/* Longtail: tokens, faces, type, shell, shared components.
   Night photography and opening titles. One hot colour, used for the player's light. */

/* ---------- Faces (self-hosted, swap, metric-matched fallbacks so nothing jumps) ---------- */

@font-face {
  font-family: "Bodoni Moda"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(../fonts/bodoni-moda-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bodoni Moda"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(../fonts/bodoni-moda-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Bodoni Moda"; font-style: italic; font-weight: 400 900; font-display: swap;
  src: url(../fonts/bodoni-moda-italic-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bodoni Moda"; font-style: italic; font-weight: 400 900; font-display: swap;
  src: url(../fonts/bodoni-moda-italic-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(../fonts/schibsted-grotesk-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(../fonts/schibsted-grotesk-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/ibm-plex-mono-400-latin.woff2) format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(../fonts/ibm-plex-mono-500-latin.woff2) format("woff2");
}

/* Fallbacks scaled to the real faces' average width and vertical metrics. */
@font-face { font-family: "Bodoni Fallback"; src: local("Georgia"); size-adjust: 104.9%; ascent-override: 107.2%; descent-override: 38.1%; line-gap-override: 0%; }
@font-face { font-family: "Bodoni Fallback Times"; src: local("Times New Roman"), local("Times"); size-adjust: 115.4%; ascent-override: 97.5%; descent-override: 34.7%; line-gap-override: 0%; }
@font-face { font-family: "Schibsted Fallback"; src: local("Arial"), local("Helvetica"); size-adjust: 105.2%; ascent-override: 92.8%; descent-override: 24.5%; line-gap-override: 0%; }
@font-face { font-family: "Plex Fallback"; src: local("Courier New"), local("Courier"); size-adjust: 100%; ascent-override: 102.5%; descent-override: 27.5%; line-gap-override: 0%; }

/* ---------- Tokens ---------- */

:root {
  color-scheme: dark;
  --night: #06070A;
  --ink: #F3EEE6;
  --mute: #8C8A86;
  --line: rgba(243, 238, 230, .14);
  --line-strong: rgba(243, 238, 230, .34);
  --ember: #FF5A1F;
  --ember-ink: #FF6A33;      /* ember as text on night */
  --on-ember: #06070A;
  --scrim: rgba(6, 7, 10, .9);
  --scrim-soft: rgba(6, 7, 10, .55);
  --veil: 6, 7, 10;          /* rgb of the page, for legibility washes */

  /* Heat ramp: Peak to Vanishing Point. Only ever tiny points of light. */
  --h0: #E9F1FF; --h1: #FFD9A8; --h2: #FF9B4A; --h3: #FF5A1F; --h4: #D9246B; --h5: #7A3CFF;

  --font-display: "Bodoni Moda", "Bodoni Fallback", "Bodoni Fallback Times", Didot, "Bodoni 72", serif;
  --font-text: "Schibsted Grotesk", "Schibsted Fallback", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "Plex Fallback", ui-monospace, monospace;

  /* Grid: 4 columns on phones, 12 from tablets up. */
  --margin: clamp(16px, 5.2vw, 76px);
  --gap: clamp(12px, 1.8vw, 28px);
  --cols: 4;
  --measure: 34rem;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in: cubic-bezier(.6, 0, .9, .4);
  --vvh: 100dvh;
  --vvtop: 0px;
}
@media (min-width: 760px) { :root { --cols: 12; } }

/* Dark is the default whatever the OS says; daylight is a choice (the toggle). */
:root[data-theme="light"] {
  color-scheme: light;
  --night: #EEE9E0;
  --ink: #121212;
  --mute: #5F5B55;
  --line: rgba(18, 18, 18, .13);
  --line-strong: rgba(18, 18, 18, .34);
  --ember: #FF5A1F;
  --ember-ink: #B43A0C;
  --on-ember: #121212;
  --scrim: rgba(238, 233, 224, .92);
  --scrim-soft: rgba(238, 233, 224, .6);
  --veil: 238, 233, 224;
  --h0: #121212;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--night);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--night);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; border-radius: 0; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; text-decoration-color: var(--line-strong); }
a:hover { text-decoration-color: currentColor; }
svg { display: block; }
[hidden] { display: none !important; }

::selection { background: var(--ember); color: var(--on-ember); }

:focus-visible { outline: 2px solid var(--ember); outline-offset: 4px; }
#view:focus, [tabindex="-1"]:focus { outline: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: var(--margin); top: -80px; z-index: 50;
  background: var(--ink); color: var(--night);
  padding: 10px 14px; font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- The world behind everything ---------- */

#world {
  position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100lvh;
  display: block; z-index: 0; pointer-events: none;
  opacity: 0; transition: opacity 1.6s ease-out;
}
.has-world #world { opacity: 1; }
.sky-open #world { pointer-events: auto; touch-action: none; cursor: grab; }

/* Without the world: a still horizon, so the page is never a flat void. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 55% at 12% 100%, rgba(255, 217, 168, .10), transparent 60%),
    radial-gradient(90% 40% at 70% 108%, rgba(122, 60, 255, .07), transparent 70%);
  transition: opacity 1.6s ease-out;
}
.has-world body::before { opacity: 0; }
:root[data-theme="light"] body::before {
  background: radial-gradient(120% 55% at 12% 100%, rgba(255, 155, 74, .14), transparent 60%);
}

/* Cinemascope bars, brought in at key moments. */
.lb {
  position: fixed; left: 0; right: 0; z-index: 1; pointer-events: none;
  height: clamp(28px, 9vh, 96px);
  background: var(--night);
  transform: scaleY(0);
}
.lb--top { top: 0; transform-origin: 50% 0; }
.lb--bottom { bottom: 0; transform-origin: 50% 100%; }

/* ---------- Type ---------- */

.display, h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-optical-sizing: auto;
  line-height: .98;
  letter-spacing: -.012em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.5rem, 7vw, 5.25rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.5rem); line-height: 1.04; }
h3 { font-size: 1.375rem; line-height: 1.1; }

.it { font-family: var(--font-display); font-style: italic; font-weight: 400; letter-spacing: 0; }
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.quiet { color: var(--mute); }
.small { font-size: .9375rem; line-height: 1.45; }
.tiny { font-size: .8125rem; line-height: 1.4; }
.lede { font-size: clamp(1.0625rem, 1.4vw, 1.25rem); line-height: 1.5; max-width: var(--measure); }
.ember { color: var(--ember-ink); }

/* Masked words for reveals (motion.js wraps them; the first paint ships them pre-wrapped). */
.w { display: inline-block; overflow: clip; overflow-clip-margin: .08em; vertical-align: top; padding-bottom: .1em; margin-bottom: -.1em; }
.wi { display: inline-block; will-change: transform; }

/* ---------- Shell ---------- */

.bar {
  position: relative; z-index: 4;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) var(--margin) 0;
  min-height: 56px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; min-height: 44px; }
.brand__mark { width: 24px; height: 24px; color: var(--ink); }
.brand__dot { fill: var(--ember); }
.brand__word { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 1.4rem; line-height: 1; letter-spacing: -.01em; }
.bar__nav { display: flex; align-items: center; gap: 2px; margin-right: -8px; }
.bar__link {
  font-size: .9375rem; font-weight: 500; white-space: nowrap;
  min-height: 44px; padding: 0 9px; color: var(--mute);
  transition: color .2s;
}
.bar__link:hover { color: var(--ink); }
.bar__theme { width: 40px; height: 44px; display: grid; place-items: center; color: var(--mute); }
.bar__theme:hover { color: var(--ink); }
.bar__theme svg { width: 18px; height: 18px; }
@media (max-width: 419px) {
  .bar__link { padding: 0 6px; font-size: .875rem; }
  .bar__theme { width: 32px; }
  .brand__word { font-size: 1.25rem; }
}
@media (max-width: 359px) { .brand__word { display: none; } }

#view {
  position: relative; z-index: 2;
  padding: 0 var(--margin);
  padding-bottom: max(40px, env(safe-area-inset-bottom));
}

