@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../vendor/fonts/IBMPlexMono-Medium.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: block;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../vendor/fonts/IBMPlexMono-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: block;
}

:root {
  --bg: #7B7F8A;          /* loader background (SPEC §3.2) */
  --hud-white: #EDEFF2;
  --hud-title: #262A36;
  --ph-bg: #2A2D35;
}

html, body {
  margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none;
  /* one-finger drags drive the virtual scroll (pointer events); pinch-zoom stays with the browser */
  touch-action: pinch-zoom;
  background: var(--bg); color: var(--hud-white);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}

#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }

/* ---------- loader (BRIEF 2.11 + 2.25): the field; its look (the 3D pod, snow, lines, percentage) is css/loader.css ---------- */
#loader {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  display: flex; align-items: center; justify-content: center; pointer-events: none;
}
#loader[hidden] { display: none; }
#loader-pct[hidden], #loader-ascii[hidden] { display: none; }

/* ---------- glyph text ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
.gt { position: absolute; inset: 0; font-family: 'IBM Plex Mono', monospace; font-weight: 500;
  font-kerning: none; font-variant-ligatures: none; font-feature-settings: 'liga' 0, 'calt' 0; }
.gt-line { position: absolute; white-space: pre; }
.gt-line span { display: inline-block; will-change: opacity; }
/* the UI pass is bloomed in igloo; a soft halo stands in for it on DOM text */
#hud .gt { text-shadow: 0 0 6px rgba(237, 239, 242, 0.22); }

/* (core 11-21 21:00, review g11: the white wordmark vanished on the ship's cream sail) a film subtitle's thin dark edge,
   the ready cue's (core/score_cue.js): no glow, no halo, no plate; it reads on the sail, the glare and the hero's sky,
   and is all but unseen on the mine's and the ice cave's dark. The same edge in every state below. */
#logo { position: absolute; filter: drop-shadow(0 1px 1px rgba(10, 12, 16, 0.8)) drop-shadow(0 0 2px rgba(10, 12, 16, 0.7)); }
/* (passage, 11-17) over the passage's pale picture (the glare, the cloud: camera/passage_table.js hudAt.ink; main.js sets
   html.pass-pale) the white type keeps its contrast on a soft dark shadow; colour, type and place unchanged */
html.pass-pale #logo { filter: drop-shadow(0 1px 1px rgba(10, 12, 16, 0.8)) drop-shadow(0 0 2px rgba(10, 12, 16, 0.7)); }
html.pass-pale #hud .gt, html.pass-pale .en-label { text-shadow: 0 1px 9px rgba(16, 20, 28, 0.55), 0 0 2px rgba(16, 20, 28, 0.35); }
/* (front, one glacier FR2) a control that sits inside a closed widescreen bar (hud.js marks it .in-bar; frame/bars.js
   draws them; hud.js sets html.cn-bars-top / cn-bars-bot while a closed bar covers it) stands on black: the pale
   ground's dark shadow is off there, its own soft glow back */
html.cn-bars-top #logo.in-bar { filter: drop-shadow(0 1px 1px rgba(10, 12, 16, 0.8)) drop-shadow(0 0 2px rgba(10, 12, 16, 0.7)); }
html.cn-bars-bot #hud .gt.in-bar { text-shadow: 0 0 6px rgba(237, 239, 242, 0.22); }
html.cn-bars-bot #skip-btn.in-bar { text-shadow: none; }
#logo-hit { position: absolute; pointer-events: auto; display: block; }
#sound-icon { position: absolute; filter: drop-shadow(0 0 4px rgba(237, 239, 242, 0.25)); }
#sound-hit { position: absolute; pointer-events: auto; background: none; border: 0; padding: 0; cursor: pointer; }
.ph-line a:focus-visible { outline: none; text-decoration: underline 1px; text-underline-offset: 0.3em; }
/* (front, one glacier FR2, FEEL row 12) THE HUD'S ONE FOCUS STYLE, for every control the HUD carries (#hud: the
   sound toggle, the wordmark, Skip, the chapters' links and buttons): a keyboard user gets the HUD's hairline under the
   label, never the browser's box or a coloured ring; a pointer click leaves nothing drawn */
#hud :focus:not(:focus-visible) { outline: none; }
#hud a:focus-visible, #hud button:focus-visible, #hud summary:focus-visible, #hud [tabindex]:focus-visible {
  outline: none !important; text-decoration: underline 1px; text-underline-offset: 0.32em;
}
/* (front r11, review look2: a browser box round "Sound: On" after an arrow key) keyboard focus on the HUD's own controls
   is the HUD's hairline under the label, never a box; a pointer click leaves no focus behind (hud.js) */
