:root {
  --bg:#150e09; --panel:#231810; --panel2:#2d1f14; --rule:#43301f;
  --text:#f7ecda; --body:#e8d9c1; --muted:#bfa98a;
  --amber:#ffb347; --teal:#46c1b5; --rose:#ec7461; --green:#5fd68a;
}
* { box-sizing:border-box; }
html { scroll-behavior:smooth; }
body {
  margin:0; color:var(--body); line-height:1.75;
  font-family:"DM Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;
  background:
    radial-gradient(ellipse 70% 45% at 85% 0%, rgba(255,179,71,.20), transparent 70%),
    radial-gradient(ellipse 60% 40% at 5% 10%, rgba(70,193,181,.12), transparent 70%),
    var(--bg);
  background-attachment:fixed;
}
/* film grain */
body::before { content:""; position:fixed; inset:0; pointer-events:none; z-index:0; opacity:.07;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
.space-decor { display:none; }
header.site-header, main, footer, .chapter-nav-inner { max-width:880px; margin-left:auto; margin-right:auto; padding-left:1.5rem; padding-right:1.5rem; }
header.site-header, main, .chapter-nav, footer { position:relative; z-index:1; }
header.site-header { padding-top:4.5rem; padding-bottom:2.5rem; }
.eyebrow { font-family:"DM Mono",ui-monospace,monospace; font-size:.75rem; letter-spacing:.18em; text-transform:uppercase; color:var(--teal); }
header.site-header h1 {
  font-family:"Fraunces",Georgia,serif; font-weight:800; font-style:italic; letter-spacing:-.02em;
  font-size:clamp(3rem,11vw,6.6rem); line-height:.92; margin:.7rem 0 1rem; color:var(--text);
  text-shadow:0 0 40px rgba(255,179,71,.35);
}
.accent-bar { height:5px; width:120px; border-radius:3px; background:linear-gradient(90deg,var(--amber),var(--rose)); }
.tagline { font-size:1.3rem; color:var(--text); margin:1.2rem 0 0; max-width:30ch; }
.repo-link { margin:1.6rem 0 0; }
.repo-link a { display:inline-block; color:var(--text); border:1px solid var(--rule); padding:.65rem 1.2rem; border-radius:999px; text-decoration:none; font-weight:700; margin:0 .75rem .5rem 0; }
.repo-link a.btn-primary { background:var(--amber); color:#241406; border-color:transparent; box-shadow:0 0 30px rgba(255,179,71,.4); }
.repo-link a:hover { opacity:.85; }
.chapter-nav { position:sticky; top:0; z-index:20; background:rgba(21,14,9,.9); backdrop-filter:blur(10px); border-bottom:1px solid var(--rule); }
.chapter-nav-inner { display:flex; flex-wrap:wrap; align-items:center; gap:.3rem .95rem; padding-top:.8rem; padding-bottom:.8rem; font-size:.8rem; }
.chapter-nav a { color:var(--muted); text-decoration:none; font-weight:500; }
.chapter-nav a:hover { color:var(--text); }
.chapter-nav .nav-back { color:var(--teal); font-weight:700; }
.chapter-nav .nav-top { margin-left:auto; }
main { padding-top:1rem; padding-bottom:3rem; counter-reset:sec; }
h2 { counter-increment:sec; font-family:"Fraunces",Georgia,serif; font-weight:800; font-size:2.8rem; letter-spacing:-.01em; margin:4.2rem 0 1rem; scroll-margin-top:6.5rem; line-height:1.05; color:var(--text); }
h2::before { content:"Side " counter(sec, upper-alpha); display:block; font-family:"DM Mono",ui-monospace,monospace; font-size:.72rem; font-weight:500; letter-spacing:.2em; text-transform:uppercase; color:var(--amber); margin-bottom:.5rem; }
h3 { font-family:"Fraunces",Georgia,serif; font-size:1.25rem; margin:2rem 0 .5rem; color:var(--amber); }
p, li { font-size:1.08rem; color:var(--body); }
b, strong { color:var(--text); }
a { color:var(--teal); }
code { font-family:"DM Mono",ui-monospace,monospace; background:var(--panel); padding:.12em .4em; border-radius:4px; font-size:.9em; }
.lead { font-size:1.2rem; max-width:62ch; }
img { max-width:100%; border-radius:10px; }
footer { padding-top:2rem; padding-bottom:3rem; color:var(--muted); font-size:.85rem; border-top:1px solid var(--rule); display:flex; flex-direction:column; gap:.5rem; }
footer a { color:var(--teal); }
/* reveal */
.reveal { opacity:0; transform:translateY(22px); transition:opacity .6s ease, transform .6s ease; }
.reveal.in { opacity:1; transform:none; }
/* back-of-sleeve tracklist */
.tracks { list-style:none; margin:1.6rem 0; padding:0; counter-reset:trk; border-top:2px solid var(--amber); }
.tracks > li { counter-increment:trk; display:grid; grid-template-columns:3rem 1fr auto; gap:.2rem 1rem; padding:1.1rem .2rem; border-bottom:1px dashed var(--rule); align-items:baseline; }
.tracks > li::before { content:counter(trk, decimal-leading-zero); font-family:"DM Mono",monospace; color:var(--amber); font-size:1.2rem; grid-row:1 / span 2; }
.tracks h3 { margin:0; color:var(--text); font-size:1.3rem; }
.tracks .gesture { font-family:"DM Mono",monospace; font-size:.72rem; letter-spacing:.12em; text-transform:uppercase; color:var(--teal); text-align:right; }
.tracks p { grid-column:2 / span 2; margin:.2rem 0 0; font-size:1rem; }
@media (max-width:640px) { .tracks > li { grid-template-columns:2.4rem 1fr; } .tracks .gesture { grid-column:2; text-align:left; } .tracks p { grid-column:2; } }
/* in-game checklist mock */
.hud { background:linear-gradient(160deg,#3a2616,#241810); border:2px solid #6b4a2b; border-radius:16px; padding:1.1rem 1.4rem; max-width:420px; font-family:"DM Mono",monospace; font-size:1rem; line-height:2; box-shadow:0 20px 50px -20px #000; }
.hud b { color:var(--green); font-weight:500; }
.hud .cur { color:var(--amber); }
.hud small { display:block; color:var(--muted); letter-spacing:.14em; text-transform:uppercase; font-size:.7rem; margin-bottom:.4rem; }
/* cards */
.act-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(250px,1fr)); gap:1.1rem; margin:1.4rem 0; }
.act { background:var(--panel); border:1px solid var(--rule); border-radius:16px; padding:1.3rem; transition:transform .2s, border-color .2s; }
.act:hover { transform:translateY(-5px) rotate(-.4deg); border-color:var(--amber); }
.act h3 { margin:.2rem 0 .4rem; color:var(--text); font-size:1.15rem; }
.act p { margin:0; font-size:1rem; }
.ic { display:inline-block; font-family:"DM Mono",monospace; font-size:.68rem; letter-spacing:.14em; text-transform:uppercase; color:#241406; background:var(--amber); padding:.2rem .6rem; border-radius:999px; margin-bottom:.6rem; }
.act:nth-child(2n) .ic { background:var(--teal); } .act:nth-child(3n) .ic { background:var(--rose); }
.callout { background:linear-gradient(90deg,rgba(255,179,71,.16),rgba(70,193,181,.08)); border:1px solid var(--rule); border-radius:14px; padding:1.1rem 1.3rem; margin:1.5rem 0; color:var(--text); }
.callout b { display:block; font-family:"DM Mono",monospace; font-size:.72rem; letter-spacing:.16em; text-transform:uppercase; color:var(--amber); margin-bottom:.3rem; }
.design-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:14px; }
.design-grid > div { background:var(--panel); border:1px solid var(--rule); border-radius:14px; padding:1rem 1.2rem; }
.design-grid h3 { margin:0 0 .4rem; }
.design-grid ul { margin:0; padding-left:1.1rem; }
@media (max-width:640px) { .design-grid { grid-template-columns:1fr; } }
table { display:block; overflow-x:auto; border-collapse:collapse; margin:1.2rem 0; font-size:.95rem; }
th, td { text-align:left; padding:.65rem .9rem; border-bottom:1px solid var(--rule); vertical-align:top; }
th { font-family:"DM Mono",monospace; color:var(--teal); font-size:.7rem; letter-spacing:.12em; text-transform:uppercase; }
/* placeholders the student replaces */
.todo { display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:.3rem; aspect-ratio:16/9; border:2px dashed var(--amber); border-radius:12px; background:repeating-linear-gradient(45deg,rgba(255,179,71,.05) 0 12px,transparent 12px 24px); color:var(--amber); font-family:"DM Mono",monospace; padding:1rem; }
.todo b { color:var(--amber); letter-spacing:.14em; text-transform:uppercase; font-size:.8rem; }
.todo span { color:var(--muted); font-size:.85rem; }
.todo-inline { font-family:"DM Mono",monospace; background:rgba(255,179,71,.14); border:1px dashed var(--amber); color:var(--amber); padding:.1em .45em; border-radius:6px; }
.gallery { display:grid; grid-template-columns:repeat(2,1fr); gap:14px; }
.gallery figure { margin:0; }
.gallery img { width:100%; aspect-ratio:16/9; object-fit:cover; border-radius:10px; display:block; cursor:zoom-in; border:1px solid var(--rule); }
.gallery figcaption, .video-card figcaption { font-size:.95rem; color:var(--muted); margin-top:.45rem; }
@media (max-width:640px) { .gallery { grid-template-columns:1fr; } }
.video-card { margin:1.5rem 0; }
.video-card video { width:100%; border-radius:14px; border:1px solid var(--rule); display:block; }
.lightbox { position:fixed; inset:0; z-index:100; background:rgba(8,5,3,.93); display:none; align-items:center; justify-content:center; padding:2rem; cursor:zoom-out; flex-direction:column; gap:.8rem; }
.lightbox.open { display:flex; }
.lightbox img { max-width:100%; max-height:calc(100vh - 6rem); }
.lightbox p { margin:0; color:var(--text); }
/* code */
.snip { margin:1.6rem 0; }
.snip h3 { margin:0 0 .3rem; }
.snip p { margin:0 0 .6rem; color:var(--muted); }
.snip pre { margin:0; padding:1rem 1.1rem; overflow-x:auto; background:#0d0805; border:1px solid var(--rule); border-radius:10px; font-size:.82rem; line-height:1.55; }
.snip code { background:none; padding:0; color:#f0e3cd; white-space:pre; }
details { background:var(--panel); border:1px solid var(--rule); border-radius:14px; padding:.9rem 1.3rem; margin:1rem 0; }
summary { cursor:pointer; font-weight:700; color:var(--amber); }
details[open] summary { margin-bottom:.6rem; }
details ol, details ul { padding-left:1.3rem; }
details li { font-size:1rem; }


/* ---------- v2: living header, playable desk, small delights ---------- */
body { overflow-x:clip; }
header.site-header > *:not(canvas) { position:relative; z-index:1; }
header.site-header h1 { background:linear-gradient(100deg,#fff3dc 10%,var(--amber) 45%,var(--rose) 80%); background-size:200% 100%; -webkit-background-clip:text; background-clip:text; color:transparent; text-shadow:none; animation:shimmer 9s ease-in-out infinite alternate; filter:drop-shadow(0 0 28px rgba(255,179,71,.28)); }
@keyframes shimmer { to { background-position:100% 0; } }
header.site-header > canvas.eq { position:absolute; left:50%; transform:translateX(-50%); bottom:0; width:100vw; height:78%; z-index:0; opacity:.85; pointer-events:none; -webkit-mask-image:linear-gradient(to top,#000 30%,transparent); mask-image:linear-gradient(to top,#000 30%,transparent); }
.repo-link { display:flex; flex-wrap:wrap; align-items:center; }
.hero-cta { display:flex; flex-wrap:wrap; gap:.75rem; align-items:center; margin:0 0 .5rem; }
.hero-cta .play { display:inline-flex; align-items:center; gap:.6rem; background:var(--amber); color:#241406; font-weight:700; text-decoration:none; padding:.8rem 1.4rem; border-radius:999px; box-shadow:0 0 0 0 rgba(255,179,71,.6); animation:ping 2.4s ease-out infinite; }
.hero-cta .play:hover { transform:translateY(-2px); }
@keyframes ping { 70% { box-shadow:0 0 0 18px rgba(255,179,71,0); } 100% { box-shadow:0 0 0 0 rgba(255,179,71,0); } }
.hero-cta .hint { font-family:"DM Mono",monospace; font-size:.75rem; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); }
.nav-progress { position:absolute; left:0; bottom:-1px; height:3px; width:0; background:linear-gradient(90deg,var(--teal),var(--amber),var(--rose)); }
.cursor-glow { position:fixed; left:0; top:0; width:420px; height:420px; margin:-210px 0 0 -210px; border-radius:50%; pointer-events:none; z-index:0; background:radial-gradient(circle,rgba(255,179,71,.13),transparent 65%); will-change:transform; }
@media (pointer:coarse) { .cursor-glow { display:none; } }

/* the playable desk */
.demo-wrap { margin:1.2rem 0 2rem; }
.demo { width:min(1020px,calc(100vw - 2rem),max(620px,calc((100vh - 240px) * 1.55))); position:relative; left:50%; transform:translateX(-50%); }
.demo-stage { position:relative; border-radius:20px; overflow:hidden; border:1px solid var(--rule); box-shadow:0 30px 80px -30px #000, 0 0 0 1px rgba(255,179,71,.08); background:#1a110a; line-height:0; }
.demo-svg { width:100%; height:auto; display:block; touch-action:none; user-select:none; -webkit-user-select:none; }
.demo-svg .wood-lines line { stroke:#000; stroke-opacity:.18; stroke-width:2; }
.demo-svg .strobe { fill:#9aa0a8; opacity:.7; }
.demo-svg .groove { fill:none; stroke:#2a211a; stroke-width:1.4; }
.demo-svg .rec-text { font:800 11px "DM Mono",monospace; letter-spacing:.14em; fill:#17100b; }
.demo-svg .rec-text.s { font-size:8px; font-weight:500; }
.demo-svg .lbl { font:500 12px "DM Mono",monospace; letter-spacing:.2em; fill:#a58a68; }
.demo-svg .read { font:500 15px "DM Mono",monospace; letter-spacing:.1em; fill:var(--amber); }
.demo-svg .tick { stroke:#a58a68; stroke-width:2.4; stroke-linecap:round; }
.demo-svg .record, .demo-svg .arm-handle, #knob, #fader { cursor:grab; }
.demo-svg .record:active, #knob:active, #fader:active { cursor:grabbing; }
.demo-svg #needle.down { fill:var(--amber); }
.demo-svg .arm-handle { animation:handle 2s ease-in-out infinite; transform-box:fill-box; transform-origin:center; }
@keyframes handle { 50% { transform:scale(1.18); } }
.demo[data-step="2"] .record { cursor:default; }
.demo-svg .pad { cursor:pointer; }
.demo-svg .pad-base { fill:#0d0907; }
.demo-svg .pad-cap { fill:#3b2d22; transition:fill .08s, transform .08s; transform-box:fill-box; transform-origin:center; }
.demo-svg .pad:hover .pad-cap { fill:#4a392b; }
.demo-svg .pad.hit-on .pad-cap { fill:#ffb347; transform:scale(.93); }
.demo-svg .pad.glow .pad-cap { fill:#a8631a; animation:padpulse .9s ease-in-out infinite alternate; }
@keyframes padpulse { to { fill:#ffb347; } }
.demo[data-step="1"] #record .rec-inner, .demo[data-step="1"] #record .hit { animation:nudge 1.6s ease-in-out infinite; transform-box:fill-box; transform-origin:center; }
@keyframes nudge { 50% { transform:translateY(-5px); } }
.demo[data-step="4"] #knob > circle:first-child { animation:handle 1.8s ease-in-out infinite; transform-box:fill-box; transform-origin:center; }
.demo[data-step="5"] #fader rect:first-child { filter:drop-shadow(0 0 8px rgba(255,179,71,.9)); }
.demo-lamp { position:absolute; inset:0; z-index:1; pointer-events:none; background:radial-gradient(ellipse 55% 70% at 22% 5%, rgba(255,190,100,.28), transparent 70%); mix-blend-mode:screen; transition:opacity 2.2s ease; }
.demo.finale .demo-lamp { opacity:.12; }
.demo-neon { position:absolute; z-index:1; pointer-events:none; height:6px; width:26%; top:2.5%; border-radius:4px; opacity:0; transition:opacity 1.6s; filter:blur(.5px); }
.demo-neon.n1 { left:6%; background:#7ff3ff; box-shadow:0 0 28px 8px rgba(127,243,255,.55); }
.demo-neon.n2 { right:6%; background:#ff9bf0; box-shadow:0 0 28px 8px rgba(255,155,240,.55); }
.demo.finale .demo-neon { opacity:1; animation:beat .75s ease-in-out infinite alternate; }
.demo.finale .demo-neon.n2 { animation-delay:-.375s; }
@keyframes beat { from { opacity:.35; } to { opacity:1; } }
.demo.finale .demo-stage { box-shadow:0 30px 100px -20px rgba(236,116,97,.35), 0 0 0 1px rgba(255,179,71,.25); }
.demo-ov { position:absolute; inset:0; z-index:2; display:flex; align-items:center; justify-content:center; padding:1rem; background:rgba(14,9,5,.42); backdrop-filter:blur(1.5px); line-height:1.5; }
.demo-ov[hidden] { display:none; }
.slate { background:linear-gradient(160deg,#3a2616,#241810); border:3px solid #6b4a2b; border-radius:18px; padding:1.6rem 2rem 1.8rem; max-width:520px; text-align:center; box-shadow:0 30px 70px -20px #000; animation:drop .7s cubic-bezier(.2,1.3,.4,1) both; }
@keyframes drop { from { opacity:0; transform:translateY(-40px) rotate(-1.5deg); } }
.slate small { display:block; font-family:"DM Mono",monospace; font-size:.7rem; letter-spacing:.2em; text-transform:uppercase; color:var(--teal); }
.slate h3 { font-size:clamp(1.3rem,3.4vw,2rem); color:var(--amber); margin:.4rem 0 .5rem; }
.slate p { font-size:1rem; margin:0 0 1.1rem; color:var(--body); }
.slate p.time { font-family:"DM Mono",monospace; }
.slate p.time b { color:var(--text); }
.demo-btn { font:700 1.05rem "DM Sans",sans-serif; letter-spacing:.06em; color:#102014; background:#6fe3a0; border:0; padding:.85rem 1.7rem; border-radius:12px; cursor:pointer; box-shadow:0 6px 0 #2f8a58, 0 14px 30px -8px rgba(95,214,138,.6); transition:transform .08s, box-shadow .08s; }
.demo-btn:hover { filter:brightness(1.06); }
.demo-btn:active { transform:translateY(5px); box-shadow:0 1px 0 #2f8a58; }
.demo-btn:disabled { opacity:.7; cursor:progress; }
.ov-done .demo-btn { background:#f08a78; color:#2a0f0a; box-shadow:0 6px 0 #a64a3b, 0 14px 30px -8px rgba(236,116,97,.6); }
.ov-done .demo-btn:active { box-shadow:0 1px 0 #a64a3b; }
.demo-hud { display:grid; grid-template-columns:1fr minmax(240px,34%); gap:1.2rem; margin-top:1rem; align-items:start; }
.demo-steps { list-style:none; margin:0; padding:0; display:flex; flex-wrap:wrap; gap:.5rem; }
.demo-steps li { display:flex; align-items:center; gap:.55rem; padding:.45rem .8rem .45rem .45rem; border:1px solid var(--rule); border-radius:999px; background:var(--panel); font-size:.88rem; color:var(--muted); transition:all .3s; }
.demo-steps .chk { display:inline-grid; place-items:center; width:1.6rem; height:1.6rem; border-radius:50%; background:var(--panel2); font:500 .75rem "DM Mono",monospace; color:var(--muted); }
.demo-steps li.cur { color:var(--text); border-color:var(--amber); box-shadow:0 0 22px -4px rgba(255,179,71,.55); }
.demo-steps li.cur .chk { background:var(--amber); color:#241406; }
.demo-steps li.done { color:var(--green); border-color:rgba(95,214,138,.4); }
.demo-steps li.done .chk { background:var(--green); color:#07210f; font-size:0; }
.demo-steps li.done .chk::after { content:"✓"; font-size:.85rem; }
.demo-side { display:flex; flex-direction:column; gap:.6rem; }
.demo-hint { margin:0; padding:.7rem .9rem; border-left:3px solid var(--amber); background:var(--panel); border-radius:0 10px 10px 0; font-size:.95rem; line-height:1.5; color:var(--text); }
.demo-hint.nudge { animation:shake .4s; border-left-color:var(--rose); }
@keyframes shake { 20%,60% { transform:translateX(-5px); } 40%,80% { transform:translateX(5px); } }
.demo-mute { align-self:flex-start; font:500 .75rem "DM Mono",monospace; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); background:none; border:1px solid var(--rule); border-radius:999px; padding:.35rem .8rem; cursor:pointer; }
.demo-mute:hover { color:var(--text); border-color:var(--amber); }
@media (max-width:760px) { .demo-hud { grid-template-columns:1fr; } .slate { padding:.7rem .9rem .9rem; border-width:2px; border-radius:12px; } .slate small { font-size:.58rem; } .slate h3 { font-size:1rem; margin:.2rem 0 .5rem; } .ov-intro .slate p { display:none; } .slate p.time { font-size:.8rem; margin-bottom:.5rem; } .demo-btn { padding:.55rem 1rem; font-size:.85rem; box-shadow:0 4px 0 #2f8a58; } .ov-done .demo-btn { box-shadow:0 4px 0 #a64a3b; } .demo-steps li { font-size:.8rem; } }
.demo-note { font-size:.9rem; color:var(--muted); margin:.9rem 0 0; }

/* copy buttons, card tilt, gallery polish */
.snip { position:relative; }
.copy-btn { position:absolute; right:.6rem; top:3.1rem; font:500 .7rem "DM Mono",monospace; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); background:#150e09; border:1px solid var(--rule); border-radius:6px; padding:.25rem .55rem; cursor:pointer; opacity:.0; transition:opacity .2s; }
.snip:hover .copy-btn, .copy-btn:focus { opacity:1; }
.copy-btn:hover { color:var(--amber); border-color:var(--amber); }
.act { transform-style:preserve-3d; will-change:transform; }
.gallery figure { position:relative; overflow:hidden; border-radius:12px; }
.gallery img { transition:transform .5s ease, filter .3s; }
.gallery figure:hover img { transform:scale(1.045); filter:brightness(1.08); }
.gallery figcaption { padding:.1rem .2rem; }
.lightbox { animation:fade .2s; }
@keyframes fade { from { opacity:0; } }
.tracks > li { transition:background .25s, padding-left .25s; }
.tracks > li:hover { background:linear-gradient(90deg,rgba(255,179,71,.10),transparent); padding-left:.8rem; }

@media (prefers-reduced-motion:reduce) {
  header.site-header h1, .hero-cta .play, .demo-svg .arm-handle, .demo.finale .demo-neon, .demo[data-step] #record .rec-inner, .demo[data-step] #knob > circle:first-child { animation:none !important; }
  .reveal { opacity:1; transform:none; }
}
.act.in { transition:transform .18s ease, border-color .2s, opacity .6s; }

/* ---- layout fixes: balanced step text, 2x2 interaction cards, proper image gallery ---- */
.tracks p, .lead, .act p { text-wrap:pretty; }
.tracks p { text-wrap:balance; max-width:72ch; }
.act-grid { grid-template-columns:repeat(2,minmax(0,1fr)); align-items:stretch; }
@media (max-width:700px) { .act-grid { grid-template-columns:1fr; } }
.gallery { grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.gallery img { height:auto; aspect-ratio:16/9; }
@media (max-width:900px) { .gallery { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:560px) { .gallery { grid-template-columns:1fr; } }
.gallery figcaption { font-size:.85rem; line-height:1.4; }

.demo-steps li { padding:.3rem .7rem .3rem .35rem; font-size:.82rem; white-space:nowrap; }
.demo-hud { margin-top:.7rem; }

/* ---- browser mixer mirrors the headset board ---- */
.demo-svg .vu { fill:#14241b; }
.demo-svg .pad.glow .pad-base { stroke:#ffb347; stroke-width:3; }
.demo[data-step="5"] #fader > rect:first-child { stroke:#ffb347; }
.demo-svg #fader { cursor:grab; }
.demo-svg .read { font-size:13px; }
.demo-svg .pad-cap { fill:#c96f1f; }
.demo-svg .pad:hover .pad-cap { fill:#e08a2e; }

/* ---- header: descenders (g, y) are no longer clipped, and both buttons are the same size ---- */
header.site-header h1 { line-height:1.06; padding-bottom:.16em; margin-bottom:.4rem; }
.repo-link a, .hero-cta .play { display:inline-flex; align-items:center; justify-content:center; gap:.55rem; box-sizing:border-box; min-height:3.1rem; padding:.7rem 1.4rem; font:700 1rem/1.2 "DM Sans",sans-serif; border:1px solid var(--rule); border-radius:999px; margin:0 .75rem .5rem 0; text-decoration:none; }
.repo-link a.btn-primary { border-color:transparent; }
.hero-cta .play { margin:0 0 .5rem; border-color:transparent; cursor:pointer; }
.hero-cta { margin:0 0 .5rem; }

/* ---- the browser demo is a pop-up, opened by a floating button ---- */
.demo-fab { position:fixed; right:1.3rem; bottom:1.3rem; z-index:60; display:flex; align-items:center; gap:.6rem; border:0; cursor:pointer; background:var(--amber); color:#241406; border-radius:999px; height:3.4rem; min-width:3.4rem; padding:0; box-shadow:0 10px 30px -6px rgba(0,0,0,.7), 0 0 0 0 rgba(255,179,71,.55); animation:ping 2.6s ease-out infinite; overflow:hidden; font:700 .9rem "DM Sans",sans-serif; }
.demo-fab[hidden] { display:none; }
.demo-fab-ic { width:3.4rem; height:3.4rem; display:grid; place-items:center; font-size:1.15rem; flex:none; }
.demo-fab-tip { max-width:0; opacity:0; white-space:nowrap; transition:max-width .25s ease, opacity .2s ease, padding .25s ease; }
.demo-fab:hover .demo-fab-tip, .demo-fab:focus-visible .demo-fab-tip { max-width:14rem; opacity:1; padding-right:1.2rem; }
.demo-modal { position:fixed; inset:0; z-index:90; display:flex; align-items:center; justify-content:center; padding:1rem; background:rgba(8,5,3,.86); backdrop-filter:blur(3px); }
.demo-modal[hidden] { display:none; }
.demo-modal-card { position:relative; width:min(760px,100%); max-height:calc(100vh - 2rem); overflow:auto; background:#1c130c; border:1px solid var(--rule); border-radius:20px; padding:1.1rem 1.2rem 1.2rem; box-shadow:0 40px 100px -20px #000; }
.demo-modal .demo-modal-lead { margin:0 2.2rem .8rem 0; font-size:.92rem; line-height:1.5; color:var(--muted); }
.demo-modal .demo-modal-lead b { color:var(--text); }
.demo-modal .demo-wrap { margin:0; }
.demo-modal .demo { width:100%; left:0; transform:none; }
.demo-modal .demo-note { margin:.7rem 0 0; font-size:.78rem; }
.demo-close { position:absolute; right:.7rem; top:.6rem; width:2.2rem; height:2.2rem; border-radius:50%; border:1px solid var(--rule); background:transparent; color:var(--text); font-size:1.4rem; line-height:1; cursor:pointer; }
.demo-close:hover { background:var(--panel); }
html.modal-open { overflow:hidden; }
@media (max-width:760px) { .demo-modal { padding:.5rem; } .demo-modal-card { padding:.8rem; } .demo-modal .demo-modal-lead { font-size:.82rem; } }
@media (prefers-reduced-motion: reduce) { .demo-fab { animation:none; } }
.hero-cta .play { animation:none; }

/* ---- header buttons: one row, same height, same baseline; floating button is a true circle ---- */
.repo-link { display:flex; flex-wrap:wrap; align-items:center; gap:.75rem; margin-top:1.6rem; }
.repo-link a, .hero-cta .play { margin:0; }
.hero-cta { display:contents; }
.demo-fab { gap:0; width:3.4rem; transition:width .25s ease; }
.demo-fab:hover, .demo-fab:focus-visible { width:15.5rem; }
.demo-fab-ic { padding-left:.14rem; }
.demo-fab-tip { padding:0; }
.demo-fab:hover .demo-fab-tip, .demo-fab:focus-visible .demo-fab-tip { padding-right:0; }

/* ---- the two header buttons share ONE set of rules: same colour, glow, hover and press ---- */
.repo-link a, .hero-cta .play {
  background:var(--amber); color:#241406; border:1px solid transparent; opacity:1; animation:none;
  box-shadow:0 0 30px rgba(255,179,71,.4); transition:transform .15s ease, box-shadow .15s ease;
}
.repo-link a:hover, .hero-cta .play:hover { opacity:1; transform:translateY(-2px); box-shadow:0 0 38px rgba(255,179,71,.55); }
.repo-link a:active, .hero-cta .play:active { transform:translateY(0); }

.ico-play { width:.8em; height:.95em; flex:none; display:inline-block; }
.demo-fab-ic .ico-play { width:1.05rem; height:1.25rem; margin-left:.12rem; }

/* ---- pop-up fades and rises in, and fades out; the floating button expands as one smooth motion ---- */
.demo-modal { animation:modalFade .55s cubic-bezier(.22,.7,.2,1) both; }
.demo-modal .demo-modal-card { animation:cardRise .7s cubic-bezier(.22,.8,.2,1) both; }
.demo-modal.closing { animation:modalFadeOut .26s ease both; pointer-events:none; }
.demo-modal.closing .demo-modal-card { animation:cardSink .26s ease both; }
@keyframes modalFade { from { opacity:0; backdrop-filter:blur(0); } to { opacity:1; } }
@keyframes modalFadeOut { to { opacity:0; } }
@keyframes cardRise { from { opacity:0; transform:translateY(22px) scale(.965); } to { opacity:1; transform:none; } }
@keyframes cardSink { to { opacity:0; transform:translateY(10px) scale(.985); } }

.demo-fab { width:3.4rem; transition:width .5s cubic-bezier(.22,.8,.2,1); will-change:width; }
.demo-fab:hover, .demo-fab:focus-visible { width:15.2rem; }
.demo-fab-tip { max-width:none; padding:0 1.3rem 0 .1rem; opacity:0; transform:translateX(-6px); transition:opacity .3s ease, transform .5s cubic-bezier(.22,.8,.2,1); transition-delay:0s; }
.demo-fab:hover .demo-fab-tip, .demo-fab:focus-visible .demo-fab-tip { max-width:none; padding:0 1.3rem 0 .1rem; opacity:1; transform:none; transition-delay:.12s; }
@media (prefers-reduced-motion: reduce) { .demo-modal, .demo-modal .demo-modal-card, .demo-modal.closing, .demo-modal.closing .demo-modal-card { animation:none; } .demo-fab, .demo-fab-tip { transition:none; } }

/* ---- section links: the CSS smooth-scroll fought the script's own animation, so it is off; links answer instantly ---- */
html { scroll-behavior:auto; }
.chapter-nav a { transition:color .12s ease; }
.chapter-nav a:active { color:var(--amber); }
.chapter-nav a.current { color:var(--amber); }
.chapter-nav a.nav-back.current, .chapter-nav a.nav-top.current { color:inherit; }
