/* Cozy diorama theme for the info pages (normal, detail, links, story).
   Loaded after each page's own <style>, so it restyles without touching
   layout or behaviour. The look: soft, matte, rounded pieces with
   gentle shadows and a muted palette, no neon glows.
   Two modes (Settings / menu → Light mode; boot.js sets html.light):
     dark (default): soft dark-blue space, navy cards, cream text
     light: warm daytime cream
   Remove the <link> to get the previous look back (archive/design-v1). */
:root {
  --cz-page: #10182b;
  --cz-card: rgba(20, 29, 51, 0.9);
  --cz-tile: #1d2945;
  --cz-tile-hover: #23314f;
  --cz-chip: rgba(29, 41, 69, 0.92);
  --cz-head: rgba(16, 24, 43, 0.88);
  --cz-band: #18233d;
  --cz-ink: #efe8dc;
  --cz-mut: #9ea8bd;
  --cz-line: rgba(239, 232, 220, 0.1);
  --cz-place: #6f7a92;
  --cz-acc: #e39e7c;         /* primary button: warm peach-terracotta */
  --cz-acc-hover: #eeb093;
  --cz-acc-ink: #2a1a12;
  --cz-acc-txt: #f0b493;     /* small accent text (labels, numbers) */
  --cz-sage: #8fb59a;
  --cz-butter: #e3c487;
  --cz-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 18px 40px -20px rgba(0, 0, 0, 0.75), 0 3px 10px -4px rgba(0, 0, 0, 0.35);
  --cz-shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 6px 16px -8px rgba(0, 0, 0, 0.6);
  --cz-r: 20px;
  /* nav drawer + Astro bubble (nav.js / astro-dock.js read these) */
  --nav-bg: #141d33; --nav-ink: #efe8dc; --nav-mut: #8e98ae; --nav-acc: #f0b493; --nav-card: #1f2b47; --nav-hover: #1f2b47;
  --nav-ham: rgba(29, 41, 69, 0.92); --nav-scrim: rgba(6, 10, 20, 0.55); --nav-line: rgba(239, 232, 220, 0.1); --nav-shadow: rgba(0, 0, 0, 0.55); --nav-hi: rgba(255, 255, 255, 0.06);
  --bub-bg: #1c2742; --bub-ink: #efe8dc; --bub-acc: #f0b493; --bub-hi: rgba(255, 255, 255, 0.06); --bub-shadow: rgba(0, 0, 0, 0.6);
}
html.light {
  --cz-page: #e9ddd0;
  --cz-card: rgba(251, 246, 238, 0.94);
  --cz-tile: #ffffff;
  --cz-tile-hover: #ffffff;
  --cz-chip: rgba(251, 246, 238, 0.94);
  --cz-head: rgba(251, 246, 238, 0.86);
  --cz-band: #f3e9dc;
  --cz-ink: #3b322d;
  --cz-mut: #7a6d64;
  --cz-line: rgba(59, 50, 45, 0.12);
  --cz-place: #a99c92;
  --cz-acc: #c97b5d;
  --cz-acc-hover: #b0654a;
  --cz-acc-ink: #ffffff;
  --cz-acc-txt: #b0654a;
  --cz-sage: #82a084;
  --cz-butter: #e9c98a;
  --cz-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 18px 40px -20px rgba(74, 48, 32, 0.38), 0 3px 10px -4px rgba(74, 48, 32, 0.16);
  --cz-shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 6px 16px -8px rgba(74, 48, 32, 0.3);
  --nav-bg: #fbf6ee; --nav-ink: #3b322d; --nav-mut: #a99c92; --nav-acc: #b0654a; --nav-card: #ffffff; --nav-hover: #f1e6d8;
  --nav-ham: rgba(251, 246, 238, 0.94); --nav-scrim: rgba(59, 50, 45, 0.35); --nav-line: rgba(59, 50, 45, 0.1); --nav-shadow: rgba(74, 48, 32, 0.4); --nav-hi: rgba(255, 255, 255, 0.7);
  --bub-bg: #fbf6ee; --bub-ink: #3b322d; --bub-acc: #b0654a; --bub-hi: rgba(255, 255, 255, 0.7); --bub-shadow: rgba(74, 48, 32, 0.45);
}
:root, html.light {
  /* the pages' own variables, re-pointed */
  --ink: var(--cz-ink); --mut: var(--cz-mut); --line: var(--cz-line); --acc: var(--cz-acc);
  --glass: var(--cz-card); --panel: var(--cz-card);
  --text: var(--cz-ink); --muted: var(--cz-mut); --dim: var(--cz-mut); --cyan: var(--cz-acc); --cyan-soft: var(--cz-acc);
  --bg: var(--cz-page);
}

