:root {
  --bg: #050507;
  --ink: #f4f1ea;
  --ink-dim: #6c685e;
  --ink-dimmer: #2a2823;
  --critical: #ff2e4d;
  --charge: #5be3ff;
  --bloom: #ff7ad9;
  --amber: #d4a017;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Visually hidden but readable to search engines & screen readers.
   Used for the semantic <h1> and intro paragraph that bots need
   but the visual design doesn't show. */
.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;
}

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Space Mono', monospace;
  overflow-x: hidden;
  cursor: none;
  scroll-behavior: smooth;
}

body {
  /* the canvas is pinned, the document body provides the scroll length */
}

a, button { color: inherit; }

/* ---------- WebGL canvas pinned full-viewport ---------- */
#webgl {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

/* ---------- custom cursor ---------- */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 22px; height: 22px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1000;
  transform: translate3d(-100px, -100px, 0);
  mix-blend-mode: difference;
  transition: width 0.35s cubic-bezier(.2,.8,.2,1),
              height 0.35s cubic-bezier(.2,.8,.2,1),
              border-color 0.3s ease,
              background 0.3s ease;
  will-change: transform;
}
.cursor::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 3px; height: 3px;
  background: var(--ink);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s;
}
.cursor.hover {
  width: 56px; height: 56px;
  background: rgba(244, 241, 234, 0.04);
}
.cursor.hover::after { width: 6px; height: 6px; }

/* ---------- HUD overlays ---------- */
.hud {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hud--tl { top: 28px; left: 28px; }
.hud--tr { top: 28px; right: 28px; align-items: flex-end; text-align: right; }
.hud--bl { bottom: 28px; left: 28px; }
.hud--br { bottom: 28px; right: 28px; align-items: flex-end; text-align: right; }

.hud b { font-weight: 400; color: var(--ink); }
.hud .crit { color: var(--critical); }
.hud .ok   { color: var(--charge); }
.hud .glow { color: var(--bloom); }
.hud .dim  { color: var(--ink-dimmer); }

.hud .rule {
  width: 60px;
  height: 1px;
  background: var(--ink-dimmer);
  margin: 6px 0 4px;
}

/* External-link credit lines inside HUDs — subtle, dim, hover brightens */
.hud__link {
  color: var(--ink-dimmer);
  text-decoration: none;
  pointer-events: auto;
  margin-top: 8px;
  letter-spacing: 0.18em;
  transition: color 0.3s ease;
  display: inline-block;
  width: max-content;
}
.hud--tr .hud__link, .hud--br .hud__link { align-self: flex-end; }
.hud__link:hover { color: var(--ink); }
.hud__link:focus { outline: none; }
.hud__link:focus-visible {
  color: var(--ink);
  box-shadow: 0 0 0 2px rgba(91, 227, 255, 0.35);
}
.hud--tr .rule { align-self: flex-end; }
.hud--br .rule { align-self: flex-end; }

/* ---------- vertical keyframe nav ---------- */
.nav {
  position: fixed;
  top: 50%;
  right: 32px;
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 28px;
  pointer-events: auto;
  mix-blend-mode: difference;
}
.nav__line {
  position: absolute;
  left: 50%;
  top: -4px; bottom: -4px;
  width: 1px;
  background: linear-gradient(to bottom,
    transparent 0%,
    var(--ink-dimmer) 8%,
    var(--ink-dimmer) 92%,
    transparent 100%);
  transform: translateX(-50%);
  pointer-events: none;
}
.nav__item {
  appearance: none;
  background: var(--bg);
  width: 7px; height: 7px;
  padding: 0;
  border: 1px solid var(--ink-dim);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.5s cubic-bezier(.2,.8,.2,1);
  position: relative;
  z-index: 1;
}
.nav__item:focus { outline: none; }
.nav__item:focus-visible {
  box-shadow: 0 0 0 3px rgba(91, 227, 255, 0.35);
}
.nav__item.active {
  background: var(--ink);
  border-color: var(--ink);
  transform: scale(1.7);
}
.nav__item::after {
  content: attr(data-num);
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--ink-dimmer);
  pointer-events: none;
  transition: color 0.4s;
}
.nav__item.active::after { color: var(--ink); }
.nav__item::before {
  content: attr(data-label);
  position: absolute;
  right: 38px;
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: var(--ink);
  white-space: nowrap;
  letter-spacing: 0.36em;
  opacity: 0;
  transition: opacity 0.35s, transform 0.35s cubic-bezier(.2,.8,.2,1);
  pointer-events: none;
}
.nav__item:hover::before,
.nav__item.active:hover::before { opacity: 1; transform: translateY(-50%) translateX(0); }

