/* =========================================================================
   Evan Atlas — base stylesheet (redesign)
   One file. Zero JS. Self-hosted fonts. Dark, fine-press editorial ground.
   Palette: slate grey (ground), earthy blue + burgundy (accents).
   Every text/ground pair below is WCAG-AA verified (see the token table).
   ========================================================================= */

/* ── Fonts — self-hosted latin woff2, weight-axis variable, swap ──────────
   Bodoni Moda: the high-contrast Didone, display only. Newsreader: the text
   face. JetBrains Mono: the ledger — labels, numerals, catalog data. The
   weight-only files pin the optical-size axis to a sturdy default, so Bodoni's
   hairlines stay intact at display sizes without a separate opsz control. */
@font-face {
  font-family: 'Bodoni Moda Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url('/assets/fonts/bodoni-moda-latin-wght-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Newsreader Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('/assets/fonts/newsreader-latin-wght-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Newsreader Variable';
  font-style: italic;
  font-display: swap;
  font-weight: 200 800;
  src: url('/assets/fonts/newsreader-latin-wght-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url('/assets/fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2');
}

:root {
  color-scheme: dark;

  /* Ground — slate. The page is dark; the work is the light. */
  --bg:        #0f151b;   /* page ground (slate)                                  */
  --abyss:     #0b1a22;   /* deep earthy-blue band — footer + pre-footer          */
  --surface:   #19222b;   /* raised panels, code, hover rows                      */

  /* Type — cool bone on the slate. */
  --ink:       #e9ecef;   /* 15.5:1 on --bg   — body + headings                   */
  --ink-dim:   #aeb8c2;   /*  9.1:1 on --bg   — secondary prose, ledes, meta      */
  --ink-faint: #8996a2;   /*  6.1:1 on --bg   — mono labels, marginalia           */

  /* Burgundy — the warm accent (primary). Deep board grounds + a lit tint. */
  --wine:      #6f2436;   /* board/button ground (ink reads 8.9:1 on it)          */
  --wine-lit:  #d98892;   /*  6.9:1 on --bg   — accent text, dropcap, active nav  */

  /* Earthy blue — the cool accent (secondary). */
  --blue:      #7fb0d4;   /*  7.9:1 on --bg   — secondary links, data accents     */

  /* Hairlines & rules — ink at low alpha, and a wine rule for accent divisions. */
  --line:      color-mix(in srgb, var(--ink) 12%, transparent);
  --line-2:    color-mix(in srgb, var(--ink) 22%, transparent);
  --rule-wine: color-mix(in srgb, var(--wine-lit) 40%, transparent);

  --focus:     var(--blue);   /* tracks the earthy-blue accent */

  --font-display: 'Bodoni Moda Variable', 'Didot', 'Bodoni MT', Georgia, serif;
  --font-body:    'Newsreader Variable', Georgia, 'Times New Roman', serif;
  --font-mono:    'JetBrains Mono Variable', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --measure: 40rem;        /* prose measure (~65ch of Newsreader)                 */
  --measure-wide: 52rem;   /* structured lists / detail articles                 */
  --rail-w: 13.75rem;      /* the fixed left spine on large screens               */
}

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--bg);
}
body {
  margin: 0;
  background: var(--bg);
  /* a whisper of depth so the large flat darks never band (CSS-only, no CSP cost) */
  background-image:
    radial-gradient(120% 80% at 12% -10%, color-mix(in srgb, var(--blue) 7%, transparent), transparent 60%),
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--wine) 9%, transparent), transparent 55%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-optical-sizing: auto;
  font-size: 1.06rem;
  line-height: 1.62;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  /* defence-in-depth: an over-long unbroken token wraps instead of forcing a
     horizontal scroll (e.g. a long title inside a non-wrapping flex row). */
  overflow-wrap: break-word;
}
img, svg, video { max-width: 100%; height: auto; }

