/* Four Elements — tokens from the Refero "North Kingdom" style (DESIGN.md): indigo void, white type, one weight. */
:root {
  --void: #050311; --void-2: #0b0920; --ink: #fff; --mute: #9b9aa0; --line: #44424d;
  --glow: #9fe8ff;
  --air: #f2b24b; --water: #52b8ff; --earth: #78d08f; --fire: #ff5a36;
  --el: var(--glow);
  --sans: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  --mono: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --gut: clamp(16px, 4vw, 56px);
  --display: clamp(44px, 8.4vw, 150px);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--void); -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body { background: var(--void); color: var(--ink); font: 400 17px/1.55 var(--sans); overflow-x: clip; -webkit-font-smoothing: antialiased; }
img, canvas, svg { display: block; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--glow); outline-offset: 4px; border-radius: 4px; }
svg use { fill: currentColor; }
::selection { background: var(--glow); color: var(--void); }

.label { font: 400 12px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); display: flex; align-items: center; gap: 10px; }
.label svg { width: 16px; height: 16px; color: var(--el); }
.display { font-weight: 400; font-size: var(--display); line-height: .95; letter-spacing: -.045em; text-wrap: balance; }
.lede { font-size: clamp(17px, 1.5vw, 21px); color: var(--mute); max-width: 34ch; }

/* ---------- nav + comet ---------- */
.nav { position: fixed; inset: 0 0 auto; z-index: 50; display: flex; justify-content: space-between; align-items: center; padding: 18px var(--gut); background: rgba(5, 3, 17, .72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: opacity .6s, visibility 0s; }
.js .nav.away { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .35s, visibility 0s .35s; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; letter-spacing: -.01em; }
.mark { width: 18px; height: 18px; color: var(--el); filter: drop-shadow(0 0 6px var(--el)); transition: color .6s; }
.nav nav { display: flex; align-items: center; gap: 6px; }
.nav nav a { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 4px; color: var(--mute); transition: color .3s; }
.nav nav a svg { width: 18px; height: 18px; }
.nav nav a:hover, .nav nav a.on { color: var(--ink); }
.nav nav a[data-el="air"].on { color: var(--air); } .nav nav a[data-el="water"].on { color: var(--water); }
.nav nav a[data-el="earth"].on { color: var(--earth); } .nav nav a[data-el="fire"].on { color: var(--fire); }
.nav .hello { width: auto !important; padding: 0 14px; margin-left: 8px; border: 1px solid var(--line); font: 400 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink) !important; }
.comet { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none; }
.comet-line { position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, transparent, var(--el)); opacity: .55; }
.comet-head { position: absolute; top: -2px; left: 0; width: 6px; height: 6px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px 2px var(--el); }
@media (max-width: 699px) { .nav nav a:not(.hello) { display: none; } }

