/* =========================================================================
   Machina Arcana — "Gaslight" design system
   This :root token block is the single source of truth for the whole site.
   Everything below derives from it. When card-db merges in, it inherits this.
   ========================================================================= */

:root {
  /* Color — dark cosmic horror, artwork glowing out of near-black */
  --black:    #15110B;  /* page base — warm soot-black, never pure #000 */
  --black-2:  #1d1810;
  --panel:    #221A11;  /* raised panels */
  --panel-2:  #2b2115;
  --amber:    #E4A04A;  /* primary / CTA — the lamp keeping the dark out */
  --amber-d:  #a96f20;
  --bone:     #E8DDC6;  /* text on dark */
  --bone-2:   #c8b894;  /* muted text — lifted for legibility on near-black */
  --verd:     #56A88F;  /* the cold "wrong" accent that shouldn't be there */
  --oxblood:  #7C2620;  /* horror / danger */
  --oxblood-l:#a8453a;

  --line:   rgba(232, 221, 198, .14);
  --line-2: rgba(232, 221, 198, .28);

  /* Type */
  --font-display: 'Cinzel', Georgia, serif;
  --font-body:    'EB Garamond', Georgia, serif;
  --font-mono:    'Spline Sans Mono', ui-monospace, monospace;

  /* Type scale */
  --step-hero: clamp(2.6rem, 6vw, 3.6rem);
  --step-h2:   clamp(1.95rem, 3.7vw, 2.5rem);
  --step-h3:   1.4rem;
  --step-body: 1.1875rem;  /* 19px */
  --step-small: 0.95rem;

  /* Spacing & layout */
  --wrap: 1160px;
  --gap: 1.5rem;
  --section-y: clamp(4.25rem, 8.5vw, 6.25rem);
  --radius: 0;

  /* Effects */
  --glow: 0 0 30px rgba(228, 160, 74, .35);
  --glow-strong: 0 0 46px rgba(228, 160, 74, .6);
}

/* ---- Base ------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { color-scheme: dark; }

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

::selection { background: var(--amber); color: var(--black); }

body {
  background: var(--black);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: var(--step-body);
  line-height: 1.65;
  background-image: radial-gradient(80% 50% at 50% 0%, rgba(228, 160, 74, .07), transparent 60%);
}

a { color: var(--amber); text-decoration: none; }
a:hover { color: #fff; }

:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

img, svg { max-width: 100%; height: auto; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.75rem; }

.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;
}

/* Skip link — hidden until keyboard focus, then drops in as an amber chip */
.skip-link {
  position: absolute; left: 1rem; top: -3.5rem; z-index: 100;
  padding: .7rem 1.2rem;
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--black); background: var(--amber); border: 1px solid var(--amber-d);
  transition: top .15s ease;
}
.skip-link:focus-visible { top: 1rem; color: var(--black); }

/* ---- Type ------------------------------------------------------------- */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.12;
  margin: 0;
  letter-spacing: .02em;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: .75rem;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--amber);
}

.meta {
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .12em;
  color: var(--bone-2);
}

/* ---- Buttons & links -------------------------------------------------- */

.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .75rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  padding: .95rem 1.9rem;
  color: var(--black);
  background: var(--amber);
  border: 1px solid var(--amber-d);
  border-radius: var(--radius);
  box-shadow: var(--glow);
  transition: box-shadow .2s ease, transform .1s ease;
}
.btn:hover { color: #000; box-shadow: var(--glow-strong); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--ghost {
  background: transparent;
  color: var(--bone);
  border: 1px solid var(--line-2);
  box-shadow: none;
}
.btn--ghost:hover { color: #fff; border-color: var(--bone); }

.btn--sm { padding: .55rem 1.1rem; }

.link-arrow {
  font-family: var(--font-mono);
  font-size: .75rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--bone-2);
}
.link-arrow:hover { color: var(--amber); }

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

.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; }
.brand img { display: block; height: 40px; width: auto; }

.site-nav { display: flex; gap: 1.6rem; align-items: center;
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; }
.site-nav a { color: var(--bone-2); }
.site-nav a:hover { color: var(--bone); }
.site-nav .lang { color: var(--bone-2); }

