/* Film shell. Colours are the site tokens (design/tokens.css). --u is 1 at 1080 px height. */

:root {
  --surface: #070B16; --surface-low: #050811; --teal: #A8F9E7; --sky: #8CC8F0; --violet: #C9B8FF;
  --silver: #DCE7F5; --amber: #F2CC7A; --umbra: #FF758F; --pearl: #F6F8FF; --text: #F0F5FC; --text-dim: #B8C8DF; --outline: #2A3E63;
}
html, body { margin: 0; height: 100%; background: var(--surface-low); color: var(--text); }
.film {
  --u: 1; position: relative; width: 100%; height: 100%; overflow: hidden; background: var(--surface);
  color: var(--text); font-family: "Inter", system-ui, sans-serif; -webkit-font-smoothing: antialiased;
}
.film canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .5s ease; }
.film.ready canvas { opacity: 1; }
.film.failed::after { content: "WebGL is unavailable, so the animation cannot start."; position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-dim); font-size: 14px; }
.labels, .captions { position: absolute; inset: 0; pointer-events: none; }

/* captions */
.cap { position: absolute; max-width: min(calc(560px * var(--u) + 120px), 86vw); transform: translateY(var(--rise, 0px)); will-change: opacity, transform; }
.cap-bl {
  left: clamp(20px, 5.2vw, 96px);
  bottom: clamp(64px, 11vh, 128px);
  isolation: isolate;
  text-shadow: 0 1px 14px rgba(5, 8, 17, 0.92), 0 0 4px rgba(5, 8, 17, 0.9);
}
.cap-bl::before {
  content: "";
  position: absolute;
  inset: -18px -28px -16px -24px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at 25% 65%, rgba(7, 11, 22, 0.78) 0%, rgba(7, 11, 22, 0.44) 58%, rgba(7, 11, 22, 0) 100%);
}
.cap-center { left: 50%; top: 50%; transform: translate(-50%, calc(-50% + var(--rise, 0px))); text-align: center; max-width: 86vw; }
.cap-kicker { font: 600 max(10px, calc(8px + 4px * var(--u))) "Inter", sans-serif; letter-spacing: .22em; text-transform: uppercase; color: var(--teal); margin-bottom: calc(6px + 6px * var(--u)); }
.cap-title { font: 500 max(19px, calc(17px + 17px * var(--u))) / 1.16 "Cinzel", serif; letter-spacing: .035em; color: var(--text); text-wrap: balance; }
.cap-title.cap-math { font-family: "Inter", sans-serif; font-weight: 400; letter-spacing: .01em; font-size: max(18px, calc(16px + 15px * var(--u))); }
.cap-body { font: 400 max(13px, calc(11px + 6.5px * var(--u))) / 1.5 "Inter", sans-serif; color: var(--text-dim); margin-top: calc(5px + 7px * var(--u)); max-width: 40em; text-wrap: pretty; }
.cap-title + .cap-body { margin-top: calc(6px + 8px * var(--u)); }
.cap-center .cap-title { font-size: max(26px, calc(26px + 38px * var(--u))); letter-spacing: .16em; text-transform: uppercase; font-weight: 500; }
.cap-center .cap-body { margin-left: auto; margin-right: auto; letter-spacing: .04em; }

/* labels pinned to world positions */
.lbl { position: absolute; left: 0; top: 0; white-space: nowrap; opacity: 0; visibility: hidden; color: var(--silver); will-change: transform, opacity; text-shadow: 0 0 12px rgba(5, 8, 17, .9), 0 0 3px rgba(5, 8, 17, .9); }
.lbl-mono { font: 400 max(10.5px, calc(8.5px + 5px * var(--u))) "JetBrains Mono", ui-monospace, monospace; letter-spacing: .01em; }
.lbl-sans { font: 500 max(10.5px, calc(8.5px + 5px * var(--u))) "Inter", sans-serif; letter-spacing: .04em; }
.lbl-serif { font: 500 max(11.5px, calc(10px + 8px * var(--u))) "Cinzel", serif; letter-spacing: .05em; }
.lbl::before { content: none; }
.lbl-ac { margin: -0.7em 0 0 0; translate: -50% 0; }
.lbl-al { margin: -0.7em 0 0 0; }
.lbl-ar { margin: -0.7em 0 0 0; translate: -100% 0; }
.lbl-at { margin: 0; translate: -50% 0; }
.lbl-ab { margin: 0; translate: -50% -100%; }