::selection { background: var(--wine); color: var(--ink); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 0; }
main:focus { outline: none; } /* scripting-free skip target (tabindex=-1) */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ── Typography ─────────────────────────────────────────────────────────── */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.018em;
  text-wrap: balance;
  margin: 2em 0 0.5em;
}
main h1 {
  font-size: clamp(2.4rem, 1.7rem + 3.3vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
  max-width: 17ch;
}
h2 { font-size: clamp(1.7rem, 1.35rem + 1.6vw, 2.5rem); }
h3 { font-size: 1.36rem; letter-spacing: -0.01em; }
h4 { font-size: 1.1rem; }
p { text-wrap: pretty; }
p, ul, ol, blockquote, pre, table, dl { margin: 0 0 1.15em; }

a { color: var(--ink); text-decoration: underline;
    text-decoration-color: var(--rule-wine); text-decoration-thickness: 1px;
    text-underline-offset: 0.2em; transition: color .16s ease, text-decoration-color .16s ease; }
a:hover { color: var(--wine-lit); text-decoration-color: var(--wine-lit); }

em, i { font-style: italic; }
strong, b { font-weight: 650; color: var(--ink); }

blockquote {
  margin-inline: 0; padding-left: 1.1rem;
  border-left: 2px solid var(--rule-wine); color: var(--ink-dim);
  font-style: italic;
}
code { font-family: var(--font-mono); font-size: 0.88em; }
pre {
  font-family: var(--font-mono); background: var(--surface);
  padding: 1rem 1.1rem; border: 1px solid var(--line); overflow-x: auto; max-width: 100%;
}
pre code { font-size: inherit; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.75rem 0; }

/* ── Skip link ──────────────────────────────────────────────────────────── */
.skip-link {
  position: fixed; left: 0.75rem; top: -4rem; z-index: 100;
  padding: 0.6rem 1rem; background: var(--wine); color: var(--ink);
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.13em;
  text-transform: uppercase; text-decoration: none; transition: top .15s ease;
}
.skip-link:focus { top: 0.75rem; color: var(--ink); }

/* ── The rail: the site's left spine on large screens ───────────────────── */
.rail { display: none; }
.shell { padding-left: 0; }

@media (min-width: 64rem) {
  .shell { padding-left: var(--rail-w); }
  .rail {
    position: fixed; inset-block: 0; left: 0; z-index: 40;
    display: flex; flex-direction: column; justify-content: space-between;
    width: var(--rail-w);
    padding: 2rem 1.6rem;
    background: var(--abyss);
    border-right: 1px solid var(--line);
  }
}

.rail-mark { display: inline-flex; flex-direction: column; gap: 0.15rem; text-decoration: none; color: var(--ink); }
.rail-mark:hover { color: var(--ink); }
.rail-mark .wordmark {
  font-family: var(--font-display); font-weight: 500; font-size: 1.7rem;
  line-height: 1.0; letter-spacing: -0.02em; color: var(--ink);
}
.rail-mark:hover .wordmark { color: var(--wine-lit); }
.rail-mark .wordmark-sub {
  font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--ink-faint); margin-top: 0.55rem;
}

.rail-nav { margin-top: 2.5rem; border-top: 1px solid var(--line); }
.rail-nav ul { list-style: none; margin: 0; padding: 0; }
.rail-nav li { border-bottom: 1px solid var(--line); }
.rail-nav a {
  display: block; padding: 0.7rem 0; text-decoration: none;
  font-family: var(--font-display); font-size: 1.2rem; letter-spacing: -0.01em;
  color: var(--ink); transition: color .16s ease, padding-left .16s ease;
}
.rail-nav a:hover { color: var(--wine-lit); padding-left: 0.3rem; }
.rail-nav a[aria-current="page"] { color: var(--wine-lit); }

.rail-foot {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-faint); line-height: 1.9;
}

