/* ---------- Theme tokens: one block per project ---------- */
:root {
  --bg: #121214;
  --panel: #1b1b1f;
  --fg: #f0f0f2;
  --muted: #9a9aa5;
  --border: #2e2e35;
  --accent: #c7c7d1;
  --accent-fg: #121214;
  --radius: 10px;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font-body);
  --display-weight: 700;
  --display-tracking: -0.02em;
  --shadow: none;
  --card-bg: transparent;
  --t: 0.9s;
}
body[data-project="rehearsal"] {
  --bg: #16161a;
  --panel: #1e1e24;
  --fg: #ededed;
  --muted: #9a9aa5;
  --border: #33333b;
  --accent: #7c95f7;
  --accent-fg: #0f1020;
  --radius: 12px;
  --font-display: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display-weight: 600;
  --display-tracking: -0.025em;
}
body[data-project="fantasy"] {
  --bg: #1f1a2e;
  --panel: #3b2d46;
  --fg: #fbf3e4;
  --muted: #dccfe8;
  --border: #6e5779;
  --accent: #f2c14e;
  --accent-fg: #2b1a0c;
  --card-bg: rgba(33, 24, 44, 0.78);
  --radius: 18px;
  --font-body: "Open Sans", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Open Sans", ui-sans-serif, system-ui, sans-serif;
  --display-weight: 800;
  --display-tracking: 0.005em;
  --shadow: 0 8px 0 rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-snap-type: y proximity; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  line-height: 1.6;
  transition: background-color var(--t) ease, color var(--t) ease;
}

