/* Base design for the page: fonts, colour and type tokens, surfaces, the bar and the sky.
   Lit surfaces (gold type, glass rims, screen shadows) take the sun's place from --sun-x and --sun-y
   and its strength from --sun-glow; the sky script keeps --sun-x and --sun-glow current. Gold and
   maroon stand for sunlight seen through air. */

@font-face { font-family: "Newsreader Dawn"; src: url("../fonts/newsreader-dawn-roman.woff2") format("woff2"); font-weight: 420; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader Dawn"; src: url("../fonts/newsreader-dawn-italic.woff2") format("woff2"); font-weight: 420; font-style: italic; font-display: swap; }
@font-face { font-family: "DM Sans Site"; src: url("../fonts/dm-sans-site.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono Site"; src: url("../fonts/jetbrains-mono-site.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

@property --sun-glow { syntax: "<number>"; inherits: true; initial-value: 0.36; }
@property --run { syntax: "<number>"; inherits: true; initial-value: 0; }

:root {
  --night: #0a0908;
  --ink: #161412;
  --ink-2: #231f1b;
  --paper: #f3eee6;
  --paper-raised: #fbf8f3;
  --text: #f5f1ea;
  --text-2: rgb(245 241 234 / 0.8);
  --text-3: rgb(245 241 234 / 0.68);
  --ink-text: #161412;
  --ink-text-2: #3d3731;
  --gold: #ffc627;
  --gold-deep: #e7a91a;
  --gold-pale: #fff1c2;
  --maroon: #8c1d40;
  --maroon-lift: #d85a78;
  --line: rgb(255 255 255 / 0.12);
  --line-strong: rgb(255 255 255 / 0.24);
  --line-ink: rgb(22 20 18 / 0.14);
  --glass: rgb(13 12 11 / 0.74);

  --serif: "Newsreader Dawn", "Times New Roman", ui-serif, Georgia, serif;
  --sans: "DM Sans Site", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono Site", ui-monospace, Consolas, monospace;

  --h1: clamp(2.9rem, 1rem + 7vw, 7.6rem);
  --h2: clamp(2rem, 1.05rem + 3.4vw, 4.4rem);
  --h3: clamp(1.3rem, 1.05rem + 0.8vw, 1.85rem);
  --lede: clamp(1.0625rem, 0.98rem + 0.45vw, 1.35rem);
  --gutter: clamp(1rem, 0.4rem + 3.2vw, 4.5rem);
  --measure: 38rem;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  --fast: 160ms;
  --med: 320ms;
  --bar: 3.5rem;
  --track: minmax(0, 1fr);

  --sun-x: 0.72;
  --sun-y: 0.86;
  color-scheme: dark;
}

*, ::before, ::after { box-sizing: border-box; }
html { background: var(--night); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  /* transparent so the fixed sky shows through; the night colour sits on html instead */
  background: transparent;
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img { max-width: 100%; height: auto; display: block; }
button { color: inherit; font: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
.vh { position: absolute !important; overflow: hidden; white-space: nowrap; clip-path: inset(50%); width: 1px; height: 1px; }

.wrap { width: min(100% - 2 * var(--gutter), 78rem); margin-inline: auto; }

/* Type scale and text styles. */
.display { font-family: var(--serif); font-weight: 420; font-size: var(--h1); line-height: 0.98; letter-spacing: -0.005em; text-wrap: balance; margin: 0; }
.h2 { font-family: var(--serif); font-weight: 420; font-size: var(--h2); line-height: 1.04; text-wrap: balance; margin: 0; }
.h3 { font-family: var(--serif); font-weight: 420; font-size: var(--h3); line-height: 1.15; text-wrap: balance; margin: 0; }
.lede { font-size: var(--lede); line-height: 1.52; color: var(--text-2); max-width: var(--measure); text-wrap: pretty; margin: 0; }
.small { font-size: 0.9375rem; color: var(--text-2); line-height: 1.6; margin: 0; text-wrap: pretty; }
.eyebrow { display: inline-flex; align-items: center; gap: 0.75em; font-size: 0.75rem; font-weight: 650; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); margin: 0; }
.eyebrow::before { width: 1.75rem; height: 1px; content: ""; background: currentColor; opacity: 0.7; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* .lit: italic gold text filled with a gradient centred below the sun, so letters nearest it shine most. */
.lit {
  font-family: var(--serif);
  font-style: italic;
  color: var(--gold);
  background-image: radial-gradient(calc(26vmax + 16vmax * var(--sun-glow)) calc(15vmax + 8vmax * var(--sun-glow)) at calc(var(--sun-x) * 100%) 150%,
    color-mix(in oklab, #fff8e2 calc(var(--sun-glow) * 100%), #ffd35a) 0%, #ffcf4a 46%, color-mix(in oklab, var(--gold) 70%, var(--gold-pale)) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Surfaces. */
.glass {
  position: relative;
  background: radial-gradient(60vmax 40vmax at calc(var(--sun-x) * 100%) 160%, rgb(255 196 120 / calc(0.08 * var(--sun-glow))) 0%, rgb(255 196 120 / 0) 60%), var(--glass);
  border-radius: 1.25rem;
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.05), 0 2.5rem 5rem -3rem rgb(0 0 0 / 0.85);
}
.glass::before {
  pointer-events: none; padding: 1px; border-radius: inherit; position: absolute; inset: -1px; content: "";
  background-image: radial-gradient(70vmax 52vmax at calc(var(--sun-x) * 100%) 160%, rgb(255 210 110 / calc(0.2 + 0.5 * var(--sun-glow))) 0%, rgb(255 198 39 / 0.08) 45%, rgb(255 255 255 / 0.02) 75%);
  -webkit-mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.day { background: var(--paper); color: var(--ink-text); --text: var(--ink-text); --text-2: var(--ink-text-2); --text-3: #5b534b; position: relative; z-index: 1; }
.day .eyebrow { color: var(--maroon); }
.day :focus-visible { outline-color: var(--maroon); }
/* .terminator: the curved, sunlit edge where a light section meets the dark page. */
.terminator { height: clamp(1.5rem, 4.6vw, 4.75rem); background: var(--paper); border-radius: 50% 50% 0 0 / 100% 100% 0 0; position: relative; z-index: 1;
  box-shadow: 0 -1px 0 0 rgb(255 224 160 / 0.95), 0 -0.5rem 1.4rem -0.25rem rgb(231 164 58 / 0.6), 0 -1.75rem 4rem -0.5rem rgb(140 29 64 / 0.6); }
.terminator--out { border-radius: 0 0 50% 50% / 0 0 100% 100%; box-shadow: 0 1px 0 0 rgb(255 224 160 / 0.5), 0 0.6rem 1.6rem -0.4rem rgb(231 164 58 / 0.28), 0 1.75rem 4rem -0.75rem rgb(140 29 64 / 0.4); }

/* .shot: a product capture in a thin frame; its shadow is cast away from the sun. */
.shot {
  position: relative; margin: 0; border-radius: 0.9rem; overflow: hidden; background: #0d0c0b;
  border: 1px solid var(--line-strong);
  box-shadow: calc((0.5 - var(--sun-x)) * 3rem) 2.4rem 4.5rem -2rem rgb(0 0 0 / 0.8), 0 0 0 1px rgb(0 0 0 / 0.4);
  cursor: zoom-in;
}
.shot img { width: 100%; height: auto; }
.shot--phone { border-radius: 1.6rem; border-width: 6px; border-color: #1d1a17; box-shadow: calc((0.5 - var(--sun-x)) * 2rem) 2rem 3.5rem -1.5rem rgb(0 0 0 / 0.85), 0 0 0 1px rgb(255 255 255 / 0.12); }
.day .shot { border-color: var(--line-ink); box-shadow: calc((0.5 - var(--sun-x)) * 2.4rem) 1.8rem 3.5rem -2rem rgb(60 30 10 / 0.45); }
.cap { font-size: 0.8125rem; color: var(--text-3); margin: 0.6rem 0 0; }

/* Buttons. */
.btn { gap: 0.6rem; justify-content: center; align-items: center; display: inline-flex; min-height: 3rem; padding: 0.9rem 1.4rem; border-radius: 0.75rem; font-weight: 650; text-decoration: none; border: 1px solid transparent; transition: transform var(--fast) var(--ease), background-color var(--med) ease, border-color var(--med) ease; }
.btn--primary { background: var(--gold); color: var(--night); box-shadow: 0 0.75rem 2rem -0.75rem rgb(255 198 39 / 0.55); }
.btn--ghost { border-color: var(--line-strong); background: rgb(255 255 255 / 0.04); }
@media (hover: hover) { .btn:hover { transform: translateY(-1px); } }

/* The fixed bar at the top. */
.bar { z-index: 50; inset: 0 0 auto; position: fixed; height: var(--bar); display: flex; align-items: center; gap: 1rem; padding-inline: var(--gutter);
  border-bottom: 1px solid var(--line); background: linear-gradient(rgb(10 9 8 / 0.86), rgb(10 9 8 / 0.62)); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.brand { font-family: var(--serif); font-size: 1.3rem; text-decoration: none; letter-spacing: 0.01em; white-space: nowrap; }
.brand small { display: block; font-family: var(--sans); font-size: 0.6875rem; color: var(--text-3); letter-spacing: 0.02em; margin-top: -0.2rem; }
.bar__mid { flex: 1; min-width: 0; font-size: 0.8125rem; color: var(--text-3); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bar__prog { height: 2px; width: 100%; bottom: -1px; left: 0; position: absolute; transform-origin: 0 50%; transform: scaleX(var(--read, 0)); background: linear-gradient(90deg, var(--maroon), var(--gold)); }
.pause { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; padding: 0 0.85rem; border-radius: 999px; border: 1px solid var(--line-strong); background: rgb(255 255 255 / 0.05); cursor: pointer; font-size: 0.8125rem; font-weight: 600; }
.pause svg { width: 14px; height: 14px; flex: none; }
.pause .pause__on { display: none; }
html[data-motion="off"] .pause .pause__on { display: inline; }
html[data-motion="off"] .pause .pause__off { display: none; }


/* The sky canvas, and the still poster under it for when there is no WebGL. */
.sky { position: fixed; inset: 0; z-index: -2; width: 100vw; height: 100lvh; display: block; pointer-events: none; }
.sky-poster { position: fixed; inset: 0; z-index: -3; pointer-events: none;
  background:
    radial-gradient(42vmax 14vmax at calc(var(--sun-x) * 100%) 88%, rgb(255 214 140 / 0.55), rgb(231 164 58 / 0.18) 40%, transparent 70%),
    radial-gradient(160vmax 60vmax at 50% 140%, #0c0b0a 0 60%, rgb(140 29 64 / 0.55) 61.2%, rgb(231 164 58 / 0.25) 62.5%, transparent 66%),
    radial-gradient(1px 1px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 72% 12%, #fff, transparent), radial-gradient(1px 1px at 34% 42%, #ddd, transparent),
    radial-gradient(1px 1px at 88% 36%, #fff, transparent), radial-gradient(1px 1px at 52% 26%, #ccc, transparent), #050505; }

/* Scroll scenes: a hold section pins its .frame; narrow or still pages lay it out flat. */
section { position: relative; }
.sec { padding-block: clamp(4rem, 2rem + 6vw, 8rem); }
.hold { height: calc(var(--span, 3) * 100lvh); }
.hold > .frame { position: sticky; top: 0; height: 100lvh; overflow: hidden; }
html[data-narrow] .hold, html[data-motion="off"] .hold { height: auto; }
html[data-narrow] .hold > .frame, html[data-motion="off"] .hold > .frame { position: relative; height: auto; overflow: visible; }

/* .lift-in tilts up into place the first time it is seen; with motion off it is simply there. */
html[data-motion="on"] .lift-in { opacity: 0; transform: perspective(900px) translate3d(0, 2.2rem, -40px) rotateX(10deg); transition: opacity 700ms var(--ease), transform 900ms var(--ease); transition-delay: calc(var(--i, 0) * 90ms); }
html[data-motion="on"] .lift-in.is-landed { opacity: 1; transform: none; }

/* The full-size screen viewer. */
.opener { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 1rem; background: rgb(5 5 5 / 0.86); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.opener[hidden] { display: none; }
.opener__fig { margin: 0; max-width: min(1400px, 96vw); max-height: 88vh; display: grid; gap: 0.6rem; }
.opener__fig img { max-height: calc(88vh - 4rem); width: auto; max-width: 100%; margin-inline: auto; border-radius: 0.8rem; box-shadow: 0 3rem 6rem -1rem #000; }
.opener__row { display: flex; align-items: center; gap: 0.75rem; }
.opener__row p { flex: 1; margin: 0; font-size: 0.9375rem; color: var(--text-2); }
.opener__close { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-strong); background: rgb(255 255 255 / 0.06); cursor: pointer; display: grid; place-items: center; }

/* .tag: a small fixed label in the corner, hidden on narrow screens. */
@media (max-width: 720px) { .tag { display: none; } }
.tag { position: fixed; right: max(0.75rem, env(safe-area-inset-right)); bottom: max(0.75rem, env(safe-area-inset-bottom)); z-index: 60; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.45rem 0.75rem; border-radius: 999px; background: rgb(10 9 8 / 0.8); border: 1px solid var(--line-strong); color: var(--text-2); }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Motion off, from the system setting or the Pause button: no transitions and no animations. */
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after { transition: none !important; animation: none !important; }
