/* Lumiversed v4 — design tokens + components. One file, no external fonts. */

/* ---------- Tokens (dark default; light via prefers-color-scheme) ---------- */
:root {
  color-scheme: dark light;
  --bg: #070a14;
  --bg-raised: #0e1424;
  --bg-sunken: #05070f;
  --line: #26304a;
  --text: #f3eee4;
  --text-muted: #b9b4c4;
  --accent: #e2c97e;        /* brand gold */
  --accent-strong: #f5e3ae;
  --accent-ink: #14110a;    /* text on gold */
  --link: #9fd6f5;
  --focus: #ffd866;
  --ok: #8fe3b0;
  --warn: #ffcf8a;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;

  --step--1: clamp(0.88rem, 0.85rem + 0.1vw, 0.94rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.4vw, 1.4rem);
  --step-2: clamp(1.45rem, 1.25rem + 0.9vw, 1.9rem);
  --step-3: clamp(1.8rem, 1.45rem + 1.6vw, 2.7rem);
  --step-4: clamp(2.2rem, 1.6rem + 2.8vw, 3.8rem);

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

  --radius-s: 6px; --radius-m: 12px; --radius-l: 20px;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.35), 0 4px 16px rgb(0 0 0 / 0.25);
  --measure: 68ch;
  --wrap: 72rem;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #faf7f0;
    --bg-raised: #ffffff;
    --bg-sunken: #f1ece1;
    --line: #d8d0bf;
    --text: #1b1a22;
    --text-muted: #4f4b57;
    --accent: #7a5512;
    --accent-strong: #5c3f0b;
    --accent-ink: #ffffff;
    --link: #1d5c8c;
    --focus: #1d5c8c;
    --ok: #1d6b3d;
    --warn: #8a4b00;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.08), 0 4px 16px rgb(0 0 0 / 0.06);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-sans); font-size: var(--step-0); line-height: 1.6;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--font-serif); line-height: 1.2; margin: 0 0 var(--space-4); font-weight: 700; }