/* The header CTA is a .btn inside .site-nav — keep its text dark on amber
   (`.site-nav a` outranks `.btn` in the cascade without this). */
.site-nav a.btn { color: var(--black); }
.site-nav a.btn:hover { color: #000; }

/* Mobile nav toggle — hidden on desktop and without JS (no-JS keeps the
   nav hidden < 900px exactly as before; the footer remains the fallback). */
.nav-toggle { display: none; }

/* ---- Sections --------------------------------------------------------- */

.section { padding: var(--section-y) 0; position: relative; }

/* The seam between two lamplit rooms — a hairline that brightens to a node at center */
.section::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: min(var(--wrap), 90%); height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--line-2) 24%,
    rgba(228, 160, 74, .4) 50%, var(--line-2) 76%, transparent);
}

/* A warm lamp pooled behind the heading — content fades up out of the dark */
.section--lamp::after {
  content: ""; position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  width: min(720px, 82%); height: 360px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(228, 160, 74, .13), transparent 72%);
}

/* The machine beat — one cold pool of verdigris where every other light is warm */
.section--cold::after {
  content: ""; position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  width: min(720px, 82%); height: 360px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(86, 168, 143, .12), transparent 72%);
}

.section-head { text-align: center; margin-bottom: 3.25rem; }
.section-head h2 { font-size: var(--step-h2); margin-top: .85rem; text-shadow: 0 0 34px rgba(228, 160, 74, .12); }
.section-head p { color: var(--bone-2); max-width: 52ch; margin: 1rem auto 0; }
.section-actions { display: flex; gap: 1.4rem; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 1.9rem; }

/* ---- Core Experience strip (a spec sheet under the hero) -------------- */