/* A strict grid every screen sits on. */
.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  column-gap: var(--gap);
}

.screen { display: flex; flex-direction: column; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 18px;
  min-height: 54px; padding: 0 20px;
  font-family: var(--font-text); font-weight: 600; font-size: 1.0625rem; letter-spacing: -.005em; line-height: 1.1;
  text-decoration: none; text-align: left;
  border: 1px solid var(--line-strong);
  color: var(--ink); background: transparent;
  transition: background-color .2s, color .2s, border-color .2s, transform .15s var(--ease-out);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: scale(.985); }
.btn--ember { background: var(--ember); border-color: var(--ember); color: var(--on-ember); }
.btn--ember:focus-visible { outline-color: var(--ink); }
.btn--ember:hover { background: #FF6E3A; border-color: #FF6E3A; }
.btn--ink { background: var(--ink); border-color: var(--ink); color: var(--night); }
.btn--wide { width: 100%; }
.btn--small { min-height: 46px; font-size: .9688rem; padding: 0 16px; gap: 12px; }
.btn[disabled], .btn[aria-disabled="true"], .btn[aria-busy="true"] { opacity: .55; pointer-events: none; }
.btn .key {
  font-family: var(--font-mono); font-size: .75rem; font-weight: 400; letter-spacing: 0;
  padding: 2px 6px; border: 1px solid currentColor; opacity: .62; line-height: 1.2;
}
@media (hover: none) { .btn .key { display: none; } }

.link {
  font-size: 1rem; font-weight: 500;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .28em; text-decoration-color: var(--line-strong);
  min-height: 44px; display: inline-flex; align-items: center;
  transition: text-decoration-color .2s, color .2s;
}
.link:hover { text-decoration-color: var(--ember); }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row--split > * { flex: 1 1 0; min-width: 0; }
.stack > * + * { margin-top: var(--gap-y, 14px); }

/* ---------- Band marks: points of light, hotter the rarer ---------- */

.mark {
  --d: 9px;
  --c: var(--h0);
  display: inline-block; flex: none; position: relative;
  width: var(--d); height: var(--d); border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 calc(var(--d) * .9) calc(var(--d) * .1) color-mix(in srgb, var(--c) 55%, transparent);
  vertical-align: .05em;
}
.mark[data-heat="1"] { --c: var(--h1); }
.mark[data-heat="2"] { --c: var(--h2); }
.mark[data-heat="3"] { --c: var(--h3); }
.mark[data-heat="4"] { --c: var(--h4); }
.mark[data-heat="5"] { --c: var(--h5); box-shadow: 0 0 calc(var(--d) * 1.4) calc(var(--d) * .25) color-mix(in srgb, var(--h5) 70%, transparent); }
.mark[data-heat="miss"] {
  border-radius: 0; background: transparent; box-shadow: none;
  width: calc(var(--d) * 1.4); height: 1px; vertical-align: .3em;
  background: var(--mute);
}
:root[data-theme="light"] .mark { box-shadow: none; }
:root[data-theme="light"] .mark[data-heat="0"] { background: transparent; border: 1.5px solid var(--ink); }
.marks { display: inline-flex; gap: 14px; align-items: center; }
.marks--lg { gap: clamp(16px, 3vw, 26px); }
.marks--lg .mark { --d: 13px; }

/* ---------- Sheet: a typographic page over the dimmed scene ---------- */

.sheet {
  width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh;
  margin: 0; padding: 0; border: 0;
  background: var(--scrim);
  color: var(--ink);
  overflow: hidden;
}
.sheet::backdrop { background: transparent; }
.sheet[open] { display: block; animation: fade-in .3s ease-out; }
.sheet__inner {
  height: 100%; overflow-y: auto; overscroll-behavior: contain;
  padding: max(14px, env(safe-area-inset-top)) var(--margin) max(48px, env(safe-area-inset-bottom));
}
.sheet__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 0 18px;
  margin-bottom: clamp(12px, 3vh, 36px);
}
.sheet__title { font-size: clamp(2.75rem, 9vw, 6.5rem); line-height: .92; padding-top: 18px; }
.sheet__title:focus { outline: none; }
.sheet__close {
  position: sticky; top: 0; z-index: 2;
  flex: none; min-height: 44px; padding: 0 2px;
  font-size: .9375rem; font-weight: 500; color: var(--mute);
  text-decoration: underline; text-underline-offset: .28em; text-decoration-color: var(--line-strong);
}
.sheet__close:hover { color: var(--ink); }
.sheet__body { max-width: 44rem; }

@keyframes fade-in { from { opacity: 0; } }

/* ---------- Toast: set like a subtitle ---------- */

.toast {
  position: fixed; left: 50%; bottom: max(26px, calc(env(safe-area-inset-bottom) + 12px));
  transform: translate(-50%, 8px);
  z-index: 60;
  background: var(--night); color: var(--ink);
  font-size: 1rem; font-weight: 500; line-height: 1.35;
  padding: 10px 16px;
  outline: 1px solid var(--line);
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .35s var(--ease-out);
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.noscript { position: relative; z-index: 3; max-width: var(--measure); margin: 24px var(--margin); font-weight: 600; }

/* ---------- Fields ---------- */

.field { display: block; }
.field__label { display: block; margin-bottom: 8px; color: var(--mute); font-size: .9375rem; }
.field__input {
  width: 100%; min-height: 58px; padding: 0 0 4px;
  background: transparent; color: var(--ink);
  border: 0; border-bottom: 1px solid var(--line-strong); border-radius: 0;
  font-family: var(--font-display); font-style: italic; font-size: 1.75rem;
  caret-color: var(--ember);
}
.field__input:focus { outline: none; border-bottom-color: var(--ember); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  #world, body::before { transition: opacity .4s ease-out !important; }
}