/* ---------- sound toggle ---------- */
.audiotoggle {
  position: fixed;
  bottom: 96px;
  left: 28px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  background: rgba(5, 5, 7, 0.4);
  border: 1px solid var(--ink-dimmer);
  border-radius: 2px;
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-dim);
  cursor: pointer;
  pointer-events: auto;
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
.audiotoggle:hover {
  color: var(--ink);
  border-color: var(--ink-dim);
}
.audiotoggle.on {
  color: var(--ink);
  border-color: var(--ink);
}
.audiotoggle:focus { outline: none; }
.audiotoggle:focus-visible { box-shadow: 0 0 0 3px rgba(91, 227, 255, 0.35); }

.audiotoggle__bars {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 11px;
}
.audiotoggle__bars i {
  width: 2px;
  height: 3px;
  background: currentColor;
  border-radius: 1px;
  transition: height 0.25s ease;
}
.audiotoggle.on .audiotoggle__bars i {
  animation: eq 0.7s ease-in-out infinite;
}
.audiotoggle.on .audiotoggle__bars i:nth-child(2) { animation-delay: 0.18s; }
.audiotoggle.on .audiotoggle__bars i:nth-child(3) { animation-delay: 0.36s; }
.audiotoggle.on .audiotoggle__bars i:nth-child(4) { animation-delay: 0.10s; }
@keyframes eq {
  0%, 100% { height: 3px; }
  50%      { height: 11px; }
}

/* ---------- about toggle (mirrors the sound toggle on the right) ---------- */
.abouttoggle {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  background: rgba(5, 5, 7, 0.4);
  border: 1px solid var(--ink-dimmer);
  border-radius: 2px;
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-dim);
  cursor: pointer;
  pointer-events: auto;
  transition: color 0.3s ease, border-color 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
.abouttoggle:hover {
  color: var(--ink);
  border-color: var(--ink-dim);
}
.abouttoggle:focus { outline: none; }
.abouttoggle:focus-visible {
  box-shadow: 0 0 0 3px rgba(91, 227, 255, 0.35);
}
.abouttoggle__plus {
  display: inline-block;
  font-size: 12px;
  line-height: 1;
  opacity: 0.7;
  transform: translateY(-1px);
}

/* ---------- about panel (modal) ---------- */
.aboutpanel {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: 32px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0.45s ease;
  pointer-events: none;
}
.aboutpanel.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.aboutpanel__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 7, 0.78);
  -webkit-backdrop-filter: blur(8px) saturate(0.9);
  backdrop-filter: blur(8px) saturate(0.9);
  cursor: pointer;
}

.aboutpanel__inner {
  position: relative;
  max-width: 520px;
  width: 100%;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(15, 15, 20, 0.94), rgba(8, 8, 11, 0.94));
  border: 1px solid var(--ink-dimmer);
  padding: 40px 40px 28px;
  color: var(--ink);
  font-family: 'Space Mono', monospace;
  transform: translateY(12px);
  transition: transform 0.45s cubic-bezier(.2, .8, .2, 1);
  outline: none;
}
.aboutpanel.open .aboutpanel__inner { transform: translateY(0); }

.aboutpanel__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: var(--ink-dim);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.3s;
}
.aboutpanel__close:hover { color: var(--ink); }
.aboutpanel__close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(91, 227, 255, 0.35);
}