.spec-strip-band { padding: clamp(2rem, 4vw, 2.6rem) 0; }
.spec-strip {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.spec-strip li { padding: .3rem 1.1rem; text-align: center; border-left: 1px solid var(--line); }
.spec-strip li:first-child { border-left: 0; }
.spec-strip b {
  display: block; font-family: var(--font-display); font-weight: 500;
  font-size: 1rem; line-height: 1.25; letter-spacing: .02em; color: var(--bone);
}

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

.hero {
  position: relative; overflow: hidden;
  min-height: clamp(620px, 88vh, 920px);
  display: grid; align-items: center; justify-items: center; text-align: center;
}
/* Full-bleed key-art layer. The plate lives in the LAST background layer (the url below) —
   the amber lantern glow + the legibility scrim stay stacked above it. To ship the final
   art, just replace hero-placeholder.jpg (same ~16:9, dark, quiet zone behind the headline)
   and nothing else needs to change. */
.hero-art {
  position: absolute; inset: 0; z-index: 0;
  background:
    /* amber lantern halo (warmth, sits on top) */
    radial-gradient(46% 52% at 50% 46%, rgba(228, 160, 74, .16), transparent 64%),
    /* legibility plate: a centred dark backing behind the headline so text reads over
       busy/pale key-art, while the figures around the edges stay visible */
    radial-gradient(64% 58% at 50% 47%, rgba(9, 7, 4, .82) 0%, rgba(9, 7, 4, .42) 44%, transparent 74%),
    /* overall vertical grounding (helps the nav at top + meta/CTA at the bottom) */
    linear-gradient(180deg, rgba(21, 17, 11, .6) 0%, rgba(21, 17, 11, .26) 46%, rgba(21, 17, 11, .9) 100%),
    url('hero-placeholder.jpg');
  background-color: var(--black);
  background-size: cover; background-position: center;
}
.hero-content { position: relative; z-index: 1; padding-block: clamp(2.5rem, 7vw, 4.5rem); }
.hero h1 { font-size: var(--step-hero); font-weight: 600; margin: 1.4rem auto 1.25rem; max-width: 16em; text-wrap: balance; text-shadow: 0 1px 1px rgba(0, 0, 0, .92), 0 2px 9px rgba(0, 0, 0, .85), 0 2px 40px rgba(0, 0, 0, .5), 0 0 46px rgba(228, 160, 74, .16); }
.hero .lede { font-size: 1.3rem; max-width: 50ch; margin: 0 auto; color: #e3d7bb; text-shadow: 0 1px 1px rgba(0, 0, 0, .9), 0 1px 14px rgba(0, 0, 0, .72); }
.hero .eyebrow, .hero .meta { text-shadow: 0 1px 6px rgba(0, 0, 0, .9), 0 0 14px rgba(0, 0, 0, .7); }
.hero .cta-row { display: flex; gap: 1.4rem; justify-content: center; align-items: center; flex-wrap: wrap; margin: 2.25rem 0 1.1rem; }

/* ---- Feature sections (title · description · image) -------------------- */

.feature-row { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.feature--flip .feature-media { order: 2; }

.feature-media {
  aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden;
  border: 1px solid var(--line-2);
  background:
    radial-gradient(62% 62% at 50% 42%, rgba(228, 160, 74, .15), transparent 72%),
    linear-gradient(180deg, var(--panel), var(--black-2));
}
/* Media containers hold either the placeholder or the final image — fill and cover. */
.feature-media img, .cta-media img, .gallery .thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.feature-body .eyebrow { display: block; margin-bottom: .9rem; }
.feature-body h2 { font-size: var(--step-h2); margin: 0; text-shadow: 0 0 34px rgba(228, 160, 74, .12); }
.feature-body p { color: var(--bone-2); margin: 1.1rem 0 0; max-width: 48ch; }

/* ---- Table showcase (full-bleed component spread) --------------------- */

.showcase { position: relative; }
/* Full-bleed plate. The placeholder PNG is exactly 2560 × 1080 (21:9); the final
   photo drops in at the same path. object-fit keeps it covering the band. */
.showcase-img {
  display: block; width: 100%; height: auto;
  aspect-ratio: 64 / 27; object-fit: cover;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}

/* ---- Card Database screenshot ----------------------------------------- */

/* One framed UI screenshot. Placeholder is 1920 × 1080 (16:9); the real capture
   drops in at the same path. */
.db-shot {
  display: block; width: 100%; height: auto; margin-bottom: 1.5rem;
  aspect-ratio: 16 / 9; object-fit: cover;
  border: 1px solid var(--line-2); background: var(--panel);
}

/* ---- Stats (Forge) ---------------------------------------------------- */

.stats { display: flex; gap: 3rem; justify-content: center; flex-wrap: wrap; }
.stat b { font-family: var(--font-display); font-size: 2.5rem; color: var(--amber); display: block; }
.stat span { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--bone-2); }

/* The cold beat: Adreama Forge reads as the machine, lit in verdigris not amber */
.section--cold .eyebrow { color: var(--verd); }
.section--cold .stat b { color: var(--verd); text-shadow: 0 0 26px rgba(86, 168, 143, .28); }
.section--cold .btn--ghost:hover { color: var(--verd); border-color: var(--verd); }

/* ---- Galleries -------------------------------------------------------- */

.gallery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.gallery { padding: .9rem; background: var(--panel); border: 1px solid var(--line-2); }
.gallery .thumb { aspect-ratio: 16 / 9; display: grid; place-items: center;
  background: linear-gradient(135deg, #1a140d, #2a2014); }
.gallery .cap { display: flex; justify-content: space-between; margin-top: .6rem;
  font-family: var(--font-mono); font-size: .75rem; color: var(--bone-2); }

/* Homepage gallery cards become links once a detail page exists. */
.gallery-link { display: block; color: inherit; }
.gallery-link .gallery { transition: border-color 160ms ease, transform 160ms ease; }
.gallery-link:hover .gallery, .gallery-link:focus-visible .gallery {
  border-color: var(--amber); transform: translateY(-2px); }
.gallery-link:focus-visible { outline: none; }
.gallery-link:hover .cap span:last-child, .gallery-link:focus-visible .cap span:last-child { color: var(--amber); }

/* ---- Gallery detail (plates + lightbox) ------------------------------- */

/* Optional editorial intro above the plates — reuses the article prose kit
   (.doc-content) at the 780px reading measure, left-aligned under the hero. */
.gallery-story { margin: 1.75rem 0 2.75rem; }

.plate-grid { list-style: none; margin: 0; padding: 0; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 1.25rem; }
.plate { margin: 0; }
.plate-btn { display: block; width: 100%; padding: 0; font: inherit; text-align: left;
  cursor: zoom-in; color: var(--bone); background: var(--panel); border: 1px solid var(--line-2);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease; }
.plate-btn:hover, .plate-btn:focus-visible {
  border-color: var(--amber); outline: none; transform: translateY(-2px); box-shadow: var(--glow); }
.plate-thumb { display: block; aspect-ratio: 1 / 1; overflow: hidden;
  background: linear-gradient(135deg, #1a140d, #2a2014); }
.plate-thumb img { display: block; width: 100%; height: 100%; object-fit: cover;
  transition: transform 240ms ease, filter 240ms ease; }
.plate-btn:hover .plate-thumb img, .plate-btn:focus-visible .plate-thumb img {
  transform: scale(1.04); filter: brightness(1.05); }
.plate-cap { display: block; padding: .7rem .85rem .8rem;
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .04em; color: var(--bone-2); }

/* Lightbox: native <dialog>, click-to-zoom (1:1) + drag-to-pan (see site.js). */
.lightbox { width: min(95vw, 84rem); height: min(94vh, 64rem); max-height: 94vh; padding: 0;
  border: 1px solid var(--line-2); background: var(--black-2); color: var(--bone);
  box-shadow: 0 28px 70px rgba(0, 0, 0, .6); }
.lightbox::backdrop { background: rgba(8, 6, 3, .82); backdrop-filter: blur(4px); }
.lightbox-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; max-height: 92vh; }
.lightbox-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem 1rem; border-bottom: 1px solid var(--line); background: var(--panel); }
.lightbox-title { min-width: 0; font-family: var(--font-display); font-weight: 500; letter-spacing: .02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-actions { display: flex; flex: 0 0 auto; gap: .5rem; }
.lightbox-zoom, .lightbox-close { min-width: 2.5rem; min-height: 2.5rem; padding: 0 .75rem;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--bone);
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em; cursor: pointer; }
.lightbox-zoom[aria-pressed="true"] { border-color: var(--amber); color: #fff; }
.lightbox-zoom:hover, .lightbox-zoom:focus-visible,
.lightbox-close:hover, .lightbox-close:focus-visible { border-color: var(--amber); outline: none; }
.lightbox-frame { display: grid; place-items: center; min-height: 0; padding: 1rem; overflow: hidden;
  background: radial-gradient(70% 60% at 50% 30%, rgba(228, 160, 74, .06), transparent 70%), var(--black); }
.lightbox-frame.is-zoomed { display: block; position: relative; }
.lightbox-image { display: block; max-width: 100%; max-height: calc(min(94vh, 64rem) - 8rem); object-fit: contain;
  cursor: zoom-in; user-select: none; -webkit-user-drag: none; touch-action: none;
  transform-origin: 0 0; transition: transform 120ms ease; box-shadow: 0 18px 46px rgba(0, 0, 0, .5); }
.lightbox-image.is-zoomed { position: absolute; top: 0; left: 0; max-width: none; max-height: none;
  cursor: grab; transition: none; }
.lightbox-image.is-dragging { cursor: grabbing; }

/* ---- Lists (guides / files) ------------------------------------------ */

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }
.lined-list { list-style: none; margin: 0; padding: 0; }
.lined-list li { display: flex; justify-content: space-between; gap: .9rem;
  padding: .75rem 0; border-bottom: 1px dashed var(--line); }
.lined-list .k { font-family: var(--font-mono); font-size: .65rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--amber); align-self: center; white-space: nowrap; }

/* ---- CTA band --------------------------------------------------------- */

.cta-band { text-align: center; padding: clamp(4.5rem, 9vw, 6.5rem) 0; position: relative; }
.cta-band::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: min(var(--wrap), 90%); height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--line-2) 24%,
    rgba(228, 160, 74, .4) 50%, var(--line-2) 76%, transparent);
}
.cta-band::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(54% 84% at 50% 32%, rgba(228, 160, 74, .22), transparent 64%); }
.cta-band > * { position: relative; }
/* Vivarium spotlight — cinematic key-art placeholder above the closing pitch */
.cta-band .cta-media {
  aspect-ratio: 16 / 7; margin: 0 auto clamp(2rem, 4vw, 3.25rem);
  display: grid; place-items: center; border: 1px solid var(--line-2);
  background:
    radial-gradient(60% 72% at 50% 42%, rgba(228, 160, 74, .16), transparent 70%),
    linear-gradient(180deg, var(--panel), var(--black-2));
}
.cta-band h2 { font-size: var(--step-hero); font-weight: 600; text-shadow: 0 0 44px rgba(228, 160, 74, .2); }
.cta-band p { color: var(--bone-2); margin: 1rem auto 2.1rem; max-width: 54ch; }
/* The old live-site line, relocated here — a poetic coda for someone already drawn in */
.cta-band .cta-coda {
  margin: 2.4rem auto 0; max-width: 34ch;
  font-family: var(--font-body); font-style: italic; font-size: 1.4rem; color: var(--bone-2);
}

