/* whatudo 3D story — Graphite tokens (see site/site.css). The canvas is the page; HTML floats over it. */
:root {
  color-scheme: dark;
  --bg: #000; --surface: #0A0A0A; --surface-2: #171717; --text: #EDEDED; --muted: #A1A1A1; --faint: #777;
  --line: #262626; --line-2: #333; --accent: #0070F3; --accent-soft: rgba(0,112,243,.18);
  --primary: #EDEDED; --primary-fg: #000;
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.22,.8,.2,1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden; }
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--mono); }
.spacer { flex: 1; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ---- top bar ---- */
.top { position: fixed; top: 0; left: 0; right: 0; height: 58px; display: flex; align-items: center; gap: 18px; padding: 0 22px; z-index: 5;
  background: linear-gradient(rgba(0,0,0,.7), rgba(0,0,0,0)); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-size: 21px; font-weight: 500; letter-spacing: -.01em; }
.brand svg { width: 18px; height: 18px; }
.place { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  padding: 6px 10px 6px 8px; border: 1px solid var(--line); border-radius: 999px; background: rgba(10,10,10,.6); backdrop-filter: blur(8px); }
.place b { color: var(--text); font-weight: 500; }
.place i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(10,10,10,.6); color: var(--text); font: 500 13.5px/1 var(--sans); cursor: pointer; transition: background .15s, border-color .15s; backdrop-filter: blur(8px); }
.btn:hover { background: var(--surface-2); border-color: #444; }
.btn.primary { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.btn.primary:hover { background: #fff; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; }

/* ---- chapter label (top-left under bar) ---- */
.chapter { position: fixed; left: 22px; top: 84px; z-index: 4; display: grid; gap: 4px; max-width: 640px; transition: opacity .5s var(--ease), transform .5s var(--ease); }
.chapter.out { opacity: 0; transform: translateY(-6px); }
.kicker { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.chapter .title { font-family: var(--display); font-size: 20px; line-height: 1.2; color: var(--text); font-variation-settings: "opsz" 48; }

/* ---- caption ---- */
.caption { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 12px;
  max-width: min(760px, calc(100% - 48px)); padding: 12px 18px 12px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(10,10,10,.78); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: opacity .35s var(--ease), transform .35s var(--ease); }
.caption.out { opacity: 0; transform: translate(-50%, 8px); }
.caption .who { flex: none; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 5px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line-2); }
.caption .who.agent { color: #fff; background: var(--accent); border-color: var(--accent); }
.caption .text { font-size: 17px; line-height: 1.4; color: var(--text); }
.caption .text em { font-style: italic; color: var(--muted); }

/* ---- end card ---- */
.endcard { position: fixed; inset: 0; z-index: 3; display: grid; place-content: center; text-align: center; padding: 0 24px; pointer-events: none; opacity: 0; transition: opacity .8s var(--ease); background: radial-gradient(60% 50% at 50% 50%, rgba(0,0,0,.72), rgba(0,0,0,.15)); }
.endcard.in { opacity: 1; pointer-events: auto; }
.endcard .eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 18px; }
.endcard h1 { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(32px, 4.6vw, 62px); line-height: 1.04; letter-spacing: -.025em; font-variation-settings: "opsz" 144; max-width: 980px; }
.endcard h1 em { font-style: italic; color: var(--muted); }
.endcard .cta { display: flex; gap: 10px; justify-content: center; margin-top: 30px; }

/* ---- controls ---- */
.controls { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 14px; width: min(760px, calc(100% - 48px)); height: 52px; padding: 0 10px 0 8px;
  border-radius: 14px; border: 1px solid var(--line); background: rgba(10,10,10,.78); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.icon { width: 36px; height: 36px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text); display: grid; place-items: center; cursor: pointer; }
.icon:hover { background: var(--surface-2); border-color: var(--line-2); }
.icon svg { width: 18px; height: 18px; }
.icon .i-play { display: none; }
body.paused .icon .i-play { display: block; }
body.paused .icon .i-pause { display: none; }
.scrub { position: relative; flex: 1; height: 24px; cursor: pointer; }
.scrub::before { content: ""; position: absolute; left: 0; right: 0; top: 11px; height: 2px; background: var(--line-2); border-radius: 2px; }
.scrub .fill { position: absolute; left: 0; top: 11px; height: 2px; width: 0; background: var(--accent); border-radius: 2px; }
.scrub .marks { position: absolute; inset: 0; pointer-events: none; }
.scrub .marks i { position: absolute; top: 8px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--faint); }
.scrub .marks i.done { border-color: var(--accent); background: var(--accent); }
.time { font-size: 12px; color: var(--muted); min-width: 34px; text-align: right; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button { height: 32px; padding: 0 12px; border: 0; background: transparent; color: var(--muted); font: 500 12.5px/1 var(--sans); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--surface-2); color: var(--text); }

.webgl-fail { position: fixed; inset: 0; display: grid; place-content: center; background: var(--bg); z-index: 9; color: var(--muted); }
.webgl-fail a { color: var(--accent); }
.webgl-fail[hidden] { display: none; }

@media (max-width: 720px) {
  .place, .top .btn { display: none; }
  .chapter { top: 70px; max-width: 240px; }
  .chapter .title { font-size: 17px; }
  .caption { bottom: 88px; padding: 10px 14px 10px 10px; flex-direction: column; align-items: flex-start; gap: 8px; width: calc(100% - 48px); }
  .caption .text { font-size: 14.5px; }
  .seg { display: none; }
}
@media (prefers-reduced-motion: reduce) { .caption, .chapter, .endcard { transition: none; } }

html.render .caption { bottom: 26px; }
html.render .controls { display: none; }
html.render .top .btn { display: none; }
/* recording mode */
html.clean .top, html.clean .chapter, html.clean .place { display: none; }
html.clean .controls { opacity: 0; transition: opacity .25s; }
html.clean .controls:hover, html.clean body.paused .controls { opacity: 1; }