.aboutpanel__eyebrow {
  font-size: 9px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 22px;
}
.aboutpanel__title {
  font-family: 'Anton', sans-serif;
  font-size: 46px;
  letter-spacing: 0.16em;
  font-weight: 400;
  margin: 0 0 6px;
  line-height: 1;
}
.aboutpanel__lede {
  font-family: 'Cormorant Garamond', serif;
  font-size: 19px;
  letter-spacing: 0.005em;
  color: var(--ink-dim);
  margin: 0 0 24px;
}
.aboutpanel__lede em {
  font-style: italic;
  color: var(--ink);
}
.aboutpanel__body {
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-dim);
  letter-spacing: 0.02em;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}
.aboutpanel__body p { margin: 0; }
.aboutpanel__meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 7px 22px;
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding-top: 18px;
  border-top: 1px solid var(--ink-dimmer);
  margin: 0;
}
.aboutpanel__meta dt { color: var(--ink-dim); margin: 0; }
.aboutpanel__meta dd { color: var(--ink); margin: 0; }
.aboutpanel__meta .ok { color: var(--charge); }
.aboutpanel__link {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink-dimmer);
  padding-bottom: 1px;
  transition: color 0.3s ease, border-color 0.3s ease;
}
.aboutpanel__link:hover {
  color: var(--charge);
  border-bottom-color: var(--charge);
}
.aboutpanel__link:focus { outline: none; }
.aboutpanel__link:focus-visible {
  color: var(--charge);
  border-bottom-color: var(--charge);
}

/* ---------- crosshair corner marks ---------- */
.cross { position: fixed; inset: 0; pointer-events: none; z-index: 90; mix-blend-mode: difference; }
.cross span {
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--ink-dimmer);
}
.cross span:nth-child(1) { top: 16px;    left: 16px;   border-right: 0; border-bottom: 0; }
.cross span:nth-child(2) { top: 16px;    right: 16px;  border-left: 0;  border-bottom: 0; }
.cross span:nth-child(3) { bottom: 16px; left: 16px;   border-right: 0; border-top: 0;    }
.cross span:nth-child(4) { bottom: 16px; right: 16px;  border-left: 0;  border-top: 0;    }

/* ---------- the long scroller (apple-style pinned timeline) ---------- */
.scroller {
  position: relative;
  z-index: 10;
  pointer-events: none;
}

/* Frames are pinned-canvas timeline sections. The padding values below
   are RESERVED HUD ZONES — content (title, desc, index, data) must NEVER
   extend into them. This guarantees no overlap with the corner HUDs,
   the right-edge nav, the bottom timeline, or the scroll hint.

     top:    100px  → clear HUD top-left/right (lives at top: 28px, ~70px tall)
     right:  200px  → clear HUD top-right + nav (right: 32px, ~150px wide)
     bottom: 130px  → clear HUD bottom-left/right + timeline (12px) + scroll hint
     left:   200px  → clear HUD top-left/bottom-left
*/
.frame {
  height: 130vh;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 100px 200px 130px;
  pointer-events: none;
  --t: 0;
}

.frame__index {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.5em;
  color: var(--ink-dim);
  margin-bottom: 14px;
  opacity: var(--t);
  transform: translateY(calc((1 - var(--t)) * 12px));
  transition: opacity 0.3s linear;
}

.frame__title {
  font-family: 'Anton', sans-serif;
  font-size: clamp(64px, 10vw, 160px);
  line-height: 0.88;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-transform: uppercase;
  max-width: 100%;
  mix-blend-mode: difference;
  opacity: var(--t);
  transform: translateY(calc((1 - var(--t)) * 40px));
}