/* ---- Brand sign-off (centered emblem before the footer) --------------- */

.logo-coda { padding: clamp(3rem, 7vw, 5rem) 0; text-align: center; position: relative; }
/* one warm light source, per the lantern motif */
.logo-coda::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(38% 60% at 50% 50%, rgba(228, 160, 74, .12), transparent 68%); }
.logo-coda img { position: relative; width: clamp(280px, 44vw, 440px); max-width: 90%; height: auto; opacity: .9; }

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

.site-footer { padding: 3.25rem 0 4rem; border-top: 1px solid var(--line); color: var(--bone-2); font-size: 1rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 1.75rem; }
.site-footer h4 { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--amber); margin: 0 0 .75rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { padding: .3rem 0; }
.colophon { margin-top: 1.9rem; padding-top: 1.1rem; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .1em; color: var(--bone-2); }

/* ---- Legal pages ------------------------------------------------------ */

.legal-page { padding: clamp(3rem, 7vw, 5rem) 0 clamp(4.5rem, 9vw, 7rem); }
.legal-hero { max-width: 780px; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.legal-hero h1 { font-size: var(--step-h2); margin: .85rem 0 1rem; text-shadow: 0 0 34px rgba(228, 160, 74, .12); }
.legal-hero p { color: var(--bone-2); margin: 0; }
.legal-meta { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--bone-2); }
.legal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.legal-content { max-width: 780px; }
.legal-content section { padding: 2rem 0; border-top: 1px solid var(--line); }
.legal-content section:first-child { padding-top: 0; border-top: 0; }
.legal-content h2 { font-size: 1.45rem; margin-bottom: .85rem; }
.legal-content h3 { font-size: 1.05rem; margin: 1.35rem 0 .45rem; text-transform: uppercase; letter-spacing: .06em; }
.legal-content p { margin: .85rem 0 0; color: var(--bone-2); }
.legal-content ul { margin: .85rem 0 0; padding-left: 1.2rem; color: var(--bone-2); }
.legal-content li { margin: .45rem 0; }
.legal-content strong { color: var(--bone); font-weight: 600; }
.legal-data { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: .6rem 1.25rem; margin: 1rem 0 0; }
.legal-data dt { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--amber); }
.legal-data dd { margin: 0; color: var(--bone-2); }
.legal-note {
  margin-top: 1.35rem; padding: 1rem 1.1rem;
  border: 1px solid var(--line-2);
  background: rgba(34, 26, 17, .55);
  color: var(--bone-2);
}
.legal-aside {
  position: sticky; top: 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  background: rgba(34, 26, 17, .45);
}
.legal-aside h2 {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--amber); margin: 0 0 .75rem;
}
.legal-aside ul { list-style: none; margin: 0; padding: 0; }
.legal-aside li { padding: .25rem 0; }
.legal-aside a { color: var(--bone-2); font-size: .98rem; }
.legal-aside a:hover { color: var(--bone); }