/* ── The top bar: a flush strip on small screens ────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--abyss); border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.4rem 1.25rem; padding: 0.75rem clamp(1.1rem, 4vw, 2rem);
}
.topbar .wordmark {
  font-family: var(--font-display); font-weight: 500; font-size: 1.2rem;
  letter-spacing: -0.015em; color: var(--ink); text-decoration: none;
}
.topbar .wordmark:hover { color: var(--wine-lit); }
/* The nav takes its own full-width row and wraps — six sections never overflow
   the strip (which would push the page into a horizontal scroll). */
.topbar-nav { flex: 1 1 100%; min-width: 0; }
.topbar-nav ul { display: flex; flex-wrap: wrap; gap: 0.35rem 0.95rem; margin: 0; padding: 0; list-style: none; }
.topbar-nav a {
  display: inline-block; padding: 0.3rem 0;
  font-family: var(--font-mono); font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--ink-dim); text-decoration: none; transition: color .16s ease;
}
.topbar-nav a:hover { color: var(--ink); }
.topbar-nav a[aria-current="page"] { color: var(--wine-lit); }
@media (min-width: 64rem) { .topbar { display: none; } }

/* ── Main + the masthead frame ──────────────────────────────────────────── */
main {
  display: block;
  max-width: 66rem;
  padding: clamp(1.75rem, 4vw, 3rem) clamp(1.25rem, 4vw, 3.5rem) 4.5rem;
}
/* prose measure — zero-specificity so components can opt out */
main :where(p, ul, ol, dl, blockquote, h3, h4, .lede) { max-width: var(--measure); }

.masthead {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.35rem 2rem; max-width: none;
  padding-bottom: 0.75rem; margin-bottom: clamp(1.75rem, 3.5vw, 2.75rem);
  border-bottom: 1px solid var(--line);
}

/* ── Type primitives ────────────────────────────────────────────────────── */
.label {
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.19em; text-transform: uppercase; color: var(--ink-faint);
  margin: 0;
}
.label-accent { color: var(--wine-lit); }
.data {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.02em;
  color: var(--ink-dim); font-variant-numeric: tabular-nums;
}
.lede {
  font-family: var(--font-body);
  font-size: clamp(1.15rem, 1rem + 0.7vw, 1.35rem);
  line-height: 1.5; color: var(--ink-dim); margin: 0 0 1.15em;
}
main h1 + .lede, .book-head + .lede { margin-top: 0.4rem; }

/* Dropcap — the Didone initial, in wine. */
.dropcap::first-letter {
  font-family: var(--font-display); float: left; font-size: 3.5em; line-height: 0.76;
  font-weight: 500; color: var(--wine-lit); padding-right: 0.08em; margin-top: 0.06em;
}

/* Arrow link — a rule you can walk along. */
.lk-arrow {
  display: inline-flex; align-items: baseline; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.15em; text-transform: uppercase; color: var(--wine-lit);
  text-decoration: none; transition: color .16s ease;
}
.lk-arrow::after { content: '→'; transition: transform .22s cubic-bezier(.2,.7,.3,1); }
.lk-arrow:hover { color: var(--ink); }
.lk-arrow:hover::after { transform: translateX(0.3rem); }