#sound-hit:focus, #logo-hit:focus { outline: none; }
#sound-hit:focus-visible, #logo-hit:focus-visible { box-shadow: 0 1px 0 0 var(--hud-white); }
#page-indicator { position: absolute; width: 38px; height: 4px; border-radius: 2px; background: rgba(38, 42, 54, 0.75); }

/* ---------- placeholder sections (after slab 03) ---------- */
#placeholder { position: fixed; inset: 0; z-index: 10; pointer-events: none; overflow: hidden; overflow: clip; visibility: hidden; }
.ph-inner { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.ph-section {
  position: absolute; left: 50%; transform: translateX(-50%);
  width: min(880px, calc(100vw - 32px)); box-sizing: border-box; min-height: 52vh;
  padding: clamp(24px, 4vw, 56px); border: 1px solid rgba(237, 239, 242, 0.16);
  background: rgba(20, 22, 28, 0.55); font-family: 'IBM Plex Mono', monospace; font-weight: 500;
}
.ph-section h2 { margin: 0 0 18px; font-size: clamp(28px, 4vw, 52px); line-height: 1.25; letter-spacing: 0.02em; font-weight: 700; color: var(--hud-white); }
.ph-kicker { margin: 0 0 14px; font-size: 13px; line-height: 1.4; color: #9aa0ad; letter-spacing: 0.06em; }
.ph-line { margin: 0; font-size: clamp(14px, 1.4vw, 17px); line-height: 1.55; color: #c9cdd5; max-width: 60ch; }
.ph-legal { margin-top: 18px; font-size: 13px; color: #c9cdd5; }
.ph-section { min-height: 52dvh; } /* tracks innerHeight on phones, like the scroll does */
@media (max-width: 360px) { /* small phones: the footer card must fit the last screen */
  .ph-section { min-height: 0; padding: 16px 16px; }
  .ph-section h2 { font-size: 22px; margin-bottom: 8px; }
  .ph-kicker { margin-bottom: 6px; }
  .ph-line { line-height: 1.45; font-size: 13px; }
  .ph-legal { margin-top: 8px; font-size: 12px; }
}
@media (max-height: 520px) { /* phones in landscape: the footer must fit the last screen */
  .ph-section { min-height: 0; padding: 16px 20px; }
  .ph-section h2 { font-size: 22px; margin-bottom: 8px; }
  .ph-kicker { margin-bottom: 6px; }
  .ph-line { line-height: 1.45; }
  .ph-legal { margin-top: 8px; font-size: 12px; }
}

/* fallback / error notices: white on the dark title colour (contrast about 12:1) */
.notice {
  margin: 0; max-width: 34em; padding: 14px 18px; box-sizing: border-box; text-align: center;
  font: 500 15px/1.5 'IBM Plex Mono', monospace; color: var(--hud-white); background: var(--hud-title);
}
#nowebgl { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: calc(100vw - 32px); z-index: 60; }
#loader .notice[hidden], .notice[hidden] { display: none; }
/* without WebGL the scroll never reaches the footer, so the legal lines (#m-legal, normally screen-reader only) show here */
#nowebgl:not([hidden]) ~ #m-legal {
  position: fixed !important; left: 16px; right: 16px; bottom: 16px; width: auto; height: auto; margin: 0; z-index: 60;
  clip: auto; clip-path: none; white-space: normal; overflow: visible;
  padding: 10px 14px; box-sizing: border-box; background: var(--hud-title);
  font: 500 12px/1.5 'IBM Plex Mono', monospace; color: var(--hud-white); text-align: center;
}
#nowebgl:not([hidden]) ~ #m-legal p { margin: 0 auto; max-width: 72ch; }
#nowebgl:not([hidden]) ~ #m-legal p + p { margin-top: 6px; }
@media (max-height: 640px) { #nowebgl:not([hidden]) { top: 16px; transform: translateX(-50%); } } /* short screens: notice up top, legal panel at the bottom, no overlap */

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- THE FILM'S ONE CHAPTER HEADING (continuity.md: one voice; front r9, 2026-11-17) ----------
   Every chapter heading in the film uses this one format, the TRACKS heading's: bold caps title, a short hairline, a
   counter line (500, tabular), a name line (700 caps), on the left edge, vertically centred, same sizes everywhere.
   #tracks-head (src/hud/tracksHead.js) is its first user; journey and ending adopt it with the same markup:
     <div class="cn-chapter"><p class="th-title">SPONSORS</p><span class="th-rule"></span>
       <p class="th-track"><span class="th-num">// 02</span><span class="th-name">THE ICE CAVE</span></p></div>
   and toggle .on to show it (.yield steps it aside on portrait screens). Never a second heading style. */
#tracks-head, .cn-chapter {
  --th-slide: 10px;
  position: absolute; top: 50%;
  left: max(clamp(20px, 4.4vw, 84px), calc(env(safe-area-inset-left, 0px) + 12px));
  transform: translateY(-50%); translate: 0 var(--th-slide); opacity: 0;
  /* an eased fade in (BRIEF 2.17: it lands on the settled beat as the cart brakes, never a pop) and the HUD's slide */
  transition: opacity 0.75s cubic-bezier(0.45, 0, 0.25, 1), translate 0.75s cubic-bezier(0.22, 1, 0.36, 1);
  font-family: 'IBM Plex Mono', monospace; color: var(--hud-white);
  /* readable on the grey field and on the dark mine alike: a soft dark lift under the HUD's own glow */
  text-shadow: 0 1px 2px rgba(18, 20, 26, 0.45), 0 0 8px rgba(237, 239, 242, 0.22);
}
#tracks-head.on, .cn-chapter.on { opacity: 1; translate: 0 0; }
#tracks-head p, .cn-chapter p { margin: 0; }
#tracks-head .th-title, .cn-chapter .th-title {
  font-weight: 700; font-size: clamp(34px, 3.8vw, 64px); line-height: 1.25;
  letter-spacing: -0.02em; text-transform: uppercase;
}
#tracks-head .th-rule, .cn-chapter .th-rule {
  display: block; width: 2.6em; height: 1px; margin: 0.55em 0 0.75em;
  background: currentColor; opacity: 0.6; font-size: clamp(14px, 1.1vw, 18px);
}
#tracks-head .th-track, .cn-chapter .th-track { display: flex; flex-direction: column; gap: 0.3em; }
#tracks-head .th-num, .cn-chapter .th-num {
  font-weight: 500; font-size: clamp(13px, 1vw, 16px); line-height: 1.3;
  letter-spacing: 0.08em; font-variant-numeric: tabular-nums;
}
#tracks-head .th-name, .cn-chapter .th-name {
  font-weight: 700; font-size: clamp(20px, 1.9vw, 32px); line-height: 1.3; text-transform: uppercase;
}
/* portrait phones and tablets: the object fills the width, so the heading sits under the logo (--th-top is set from
   the logo's real position) and steps aside while a cart callout is up */