/* ---- Guide / doc article kit -----------------------------------------
   Long-form reading shell, generalized from the legal pages. A guide page is
   a `.section` (so it inherits the seam + lamp), themed per DESIGN_SYSTEM §4.3 /
   §4.6: technical guides use `.section--lamp` (warm), lore guides
   use `.section--cold` (verdigris). The legal pages keep their own `.legal-*`
   classes for now; a later pass can fold them onto this shell. */

.doc-page { padding: clamp(3rem, 7vw, 5rem) 0 clamp(4.5rem, 9vw, 7rem); }

/* Article header — eyebrow (category) + title + dek + metadata line */
.doc-hero { max-width: 780px; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.doc-hero h1 { font-size: var(--step-h2); margin: .85rem 0 1rem; text-shadow: 0 0 34px rgba(228, 160, 74, .12); }
.doc-hero .lede { font-size: 1.3rem; color: var(--bone-2); margin: 0 0 1rem; max-width: 60ch; }
.doc-hero .meta { display: block; margin-top: .25rem; }

/* Content column + sticky table of contents */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.doc-content { max-width: 780px; }

.doc-toc { position: sticky; top: 1.25rem; padding: 1rem 1.1rem; border: 1px solid var(--line); background: rgba(34, 26, 17, .45); }
.doc-toc h2 { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--amber); margin: 0 0 .75rem; }
.doc-toc ul { list-style: none; margin: 0; padding: 0; }
.doc-toc li { padding: .25rem 0; }
.doc-toc a { color: var(--bone-2); font-size: .98rem; }
.doc-toc a:hover { color: var(--bone); }