h1 { font-size: var(--step-4); letter-spacing: -0.01em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); font-family: var(--font-sans); }
p, ul, ol { margin: 0 0 var(--space-4); }
a { color: var(--link); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
code { font-size: 0.92em; background: var(--bg-sunken); padding: 0.1em 0.35em; border-radius: 4px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--space-4); }
.prose { max-width: var(--measure); }
.muted { color: var(--text-muted); }
.small { font-size: var(--step--1); }
.eyebrow { font-size: var(--step--1); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: var(--space-3); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.skip-link { position: absolute; left: var(--space-4); top: -100px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: var(--space-2) var(--space-4); border-radius: var(--radius-s); font-weight: 700; }
.skip-link:focus { top: var(--space-2); }

/* ---------- Header / nav ---------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-5); padding-top: var(--space-3); padding-bottom: var(--space-3); }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; font-size: 0.95rem; min-height: 44px; }
.brand img { width: 32px; height: 32px; border-radius: 50%; }
.nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); margin: 0; padding: 0; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); color: var(--text); text-decoration: none; border-radius: var(--radius-s); font-size: 0.95rem; }
.nav a:hover { background: var(--bg-raised); }
.nav a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }

/* ---------- Sections ---------- */
main { display: block; }
.section { padding: var(--space-8) 0; }
.section + .section { border-top: 1px solid var(--line); }
.page-head { padding: var(--space-7) 0 var(--space-5); }
.lead { font-size: var(--step-1); color: var(--text-muted); max-width: 60ch; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: var(--space-8) 0; isolation: isolate; background: var(--bg-sunken); }
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgb(5 7 15 / 0.92) 0%, rgb(5 7 15 / 0.75) 55%, rgb(5 7 15 / 0.45) 100%); }
.hero, .hero h1 { color: #f3eee4; }
.hero .lead { color: #d9d4e2; }
.hero .eyebrow { color: #e2c97e; }
.hero-grid { display: grid; gap: var(--space-6); align-items: end; }
@media (min-width: 60rem) { .hero-grid { grid-template-columns: 1.4fr 1fr; } }

/* ---------- Buttons ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-5); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 48px; padding: 0 var(--space-5); border-radius: 999px; font-weight: 700; text-decoration: none; border: 2px solid transparent; font-size: var(--step-0); cursor: pointer; font-family: inherit; line-height: 1.2; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { border-color: currentColor; color: var(--text); background: transparent; }
.hero .btn-primary { background: #e2c97e; color: #14110a; }
.hero .btn-ghost { color: #f3eee4; }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: var(--space-5); }
@media (min-width: 40rem) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 60rem) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius-m); padding: var(--space-5); box-shadow: var(--shadow-1); }
.card h3 { margin-bottom: var(--space-2); }
.card p:last-child { margin-bottom: 0; }
.card-link { color: inherit; text-decoration: none; display: block; height: 100%; }
.card-link:hover .card, .card-link:focus-visible .card { border-color: var(--accent); }
.tag { display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; padding: 0.15em 0.6em; border-radius: 999px; border: 1px solid var(--line); color: var(--text-muted); }
.tag-ok { color: var(--ok); border-color: currentColor; }
.tag-warn { color: var(--warn); border-color: currentColor; }

.feature-card { background: #101a2c; border: 2px solid #e2c97e; border-radius: var(--radius-l); padding: var(--space-5); color: #f3eee4; }
.feature-card h2 { font-size: var(--step-2); color: #f3eee4; }
.feature-card p { color: #d9d4e2; }

.pillars { counter-reset: p; }
.pillar-num { font-family: var(--font-serif); font-size: var(--step-3); color: var(--accent); line-height: 1; margin-bottom: var(--space-3); display: block; }

/* ---------- Steps / diagram ---------- */
.steps { list-style: none; padding: 0; display: grid; gap: var(--space-4); }
@media (min-width: 50rem) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius-m); padding: var(--space-5); }
.steps b { display: block; font-size: var(--step-1); margin-bottom: var(--space-2); }

figure { margin: var(--space-6) 0; }
figcaption { font-size: var(--step--1); color: var(--text-muted); margin-top: var(--space-3); max-width: var(--measure); }
.diagram { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius-m); padding: var(--space-4); }
.diagram svg { width: 100%; height: auto; }
.d-box { fill: var(--bg-sunken); stroke: var(--line); stroke-width: 2; }
.d-box-accent { fill: var(--bg-sunken); stroke: var(--accent); stroke-width: 2.5; }
.d-text { fill: var(--text); font-family: var(--font-sans); font-size: 17px; }
.d-text-b { fill: var(--text); font-family: var(--font-sans); font-size: 18px; font-weight: 700; }
.d-text-s { fill: var(--text-muted); font-family: var(--font-sans); font-size: 14px; }
.d-text-accent { fill: var(--accent); font-family: var(--font-sans); font-size: 15px; font-weight: 700; }
.d-arrow { stroke: var(--text-muted); stroke-width: 2.5; fill: none; }
.d-arrow-accent { stroke: var(--accent); stroke-width: 2.5; fill: none; stroke-dasharray: 7 6; }
.d-head { fill: var(--text-muted); }
.d-head-accent { fill: var(--accent); }

/* ---------- Lessons ---------- */
.lesson-meta { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); color: var(--text-muted); font-size: var(--step--1); margin-bottom: var(--space-5); }
.lesson h2 { font-size: var(--step-2); margin-top: var(--space-7); }
.box { border-radius: var(--radius-m); padding: var(--space-5); margin: var(--space-6) 0; border: 1px solid var(--line); background: var(--bg-raised); }
.box h2 { margin-top: 0; font-size: var(--step-1); font-family: var(--font-sans); }
.box-try { border-left: 6px solid var(--link); }
.box-key { border-left: 6px solid var(--accent); }
.box ul:last-child, .box ol:last-child, .box p:last-child { margin-bottom: 0; }
.sources ol { padding-left: 1.4em; }
.sources li { margin-bottom: var(--space-2); overflow-wrap: anywhere; }
.disclosure { font-size: var(--step--1); color: var(--text-muted); border-top: 1px solid var(--line); padding-top: var(--space-4); margin-top: var(--space-6); }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-2); padding: 0; margin: 0 0 var(--space-4); font-size: var(--step--1); color: var(--text-muted); }
.breadcrumb li + li::before { content: "/"; margin-right: var(--space-2); }
.track { margin-bottom: var(--space-7); }
.lesson-list { list-style: none; padding: 0; display: grid; gap: var(--space-3); }
.lesson-list .soon { color: var(--text-muted); padding: var(--space-3) var(--space-4); border: 1px dashed var(--line); border-radius: var(--radius-m); }