/* ── Buttons & boards — nothing rounded, nothing soft ───────────────────── */
.btn, .cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  font-family: var(--font-mono); font-size: 0.74rem; font-weight: 600;
  letter-spacing: 0.13em; text-transform: uppercase; text-decoration: none;
  padding: 0.8rem 1.35rem; border-radius: 0; border: 1px solid transparent;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.btn-board, .cta {
  background: var(--wine); color: var(--ink);
}
.btn-board:hover, .cta:hover {
  background: color-mix(in srgb, var(--wine) 80%, #000); color: var(--ink);
}
.btn-line {
  border-color: var(--line-2); color: var(--ink);
}
.btn-line:hover { border-color: var(--wine-lit); color: var(--wine-lit); }
.btn-sm { padding: 0.5rem 0.85rem; font-size: 0.66rem; letter-spacing: 0.11em; }

/* ── The ledger row: a ruled index line ─────────────────────────────────── */
.ledger { list-style: none; margin: 1.5rem 0 0; padding: 0; max-width: var(--measure-wide); }
.ledger > li { border-top: 1px solid var(--line); }
.ledger > li:last-child { border-bottom: 1px solid var(--line); }

/* Squared mono tag (deposit venue, keywords) — a catalog code, not a pill. */
.tag {
  display: inline-block; font-family: var(--font-mono); font-size: 0.66rem;
  font-weight: 500; letter-spacing: 0.11em; text-transform: uppercase;
  line-height: 1; padding: 0.32em 0.55em; color: var(--blue);
  border: 1px solid color-mix(in srgb, var(--blue) 45%, transparent);
  vertical-align: middle;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  margin-top: 4rem; background: var(--abyss);
  border-top: 1px solid var(--rule-wine);
}
.footer-inner { padding: clamp(2.5rem, 5vw, 4rem) clamp(1.25rem, 4vw, 3.5rem) 1rem; max-width: 72rem; }
.footer-colophon {
  display: inline-flex; align-items: baseline; text-decoration: none; color: var(--ink);
}
.footer-colophon .wordmark {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2rem, 6vw, 3.4rem); line-height: 0.9; letter-spacing: -0.025em;
}
.footer-colophon:hover .wordmark { color: var(--wine-lit); }

.footer-grid {
  display: grid; gap: 1.75rem 2.5rem; margin-top: clamp(2rem, 4vw, 3rem);
  padding-top: 1.75rem; border-top: 1px solid var(--line);
}
@media (min-width: 40rem) { .footer-grid { grid-template-columns: 1.3fr 1fr 1fr; } }
.footer-about { color: var(--ink-dim); font-size: 0.97rem; max-width: 30ch; margin: 0; }
.footer-about + .label { margin-top: 1.25rem; }
.footer-col h2 { /* rendered with .label */ margin: 0 0 0.9rem; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { border-bottom: 1px solid var(--line); }
.footer-col li:first-child { border-top: 1px solid var(--line); }
.footer-col a {
  display: block; padding: 0.55rem 0; color: var(--ink-dim);
  text-decoration: none; font-size: 0.95rem; transition: color .16s ease;
}
.footer-col a:hover { color: var(--wine-lit); }

.footer-base {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.3rem 2rem; margin-top: clamp(2rem, 4vw, 3rem);
  padding: 1.25rem clamp(1.25rem, 4vw, 3.5rem);
  border-top: 1px solid var(--line);
}
.footer-base p { margin: 0; }

/* =========================================================================
   Content components — every class the templates and content markdown use,
   restyled to the fine-press ground (class names preserved).
   ========================================================================= */

/* Home. */
.home-section { margin-top: clamp(2.5rem, 4vw, 3.25rem); padding-top: 1.5rem; border-top: 1px solid var(--line); }
.home-section > h2 { margin-top: 0; }

/* Section pointer lists (home Explore + 404) — as a ruled ledger. */
.section-links { list-style: none; margin: 1.25rem 0 0; padding: 0; max-width: var(--measure-wide); }
.section-links li {
  display: flex; flex-wrap: wrap; gap: 0.15rem 0.7rem; align-items: baseline;
  padding: 0.85rem 0; border-top: 1px solid var(--line);
}
.section-links li:last-child { border-bottom: 1px solid var(--line); }
.section-links a { font-family: var(--font-display); font-size: 1.24rem; text-decoration: none; color: var(--ink); }
.section-links a:hover { color: var(--wine-lit); }
.section-links strong { font-weight: 500; color: inherit; }
.section-links span { color: var(--ink-dim); font-size: 0.97rem; }

/* Bookshelf index — covers on a shelf. */
.book-list { list-style: none; margin: 1.5rem 0 0; padding: 0; max-width: var(--measure-wide); }
.book-list-item {
  display: flex; gap: 1.25rem; align-items: flex-start;
  padding: 1.4rem 0; border-top: 1px solid var(--line);
}
.book-list-item:last-child { border-bottom: 1px solid var(--line); }
.book-list-cover { flex: 0 0 auto; }
.book-list-cover img { width: 74px; height: auto; border: 1px solid var(--line); }
.book-list-body { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.book-list-title { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.1; text-decoration: none; color: var(--ink); }
.book-list-title:hover { color: var(--wine-lit); }
.book-list-series { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.13em; text-transform: uppercase; color: var(--wine-lit); }
.book-list-hook { color: var(--ink-dim); font-size: 0.98rem; }

/* Book page. */
.book, .paper, .game, .invention { max-width: var(--measure-wide); }
.book-head { margin-bottom: 1.5rem; }
.book-head h1 { margin-bottom: 0.4rem; }
.book-series { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500; letter-spacing: 0.15em; text-transform: uppercase; color: var(--wine-lit); margin: 0 0 0.4rem; }
.book-byline { color: var(--ink-dim); margin: 0 0 1.5rem; }
.book-cover { display: block; max-width: 250px; height: auto; margin: 0 0 1.9rem; border: 1px solid var(--line-2); }
.book-blurb { margin-bottom: 2rem; }
.book-buy ul, .game-buy ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 0 0 1.75rem; padding: 0; }
.book-buy a, .game-buy a {
  display: inline-block; padding: 0.62rem 1.05rem; border: 1px solid var(--line-2);
  color: var(--ink); text-decoration: none;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; transition: border-color .16s ease, color .16s ease;
}
.book-buy a:hover, .game-buy a:hover { border-color: var(--wine-lit); color: var(--wine-lit); }
.book-back, .paper-back, .game-body + .paper-back { margin-top: 2rem; }
.book-back a, .paper-back a { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); text-decoration: none; }
.book-back a:hover, .paper-back a:hover { color: var(--wine-lit); }