/* ---------- 1 · wake (Avatar State) ---------- */
.wake { height: 340vh; position: relative; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.wake .stage { background: #000; }
.cam { position: absolute; inset: 0; will-change: transform; }
.cam .poster, .cam canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam .aura { mix-blend-mode: screen; }
.js .cam .poster.hide { visibility: hidden; }
.flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 30%, #fff 0, var(--glow) 30%, transparent 70%); opacity: 0; pointer-events: none; }
.wake-top { position: absolute; top: 28px; left: var(--gut); right: var(--gut); display: flex; justify-content: space-between; }
.wake-count .ct { color: var(--ink); }
.wake-cue { position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%); white-space: nowrap; color: var(--ink); }
.wake-cue svg { width: 14px; height: 14px; color: var(--glow); animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(4px); } }
.wake-copy { position: absolute; left: var(--gut); right: var(--gut); bottom: clamp(56px, 10vh, 110px); display: grid; gap: 18px; }
.hero-title { max-width: 9ch; text-shadow: 0 2px 40px rgba(0, 0, 0, .5); }
.js .wake-copy { opacity: 0; }
@media (max-width: 699px) {
  .cam .poster { object-fit: cover; object-position: 50% 0; top: 52px; height: 62%; -webkit-mask-image: radial-gradient(closest-side, #000 70%, transparent); mask-image: radial-gradient(closest-side, #000 70%, transparent); }
  .cam .poster.hide { visibility: hidden; }
  .wake-top { top: calc(16px + env(safe-area-inset-top)); } .wake-count { display: none; }
  .wake-copy { bottom: 84px; gap: 12px; } .hero-title { font-size: min(13.5vw, 64px); max-width: none; }
  .wake-cue { left: var(--gut); transform: none; bottom: 30px; } .wake-cue .long { display: none; }
}
@media (min-width: 700px) { .wake-cue .short { display: none; } }

/* ---------- 2 · vow ---------- */
.vow { padding: clamp(120px, 20vh, 220px) var(--gut) clamp(90px, 14vh, 160px); display: grid; gap: 40px; }
.vow .display { font-size: clamp(36px, 5.6vw, 96px); max-width: 16ch; }
.map { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); margin-top: 24px; }
.map a { display: grid; gap: 8px; padding: 22px 18px 6px 0; }
.map svg { width: 28px; height: 28px; color: var(--c); margin-bottom: 10px; transition: transform .5s cubic-bezier(.2, .9, .3, 1.4); }
.map a:hover svg { transform: translateY(-4px) rotate(-8deg); }
.map b { font-weight: 400; font-size: 24px; letter-spacing: -.02em; }
.map span { color: var(--mute); font-size: 15px; }
@media (max-width: 699px) { .map { grid-template-columns: 1fr 1fr; } .map li:nth-child(n+3) a { border-top: 1px solid var(--line); } }

/* ---------- chapters (shared) ---------- */
.chapter { position: relative; }
.chapter .bg, .chapter .bg img, .chapter canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.chapter .bg img { object-fit: cover; }
.chapter .copy { position: absolute; left: var(--gut); bottom: clamp(48px, 10vh, 110px); display: grid; gap: 16px; z-index: 3; }
.chapter .copy .label { color: var(--ink); }
.chapter .copy .lede { color: rgba(255, 255, 255, .78); }
.chapter .stage::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, var(--void) 0, transparent 22%, transparent 55%, rgba(5, 3, 17, .82) 100%); }
.hint { position: absolute; right: var(--gut); bottom: clamp(48px, 10vh, 110px); z-index: 3; color: rgba(255, 255, 255, .6); }
@media (hover: none) { .hint { display: none; } }
.air { --el: var(--air); } .water { --el: var(--water); } .earth { --el: var(--earth); } .fire { --el: var(--fire); }
.air { height: 200vh; }
.water .stage { height: 100vh; height: 100svh; }
.air .wind { z-index: 1; }

/* water: tide */
.water { height: 200vh; }
.water .stage { position: sticky; }
.js .water .tide { clip-path: polygon(0 100%, 100% 100%, 100% 100%, 0 100%); }
.water .whip { z-index: 1; }

/* earth: pillars */
.earth { height: 260vh; }
.earth .bg img { opacity: .55; }
.earth .copy { top: clamp(96px, 16vh, 160px); bottom: auto; }
.pillars { position: absolute; left: var(--gut); right: var(--gut); bottom: 0; height: 74%; display: flex; align-items: flex-end; gap: clamp(8px, 1.6vw, 24px); z-index: 3; }
.pillar { flex: 1; height: calc(var(--h) * 100%); position: relative; border-radius: 3px 3px 0 0;
  background: #5a4532 url(/img/stone-900.webp) center / cover no-repeat; background-blend-mode: luminosity; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), inset 8px 0 18px rgba(0, 0, 0, .55), inset -8px 0 18px rgba(0, 0, 0, .55);
  will-change: transform; }