/* ---------- Backdrops ---------- */
.backdrop { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.bd { position: absolute; inset: 0; opacity: 0; transition: opacity var(--t) ease; }
body[data-project="rehearsal"] .bd-rehearsal,
body[data-project="fantasy"] .bd-fantasy { opacity: 1; }

/* faint staff lines drifting across the app theme */
.bd-rehearsal {
  background:
    radial-gradient(60% 50% at 80% 10%, rgba(124, 149, 247, 0.14), transparent 70%),
    repeating-linear-gradient(to bottom, transparent 0 46px, rgba(255, 255, 255, 0.045) 46px 47px, transparent 47px 55px);
}
/* dusk sky over a checkerboard of grass */
.bd-fantasy {
  background:
    radial-gradient(40% 22% at 78% 30%, rgba(255, 190, 110, 0.35), transparent 70%),
    linear-gradient(to bottom, #1d2447 0%, #4b3f7a 30%, #a8566a 52%, rgba(168, 86, 106, 0) 62%),
    conic-gradient(#3f8a3f 25%, #58a047 0 50%, #3f8a3f 0 75%, #58a047 0) 0 0 / 96px 96px;
}
.bd-fantasy::after { /* soften the grass so it reads as ground, not noise */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 55%, rgba(24, 20, 36, 0.55));
}

/* ---------- Layout ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px clamp(16px, 4vw, 48px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--t), border-color var(--t);
}
.brand { color: var(--fg); text-decoration: none; font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-tracking); }
.nav nav { display: flex; gap: clamp(12px, 3vw, 28px); }
.nav nav a { color: var(--muted); text-decoration: none; font-size: 0.9rem; padding: 4px 0; border-bottom: 2px solid transparent; transition: color 0.3s, border-color 0.3s; }
.nav nav a:hover, .nav nav a.active { color: var(--fg); border-color: var(--accent); }

section { min-height: 100svh; scroll-snap-align: start; display: grid; align-items: center; padding: 96px clamp(16px, 4vw, 48px) 48px; }
.hero { max-width: 900px; margin: 0 auto; align-content: center; }
.project { grid-template-columns: 1fr 1.1fr; gap: clamp(24px, 5vw, 72px); max-width: 1200px; margin: 0 auto; }

h1, h2 { font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-tracking); line-height: 1.1; margin: 0 0 16px; transition: letter-spacing var(--t); }
h1 { font-size: clamp(2.4rem, 7vw, 4.5rem); }
h2 { font-size: clamp(2rem, 5vw, 3.4rem); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.75rem; color: var(--accent); margin: 0 0 12px; transition: color var(--t); }
.project-text { background: var(--card-bg); border-radius: var(--radius); padding: clamp(0px, 2vw, 28px); transition: background-color var(--t), padding var(--t); }
.lede, .project-text p { color: var(--muted); font-size: 1.05rem; max-width: 52ch; }
.scroll-hint { color: var(--accent); text-decoration: none; display: inline-block; margin-top: 24px; }

.tags { list-style: none; padding: 0; margin: 20px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { border: 1px solid var(--border); background: var(--panel); border-radius: 999px; padding: 4px 12px; font-size: 0.8rem; transition: all var(--t); }

.btn { display: inline-block; padding: 12px 22px; border-radius: var(--radius); font-weight: 600; text-decoration: none; background: var(--accent); color: var(--accent-fg); box-shadow: var(--shadow); transition: background-color var(--t), color var(--t), border-radius var(--t), transform 0.15s; }
.btn:hover { transform: translateY(-2px); }

footer { padding: 32px; text-align: center; color: var(--muted); font-size: 0.85rem; }

/* ---------- Rehearsal Room mock ---------- */
.rr-window { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); }
.rr-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 0.8rem; }
.rr-btn { border: 1px solid #33333b; border-radius: 8px; padding: 4px 12px; color: #9a9aa5; }
.rr-btn.on { background: #7c95f7; color: #0f1020; border-color: #7c95f7; font-weight: 600; }
.rr-time { margin-left: auto; font-family: ui-monospace, Menlo, monospace; color: #9a9aa5; }
.rr-score { background: #fff; border-radius: 8px; padding: 12px 14px 10px; color: #111; font-family: "Academico", Georgia, serif; }
.rr-title { text-align: center; font-weight: 700; margin-bottom: 10px; }

/* ---------- Fantasy Quest mock ---------- */
.fq-screen { position: relative; aspect-ratio: 16 / 10; border-radius: 18px; overflow: hidden; border: 4px solid #1a1620; box-shadow: 0 10px 0 rgba(0, 0, 0, 0.3);
  background: conic-gradient(#3f7a3a 25%, #55903f 0 50%, #3f7a3a 0 75%, #55903f 0) 0 0 / 14% 22%; }
.fq-hud { position: absolute; top: 3%; left: 3%; width: 36%; color: #fff; font-size: 0.7rem; }
.bar { position: relative; height: 12px; background: rgba(0, 0, 0, 0.45); margin-bottom: 4px; border-radius: 2px; }
.bar span { display: block; height: 100%; border-radius: 2px; }
.bar em { position: absolute; inset: 0; text-align: center; font-style: normal; font-size: 0.6rem; line-height: 12px; }
.bar.hp span { background: #d94a4a } .bar.mp span { background: #3b82e0 } .bar.xp { height: 5px } .bar.xp span { background: #e0c040 }
.fq-minimap { position: absolute; top: 3%; right: 3%; width: 20%; aspect-ratio: 1; border-radius: 50%; background: #10204a; border: 2px solid #000; display: grid; place-items: center; }
.isle { width: 70%; aspect-ratio: 1; border-radius: 45% 55% 50% 50%; background: #3f7a3a; border: 4px solid #b8a888; display: grid; place-items: center; }
.isle u { width: 8px; height: 8px; border-radius: 50%; background: #ffd93b; }
.tree { position: absolute; width: 11%; aspect-ratio: 1; border-radius: 50%; background: #2f6b2f; box-shadow: 4px 6px 0 rgba(0, 0, 0, 0.25); }
.t1 { left: 8%; top: 52% } .t2 { left: 22%; top: 70% } .t3 { right: 10%; top: 62%; width: 14% }
.cottage { position: absolute; left: 48%; top: 34%; width: 20%; }
.roof { background: #b23a35; aspect-ratio: 3 / 1; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.wall { height: 38px; background: #efe3c5; }
.mage { position: absolute; left: 36%; top: 62%; width: 4%; aspect-ratio: 1; background: #7a5232; border-radius: 50%; box-shadow: 0 -8px 0 -2px #5a3a20; }
.orb { position: absolute; left: 44%; top: 58%; width: 3%; aspect-ratio: 1; border-radius: 50%; background: #a98cff; box-shadow: 0 0 16px 6px rgba(169, 140, 255, 0.7); animation: float 2.4s ease-in-out infinite; }
@keyframes float { 50% { transform: translate(18px, -10px); } }
.fq-hint { position: absolute; bottom: 3%; left: 0; right: 0; text-align: center; font-size: 0.65rem; color: rgba(255, 255, 255, 0.7); }

/* ---------- Small screens & motion ---------- */
@media (max-width: 800px) {
  .project { grid-template-columns: 1fr; align-content: center; }
  .nav nav a { font-size: 0.8rem; }
  .brand { font-size: 0.9rem; }
}
@media (prefers-reduced-motion: reduce) {
  :root { --t: 0.01s; }
  html { scroll-behavior: auto; }
  .playhead, .orb { animation: none; }
}

/* ---------- Intro + shared bits ---------- */
.hero .lede { max-width: 60ch; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--border); box-shadow: none; }
.nav-cta { color: var(--accent) !important; font-weight: 600; }

/* ---------- Learn page ---------- */
.learn-wrap { max-width: 1100px; margin: 0 auto; padding: 88px clamp(16px, 4vw, 48px) 48px; }
.learn-head h1 { font-size: clamp(2rem, 5vw, 3rem); }
.tabs { display: flex; gap: 8px; margin: 20px 0; border-bottom: 1px solid var(--border); }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font: inherit; padding: 10px 14px; cursor: pointer; }
.tab[aria-selected="true"] { color: var(--fg); border-color: var(--accent); }
.wiki { display: grid; grid-template-columns: 250px 1fr; gap: 32px; }
.wiki-side input { width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--fg); font: inherit; margin-bottom: 12px; }
.wiki-side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.wiki-side a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 0.92rem; }
.wiki-side a:hover { color: var(--fg); background: var(--panel); }
.wiki-side a.active { color: var(--accent-fg); background: var(--accent); font-weight: 600; }
.wiki-side li.empty { color: var(--muted); padding: 8px 10px; font-size: 0.9rem; }
.article { max-width: 68ch; min-width: 0; }
.article h2 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
.article h3 { margin: 1.8em 0 0.4em; }
.article p, .article li { color: var(--fg); opacity: 0.9; }
.article li { margin: 0.3em 0; }
.article code { background: var(--panel); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 0.9em; }
.article blockquote { margin: 1.2em 0; padding: 10px 16px; border-left: 3px solid var(--accent); background: var(--panel); border-radius: 0 8px 8px 0; }
.article blockquote p { margin: 0.3em 0; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--border); }
.pager a { color: var(--accent); text-decoration: none; }
.videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.video { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.video .frame { aspect-ratio: 16 / 9; background: #000; display: grid; place-items: center; }
.video iframe, .video video { width: 100%; height: 100%; border: 0; }
.video .play { width: 100%; height: 100%; border: 0; cursor: pointer; color: #fff; font-size: 2rem; background-size: cover; background-position: center; background-color: #222; }
.video .meta { padding: 12px 14px; }
.video h3 { margin: 0 0 4px; font-size: 1rem; }
.video p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.empty-state { border: 1px dashed var(--border); border-radius: var(--radius); padding: 40px 24px; text-align: center; color: var(--muted); }
[hidden] { display: none !important; }
@media (max-width: 800px) { .wiki { grid-template-columns: 1fr; } .nav nav { gap: 10px; } }

/* ---------- Project pictures as links ---------- */
a.project-visual { display: block; color: inherit; transition: transform 0.25s; }
a.project-visual:hover, a.project-visual:focus-visible { transform: translateY(-4px) scale(1.015); }
a.project-visual:focus-visible { outline: 3px solid var(--accent); outline-offset: 6px; border-radius: var(--radius); }

/* ---------- Scroll follower ---------- */
.trail { position: absolute; top: 0; left: 0; width: 100%; z-index: -1; pointer-events: none; overflow: hidden; }
.trail > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.trail polyline { fill: none; stroke: var(--accent); stroke-linecap: round; stroke-linejoin: round; transition: stroke var(--t); }
.trail-ghost { stroke-width: 2; stroke-dasharray: 2 12; opacity: 0.25; }
.trail-lit { stroke-width: 3; stroke-dasharray: 2 12; opacity: 0.9; }
.sprite { position: absolute; width: 0; height: 0; will-change: transform; }
.s { position: absolute; left: 0; top: 0; width: 38px; height: 38px; margin: -19px 0 0 -19px; opacity: 0; transform: scale(0.4); transition: opacity var(--t), transform var(--t); overflow: visible; }
body[data-project="neutral"] .s-neutral,
body[data-project="rehearsal"] .s-rehearsal,
body[data-project="fantasy"] .s-fantasy { opacity: 1; transform: none; }
.s-neutral { fill: var(--accent); filter: drop-shadow(0 0 8px var(--accent)); animation: spin 8s linear infinite; }
.s-rehearsal { fill: #7c95f7; stroke: #7c95f7; height: 44px; filter: drop-shadow(0 0 8px rgba(124, 149, 247, 0.6)); animation: sway 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
.s-fantasy i { position: absolute; left: 50%; top: 50%; border-radius: 50%; background: #a98cff; box-shadow: 0 0 18px 8px rgba(169, 140, 255, 0.65); }
.s-fantasy i:nth-child(1) { width: 20px; height: 20px; margin: -10px; animation: pulse 1.6s ease-in-out infinite; }
.s-fantasy i:nth-child(2), .s-fantasy i:nth-child(3) { width: 6px; height: 6px; margin: -3px; background: #ffe9a8; box-shadow: 0 0 8px 3px rgba(242, 193, 78, 0.8); }
.s-fantasy i:nth-child(2) { animation: orbit 2.2s linear infinite; }
.s-fantasy i:nth-child(3) { animation: orbit 2.2s linear infinite -1.1s; }
.s-fantasy { overflow: visible; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sway { 50% { transform: rotate(14deg) translateY(-4px); } }
@keyframes pulse { 50% { transform: scale(1.25); } }
@keyframes orbit { from { transform: rotate(0) translateX(22px); } to { transform: rotate(360deg) translateX(22px); } }
@media (prefers-reduced-motion: reduce) { .s, .s i { animation: none !important; } }

/* ---------- Score ---------- */
.score-svg { display: block; width: 100%; height: auto; }
.score-svg .cursor { animation: cursor 8s linear infinite; }
@keyframes cursor { from { transform: translateX(76px); } to { transform: translateX(372px); } }
@media (prefers-reduced-motion: reduce) { .score-svg .cursor { animation: none; transform: translateX(120px); } }

/* ---------- Right-edge progress rail ---------- */
.rail { position: fixed; right: 20px; top: 50%; transform: translateY(-50%); height: 62vh; width: 56px; z-index: 5; pointer-events: none; --p: 0%; }
.rail > div { position: absolute; inset: 0; opacity: 0; transition: opacity var(--t); }
body[data-project="neutral"] .rail-n, body[data-project="rehearsal"] .rail-r, body[data-project="fantasy"] .rail-f { opacity: 1; }

/* intro: a quiet thread with a dot per section */
.rn-line, .rn-fill { position: absolute; left: 50%; top: 0; width: 2px; margin-left: -1px; border-radius: 2px; }
.rn-line { bottom: 0; background: rgba(240, 240, 242, 0.18); }
.rn-fill { height: var(--p); background: #f0f0f2; }
.rn-dot { position: absolute; left: 50%; width: 11px; height: 11px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--bg); border: 2px solid rgba(240, 240, 242, 0.4); transition: background 0.4s, border-color 0.4s; }
.rn-dot.on { background: #f0f0f2; border-color: #f0f0f2; }

/* Rehearsal Room: a staff turned on its side; the note plays down it, bar by bar */
.rr-lines { position: absolute; left: 16px; width: 24px; top: 0; bottom: 0;
  background: repeating-linear-gradient(to right, rgba(124, 149, 247, 0.28) 0 1px, transparent 1px 6px); background-size: 25px 100%; background-repeat: no-repeat; }
.rr-lines.lit { background-image: repeating-linear-gradient(to right, #7c95f7 0 1px, transparent 1px 6px); clip-path: inset(0 0 calc(100% - var(--p)) 0); }
.rr-bars { position: absolute; left: 12px; width: 32px; top: 0; bottom: 0; }
.rr-bars b { position: absolute; left: 0; right: 0; height: 2px; margin-top: -1px; background: rgba(124, 149, 247, 0.35); }
.rr-bars b.on { background: #7c95f7; }
.rr-note { position: absolute; left: 28px; top: var(--p); width: 14px; height: 10px; margin: -5px 0 0 -7px; border-radius: 50%; background: #7c95f7; transform: rotate(-20deg); box-shadow: 0 0 10px rgba(124, 149, 247, 0.7); }

/* Fantasy Quest: the XP bar from the game's HUD, with a level gem */
.rf-track { position: absolute; left: 50%; top: 0; bottom: 0; width: 18px; margin-left: -9px; background: rgba(14, 11, 18, 0.75); border: 3px solid #0e0b12; border-radius: 10px; overflow: hidden;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); }
.rf-fill { position: absolute; left: 0; right: 0; top: 0; height: var(--p); background: linear-gradient(90deg, #e0b030, #ffe27a 50%, #e0b030); }
.rf-track::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, transparent 0 calc(11.111% - 2px), rgba(0, 0, 0, 0.55) calc(11.111% - 2px) 11.111%); }
.rf-gem { position: absolute; left: 50%; top: var(--p); width: 20px; height: 20px; margin: -10px 0 0 -10px; transform: rotate(45deg); background: #a98cff; border: 2px solid #fff4c7; border-radius: 4px; box-shadow: 0 0 14px 4px rgba(169, 140, 255, 0.7); }
.rf-lv { position: absolute; right: 36px; top: var(--p); margin-top: -8px; font: 800 11px/1 "Open Sans", sans-serif; letter-spacing: 0.06em; color: #fff4c7; background: rgba(14, 11, 18, 0.75); border-radius: 6px; padding: 4px 7px; white-space: nowrap; }

@media (min-width: 801px) { section { padding-right: max(clamp(16px, 4vw, 48px), 100px); padding-left: clamp(16px, 4vw, 48px); } }
@media (max-width: 800px) { .rail { display: none; } }

/* ---------- Bio + credit ---------- */
.hero .bio { margin-top: 14px; color: var(--fg); opacity: 0.85; }
.credit { margin: 14px 0 0; font-size: 0.95rem; color: var(--accent) !important; font-weight: 600; }
.credit::before { content: "★ "; }