body { font-family: 'Nunito', 'Manrope', system-ui, sans-serif; color: var(--cz-ink); background: var(--cz-page); transition: background-color 300ms ease; }
/* fallback sky while the 3D landing loads (or without WebGL) */
body::before { background: linear-gradient(180deg, #0f1830 0%, #16223f 35%, #2f62b0 75%, #8fc4ec 100%) !important; }
html.light body::before { background: linear-gradient(180deg, #1b2a4a 0%, #3d4775 30%, #8a7aa2 55%, #dba08a 80%, #f6cba0 100%) !important; }
body::after { opacity: 0.035 !important; } /* paper grain, barely there */

/* no glowing text: plain ink on the cards */
h1, h2, h3, p, .datum, .meta, .org, .role { text-shadow: none !important; }

/* headings + labels: rounded and friendly instead of techy mono */
h1, h2, h3, .brand, .btn, .tabs a, .org, .link-btn .lbl b, .nav-link { font-family: 'Nunito', 'Sora', sans-serif !important; }
h1 { font-weight: 800; letter-spacing: -0.02em; color: var(--cz-ink); }
h2 { font-weight: 800; color: var(--cz-ink); }
.meta, .datum, .kicker, .idx, .dc-idx, .dc-count, .dc-arrow, .current-chip, .group-h, .chip, .reach-field label,
.settings h3, .settings .sw, .grp-h, .role, .link-btn .idx, .link-btn .arr, footer, .links a, #scrollHint {
  font-family: 'Nunito', system-ui, sans-serif !important; letter-spacing: 0.01em;
}
.kicker, .group-h, .grp-h, h2 .idx, .settings h3 { font-weight: 700; font-size: 12px; color: var(--cz-acc-txt); }
.kicker { font-size: 14px; } /* the line that names the page: readable, not a footnote */

a { color: var(--cz-ink); border-bottom-color: var(--cz-line); }
a:hover { color: var(--cz-acc-txt); border-bottom-color: var(--cz-acc); }
:is(a, button, summary, input, textarea):focus-visible { outline: 2px solid var(--cz-acc) !important; outline-offset: 3px; border-radius: 10px; }

/* ---- top bar ---- */
.top::before { background: linear-gradient(180deg, rgba(10, 16, 32, 0.45), transparent) !important; }
html.scrolled .top::before, .top { border-bottom-color: var(--cz-line); }
html.scrolled .top::before { background: var(--cz-head) !important; border-bottom: 1px solid var(--cz-line) !important; }
.brand { font-weight: 800; color: var(--cz-ink) !important; text-shadow: none !important; }
/* over the landing scene's night sky (normal.html, before scrolling) the name reads in cream */
html:not(.scrolled) #landing ~ .top .brand { color: #fbf6ee !important; text-shadow: 0 1px 8px rgba(40, 30, 50, 0.35) !important; }
.brand .sub { color: inherit !important; opacity: 0.75; font-family: 'Nunito', sans-serif !important; }
.chip, .gear, .nav-ham {
  border-radius: 999px !important; border: none !important; background: var(--cz-chip) !important; color: var(--cz-ink) !important;
  box-shadow: var(--cz-shadow-sm); font-weight: 700; font-size: 12.5px;
}
.chip:hover, .gear:hover, .nav-ham:hover { background: var(--cz-tile-hover) !important; color: var(--cz-acc-txt) !important; }
.gear { width: 42px; height: 42px; }
.settings { border-radius: var(--cz-r); background: var(--cz-card); border: none; box-shadow: var(--cz-shadow); }
.settings button.opt { border-radius: 12px; border: 1px solid var(--cz-line); color: var(--cz-ink); background: var(--cz-tile); }
.settings button.opt:hover { border-color: var(--cz-acc); }

#scrollHint { color: #fff; text-shadow: 0 1px 8px rgba(40, 30, 50, 0.45) !important; font-weight: 700; }

/* ---- Home / 3D site / Settings: round icon buttons whose name slides out
   on hover, keyboard focus, or a press-and-hold on touch (topbar.js) ---- */
.tb { display: flex; align-items: center; gap: 8px; }
.tb-fixed { position: fixed; top: 14px; right: 14px; z-index: 8000; }
.tb-btn {
  display: inline-flex; align-items: center; height: 42px; min-width: 42px; padding: 0 12px; gap: 0;
  border: none !important; border-radius: 999px; background: var(--cz-chip); color: var(--cz-ink) !important;
  box-shadow: var(--cz-shadow-sm); cursor: pointer; text-decoration: none; font: 700 13px 'Nunito', system-ui, sans-serif;
  transition: background 200ms ease, color 200ms ease, transform 200ms ease;
  -webkit-touch-callout: none; user-select: none;
}
.tb-btn svg { flex: none; }
.tb-l { max-width: 0; opacity: 0; overflow: hidden; white-space: nowrap; transition: max-width 260ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 200ms ease, margin 260ms ease; }
.tb-btn:hover, .tb-btn:focus-visible, .tb-btn.hold, .tb-btn[aria-expanded="true"] { background: var(--cz-tile-hover); color: var(--cz-acc-txt) !important; transform: translateY(-1px); }
.tb-btn:hover .tb-l, .tb-btn:focus-visible .tb-l, .tb-btn.hold .tb-l { max-width: 90px; opacity: 1; margin-left: 7px; }
html:not(.js) .tb-set { display: none; }
html.noMotion .tb-btn, html.noMotion .tb-l { transition: none; }
/* folded-phone cover screens (280-320 px wide): slightly smaller round buttons, so the name fits beside them */
@media (max-width: 320px) {
  .tb { gap: 6px; }
  .tb-btn { height: 36px; min-width: 36px; padding: 0 9px; }
  html .nav-ham { width: 38px; height: 38px; }
  .top { padding-left: 12px !important; padding-right: 12px !important; gap: 6px !important; }
}

/* the settings panel (built by topbar.js, same on every page) */
.settings { position: fixed; top: 68px; right: clamp(12px, 3vw, 32px); z-index: 8500; width: min(250px, calc(100vw - 24px)); padding: 16px; color: var(--cz-ink); }
.settings[hidden] { display: none; }
.settings h3 { margin: 0 0 6px; }
.settings button.opt { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-top: 8px; padding: 9px 10px 9px 13px; font: 700 13px 'Nunito', system-ui, sans-serif; cursor: pointer; }
/* slide switches: the track names both sides, the knob slides across */
.opt .sw { position: relative; flex: none; width: 82px; height: 28px; border-radius: 999px; background: var(--cz-band); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25); transition: background 250ms ease; }
.opt .sw-k { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--cz-ink); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); transition: transform 260ms cubic-bezier(0.3, 1.3, 0.5, 1); }
.opt .sw-t { position: absolute; top: 0; bottom: 0; left: 30px; right: 8px; display: flex; align-items: center; justify-content: center; font: 800 11px 'Nunito', system-ui, sans-serif; letter-spacing: 0.02em; color: var(--cz-mut); }
.opt[aria-checked="true"] .sw { background: var(--cz-acc); }
.opt[aria-checked="true"] .sw-k { transform: translateX(54px); background: #fff; }
.opt[aria-checked="true"] .sw-t { left: 8px; right: 30px; color: var(--cz-acc-ink); }
html.noMotion .opt .sw, html.noMotion .opt .sw-k { transition: none; }
.nav-theme .opt-n { flex: 1; text-align: left; }

/* ---- cards ---- */
.hero-inner, .glass, main.sheet, .wrap, .settings {
  background: var(--cz-card) !important; border: none !important; border-radius: var(--cz-r) !important; box-shadow: var(--cz-shadow);
}
.hero-inner p.sum, .reach-copy, .reach-note, .lede, .sub, .item p, .card p, .domain-card p { color: var(--cz-mut); }
.role { color: var(--cz-ink); }
.datum { color: var(--cz-mut); }
h2::after, .group-h::after { background: var(--cz-line); }

/* buttons: soft pills */
.btn { border-radius: 999px !important; font-weight: 800; padding: 12px 22px; }
.btn.primary { background: var(--cz-acc) !important; color: var(--cz-acc-ink) !important; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 8px 18px -8px rgba(176, 101, 74, 0.6); }
.btn.primary:hover { background: var(--cz-acc-hover) !important; color: var(--cz-acc-ink) !important; }
.btn.ghost { background: var(--cz-tile) !important; color: var(--cz-ink) !important; border: 1px solid var(--cz-line) !important; box-shadow: var(--cz-shadow-sm); }
.btn.ghost:hover { color: var(--cz-acc-txt) !important; border-color: var(--cz-acc) !important; }

/* now card + index rows */
.card { border-left: 3px solid var(--cz-butter); border-radius: 4px; }
.now-card { border-left-color: var(--cz-sage); }
.current-chip { color: var(--cz-sage); font-weight: 700; }
.current-chip .d { background: var(--cz-sage); border-radius: 50%; width: 7px; height: 7px; }
.grid { border-top: none; display: grid; gap: 10px; }
.domain-card { border: none !important; border-radius: 16px; background: var(--cz-tile); box-shadow: var(--cz-shadow-sm); padding: 16px 18px !important; transition: transform 200ms ease, box-shadow 200ms ease; }
.domain-card:hover { background: var(--cz-tile-hover); transform: translateY(-2px); }
.domain-card .dc-idx { color: var(--cz-acc-txt); font-weight: 800; }
.domain-card:hover .dc-idx, .domain-card:hover .dc-arrow { color: var(--cz-acc-txt); }

/* contact form */
.reach-field input, .reach-field textarea { border-radius: 14px; border: 1px solid var(--cz-line); background: var(--cz-tile); color: var(--cz-ink); font-family: 'Nunito', sans-serif; }
.reach-field input::placeholder, .reach-field textarea::placeholder { color: var(--cz-place); }
.reach-divider { background: var(--cz-line); }

footer.panel { color: #fff; }
footer.panel > div { background: var(--cz-card) !important; border: none !important; border-radius: 999px !important; box-shadow: var(--cz-shadow-sm); color: var(--cz-mut); }
footer a { color: var(--cz-ink); }

/* ---- detail page ---- */
body > header.top { background: var(--cz-head); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); } /* blur: page text no longer ghosts through the sticky bar */
/* the landing page's bar floats over the scene: its own ::before draws the backdrop (a soft
   fade, then solid once scrolled), so it must not get the solid sticky-bar fill as well.
   In light mode that fill put a pale band behind the cream name before scrolling. */
#landing ~ header.top { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.tabs a { border-radius: 999px; border: 1px solid var(--cz-line); background: var(--cz-tile); color: var(--cz-mut); font-weight: 700; }
.tabs a:hover { color: var(--cz-acc-txt); border-color: var(--cz-acc); }
.tabs a.on { background: var(--cz-acc); border-color: var(--cz-acc); color: var(--cz-acc-ink); }
.item { border-left: none; border-radius: 16px; background: var(--cz-tile); box-shadow: var(--cz-shadow-sm); padding: 18px 20px !important; }
.item h3 { color: var(--cz-ink); font-weight: 800; }
.links a { border-radius: 999px; border: 1px solid var(--cz-line); background: var(--cz-band); font-weight: 700; }
.links a:hover { border-color: var(--cz-acc); color: var(--cz-acc-txt); }
.media img { border-radius: 12px; border: none; }
.band { border: none; border-radius: var(--cz-r); background: var(--cz-band); }

/* ---- links page ---- */
.link-btn { border-bottom: none !important; border-radius: 16px; background: var(--cz-tile); box-shadow: var(--cz-shadow-sm); margin-top: 10px; padding: 14px 16px !important; }
.link-btn:hover { background: var(--cz-tile-hover); transform: translateY(-1px); }
.link-btn::before { display: none; }
.link-btn .idx { color: var(--cz-acc-txt); font-weight: 800; }
.link-btn:hover .arr { color: var(--cz-acc-txt); }
.grp-h { border-bottom: none; }
.noscript-links a { background: var(--cz-tile); border: none; border-radius: 16px; box-shadow: var(--cz-shadow-sm); }

/* ---- story page ---- */
.lede, p { color: var(--cz-mut); }
em { color: var(--cz-ink); border-bottom-color: var(--cz-butter); }
h2 .yr { color: var(--cz-acc-txt); font-family: 'Nunito', sans-serif !important; font-weight: 800; }
figure img { border-radius: 14px; border: none; box-shadow: var(--cz-shadow-sm); }
figcaption, .note { font-family: 'Nunito', sans-serif !important; color: var(--cz-mut); }
.ph { border-radius: 16px; border: 2px dashed var(--cz-line); background: var(--cz-band); color: var(--cz-mut); font-family: 'Nunito', sans-serif !important; }
.cards { border-top: none; display: grid; gap: 10px; }
.cards .card { border: none; border-radius: 14px; background: var(--cz-tile); box-shadow: var(--cz-shadow-sm); padding: 14px 16px; }
.card b, .timeline b, .sig { font-family: 'Nunito', sans-serif !important; color: var(--cz-ink); }
.evo { border-top-color: var(--cz-line); }
.side { border: none; border-radius: 16px; background: #1f2e4d; box-shadow: var(--cz-shadow-sm); }
.side .tag { border-radius: 999px; background: rgba(251, 246, 238, 0.92); color: #3b322d; font-family: 'Nunito', sans-serif !important; font-weight: 800; font-size: 11px; letter-spacing: 0.01em; }
.side.now .tag { color: #b0654a; }
.ctl { border-top-color: rgba(255, 255, 255, 0.08); }
.ctl button, .play { border-radius: 999px; font-family: 'Nunito', sans-serif !important; font-weight: 700; color: #f3e9dc; border-color: rgba(243, 233, 220, 0.25); }
.ctl button:hover, .play:hover, .ctl button[aria-pressed="true"] { border-color: var(--cz-butter); color: #fff; }
.play { border-radius: 0; background: rgba(233, 201, 138, 0.12); color: #f3dcc4; }
.play small { color: rgba(243, 233, 220, 0.7); }
.oldbub { background: var(--bub-bg); color: var(--bub-ink); border: none; border-radius: 14px; }
.timeline { border-left-color: var(--cz-line); }
.timeline li::before { background: var(--cz-acc); }
.timeline li { color: var(--cz-mut); }

/* ?scene=1 (story page preview): only the landing animation, driven by the
   story page's slider instead of scrolling */
html.sceneOnly, html.sceneOnly body { overflow: hidden !important; }
html.sceneOnly body > :not(#landing) { display: none !important; }

/* high-contrast mode keeps its plain black/white override */
html.hiContrast body { background: #000 !important; }
html.hiContrast :is(.hero-inner, .glass, .wrap, .item, .link-btn, .domain-card, .settings) { background: #000 !important; color: #fff !important; box-shadow: none !important; border: 1px solid #fff !important; }