.pillar::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(255, 222, 180, .07), transparent 18%, transparent 60%, rgba(0, 0, 0, .55)); }
.pillar span { position: absolute; top: 28px; left: 50%; transform: translateX(-50%) rotate(180deg); writing-mode: vertical-rl; white-space: nowrap;
  font: 400 clamp(18px, 2.5vw, 40px)/1 "Cambria Math", "STIX Two Math", "Times New Roman", serif; letter-spacing: .02em;
  color: #1d1610; text-shadow: 0 1px 0 rgba(255, 230, 200, .25), 0 -1px 0 rgba(0, 0, 0, .8); }
.pillar span sup { font-size: .6em; }
.pillar.lit span { color: #b9f5c8; text-shadow: 0 0 18px rgba(120, 208, 143, .9), 0 0 4px rgba(120, 208, 143, .9), 0 1px 0 rgba(0, 0, 0, .6); transition: color 1.2s, text-shadow 1.2s; }
.js .pillar { transform: translateY(102%); }
.dust { position: absolute; inset: 0; z-index: 4; pointer-events: none; }

/* fire: burn */
.fire { height: 220vh; }
.fire .stage { position: sticky; }
.fire .burn { z-index: 1; }
.js .fire.gl .burn-fallback { visibility: hidden; }
.js .fire:not(.gl) .burn-fallback { clip-path: inset(100% 0 0 0); }

/* ---------- balance ---------- */
.balance { height: 260vh; position: relative; }
.balance .stage { background: #000; }
.lotus { position: absolute; left: 50%; top: 38%; width: min(66vmin, 700px); height: auto; transform: translate(-50%, -50%) scale(.82); opacity: 0;
  -webkit-mask-image: radial-gradient(closest-side, #000 58%, transparent 100%); mask-image: radial-gradient(closest-side, #000 58%, transparent 100%); }
.orbs { position: absolute; left: 50%; top: 38%; width: 0; height: 0; }
.orbs span { position: absolute; left: -32px; top: -32px; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; color: var(--c);
  border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); background: radial-gradient(circle, color-mix(in srgb, var(--c) 28%, transparent), transparent 70%); will-change: transform, opacity; }
.orbs span svg { width: 26px; height: 26px; }
.orbs .core { position: absolute; left: -110px; top: -110px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, #fff 0, rgba(159, 232, 255, .55) 22%, transparent 66%); opacity: 0; transform: scale(.2); }
.balance .copy { position: absolute; left: 0; right: 0; bottom: 0; padding: 120px var(--gut) clamp(56px, 9vh, 100px); display: grid; gap: 16px; text-align: center; justify-items: center;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .78) 45%, #000); }
.balance .copy .label { color: var(--glow); }
.balance .copy .lede { color: rgba(255, 255, 255, .84); }
.balance .display { text-shadow: 0 2px 30px rgba(0, 0, 0, .8); }
.balance .display { font-size: clamp(40px, 6.6vw, 118px); max-width: 12ch; }
.js .balance .copy { opacity: 0; }

/* ---------- hello + footer ---------- */
.hello { padding: clamp(120px, 22vh, 240px) var(--gut) 80px; display: grid; justify-items: center; text-align: center; gap: 28px; position: relative; }
.tile { width: clamp(120px, 16vw, 200px); color: var(--glow); margin-bottom: 16px; }
.tile svg { width: 100%; height: auto; overflow: visible; }
.tile circle, .tile path { fill: none; stroke: currentColor; stroke-width: 1.2; }
.tile .petals path { stroke: rgba(255, 255, 255, .75); }
.hello .display { font-size: clamp(40px, 7vw, 124px); max-width: 11ch; }
.cta { display: inline-flex; align-items: center; gap: 12px; padding: 18px 26px; border-radius: 4px; background: var(--ink); color: var(--void); font: 400 13px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.cta svg { width: 14px; height: 14px; transform: rotate(-90deg); }
.cta:hover { background: var(--glow); }

.foot { padding: 40px var(--gut) 28px; border-top: 1px solid var(--line); overflow: hidden; }
.word { position: relative; font-size: 19.4vw; line-height: .8; letter-spacing: -.06em; margin: 10px 0 30px -.04em; user-select: none; }
.word span { display: block; color: #13112a; }
.word .lit { position: absolute; inset: 0; color: #fff;
  -webkit-mask-image: radial-gradient(circle var(--r, 22vw) at var(--mx, 50%) var(--my, 50%), #000 0, rgba(0, 0, 0, .35) 40%, transparent 70%);
  mask-image: radial-gradient(circle var(--r, 22vw) at var(--mx, 50%) var(--my, 50%), #000 0, rgba(0, 0, 0, .35) 40%, transparent 70%); }
.foot-row { justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* ---------- reduced motion / no JS: a finished, static page ---------- */
.reduce .wake { height: auto; } .reduce .wake .stage { position: relative; }
.reduce .wake-copy, .reduce .balance .copy { opacity: 1; }
.reduce .wake-cue, .reduce .wake-count { display: none; }
.reduce .air, .reduce .water, .reduce .earth, .reduce .fire, .reduce .balance { height: auto; }
.reduce .air .stage, .reduce .water .stage, .reduce .fire .stage, .reduce .balance .stage, .reduce .earth .stage { position: relative; height: 100svh; }
.reduce .water .tide { clip-path: none; }
.reduce .pillar { transform: none; }
.reduce .lotus { opacity: 1; transform: translate(-50%, -50%); }
@media (max-width: 699px) { .lotus, .orbs { top: 34%; } .lotus { width: 92vw; } }
.reduce .fire .burn-fallback { clip-path: none !important; visibility: visible !important; }
.reduce canvas.burn { display: none; }

/* ---------- sound: floating control (bottom-right) + visible YouTube mini player, loaded on first interaction ---------- */
.tune { position: fixed; right: var(--gut); bottom: 22px; z-index: 61; display: flex; align-items: center; height: 48px; padding: 0; border: 0; border-radius: 24px;
  background: rgba(11, 9, 32, .55); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); color: var(--ink); cursor: pointer; font: inherit; transition: box-shadow .4s, background-color .4s; }
.tune:hover, .tune:focus-visible { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--el) 55%, transparent), 0 0 24px -6px var(--el); background: rgba(11, 9, 32, .72); }
.tune-ring { position: absolute; left: 0; top: 0; width: 48px; height: 48px; transform: rotate(-90deg); pointer-events: none; }
.tune-ring circle { fill: none; stroke-width: 1.5; }
.tune-ring .track { stroke: rgba(255, 255, 255, .06); }
.tune-ring .prog { stroke: var(--el); stroke-dasharray: 1; stroke-dashoffset: 1; stroke-linecap: round; filter: drop-shadow(0 0 3px var(--el)); transition: stroke .6s; }
.tune-bars { width: 48px; height: 48px; flex: none; display: flex; align-items: center; justify-content: center; gap: 2.5px; }
.tune-bars i { width: 2.5px; height: 16px; border-radius: 2px; background: currentColor; transform: scaleY(.16); transform-origin: 50% 50%; transition: transform .35s cubic-bezier(.3, .7, .2, 1), background-color .6s; }
.tune[aria-pressed="true"] .tune-bars i { background: #fff; transition: none; }
.tune-label { display: grid; text-align: left; max-width: 0; overflow: hidden; white-space: nowrap; opacity: 0; transition: max-width .55s cubic-bezier(.2, .9, .3, 1), opacity .35s, padding .55s; padding-right: 0; }
.tune-label b { font-weight: 400; font-size: 14px; letter-spacing: -.01em; line-height: 1.15; }
.tune-label small { font: 400 10px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
@media (hover: hover) { .tune:hover .tune-label, .tune:focus-visible .tune-label { max-width: 220px; opacity: 1; padding-right: 20px; } }
@media (hover: hover) { .tune.hint .tune-label { max-width: 220px; opacity: 1; padding-right: 20px; } }
.js .tune { opacity: 0; transform: translateY(10px); transition: opacity .8s .6s, transform .8s .6s cubic-bezier(.2, .9, .3, 1), box-shadow .4s, background-color .4s; }
.js .tune.ready { opacity: 1; transform: none; }
@media (max-width: 699px) { .tune { right: 16px; bottom: 16px; } }
.player { position: fixed; right: var(--gut); bottom: 82px; z-index: 60; width: 236px; padding: 10px; background: rgba(11, 9, 32, .86); border: 1px solid var(--line); border-radius: 8px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transform: translateY(12px) scale(.97); transform-origin: 100% 100%; opacity: 0; transition: transform .6s cubic-bezier(.2, .9, .3, 1), opacity .6s; }
.player.on { transform: none; opacity: 1; }
.player[hidden] { display: block; visibility: hidden; pointer-events: none; }
.player-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.player-x { background: none; border: 0; color: var(--mute); font-size: 20px; line-height: 1; cursor: pointer; width: 28px; height: 28px; }
.player-x:hover { color: var(--ink); }
.player-frame { aspect-ratio: 16 / 9; width: 214px; border-radius: 4px; overflow: hidden; background: #000; }
.player-frame iframe { width: 100%; height: 100%; display: block; border: 0; }
.player-title { margin-top: 10px; font-size: 15px; letter-spacing: -.01em; }
.player-title span { display: block; color: var(--mute); font-size: 13px; }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; }
.eq i { width: 2px; height: 10px; background: var(--glow); animation: eq .9s ease-in-out infinite; transform-origin: 50% 100%; }
.eq i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3) { animation-delay: -.6s; }
.paused .eq i { animation: none; transform: scaleY(.3); }
@media (max-width: 699px) { .player { right: 16px; bottom: 74px; width: 252px; display: grid; grid-template-columns: 120px 1fr; gap: 0 10px; align-items: center; }
  .player-top { grid-column: 1 / -1; } .player-frame { width: 120px; } .player-title { margin: 0; } }
.cta[hidden] { display: none; }