/* Body sections — hairline-divided; full-strength bone prose (guides are read,
   not skimmed like the muted legal text) */
.doc-content > section { padding: 2.25rem 0; border-top: 1px solid var(--line); }
.doc-content > section:first-child { padding-top: 0; border-top: 0; }
.doc-content h2 { font-size: 1.6rem; margin-bottom: .85rem; }
.doc-content h3 { font-size: 1.2rem; margin: 1.6rem 0 .5rem; }
.doc-content p { margin: 1rem 0 0; }
.doc-content ul, .doc-content ol { margin: 1rem 0 0; padding-left: 1.3rem; }
.doc-content li { margin: .5rem 0; }
.doc-content li::marker { color: var(--amber); }
.doc-content strong { color: var(--bone); font-weight: 600; }
.doc-content a { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: .18em; }

/* Pull-quote — lore flavor; warm by default, cold under a lore guide */
.doc-content blockquote {
  margin: 1.6rem 0 0; padding: .2rem 0 .2rem 1.25rem;
  border-left: 2px solid var(--amber-d);
  font-style: italic; font-size: 1.25rem; color: var(--bone-2);
}

/* Inline figure — softly rounded framed plate for card and art examples */
.doc-figure { margin: 1.75rem 0 0; }
.doc-figure img { display: block; width: 100%; height: auto; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel); }
.doc-figure figcaption { margin-top: .6rem; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .04em; color: var(--bone-2); }

/* Media row — a small game icon/token beside its rule text (e.g. action spaces) */
.doc-media { display: flex; gap: 1.1rem; align-items: flex-start; margin: 1.75rem 0 0; }
.doc-media > img { flex: 0 0 auto; width: clamp(72px, 16vw, 96px); height: auto; border: 1px solid var(--line-2); background: var(--panel); }
.doc-media-body > :first-child { margin-top: 0; }

/* Callouts — one panel, three semantic beats on the warm / cold / oxblood axis:
   note (amber tip), machine (verdigris edge-case), warning (oxblood gotcha).
   Callout colors stay semantic regardless of the page's warm/cold theme. */
.callout {
  margin: 1.6rem 0 0; padding: 1.1rem 1.25rem;
  border: 1px solid var(--line-2); border-left: 3px solid var(--amber);
  background: rgba(34, 26, 17, .55); color: var(--bone-2);
}
.callout > :first-child { margin-top: 0; }
.callout-label {
  display: block; margin-bottom: .35rem;
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--amber);
}
.callout--machine { border-left-color: var(--verd); }
.callout--machine .callout-label { color: var(--verd); }
.callout--warning { border-left-color: var(--oxblood-l); }
.callout--warning .callout-label { color: var(--oxblood-l); }