.frame__title em {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.frame__desc {
  margin-top: 28px;
  max-width: 380px;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
  opacity: var(--t);
  transform: translateY(calc((1 - var(--t)) * 20px));
}

/* Data is now INLINE with the content flow — a horizontal row below
   the description. No more absolute corners colliding with the HUD. */
.frame__data {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 28px;
  margin-top: 32px;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
  line-height: 1.6;
  opacity: var(--t);
}
.frame__data b { color: var(--ink); font-weight: 400; }

/* Corner labels are decorative — hidden to remove a source of overlap.
   The frame index already provides numeric/section context. */
.frame__corner { display: none; }

/* Alignment variants — title length is constrained by .frame padding,
   so right-aligned sections cannot bleed into the right HUD/nav. */
.frame--01 { align-items: flex-start; }

.frame--02 { align-items: flex-end; text-align: right; }
.frame--02 .frame__data { justify-content: flex-end; }

.frame--03 { align-items: flex-start; }

.frame--04 { align-items: flex-start; }
.frame--04 .frame__title { transform: rotate(-1.6deg) translateY(calc((1 - var(--t)) * 40px)); }

.frame--05 { align-items: center; text-align: center; }
.frame--05 .frame__title { font-size: clamp(96px, 16vw, 220px); }
.frame--05 .frame__desc { margin: 28px auto 0; text-align: center; }
.frame--05 .frame__data { justify-content: center; }

.frame--06 { align-items: flex-end; text-align: right; }
.frame--06 .frame__data { justify-content: flex-end; }

/* ---------- bottom marquee ---------- */
.marquee {
  position: fixed;
  bottom: 64px;
  left: 0; right: 0;
  overflow: hidden;
  white-space: nowrap;
  font-family: 'Anton', sans-serif;
  font-size: 9vw;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px var(--ink-dimmer);
  pointer-events: none;
  opacity: 0.55;
  z-index: 5;
  letter-spacing: 0.04em;
  transform: translateY(50%);
}
.marquee__inner { display: inline-block; padding-left: 100%; animation: marquee 38s linear infinite; }
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

/* ---------- bottom timeline (replaces bare progress line) ---------- */
.timeline {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 12px;
  z-index: 200;
  pointer-events: none;
  mix-blend-mode: difference;
}
.timeline__track {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: var(--ink-dimmer);
}
.timeline__fill {
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  background: var(--ink);
  width: 0;
  transition: width 0.05s linear;
  box-shadow: 0 0 6px rgba(244, 241, 234, 0.4);
}
.timeline__ticks {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 100%;
}
.timeline__ticks span {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 6px;
  background: var(--ink-dim);
  transform: translateX(-50%);
}

/* ---------- scroll hint ---------- */
.scrollhint {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  pointer-events: none;
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.5em;
  color: var(--ink);
  mix-blend-mode: difference;
  transition: opacity 0.7s ease, transform 0.7s ease;
  animation: hint-fade-in 1.2s 1.6s both;
}
.scrollhint.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  pointer-events: none;
}
.scrollhint__line {
  width: 1px;
  height: 32px;
  background: linear-gradient(to bottom, transparent, var(--ink));
  position: relative;
  overflow: hidden;
}
.scrollhint__line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 0%, var(--ink) 50%, transparent 100%);
  animation: hint-drop 1.8s ease-in-out infinite;
}
@keyframes hint-fade-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes hint-drop {
  0%   { transform: translateY(-100%); }
  60%  { transform: translateY(100%); }
  100% { transform: translateY(100%); }
}

/* ---------- loader ---------- */
.loader {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(91, 227, 255, 0.04), transparent 60%),
    var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 28px;
  transition: opacity 0.9s ease, visibility 0.9s ease;
}
.loader.hidden { opacity: 0; visibility: hidden; }

/* rotating sigil — three nested arcs */
.loader__sigil {
  position: relative;
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
}
.loader__sigil span {
  position: absolute;
  inset: 0;
  border: 1px solid transparent;
  border-radius: 50%;
}
.loader__sigil span:nth-child(1) {
  border-top-color: var(--ink);
  animation: spin 2.4s linear infinite;
}
.loader__sigil span:nth-child(2) {
  inset: 8px;
  border-right-color: var(--charge);
  animation: spin 1.8s linear infinite reverse;
}
.loader__sigil span:nth-child(3) {
  inset: 18px;
  border-bottom-color: var(--ink-dim);
  border-left-color: var(--ink-dim);
  animation: spin 3s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loader__title {
  font-family: 'Anton', sans-serif;
  font-size: 28px;
  letter-spacing: 0.5em;
  color: var(--ink);
  padding-left: 0.5em; /* offset the trailing letter-spacing */
}
.loader__sub {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  margin-top: -16px;
}

.loader__bar {
  width: 280px;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
}
.loader__bar span {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, var(--charge), var(--ink));
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.18s linear;
}