/* Eyebrow (paper / game / invention breadcrumb line). */
.paper-eyebrow { font-family: var(--font-mono); font-size: 0.68rem; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 0.6rem; }
/* Underlined by default (not color alone): the eyebrow link sits in a run of
   --ink-faint text, and link-vs-text color contrast there is <3:1, so WCAG
   1.4.1 (and Lighthouse `link-in-text-block`) require a non-color affordance. */
.paper-eyebrow a { color: var(--wine-lit); text-decoration: underline; text-underline-offset: 0.15em; }
.paper-eyebrow a:hover { color: var(--ink); }

/* Paper page. */
.paper-head { margin-bottom: 1.5rem; }
.paper-head h1 { margin: 0 0 0.6rem; }
.paper-authors { margin: 0 0 0.4rem; font-size: 1rem; color: var(--ink-dim); }
.paper-authors a { color: var(--ink); }
.paper-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem; align-items: center; margin: 0; color: var(--ink-faint); font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.04em; }
.paper-actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: center; margin: 1.75rem 0 0; }
.paper-doi { font-family: var(--font-mono); font-size: 0.74rem; word-break: break-all; color: var(--blue); }
.paper-abstract, .paper-keywords, .paper-cite, .paper-related, .paper-notes { margin-top: 2.25rem; }
.paper-abstract > h2, .paper-keywords > h2, .paper-cite > h2, .paper-related > h2 { font-size: 1.34rem; margin: 0 0 0.7rem; }
.paper-abstract p { margin-bottom: 0.9em; }
.keyword-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; max-width: none; }
.keyword-list li { /* .tag look */ font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-dim); padding: 0.32em 0.6em; background: var(--surface); border: 1px solid var(--line); }
.paper-cite-note { color: var(--ink-dim); font-size: 0.94rem; margin: 0 0 0.7rem; }
pre.bibtex { font-size: 0.8rem; line-height: 1.55; white-space: pre; }
.related-list { list-style: none; margin: 0; padding: 0; }
.related-list li { padding: 0.6rem 0; border-top: 1px solid var(--line); }
.related-list li:last-child { border-bottom: 1px solid var(--line); }

