/* cvedeck.com -- design language "rack and label", ported from the app's
 * frontend/src/index.css. Where this and the app disagree, the app is right.
 *
 * Fonts are vendored, not fetched, for the same reason the app vendors them:
 * nothing on this site makes a request to a third party. OFL clause 2 requires
 * the licence to travel with the font files; it does, in ./fonts/OFL.txt.
 */
@font-face {
  font-family: 'Archivo';
  src: url('./fonts/archivo-var-latin.woff2') format('woff2-variations');
  font-weight: 400 700;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('./fonts/plexmono-400-latin.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('./fonts/plexmono-500-latin.woff2') format('woff2');
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('./fonts/plexmono-600-latin.woff2') format('woff2');
  font-weight: 600; font-display: swap;
}

:root {
  /* Dark by default, light when the OS asks. No toggle: the site has no JS. */
  color-scheme: dark;

  --bg: light-dark(#EAE8E2, #141614);
  --bg-subtle: light-dark(#E1DFD8, #1B1E1C);
  --surface: light-dark(#F7F6F2, #232725);
  --surface-hover: light-dark(#EFEDE7, #2D322F);
  --surface-muted: light-dark(#E5E3DC, #1E211F);
  --border: light-dark(#CBC7BD, #3B413D);
  --border-focus: light-dark(#2E6E60, #5FB3A1);
  --text: light-dark(#1F211F, #F2F1EC);
  --text-muted: light-dark(#5C615C, #9AA09A);
  --text-dim: light-dark(#85897F, #6F756F);

  /* Verdigris carries every interactive element and appears nowhere in data. */
  --accent: light-dark(#2E6E60, #4E9A8A);
  --accent-hover: light-dark(#1F5347, #5FB3A1);
  --accent-subtle: light-dark(rgba(46, 110, 96, 0.11), rgba(78, 154, 138, 0.14));
  --accent-text: light-dark(#FFFFFF, #0E1513);

  --font-sans: 'Archivo', system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;

  /* Exploitation is the ONLY thing that gets red -- on this site too. */
  --exploit: light-dark(#B93B1E, #E2543A);
  --exploit-bg: light-dark(#FBE3DC, rgba(226, 84, 58, 0.16));
  --exploit-border: light-dark(#E9B4A4, rgba(226, 84, 58, 0.42));

  /* Severity: one amber hue, four depths. */
  --critical: light-dark(#7A5407, #EFC043);
  --critical-bg: light-dark(#F7EBC8, rgba(239, 192, 67, 0.15));
  --critical-border: light-dark(#DFC894, rgba(239, 192, 67, 0.40));
  --high: light-dark(#8A6A1C, #D2A63C);
  --medium: light-dark(#8A7742, #B29154);
  --low: light-dark(#857D6B, #94836A);

  --warn-bg: light-dark(#F6EBCB, #2E2712);
  --warn-text: light-dark(#6E560F, #E8C547);
  --warn-border: light-dark(#D9C68F, #6A5A24);

  --radius-sm: 2px;
  --radius: 3px;
  --radius-lg: 4px;

  --text-xs: 0.75rem;
  --text-sm: 0.82rem;
  --text-md: 0.88rem;
  --text-base: 1rem;
  --text-lg: 1.2rem;
  --text-xl: 1.45rem;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;

  --shadow: light-dark(0 1px 3px rgba(31, 33, 31, 0.10), 0 2px 10px rgba(0, 0, 0, 0.4));
  --wrap: 72rem;
}

@media (prefers-color-scheme: light) {
  :root { color-scheme: light; }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
a:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

code, pre, kbd { font-family: var(--font-mono); }

.skip {
  position: absolute; left: -9999px; top: 0;
}
.skip:focus {
  left: var(--space-4); top: var(--space-4); z-index: 10;
  background: var(--surface); padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-focus);
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

/* --- Header rack --------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding-block: var(--space-4);
}

/* The wordmark echoes the app: "cve" set plain, "DECK" stamped as a label. */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text);
  text-decoration: none;
  font-size: 1.35rem;
  line-height: 1;
}
.wordmark:hover { color: var(--text); }
.wordmark-cve { font-weight: 500; letter-spacing: -0.01em; }
.wordmark-deck {
  font-stretch: 125%;
  font-weight: 600;
  letter-spacing: 0.12em;
  padding: 0.3rem 0.55rem 0.25rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 1px;
  color: var(--text-muted);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
  font-weight: 600;
}
.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

/* --- Hero ---------------------------------------------------------------- */

.hero { padding-block: clamp(2.5rem, 7vw, 5rem) var(--space-6); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 0 0 var(--space-3);
}

h1, h2, h3 { line-height: 1.15; margin: 0; }

h1 {
  font-size: clamp(2rem, 5.2vw, 3.4rem);
  font-weight: 700;
  font-stretch: 88%;
  letter-spacing: -0.02em;
  max-width: 22ch;
}
.hero-sub {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--text-muted);
  max-width: 46rem;
  margin: var(--space-4) 0 var(--space-5);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--text-md);
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
}
.btn:hover { color: var(--accent-text); filter: brightness(1.1); }
.btn-secondary {
  background: var(--bg-subtle);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover { color: var(--text); border-color: var(--border-focus); filter: none; }

/* Screenshots sit in a bezel so they read as equipment, not as the page. */
.shot {
  margin: var(--space-6) 0 0;
}
.shot-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
  padding: 6px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.shot-frame img { border-radius: var(--radius-sm); width: 100%; }
.shot figcaption {
  font-size: var(--text-xs);
  color: var(--text-dim);
  margin-top: var(--space-2);
}

/* --- Rack units (sections) ------------------------------------------------ */

.unit {
  border-top: 1px solid var(--border);
  padding-block: clamp(2.5rem, 6vw, 4rem);
}
.unit-head {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}
.unit-no {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
h2 {
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
  font-weight: 700;
  font-stretch: 92%;
  letter-spacing: -0.015em;
}
.lede {
  color: var(--text-muted);
  max-width: 44rem;
  margin: 0;
}

/* --- Tag records ---------------------------------------------------------- */

.records {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.record {
  display: grid;
  grid-template-columns: minmax(10rem, 14rem) 1fr;
  gap: var(--space-2) var(--space-5);
  align-items: baseline;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
}
.record p { margin: 0; color: var(--text-muted); }
.record strong { color: var(--text); font-weight: 600; }

@media (max-width: 640px) {
  .record { grid-template-columns: 1fr; }
}

/* The stamped label: the hostname treatment from mockup C, used for labels and
   hostnames only -- never for buttons -- so it doesn't turn twee. */
.stamp {
  justify-self: start;
  font-family: var(--font-sans);
  font-stretch: 118%;
  font-weight: 600;
  font-size: var(--text-xs);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  line-height: 1.3;
  white-space: nowrap;
  padding: 0.3rem 0.65rem 0.25rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-dim);
  background: var(--bg-subtle);
  border-radius: 1px;
  color: var(--text);
}
.stamp-rank { border-left-color: var(--accent); }

/* Red is for exploitation alone. */
.stamp-exploit {
  border-left-color: var(--exploit);
  color: var(--exploit);
  border-color: var(--exploit-border);
  background: var(--exploit-bg);
}
.stamp-severity {
  border-left-color: var(--critical);
  color: var(--critical);
  border-color: var(--critical-border);
  background: var(--critical-bg);
}
.stamp-warn {
  border-left-color: var(--warn-border);
  color: var(--warn-text);
  border-color: var(--warn-border);
  background: var(--warn-bg);
}
/* Unknown is the quietest: the absence of a claim must not read as reassurance. */
.stamp-unknown {
  color: var(--text-dim);
  border-left-color: var(--border);
  border-style: dashed;
  border-left-style: solid;
}

.rank-no {
  font-family: var(--font-mono);
  color: var(--text-dim);
  margin-right: 0.4rem;
}

.note {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 44rem;
  margin: var(--space-4) 0 0;
}

/* --- Scope ---------------------------------------------------------------- */

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: var(--space-3);
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
}
.panel h3 {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.panel p, .panel ul { margin: 0; color: var(--text-muted); }
.panel ul { padding-left: 1.1rem; }
.panel li + li { margin-top: var(--space-1); }
.panel code { font-size: 0.92em; color: var(--text); }
.panel .panel-gap { margin-top: var(--space-6); }
.panel .code + p, .panel p + .code { margin-top: var(--space-3); }

/* --- Code ----------------------------------------------------------------- */

/* The wrapper doesn't scroll; the <pre> inside it does. That keeps the copy
   button pinned to the corner instead of scrolling away with long lines. */
.code {
  position: relative;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  margin: var(--space-4) 0 0;
}
.code pre {
  margin: 0;
  padding: var(--space-4) var(--space-5);
  overflow-x: auto;
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--text);
}
.code .c { color: var(--text-dim); }
.code.has-copy pre { padding-right: 5.5rem; }
.note + .code { margin-top: var(--space-2); }

/* Added by assets/copy.js, so it only exists when it can work. */
.copy-btn {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  min-height: 2rem;
  padding: 0.25rem 0.7rem;
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.copy-btn:hover { color: var(--text); border-color: var(--border-focus); }
.copy-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.copy-btn[data-state="copied"] {
  color: var(--accent-text);
  background: var(--accent);
  border-color: var(--accent);
}
.copy-btn[data-state="manual"] { color: var(--text); border-color: var(--border-focus); }

/* On narrow screens long lines scroll sideways underneath the button, so give
   the button its own strip above the code instead of overlapping it. Scoped
   to .has-copy so blocks without a button (no JavaScript) keep normal padding. */
@media (max-width: 640px) {
  .code.has-copy pre { padding: 2.9rem var(--space-4) var(--space-4); }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Footer --------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
  padding-block: var(--space-5);
}
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--text); }

/* --- Inner pages ------------------------------------------------------------ */

.page-head { padding-block: clamp(2.5rem, 6vw, 4rem) var(--space-5); }
.page-head h1 { max-width: 26ch; }

/* Long-form text inside a rack unit. */
.prose { max-width: 46rem; }
.prose > * + * { margin-top: var(--space-4); }
.prose p, .prose li { color: var(--text-muted); }
.prose strong { color: var(--text); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.2rem; }
.prose li + li { margin-top: var(--space-2); }
.prose h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  margin-top: var(--space-6);
}
.prose code { font-size: 0.9em; color: var(--text); }

.unit-body > * + * { margin-top: var(--space-5); }

/* A plain data table: meanings, variables. Scrolls inside itself when narrow. */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-md);
}
.table-wrap th,
.table-wrap td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.table-wrap th {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-subtle);
  white-space: nowrap;
}
.table-wrap td { color: var(--text-muted); }
.table-wrap td:first-child { color: var(--text); white-space: nowrap; }
.table-wrap tr:last-child td { border-bottom: 0; }

/* Distribution labels. */
.stamp-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Home: one card per inner page. */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.card-link {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  height: 100%;
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
}
.card-link:hover { border-color: var(--border-focus); background: var(--surface-hover); color: var(--text-muted); }
.card-link:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.card-link h3 { font-size: var(--text-base); font-weight: 600; color: var(--text); }
.card-link .stamp { align-self: flex-start; max-width: 100%; margin-bottom: var(--space-1); }
.card-more { margin-top: auto; color: var(--accent); font-weight: 600; font-size: var(--text-sm); }

/* Bottom-of-page link to the next page in the reading order. */
.next {
  display: flex;
  justify-content: flex-end;
  padding-block: var(--space-5) var(--space-8);
}
.next a {
  font-weight: 600;
  text-decoration: none;
}
.next a:hover { text-decoration: underline; }

/* --- 404 ------------------------------------------------------------------ */

.notfound {
  padding-block: clamp(4rem, 12vw, 8rem);
}
.notfound .stamp { font-size: var(--text-sm); display: inline-block; margin-bottom: var(--space-4); }
.notfound p { color: var(--text-muted); margin: var(--space-4) 0 var(--space-5); }