@media (max-aspect-ratio: 1/1) {
  #tracks-head, .cn-chapter { top: var(--th-top, calc(env(safe-area-inset-top, 0px) + 64px)); transform: none; }
  #tracks-head.yield, .cn-chapter.yield { opacity: 0; }
  #tracks-head .th-title, .cn-chapter .th-title { font-size: clamp(26px, 7.5vw, 40px); }
  #tracks-head .th-rule, .cn-chapter .th-rule { display: none; }
  #tracks-head .th-track, .cn-chapter .th-track { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 0.2em 0.7em; margin-top: 0.2em; }
  #tracks-head .th-name, .cn-chapter .th-name { font-size: clamp(16px, 4.6vw, 22px); }
}
@media (prefers-reduced-motion: reduce) {
  #tracks-head, .cn-chapter { --th-slide: 0px; transition: none; }
}

/* ---------- the transitions' skip button (BRIEF 2.24, owner 2026-10-31; src/hud/skip.js) ---------- */
#skip-btn {
  position: absolute;
  right: max(clamp(20px, 4.4vw, 84px), calc(env(safe-area-inset-right, 0px) + 12px));
  bottom: max(clamp(20px, 4.6vh, 64px), calc(env(safe-area-inset-bottom, 0px) + 16px));
  display: inline-flex; align-items: center; gap: 0.6em; margin: 0; padding: 0.62em 1.05em 0.62em 1.2em;
  border: 1px solid rgba(237, 239, 242, 0.5); border-radius: 999px; background: rgba(14, 16, 20, 0.34);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: var(--hud-white); font: 500 clamp(12px, 0.85vw, 14px)/1.3 'IBM Plex Mono', monospace;
  letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; cursor: pointer;
  text-shadow: 0 1px 2px rgba(10, 12, 16, 0.5);
  pointer-events: none; opacity: 0; translate: 0 6px;
  transition: opacity 0.35s cubic-bezier(0.45, 0, 0.25, 1), translate 0.35s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s;
}
#skip-btn.on { opacity: 1; translate: 0 0; pointer-events: auto; }
#skip-btn:hover { background: rgba(14, 16, 20, 0.55); }
#skip-btn:focus-visible { outline: none; border-color: rgba(237, 239, 242, 0.95); }
#skip-btn:focus-visible .sk-label { text-decoration: underline 1px; text-underline-offset: 0.32em; }
#skip-btn svg { width: 1.05em; height: 1.05em; flex: none; }
#skip-fade { position: fixed; inset: 0; z-index: 30; background: #000; opacity: 0; pointer-events: none; transition: opacity 0.4s ease-out; }
#skip-fade.on { opacity: 1; transition: opacity 0.16s ease-in; }
@media (prefers-reduced-motion: reduce) { #skip-btn, #skip-fade { transition: none; } }