/* ---------- Studio ---------- */
.filters { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-5); border: 0; padding: 0; }
.filters legend { width: 100%; font-weight: 700; margin-bottom: var(--space-2); padding: 0; }
.filter-btn { min-height: 44px; padding: 0 var(--space-4); border-radius: 999px; border: 1px solid var(--line); background: var(--bg-raised); color: var(--text); font: inherit; cursor: pointer; }
.filter-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.gallery { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.gallery li[hidden] { display: none; }
.tile { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; height: 100%; display: flex; flex-direction: column; }
.tile img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--bg-sunken); }
.tile-body { padding: var(--space-4); }
.tile h3 { margin: 0 0 var(--space-2); }
.tile h3 a { color: var(--text); text-decoration: none; }
.tile h3 a:hover { text-decoration: underline; }
.badges { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-2) 0; }
.meta-list { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-5); margin: 0 0 var(--space-5); }
.meta-list dt { font-weight: 700; }
.meta-list dd { margin: 0; color: var(--text-muted); }
.detail-img { border-radius: var(--radius-m); border: 1px solid var(--line); }
.empty-note { border: 1px dashed var(--line); border-radius: var(--radius-m); padding: var(--space-5); color: var(--text-muted); }

/* ---------- Chat UI (kept for the Ask AI assistant) ---------- */
.assistant { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius-l); padding: var(--space-5); box-shadow: var(--shadow-1); }
.assistant-label { display: inline-flex; gap: var(--space-2); align-items: center; font-size: var(--step--1); font-weight: 700; color: var(--accent); margin-bottom: var(--space-4); }
.assistant-label::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.chat-log { list-style: none; padding: 0; margin: 0 0 var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
.msg { max-width: 46rem; padding: var(--space-3) var(--space-4); border-radius: var(--radius-m); }
.msg p:last-child, .msg ul:last-child { margin-bottom: 0; }
.msg-bot { background: var(--bg-sunken); border: 1px solid var(--line); align-self: flex-start; }
.msg-user { background: var(--accent); color: var(--accent-ink); align-self: flex-end; font-weight: 600; }
.msg-bot a { color: var(--link); }
.choices { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.choice { min-height: 48px; padding: var(--space-2) var(--space-4); border-radius: var(--radius-m); border: 2px solid var(--accent); background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.choice:hover { background: var(--bg-sunken); }
.choice-restart { border-color: var(--line); font-weight: 400; }
.action-row { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.action-row .btn { min-height: 44px; font-size: var(--step--1); padding: 0 var(--space-4); }
.reply-note { font-size: var(--step--1); color: var(--text-muted); margin-top: var(--space-2); }
.js-only { display: none; }
.has-js .js-only { display: block; }
.has-js .no-js-only { display: none; }
.fallback h3 { margin-top: var(--space-5); }
.fact-list { padding-left: 1.2em; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: var(--space-7) 0; background: var(--bg-sunken); color: var(--text-muted); font-size: var(--step--1); }
.site-footer .wrap { display: grid; gap: var(--space-5); }
@media (min-width: 50rem) { .site-footer .wrap { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h2 { font-size: var(--step-0); font-family: var(--font-sans); color: var(--text); margin-bottom: var(--space-2); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li a { display: inline-block; padding: var(--space-1) 0; min-height: 32px; }
.pillar-line { letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); font-weight: 600; }

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

/* ---------- Tight page head + chat choices ---------- */
.page-head-tight { padding-top: var(--space-5); padding-bottom: var(--space-3); }
.page-head-tight h1 { font-size: var(--step-3); }
.assistant-label { font-family: var(--font-sans); font-size: var(--step--1); margin-top: 0; }
.choice { text-decoration: none; display: inline-flex; align-items: center; }
.faq-list dt { font-weight: 700; margin-top: var(--space-3); }
.faq-list dd { margin: 0; }

/* ---------- Studio filters (generated from the manifest, no JS) ---------- */
.studio:has(#type-image:checked) .gallery li:not([data-type="image"]){display:none}
.studio:has(#origin-code:checked) .gallery li:not([data-origin="code"]){display:none}
.studio-filters input{position:absolute;opacity:0;width:1px;height:1px}
.studio-filters input:checked+label{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.studio-filters input:focus-visible+label{outline:3px solid var(--focus);outline-offset:3px}
.filter-btn{display:inline-flex;align-items:center}