/* portrait safe-area caption alignment for cinema modes */
@media (max-aspect-ratio: 1/1) {
  .film:not(.explore) .cap-bl {
    left: 20px;
    right: 20px;
    max-width: calc(100vw - 40px);
    bottom: clamp(68px, 10vh, 112px);
  }
}

/* quiet auto-hiding corner navigation for film & wonder modes */
.film-nav, .wonder-nav {
  position: absolute;
  top: clamp(14px, 3vh, 28px);
  left: clamp(16px, 5.2vw, 96px);
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border: 1px solid rgba(42, 62, 99, 0.72);
  border-radius: 999px;
  background: rgba(7, 11, 22, 0.74);
  backdrop-filter: blur(8px);
  color: var(--text-dim);
  font: 500 12px/1.2 "Inter", system-ui, sans-serif;
  letter-spacing: .04em;
  transition: opacity .5s ease, border-color .2s ease;
}
.film-nav a, .wonder-nav a {
  color: var(--text);
  text-decoration: none;
  transition: color .2s ease;
}
.film-nav a:hover, .film-nav a:focus-visible,
.wonder-nav a:hover, .wonder-nav a:focus-visible {
  color: var(--teal);
  outline: none;
}
.film-nav a:focus-visible, .wonder-nav a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.film-nav-sep { color: var(--outline); user-select: none; }
.film.idle .film-nav, .film.idle .wonder-nav { opacity: 0; pointer-events: none; }
.film.no-ui .film-nav, .film.no-ui .wonder-nav { display: none; }
.film-nav:focus-within, .wonder-nav:focus-within { opacity: 1; pointer-events: auto; }

/* transport */
.transport { position: absolute; left: clamp(16px, 5.2vw, 96px); right: clamp(16px, 5.2vw, 96px); bottom: clamp(14px, 3.4vh, 36px); display: flex; align-items: center; gap: 14px; transition: opacity .5s ease; }
.film.idle .transport { opacity: 0; }
.film.idle { cursor: none; }
.film.no-ui .transport { display: none; }
.tp-play { all: unset; box-sizing: border-box; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--silver); border: 1px solid var(--outline); background: rgba(11, 18, 34, .6); transition: border-color .2s, color .2s; }
.tp-play:hover, .tp-play:focus-visible { border-color: var(--teal); color: var(--teal); }
.tp-play svg { fill: currentColor; }
.tp-play .ico-pause, .tp-play.is-playing .ico-play { display: none; }
.tp-play.is-playing .ico-pause { display: block; }
.tp-track { position: relative; flex: 1; height: 22px; cursor: pointer; outline: none; touch-action: none; }
.tp-rail, .tp-fill { position: absolute; left: 0; top: 50%; height: 1px; margin-top: -.5px; }
.tp-rail { right: 0; background: var(--outline); }
.tp-fill { width: 0; background: var(--teal); }
.tp-fill::after { content: ""; position: absolute; right: -3px; top: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.tp-track:focus-visible .tp-rail { background: var(--silver); }
.tp-marks i { position: absolute; top: 50%; width: 1px; height: 7px; margin-top: -3.5px; background: var(--outline); }
.tp-name { min-width: 9em; text-align: right; font: 500 11px "Inter", sans-serif; letter-spacing: .18em; text-transform: uppercase; color: var(--text-dim); }
@media (max-width: 640px) { .tp-name { display: none; } }
@media (prefers-reduced-motion: reduce) { .film canvas, .transport, .film-nav, .wonder-nav { transition: none; } }

/* wonder mode: the animations alone, no labels, captions or controls; cursor hides only when idle */
.film.wonder .labels, .film.wonder .captions, .film.wonder .transport { display: none; }

