/* Explain This CVE: styles.
   Design language: a calm sci-fi graphic novel (comic panels with cut corners, flat ink illustration, day/night
   themes), taken from the author's portfolio site. Fonts are self-hosted (SIL OFL licences are in /fonts).
   No gradients, blur or soft shadows; the only shadow is a hard offset. No inline styles anywhere. */

@font-face{font-family:"Chakra Petch";font-style:normal;font-weight:500;font-display:swap;src:url("/fonts/chakra-petch-latin-500-normal.woff2") format("woff2")}
@font-face{font-family:"Chakra Petch";font-style:normal;font-weight:600;font-display:swap;src:url("/fonts/chakra-petch-latin-600-normal.woff2") format("woff2")}
@font-face{font-family:"Chakra Petch";font-style:normal;font-weight:700;font-display:swap;src:url("/fonts/chakra-petch-latin-700-normal.woff2") format("woff2")}
@font-face{font-family:"Chakra Petch";font-style:italic;font-weight:600;font-display:swap;src:url("/fonts/chakra-petch-latin-600-italic.woff2") format("woff2")}
@font-face{font-family:"Instrument Sans";font-style:normal;font-weight:400;font-display:swap;src:url("/fonts/instrument-sans-latin-400-normal.woff2") format("woff2")}
@font-face{font-family:"Instrument Sans";font-style:normal;font-weight:500;font-display:swap;src:url("/fonts/instrument-sans-latin-500-normal.woff2") format("woff2")}
@font-face{font-family:"Instrument Sans";font-style:normal;font-weight:600;font-display:swap;src:url("/fonts/instrument-sans-latin-600-normal.woff2") format("woff2")}

:root {
  --bg: #E4EDF0; --panel: #F8FBFC; --line: #142640; --text: #13233A; --muted: #4B5F78;
  --blue: #1D4E89; --teal: #0D8784; --purple: #6A4BC8; --green: #1C9A5F;
  --green-text: #157A4B; --teal-text: #0B706D;
  /* Severity colours: the one deliberate addition to the palette. A vulnerability scale needs red, orange and
     amber to be understood at a glance, and the base palette has none. Text on them is always white (day) or
     near-black (night) and the level is always also written as a word. */
  --crit: #B3261E; --high: #B4540A; --med: #8A6A00; --on-sev: #FFFFFF;
  /* scene colours */
  --sky-a: #BFE5E8; --sky-b: #A3D6DE; --orb: #FBF6DF; --cloud: #FFFFFF;
  --far: #8DBCD0; --mid: #4C88B0; --near: #1F4F80; --ground: #2B5F8E;
  --win: #E9F6F7; --star-o: 0; --dots: rgba(20, 38, 64, .16);
  --f-display: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --f-body: "Instrument Sans", "Segoe UI", Roboto, system-ui, sans-serif;
  --f-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --frame: 3px;
  --cut: 22px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09101F; --panel: #101B32; --line: #9FBCE3; --text: #E2EBF7; --muted: #9AAECA;
    --blue: #78A8EC; --teal: #45D4C8; --purple: #A991FF; --green: #5FE3A2;
    --green-text: #5FE3A2; --teal-text: #45D4C8;
    --crit: #FF7A70; --high: #FFA05A; --med: #F2C94C; --on-sev: #09101F;
    --sky-a: #121F3C; --sky-b: #18294D; --orb: #E4ECF7; --cloud: #24365F;
    --far: #22355E; --mid: #1A2B4E; --near: #0C1630; --ground: #0F1B38;
    --win: #6EF0BC; --star-o: 1; --dots: rgba(159, 188, 227, .14);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #09101F; --panel: #101B32; --line: #9FBCE3; --text: #E2EBF7; --muted: #9AAECA;
  --blue: #78A8EC; --teal: #45D4C8; --purple: #A991FF; --green: #5FE3A2;
  --green-text: #5FE3A2; --teal-text: #45D4C8;
  --crit: #FF7A70; --high: #FFA05A; --med: #F2C94C; --on-sev: #09101F;
  --sky-a: #121F3C; --sky-b: #18294D; --orb: #E4ECF7; --cloud: #24365F;
  --far: #22355E; --mid: #1A2B4E; --near: #0C1630; --ground: #0F1B38;
  --win: #6EF0BC; --star-o: 1; --dots: rgba(159, 188, 227, .14);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 400 1.0625rem/1.62 var(--f-body);
  background-image: radial-gradient(var(--dots) 1px, transparent 1.3px); background-size: 9px 9px;
  transition: background-color .5s, color .5s;
}
h1, h2, h3, p, ul, dl, dd { margin: 0; }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; }
a { color: var(--teal-text); text-underline-offset: 3px; }
a:hover { color: var(--text); }
hr { border: 0; border-top: 2px solid var(--line); opacity: .35; margin: 18px 0; }
code, .mono { font-family: var(--f-mono); }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }

.wrap { max-width: 1160px; margin-inline: auto; padding-inline: clamp(16px, 4vw, 40px); }
.page { padding-bottom: 8px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 16px; top: -60px; background: var(--text); color: var(--bg); padding: 10px 14px; z-index: 50; font: 600 1rem/1 var(--f-display); }
.skip-link:focus { top: 10px; }
.defs { position: absolute; }

/* ---------------------------------------------------------------- frames: outer = line colour, inner = panel */
.frame { background: var(--line); padding: var(--frame); clip-path: var(--shape); }
.frame > .in { background: var(--panel); clip-path: var(--shape); height: 100%; position: relative; overflow: hidden; transition: background-color .5s; }
.cut-a { --shape: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%); }
.cut-b { --shape: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut)); }
.cut-c { --shape: polygon(0 0, 100% 0, 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut))); }

/* ---------------------------------------------------------------- svg scene paint */
.sky-a { fill: var(--sky-a); } .orb { fill: var(--orb); } .cloud { fill: var(--cloud); }
.far { fill: var(--far); } .mid { fill: var(--mid); } .near { fill: var(--near); } .ground { fill: var(--ground); }
.win { fill: var(--win); } .ink { stroke: var(--line); stroke-width: 2.5; stroke-linejoin: round; }
.f-teal { fill: var(--teal); } .f-purple { fill: var(--purple); }
.star { fill: var(--orb); opacity: var(--star-o); transition: opacity .6s; }
.dots { fill: url(#halftone); }
.check { stroke: var(--panel); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.sfx { font: italic 600 22px var(--f-display); fill: var(--purple); }
svg * { transition: fill .5s, stroke .5s; }

/* ---------------------------------------------------------------- nav */
.nav { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: var(--frame) solid var(--line); transition: background-color .5s; }
.nav-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 10px; }
.brand { font: 700 1.2rem/1 var(--f-display); text-decoration: none; color: var(--text); letter-spacing: .02em; }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.btn.small { padding: 8px 14px 7px; min-height: 0; font-size: .95rem; }
.toggle {
  display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--line); background: var(--panel); color: var(--text);
  font: 600 .95rem/1 var(--f-display); padding: 7px 12px; cursor: pointer;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.toggle:hover { border-color: var(--teal); }
.toggle svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; text-decoration: none; cursor: pointer;
  font: 600 1.02rem/1 var(--f-display); letter-spacing: .02em; padding: 13px 22px 12px; min-height: 46px;
  background: var(--text); color: var(--bg); border: 0;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  transition: background-color .2s, color .2s;
}
.btn:hover:not(:disabled) { background: var(--teal); color: var(--bg); }
.btn:disabled { cursor: progress; opacity: .6; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 2px var(--line); }
.btn.ghost:hover { background: var(--panel); box-shadow: inset 0 0 0 2px var(--teal); color: var(--text); }

/* ---------------------------------------------------------------- hero */
.hero { margin-top: clamp(20px, 3vw, 32px); --cut: 44px; }
.hero .in { display: flex; flex-direction: column; background: var(--sky-a); }
.hero-copy { padding: clamp(22px, 4vw, 44px) clamp(22px, 4vw, 44px) clamp(16px, 2.5vw, 28px); }
.scene { order: 2; display: block; width: 100%; height: clamp(150px, 20vw, 230px); margin-top: auto; }
.eyebrow { font: 700 .9rem/1 var(--f-display); letter-spacing: .08em; text-transform: uppercase; color: var(--teal-text); }
.hero h1 {
  font: 700 clamp(3rem, 8.6vw, 6.2rem)/.9 var(--f-display); letter-spacing: -.02em; margin: 14px 0 16px;
  text-shadow: .045em .045em 0 var(--teal);
}
.lede { font-size: 1.15rem; max-width: 46ch; }

/* ---------------------------------------------------------------- search */
.search { margin-top: 24px; }
.search .in { padding: 22px; }
.search label { display: block; font: 700 1rem/1 var(--f-display); margin-bottom: 10px; }
.input-row { display: flex; gap: 12px; }
input[type="text"] {
  flex: 1; min-width: 0; font: 500 1.1rem/1.2 var(--f-mono); color: var(--text); background: var(--bg);
  border: 2px solid var(--line); border-radius: 0; padding: 12px 14px;
}
input[type="text"]::placeholder { color: var(--muted); opacity: .8; }
input[aria-invalid="true"] { border-color: var(--crit); }
.hint { color: var(--muted); font-size: .95rem; margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip-button {
  font: 600 .9rem/1 var(--f-display); color: var(--text); background: transparent; border: 2px solid var(--blue);
  padding: 6px 10px; cursor: pointer;
}
.chip-button:hover { border-color: var(--teal); color: var(--teal-text); }
.field-error { color: var(--crit); font: 600 1rem/1.4 var(--f-display); margin-top: 10px; }
button { font: inherit; }

.status { display: flex; align-items: center; gap: 12px; padding: 16px 4px 4px; color: var(--muted); font: 600 1rem/1 var(--f-display); }
.status[hidden], .notice[hidden], .field-error[hidden], #result[hidden] { display: none; }
.loader { display: inline-flex; gap: 5px; }
.loader i { width: 9px; height: 9px; background: var(--teal); display: block; }
.notice { margin-top: 20px; padding: 14px 18px; border: 2px solid var(--crit); background: var(--panel); color: var(--text); font: 600 1rem/1.4 var(--f-display); }

/* ---------------------------------------------------------------- result */
#result { margin-top: 28px; }
#result:focus { outline: none; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.view-toggle { display: inline-flex; gap: 10px; border: 0; margin: 0; padding: 0; min-width: 0; }
.view-toggle label { position: relative; cursor: pointer; }
.view-toggle input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.view-toggle span {
  display: block; font: 600 1.02rem/1 var(--f-display); letter-spacing: .02em; padding: 13px 22px 12px; color: var(--text);
  box-shadow: inset 0 0 0 2px var(--line);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}
.view-toggle label:hover span { box-shadow: inset 0 0 0 2px var(--teal); }
.view-toggle input:checked + span { background: var(--text); color: var(--bg); box-shadow: none; }
.view-toggle input:focus-visible + span { outline: 3px solid var(--teal); outline-offset: 3px; }

.story { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 22px; }
.span-6 { grid-column: span 6; }
.span-3 { grid-column: span 3; }
.story .in { padding: 22px 24px 26px; }
.story .in > * + * { margin-top: 12px; }
.story .in > .panel-head + * { margin-top: 16px; }

.panel-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.panel-head h2 { font: 700 1.45rem/1.15 var(--f-display); letter-spacing: -.005em; }
.chap { display: inline-block; background: var(--panel); border: 2px solid var(--line); font: 700 .8rem/1 var(--f-display); padding: 6px 9px 5px; letter-spacing: .03em; }

.head .cve-id { font: 700 1.05rem/1 var(--f-mono); color: var(--teal-text); }
.brief-title { font: 700 clamp(1.5rem, 3.6vw, 2.3rem)/1.1 var(--f-display); letter-spacing: -.01em; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: .95rem; display: flex; flex-wrap: wrap; gap: 4px 18px; }

.muted { color: var(--muted); }
.note { color: var(--muted); font-size: .95rem; }
.label { font: 700 .85rem/1.2 var(--f-display); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.quote { border-left: 4px solid var(--teal); padding: 2px 0 2px 14px; overflow-wrap: anywhere; }
.verify { font: 600 .95rem/1.4 var(--f-display); border: 2px solid var(--purple); padding: 10px 12px; }

/* severity */
.severity-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; }
.badge { display: inline-flex; align-items: stretch; border: 2px solid var(--line); box-shadow: 4px 4px 0 var(--line); color: var(--on-sev); font-family: var(--f-display); font-weight: 700; margin-right: 4px; }
.badge-label { padding: 10px 14px; letter-spacing: .05em; text-transform: uppercase; font-size: 1rem; align-self: center; }
.badge-score { padding: 10px 14px; background: var(--panel); color: var(--text); font-size: 1.6rem; line-height: 1; display: grid; place-items: center; border-left: 2px solid var(--line); }
.sev-critical { background: var(--crit); } .sev-high { background: var(--high); } .sev-medium { background: var(--med); }
.sev-low { background: var(--green-text); } .sev-none, .sev-unknown { background: var(--muted); }
.vector { display: block; background: var(--bg); border: 2px solid var(--line); padding: 10px 12px; font-size: .85rem; overflow-wrap: anywhere; }

/* key/value lists */
.facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px 16px; }
.facts dt { color: var(--muted); font: 600 .9rem/1.3 var(--f-display); margin-top: 8px; }
.facts dd { overflow-wrap: anywhere; }
@media (min-width: 620px) {
  .facts { grid-template-columns: minmax(130px, 210px) minmax(0, 1fr); }
  .facts dt { margin-top: 0; padding: 5px 0; }
  .facts dd { padding: 5px 0; }
}

/* chips (2px border in the group's accent colour, no fill) and status tags */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; margin-top: 8px; }
.chip { font: 600 .9rem/1.1 var(--f-display); padding: 6px 9px; border: 2px solid var(--c, var(--blue)); color: var(--text); overflow-wrap: anywhere; }
.chip.mono { font-family: var(--f-mono); font-size: .8rem; font-weight: 500; }
.c-blue { --c: var(--blue); } .c-teal { --c: var(--teal); } .c-purple { --c: var(--purple); } .c-muted { --c: var(--muted); border-style: dashed; color: var(--muted); }