/* Download block — per-language manuals & rules aids (Files pillar). Each row
   is one click target: name · format/lang/size · download affordance */
.doc-files { list-style: none; margin: 1.75rem 0 0; padding: 0; }
.file-row {
  display: flex; align-items: baseline; gap: .9rem;
  padding: .85rem 0; border-bottom: 1px solid var(--line); color: var(--bone);
}
.file-row:first-child { border-top: 1px solid var(--line); }
.file-row .file-name { font-weight: 600; }
.file-row .file-spec { font-family: var(--font-mono); font-size: .65rem; letter-spacing: .14em; text-transform: uppercase; color: var(--bone-2); }
.file-row .file-dl { margin-left: auto; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--amber); white-space: nowrap; }

/* Lore guides run cold: page chrome shifts amber -> verdigris (callouts excepted) */
.section--cold .doc-toc h2 { color: var(--verd); }
.section--cold .doc-content blockquote { border-left-color: var(--verd); }
.section--cold .doc-content li::marker { color: var(--verd); }

/* ---- Scroll reveal (the lantern sweeping the room) -------------------- */

.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .9s ease, transform .9s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---- Back-to-top (appears after two screens; bottom-right) ------------ */

.to-top {
  position: fixed;
  right: calc(1.25rem + env(safe-area-inset-right, 0px));
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  width: 2.9rem; height: 2.9rem; padding: 0;
  display: grid; place-items: center;
  color: var(--amber);
  background: rgba(34, 26, 17, .82);
  border: 1px solid var(--line-2);
  border-radius: 50%;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
  cursor: pointer;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s,
    color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { color: #fff; border-color: var(--amber); box-shadow: var(--glow); }
.to-top svg { width: 1.1rem; height: 1.1rem; display: block; }

/* ---- Responsive ------------------------------------------------------- */

@media (max-width: 900px) {
  .gallery-grid, .two-col, .footer-grid, .feature-row, .legal-layout, .doc-layout { grid-template-columns: 1fr; }
  .legal-aside, .doc-toc { position: static; order: -1; }
  .legal-data { grid-template-columns: 1fr; }
  .feature--flip .feature-media { order: 0; }
  .spec-strip { grid-template-columns: 1fr 1fr; }
  .spec-strip li { border-left: 0; border-top: 1px solid var(--line); padding: .8rem; }
  .spec-strip li:nth-child(-n+2) { border-top: 0; }
  .site-nav { display: none; }

  /* Mobile nav: the toggle appears in the header row; the open menu expands
     below it as a full-width column (header wraps — no overlay, no z-index). */
  .site-header { flex-wrap: wrap; }
  .js .nav-toggle {
    display: grid; place-items: center;
    width: 2.75rem; height: 2.75rem; padding: 0;
    color: var(--bone); background: transparent;
    border: 1px solid var(--line-2); border-radius: var(--radius);
    cursor: pointer;
  }
  .nav-toggle svg { width: 1.2rem; height: 1.2rem; display: block; }
  .nav-toggle .icon-close { display: none; }
  .nav-toggle[aria-expanded="true"] .icon-open { display: none; }
  .nav-toggle[aria-expanded="true"] .icon-close { display: block; }
  .nav-toggle[aria-expanded="true"] { color: var(--amber); border-color: var(--amber-d); }
  .js .site-nav.is-open {
    display: flex; flex-direction: column; align-items: stretch;
    flex-basis: 100%; gap: 0;
    padding: .5rem 0 1.1rem; margin-top: 1.1rem;
    border-top: 1px solid var(--line);
  }
  .js .site-nav.is-open a:not(.btn) { padding: .85rem .15rem; border-bottom: 1px dashed var(--line); }
  .js .site-nav.is-open .lang { padding: .85rem .15rem; }
  .js .site-nav.is-open .btn { margin-top: 1rem; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
}