.loader__meta {
  display: flex;
  justify-content: space-between;
  width: 280px;
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.36em;
  text-transform: uppercase;
}
.loader__label { color: var(--ink-dim); }
.loader__pct { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ============================================================
   Touch device adjustments — hide custom cursor, restore native
   ============================================================ */
@media (hover: none) and (pointer: coarse) {
  html, body { cursor: auto; }
  .cursor { display: none !important; }
  .nav__item::before { display: none; } /* hover label has no use on touch */
}

/* ============================================================
   Tablet & smaller (≤ 900px) — narrower HUD, slightly less padding
   ============================================================ */
@media (max-width: 900px) {
  .frame { padding: 90px 140px 120px; }
  .frame__title { font-size: clamp(56px, 9vw, 120px); }
}

/* ============================================================
   Mobile (≤ 720px) — HUD shrinks, padding follows
   Reserve: top 80px, right 80px (HUD+nav), bottom 120px, left 80px
   ============================================================ */
@media (max-width: 720px) {
  .frame {
    padding: 80px 80px 120px;
    height: 110vh;
  }
  .frame__title {
    font-size: clamp(44px, 11vw, 88px);
    line-height: 0.92;
  }
  .frame--05 .frame__title { font-size: clamp(72px, 18vw, 140px); }
  .frame__desc {
    margin-top: 18px;
    max-width: 100%;
    font-size: 11px;
    line-height: 1.6;
  }
  .frame__index { font-size: 9px; letter-spacing: 0.32em; margin-bottom: 10px; }

  .frame__data {
    margin-top: 22px;
    font-size: 9px;
    letter-spacing: 0.14em;
    gap: 4px 20px;
  }

  /* HUD — pulled into safe-area, tighter type */
  .hud {
    font-size: 8.5px;
    letter-spacing: 0.14em;
    line-height: 1.65;
  }
  .hud .rule { width: 36px; margin: 4px 0 2px; }
  .hud--tl { top: max(14px, env(safe-area-inset-top, 14px)); left: max(14px, env(safe-area-inset-left, 14px)); }
  .hud--tr { top: max(14px, env(safe-area-inset-top, 14px)); right: max(14px, env(safe-area-inset-right, 14px)); }
  .hud--bl { bottom: max(28px, env(safe-area-inset-bottom, 28px)); left: max(14px, env(safe-area-inset-left, 14px)); }
  .hud--br { bottom: max(28px, env(safe-area-inset-bottom, 28px)); right: max(14px, env(safe-area-inset-right, 14px)); }

  /* Nav — bigger invisible touch target around each dot */
  .nav {
    right: max(14px, env(safe-area-inset-right, 14px));
    gap: 26px;
  }
  .nav__item {
    width: 9px; height: 9px;
  }
  .nav__item::after { font-size: 8px; right: 14px; }
  /* invisible 32px touch surface around the dot */
  .nav__item::before {
    content: '';
    position: absolute;
    inset: -12px;
    background: transparent;
    pointer-events: auto;
  }

  /* Sound toggle — above the bottom-left HUD, into the safe area */
  .audiotoggle {
    bottom: max(84px, calc(env(safe-area-inset-bottom, 0px) + 84px));
    left: max(14px, env(safe-area-inset-left, 14px));
    font-size: 8px;
    letter-spacing: 0.2em;
    padding: 7px 10px;
    gap: 7px;
  }

  /* About toggle mirrors the sound toggle on the right */
  .abouttoggle {
    bottom: max(84px, calc(env(safe-area-inset-bottom, 0px) + 84px));
    right: max(14px, env(safe-area-inset-right, 14px));
    font-size: 8px;
    letter-spacing: 0.2em;
    padding: 7px 10px;
    gap: 6px;
  }
  .abouttoggle__plus { font-size: 11px; }

  /* About panel — tighter on phones */
  .aboutpanel { padding: 18px; }
  .aboutpanel__inner { padding: 30px 24px 22px; max-height: calc(100vh - 36px); }
  .aboutpanel__eyebrow { font-size: 8px; letter-spacing: 0.34em; margin-bottom: 16px; }
  .aboutpanel__title { font-size: 34px; letter-spacing: 0.12em; }
  .aboutpanel__lede { font-size: 16px; margin-bottom: 18px; }
  .aboutpanel__body { font-size: 11px; gap: 10px; margin-bottom: 22px; }
  .aboutpanel__meta {
    grid-template-columns: max-content 1fr;
    gap: 5px 16px;
    font-size: 8.5px;
    letter-spacing: 0.18em;
  }

  /* Crosshair corners — smaller */
  .cross span { width: 10px; height: 10px; }
  .cross span:nth-child(1) { top: 12px;    left: 12px; }
  .cross span:nth-child(2) { top: 12px;    right: 12px; }
  .cross span:nth-child(3) { bottom: 16px; left: 12px; }
  .cross span:nth-child(4) { bottom: 16px; right: 12px; }

  /* Loader */
  .loader { gap: 22px; }
  .loader__sigil { width: 44px; height: 44px; }
  .loader__sigil span:nth-child(2) { inset: 6px; }
  .loader__sigil span:nth-child(3) { inset: 14px; }
  .loader__title { font-size: 22px; letter-spacing: 0.4em; padding-left: 0.4em; }
  .loader__sub { font-size: 11px; }
  .loader__bar { width: 220px; }
  .loader__meta { width: 220px; font-size: 8px; letter-spacing: 0.3em; }

  /* Scroll hint — small, above HUD */
  .scrollhint {
    bottom: max(110px, calc(env(safe-area-inset-bottom, 0px) + 110px));
    font-size: 8px;
    letter-spacing: 0.4em;
    gap: 10px;
  }
  .scrollhint__line { height: 24px; }

  /* Timeline — slightly thicker tick marks, easier to see */
  .timeline { height: 14px; }
  .timeline__ticks span { height: 7px; }
}

/* ============================================================
   Narrow phones (≤ 480px) — even tighter HUD allowance
   ============================================================ */
@media (max-width: 480px) {
  .frame {
    padding: 70px 64px 110px;
    height: 100vh;
  }
  .frame__title { font-size: clamp(36px, 10.5vw, 64px); }
  .frame--05 .frame__title { font-size: clamp(60px, 22vw, 110px); }
  .frame__desc { font-size: 10.5px; }
  .frame__data { font-size: 8px; gap: 4px 16px; letter-spacing: 0.12em; }

  .loader__title { font-size: 18px; letter-spacing: 0.35em; padding-left: 0.35em; }
  .loader__sub { font-size: 10px; }
  .loader__bar, .loader__meta { width: 180px; }
  .loader__meta { font-size: 7.5px; letter-spacing: 0.25em; }

  .hud { font-size: 8px; }

  .nav { gap: 22px; }
  .nav__item::before { inset: -14px; } /* even bigger touch target */
}

/* ============================================================
   Short viewports (landscape phones) — keep HUD safe zones,
   shrink vertical padding since vertical space is scarce
   ============================================================ */
@media (max-height: 480px) and (orientation: landscape) {
  .frame { height: 130vh; padding: 50px 140px 70px; }
  .frame__title { font-size: clamp(38px, 6.5vw, 70px); }
  .frame__desc { margin-top: 14px; font-size: 10px; }
  .frame__data { margin-top: 16px; font-size: 8px; gap: 3px 18px; }
  .scrollhint { display: none; }
}

/* ============================================================
   Notch / safe-area on desktop too
   ============================================================ */
.hud--tl { top: max(28px, env(safe-area-inset-top, 28px)); }
.hud--tr { top: max(28px, env(safe-area-inset-top, 28px)); }

/* ============================================================
   Reduced motion — respect user preference
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scrollhint { animation: none; }
  .scrollhint__line::after { animation: none; }
  .loader__sigil span { animation: none !important; }
  .audiotoggle.on .audiotoggle__bars i { animation: none; height: 7px; }
}
