:root {
  --bg: #f6f5f3;
  --ink: #111111;
  --mute: #6b6b6b;
  --line: #e3e1dc;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: only light; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }

/* ── Top bar ─────────────────────────────────────────────── */
.topbar {
  flex: 0 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  z-index: 5;
}
.back {
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--mute);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 92px;
}
.back .arrow { font-size: 15px; transition: transform .3s ease; }
.back:hover { color: var(--ink); }
.back:hover .arrow { transform: translateX(-3px); }

.brand { display: flex; align-items: baseline; gap: 14px; text-align: center; }
.brand-name {
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 400;
}
.brand-sub {
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--mute);
}
.meta {
  min-width: 92px;
  text-align: right;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--mute);
}

/* ── Stage ───────────────────────────────────────────────── */
.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: #0d0e10;
  overflow: hidden;
  isolation: isolate;
}
#scene {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#scene:active { cursor: grabbing; }

.stage-caption {
  position: absolute;
  left: 24px;
  top: 20px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.82);
  background: rgba(10,10,12,.28);
  backdrop-filter: blur(6px);
  padding: 7px 10px;
  pointer-events: none;
  mix-blend-mode: normal;
  transition: opacity .3s ease;
}
.stage-caption .dot {
  width: 5px; height: 5px; background: #e8b06a; display: inline-block;
}

.hint {
  position: absolute;
  right: 24px;
  top: 20px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: rgba(255,255,255,.72);
  background: rgba(10,10,12,.28);
  backdrop-filter: blur(6px);
  padding: 7px 10px;
  pointer-events: none;
  transition: opacity .8s ease;
}
.hint.is-hidden { opacity: 0; }

/* ── Work card ───────────────────────────────────────────── */
.card {
  position: absolute;
  right: 24px;
  bottom: 24px;
  width: 262px;
  background: rgba(246,245,243,.96);
  backdrop-filter: blur(10px);
  padding: 20px 22px 18px;
  border: 1px solid rgba(0,0,0,.08);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
  z-index: 3;
}
.card.is-open { opacity: 1; transform: none; pointer-events: auto; }
.card-close {
  position: absolute; top: 8px; right: 10px;
  font-size: 18px; line-height: 1; color: var(--mute);
}
.card-kicker {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mute);
  margin-bottom: 10px;
}
.card-title {
  font-size: 19px;
  font-weight: 400;
  letter-spacing: -.01em;
  line-height: 1.2;
  margin: 0 0 10px;
}
.card-meta {
  font-size: 11px;
  line-height: 1.65;
  color: var(--mute);
  margin: 0 0 16px;
}
.card-link {
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 3px;
}
.card-link span { display: inline-block; transition: transform .3s ease; }
.card-link:hover span { transform: translateX(3px); }

/* ── Loader ──────────────────────────────────────────────── */
.loader {
  position: absolute;
  inset: 0;
  background: var(--bg);
  display: grid;
  place-items: center;
  z-index: 10;
  transition: opacity .7s ease, visibility .7s;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader-inner { width: 210px; text-align: left; }
.loader-title {
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  margin-bottom: 14px;
}
.loader-track { height: 1px; background: var(--line); overflow: hidden; }
.loader-track span {
  display: block; height: 100%; width: 0%;
  background: var(--ink); transition: width .4s ease;
}
.loader-note {
  margin-top: 12px; font-family: var(--mono); font-size: 9px;
  letter-spacing: .08em; color: var(--mute);
}

/* ── Controls ────────────────────────────────────────────── */
.controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 0 28px;
  height: 88px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  z-index: 5;
  overflow-x: auto;
  scrollbar-width: none;
}
.controls::-webkit-scrollbar { display: none; }
.group { display: flex; align-items: center; gap: 18px; white-space: nowrap; }
.label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mute);
}
.views button, .tools button {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--mute);
  padding: 7px 0 5px;
  border-bottom: 1px solid transparent;
  transition: color .25s ease, border-color .25s ease;
}
.views button:hover, .tools button:hover { color: var(--ink); }
.views button.is-active, .tools button.is-on { color: var(--ink); border-color: var(--ink); }

.time { gap: 12px; }
.time-end {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--mute);
}
#time {
  -webkit-appearance: none;
  appearance: none;
  width: 190px;
  height: 18px;
  background: transparent;
  margin: 0;
  cursor: pointer;
}
#time::-webkit-slider-runnable-track {
  height: 1px; background: #c9c6bf;
}
#time::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 9px; height: 9px; background: var(--ink);
  margin-top: -4px; border-radius: 0;
}
#time::-moz-range-track { height: 1px; background: #c9c6bf; }
#time::-moz-range-thumb { width: 9px; height: 9px; background: var(--ink); border: 0; border-radius: 0; }
#time-out {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink);
  min-width: 38px;
}

.fallback[hidden] { display: none; }
.fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--ink); background: var(--bg); padding: 40px; text-align: center;
  font-size: 14px;
}

/* ── Shot mode (for still renders) ───────────────────────── */
body.shot { overflow: hidden; }
body.shot .topbar, body.shot .controls, body.shot .hint,
body.shot .stage-caption, body.shot .card { display: none !important; }
body.shot .stage { height: 100vh; flex: 1 1 100vh; }
body.shot .loader { display: none; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 980px) {
  .topbar { height: 58px; padding: 0 18px; }
  .brand { gap: 0; }
  .brand-sub, .meta { display: none; }
  .back { min-width: 0; }
  .controls {
    height: auto;
    flex-wrap: wrap;
    gap: 12px 26px;
    padding: 14px 18px 16px;
    justify-content: flex-start;
  }
  .stage { flex: 1 1 auto; min-height: 46vh; }
  .group { gap: 14px; }
  .time #time { width: 130px; }
  .stage-caption { left: 14px; top: 14px; font-size: 9px; }
  .hint { display: none; }
  .card { left: 14px; right: 14px; bottom: 14px; width: auto; }
}
@media (max-width: 560px) {
  .views button { font-size: 10px; }
  .views { gap: 11px; }
  .label { display: none; }
  .controls { gap: 10px 20px; }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