/* Research index. */
.research-intro, .section-intro { font-family: var(--font-body); font-size: clamp(1.15rem, 1rem + 0.7vw, 1.32rem); line-height: 1.5; color: var(--ink-dim); }
.research-group { margin-top: clamp(2.25rem, 4vw, 3rem); padding-top: 1.5rem; border-top: 1px solid var(--line); max-width: var(--measure-wide); }
.research-group > h2 { margin-top: 0; }
.paper-list { list-style: none; margin: 1rem 0 0; padding: 0; max-width: none; }
.paper-list-item { padding: 1.25rem 0; border-top: 1px solid var(--line); }
.paper-list-item:last-child { border-bottom: 1px solid var(--line); }
.paper-list-title { font-family: var(--font-display); font-size: 1.4rem; line-height: 1.12; text-decoration: none; color: var(--ink); }
.paper-list-title:hover { color: var(--wine-lit); }
.paper-list-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; align-items: center; margin: 0.45rem 0 0; color: var(--ink-faint); font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.03em; max-width: none; }
.paper-list-hook { margin: 0.5rem 0 0; color: var(--ink-dim); }

/* lane-badge (deposit venue) — the squared catalog tag. */
.lane-badge {
  display: inline-block; font-family: var(--font-mono); font-size: 0.64rem;
  font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; line-height: 1;
  padding: 0.34em 0.55em; color: var(--blue);
  border: 1px solid color-mix(in srgb, var(--blue) 45%, transparent);
  vertical-align: middle;
}

/* Inventions / Games index — entry cards. */
.entry-list { list-style: none; margin: 1.75rem 0 0; padding: 0; max-width: var(--measure-wide); }
.entry-card { padding: 2rem 0; border-top: 1px solid var(--line); }
.entry-card:last-child { border-bottom: 1px solid var(--line); }
.entry-media { display: block; margin: 0 0 1.15rem; }
.entry-media img { display: block; width: 100%; height: auto; border: 1px solid var(--line-2); }
.entry-body { display: flex; flex-direction: column; gap: 0.4rem; }
.entry-title { margin: 0; font-size: clamp(1.7rem, 1.4rem + 1.3vw, 2.2rem); }
.entry-title a { color: var(--ink); text-decoration: none; }
.entry-title a:hover { color: var(--wine-lit); }
.entry-tagline { margin: 0; color: var(--ink-dim); font-size: 1.12rem; line-height: 1.4; }
.entry-actions { margin: 0.4rem 0 0; }
.entry-link { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; text-decoration: none; color: var(--wine-lit); }
.entry-link:hover { color: var(--ink); }

/* Game / invention detail. */
.game-head, .invention-head { margin-bottom: 1.5rem; }
.game-head h1, .invention-head h1 { margin: 0 0 0.5rem; }
.game-tagline, .invention-tagline { margin: 0; color: var(--wine-lit); font-family: var(--font-display); font-size: 1.4rem; line-height: 1.2; }
.game-hero, .invention-hero { display: block; width: 100%; height: auto; margin: 0 0 1.9rem; border: 1px solid var(--line-2); }
.game-actions, .invention-actions { margin: 0 0 2rem; }
.game-body, .invention-body { margin-bottom: 2rem; }
.game-credits { margin-top: 2.25rem; }
.game-credits > h2 { font-size: 1.34rem; margin: 0 0 0.7rem; }
.credits-list { list-style: none; margin: 0; padding: 0; }
.credits-list li { padding: 0.55rem 0; border-top: 1px solid var(--line); }
.credits-list li:last-child { border-bottom: 1px solid var(--line); }
.credit-role { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); margin-right: 0.5rem; }