.tag-status { display: inline-block; font: 700 .9rem/1 var(--f-display); padding: 6px 10px 5px; margin-right: 6px; border: 2px solid var(--c, var(--line)); color: var(--text); }
.tag-status.danger { background: var(--crit); border-color: var(--crit); color: var(--on-sev); }
.tag-status.ok { --c: var(--green); }
.tag-status.warn { --c: var(--med); }
.tag-status.ai { --c: var(--purple); }
.tag-status.neutral { --c: var(--muted); }

/* EPSS meter: skewed bar, teal fill */
.epss-line { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.epss-value { font: 700 2.4rem/1 var(--f-display); }
.epss-bar { appearance: none; -webkit-appearance: none; display: block; width: calc(100% - 12px); margin-left: 8px; height: 16px; border: 2px solid var(--line); border-radius: 0; background: var(--panel); transform: skewX(-20deg); overflow: hidden; }
.epss-bar::-webkit-progress-bar { background: var(--panel); }
.epss-bar::-webkit-progress-value { background: var(--teal); }
.epss-bar::-moz-progress-bar { background: var(--teal); }

/* summary */
.summary-tag { font-size: .95rem; }
.qa { border: 2px solid var(--line); padding: 12px 14px; background: var(--bg); }
.qa h3 { font: 700 .85rem/1 var(--f-display); letter-spacing: .06em; text-transform: uppercase; color: var(--purple); margin-bottom: 6px; }
.desc-title { font: 700 1.1rem/1.2 var(--f-display); margin-top: 22px; }
.description { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .98rem; }

/* products and links */
.products, .links { list-style: none; padding: 0; display: grid; gap: 14px; }
.products > li > strong { font: 700 1.05rem/1.3 var(--f-display); overflow-wrap: anywhere; }
.links { gap: 10px; }
.links li { overflow-wrap: anywhere; border: 2px solid var(--line); padding: 8px 10px; transition: border-color .2s; }
.links li:hover { border-color: var(--teal); }
.links .path { color: var(--muted); font-size: .85rem; margin-left: 6px; }
.tags { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 8px; vertical-align: middle; }
.tag { font: 600 .8rem/1 var(--f-display); color: var(--purple); }
.tag + .tag::before { content: "·"; margin-right: 6px; color: var(--muted); }

.data-note { grid-column: span 6; font-size: .9rem; color: var(--muted); }
.source-status { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 6px; font: 600 .95rem/1.4 var(--f-display); }
.source-status .good { color: var(--green-text); }
.source-status .bad { color: var(--text); border-bottom: 2px solid var(--med); }

/* ---------------------------------------------------------------- ending + footer */
.end { margin-top: 56px; --cut: 40px; }
.end .in { padding: clamp(28px, 5vw, 60px); display: grid; gap: 16px; justify-items: start; }
.end .in::before { content: ""; position: absolute; inset: 0; background: radial-gradient(var(--dots) 1.2px, transparent 1.5px); background-size: 8px 8px; pointer-events: none; }
.end h2 { font: italic 600 clamp(2.4rem, 7vw, 4.6rem)/.95 var(--f-display); text-shadow: .045em .045em 0 var(--purple); position: relative; }
.end p { position: relative; max-width: 62ch; }
.disclaimer { font-size: 1.05rem; }
.fine { color: var(--muted); font: 600 .95rem/1.2 var(--f-display); }
.byline { font: 600 1.05rem/1.3 var(--f-display); }
.site-footer { padding-block: 28px 48px; color: var(--muted); font-size: .9rem; display: grid; gap: 8px; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 900px) {
  .span-3 { grid-column: span 6; }
}
@media (max-width: 520px) {
  .nav-link { display: none; }
  .hero { --cut: 28px; }
  .end { --cut: 28px; }
  .input-row { flex-direction: column; }
  .btn { width: 100%; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .view-toggle { display: grid; grid-template-columns: 1fr 1fr; }
  .view-toggle span { text-align: center; }
  .story .in, .search .in { padding: 18px; }
}

/* ---------------------------------------------------------------- motion (stepped, calm, off for reduced motion) */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .hero h1 { animation: ink .9s steps(14) backwards; }
  .hero-copy .eyebrow, .lede { animation: pop .5s steps(5) .5s backwards; }
  .clouds { animation: drift 40s steps(80) infinite alternate; }
  .flick { animation: flicker 5s steps(1) infinite; }
  .star circle { animation: twinkle 3.2s steps(2) infinite; }
  .star circle:nth-child(2n) { animation-delay: 1.1s; }
  .loader i { animation: blink 1s steps(1) infinite; }
  .loader i:nth-child(2) { animation-delay: .2s; }
  .loader i:nth-child(3) { animation-delay: .4s; }
  .story.animate-in > * { animation: settle .55s steps(7) backwards; }
  .story.animate-in > :nth-child(2) { animation-delay: .06s; }
  .story.animate-in > :nth-child(3) { animation-delay: .12s; }
  .story.animate-in > :nth-child(n+4) { animation-delay: .18s; }
}
@keyframes ink { from { clip-path: inset(-.2em 100% -.2em -.2em); } to { clip-path: inset(-.2em -.2em -.2em -.2em); } }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(120px); } }
@keyframes flicker { 0%, 100% { opacity: 1; } 55% { opacity: .25; } 60% { opacity: 1; } }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }
@keyframes settle { from { opacity: 0; transform: translateY(26px) rotate(.4deg); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- print: a clean black-on-white page, no decoration */
@media print {
  :root, :root[data-theme] { --bg: #fff; --panel: #fff; --line: #000; --text: #000; --muted: #333; --teal-text: #000; --purple: #000; color-scheme: light; }
  body { background: #fff; font-size: 11pt; }
  .skip-link, .nav, .search, .end a, .status, .notice, .toolbar, .scene, .lede, .eyebrow, .end, .site-footer { display: none !important; }
  .hero { clip-path: none; padding: 0; background: none; } .hero .in { background: none; clip-path: none; }
  .hero h1 { font-size: 1.6rem; text-shadow: none; }
  .frame, .frame > .in { clip-path: none !important; }
  .frame { padding: 1px; break-inside: avoid; }
  .story { display: block; }
  .story > * { margin-bottom: 12px; }
  .badge { box-shadow: none; color: #000; background: #fff !important; }
  a { color: #000; }
}