/* Contact. */
.contact-links { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 0.75rem 0 0; padding: 0; max-width: none; }
.contact-links a { display: inline-block; padding: 0.4rem 0; font-family: var(--font-display); font-size: 1.12rem; text-decoration: none; color: var(--ink); }
.contact-links a:hover { color: var(--wine-lit); }

/* Contact form — a plain zero-JS mailto form (CSP allows form-action mailto:). */
.contact-form { max-width: var(--measure); margin: 0.75rem 0 2.25rem; }
.form-row { display: flex; flex-direction: column; gap: 0.4rem; margin: 0 0 1.2rem; max-width: none; }
.form-row label {
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint);
}
.contact-form input, .contact-form textarea {
  width: 100%; font-family: var(--font-body); font-size: 1rem; line-height: 1.5;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: 0; padding: 0.6rem 0.75rem;
}
.contact-form textarea { resize: vertical; min-height: 8.5rem; }
.contact-form input:focus, .contact-form textarea:focus {
  outline: 2px solid var(--focus); outline-offset: 2px; border-color: var(--wine-lit);
}
.contact-form button { border: 0; cursor: pointer; }

/* =========================================================================
   Light content ground (owner request): the body area of every page reads
   dark-on-light. The left rail, the mobile top bar, and the footer keep the
   dark fine-press ground. Implemented by re-scoping the palette tokens to
   <main> — the footer is a SIBLING of <main>, so it is untouched — and painting
   the content column light on .shell. Every text/ground pair below is WCAG-AA
   verified against the light ground (contrasts noted).
   ========================================================================= */
:root { --paper: #f5f2ea; }              /* warm ivory content ground */
.shell { background: var(--paper); }

main {
  --bg:        var(--paper);
  --surface:   #ebe5d8;   /* raised panels, code, keyword chips              */
  --ink:       #17202a;   /* body + headings        — 14.7:1 on --paper      */
  --ink-dim:   #45515d;   /* secondary prose, ledes, meta — 7.2:1            */
  --ink-faint: #5b6772;   /* mono labels, marginalia      — 5.2:1            */
  --wine:      #6f2436;   /* button ground stays deep burgundy (light text)  */
  --wine-lit:  #8a2635;   /* accent text, active nav, links — 7.9:1          */
  --blue:      #2f6a92;   /* secondary links / data accents — 5.2:1          */
  --line:      color-mix(in srgb, var(--ink) 14%, transparent);
  --line-2:    color-mix(in srgb, var(--ink) 26%, transparent);
  --rule-wine: color-mix(in srgb, var(--wine-lit) 45%, transparent);
  --focus:     var(--blue);
  background: var(--paper);
  color: var(--ink);
}
/* Wine-grounded controls keep light text in BOTH themes (the burgundy ground is
   dark on the light page too). */
main .cta, main .btn-board,
main .cta:hover, main .btn-board:hover { color: #f6efe9; }
main ::selection { background: var(--wine); color: #f6efe9; }

/* Home hero — portrait on the left, intro on the right; stacks on narrow screens. */
.hero {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: clamp(1.5rem, 4vw, 3rem); margin: 0 0 1rem; max-width: none;
}
.hero-portrait {
  flex: 0 0 auto; width: clamp(150px, 34vw, 240px); height: auto;
  border: 1px solid var(--line-2);
}
.hero-copy { flex: 1 1 22rem; min-width: 0; }
.hero-copy h1 { margin-top: 0; }
.hero-copy .lede { margin-bottom: 0.9em; }

/* Inventions / Games index — title + tagline sit above a SMALLER entry image. */
.entry-media { max-width: 360px; margin: 1.2rem 0; }

/* Footer: the "Evan Atlas" colophon was removed (owner request), so the grid no
   longer needs its divider from it. */
.footer-grid { margin-top: 0; padding-top: 0; border-top: 0; }
