@font-face { font-family: Cinzel; font-weight: 600; font-display: swap; src: url(../fonts/cinzel-600.woff2) format('woff2'); }
@font-face { font-family: Cinzel; font-weight: 700; font-display: swap; src: url(../fonts/cinzel-700.woff2) format('woff2'); }
@font-face { font-family: Cinzel; font-weight: 900; font-display: swap; src: url(../fonts/cinzel-900.woff2) format('woff2'); }
@font-face { font-family: Barlow; font-weight: 400; font-display: swap; src: url(../fonts/barlow-condensed-400.woff2) format('woff2'); }
@font-face { font-family: Barlow; font-weight: 500; font-display: swap; src: url(../fonts/barlow-condensed-500.woff2) format('woff2'); }
@font-face { font-family: Barlow; font-weight: 600; font-display: swap; src: url(../fonts/barlow-condensed-600.woff2) format('woff2'); }

:root {
  --ivory: #f3ead9;
  --ivory-dim: #cfc3b2;
  --gold: #d9b168;
  --gold-hot: #ffdf9e;
  --crimson: #a51c24;
  --violet: #2a1a4a;
  --ink: #0b0716;
  --edge: clamp(18px, 3.2vw, 44px);
  --display: Cinzel, 'Trajan Pro', 'Palatino Linotype', Palatino, Georgia, serif;
  --label: Barlow, 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;
  --ease: cubic-bezier(.19, .8, .22, 1);
}

* { box-sizing: border-box; margin: 0; }
html { background: var(--ink); color: var(--ivory); -webkit-text-size-adjust: 100%; }
body { font-family: var(--label); overflow-x: hidden; -webkit-font-smoothing: antialiased; }
html.locked, html.locked body { overflow: hidden; height: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 1px solid var(--gold-hot); outline-offset: 4px; }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; height: 100lvh; display: block; z-index: 0; }
#track { position: relative; width: 1px; pointer-events: none; }

/* ---- loader ---- */
#loader {
  position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 22px;
  background: radial-gradient(ellipse at 50% 46%, #1b1032 0%, #0b0716 62%);
  transition: opacity 1.1s ease, visibility 1.1s;
}
#loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.sigil { width: min(38vmin, 240px); overflow: visible; transition: transform 1.3s var(--ease), opacity .9s ease; }
#loader.done .sigil { transform: scale(2.6); opacity: 0; }
.sigil-track { fill: none; stroke: rgba(217, 177, 104, .16); stroke-width: 1; }
.sigil-fill { fill: none; stroke: var(--gold-hot); stroke-width: 1.5; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .5s ease; filter: drop-shadow(0 0 6px rgba(255, 190, 110, .8)); }
.sigil-core { fill: var(--gold-hot); filter: drop-shadow(0 0 10px #ffb45e); animation: breathe 2.6s ease-in-out infinite; }
.sigil-rays polygon { fill: var(--gold); opacity: 0; transition: opacity .5s ease; }
.sigil-rays polygon.on { opacity: 1; }
.loader-line { font: 600 12px/1 var(--display); letter-spacing: .42em; text-transform: uppercase; color: var(--gold); text-indent: .42em; }
@keyframes breathe { 50% { transform: scale(1.5); opacity: .7; } }

/* ---- chrome ---- */
#chrome {
  position: fixed; z-index: 30; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center;
  padding: max(env(safe-area-inset-top), 18px) var(--edge) 0; pointer-events: none;
  opacity: 0; transition: opacity 1.4s ease;
}
.live #chrome { opacity: 1; }
#chrome > * { pointer-events: auto; }
.mark { display: inline-flex; align-items: center; gap: 10px; font: 700 15px/1 var(--display); letter-spacing: .34em; text-shadow: 0 1px 12px rgba(10, 5, 25, .6); }
.mark-sun { width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ffe9b8, #e9872c 55%, #8a1c14); box-shadow: 0 0 14px 2px rgba(255, 150, 60, .55); }
#play-link { margin-left: auto; margin-right: clamp(16px, 2.4vw, 34px); padding: 10px 4px; font: 600 13px/1 var(--label); letter-spacing: .22em; text-transform: uppercase; color: var(--gold-hot); text-shadow: 0 1px 10px rgba(10, 5, 25, .7); transition: filter .3s ease; }
#play-link:hover, #play-link:focus-visible { filter: brightness(1.25); }
#sound { display: inline-flex; align-items: center; gap: 10px; padding: 10px 4px; font: 500 13px/1 var(--label); letter-spacing: .22em; text-transform: uppercase; text-shadow: 0 1px 10px rgba(10, 5, 25, .7); }
.sound-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.sound-bars i { width: 2px; height: 3px; background: var(--gold); transition: height .2s ease; }
#sound[aria-pressed=true] .sound-bars i { animation: bar 1s ease-in-out infinite; }
#sound[aria-pressed=true] .sound-bars i:nth-child(2) { animation-delay: -.3s; }
#sound[aria-pressed=true] .sound-bars i:nth-child(3) { animation-delay: -.6s; }
#sound[aria-pressed=true] .sound-bars i:nth-child(4) { animation-delay: -.15s; }
@keyframes bar { 50% { height: 12px; } }

html.veiled #chrome, html.veiled #rail { opacity: 0; transition-duration: .4s; }
#chrome::before { content: ''; position: absolute; z-index: -1; inset: 0 0 -96px; background: linear-gradient(rgba(11, 7, 22, .24), rgba(11, 7, 22, .1) 45%, rgba(11, 7, 22, .03) 75%, transparent); pointer-events: none; }

/* ---- chapter rail ---- */
#rail {
  position: fixed; z-index: 30; right: var(--edge); top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 22px; opacity: 0; transition: opacity 1.4s ease;
}
.live #rail { opacity: 1; }
#rail::before { content: ''; position: absolute; right: 3px; top: 3px; bottom: 3px; width: 1px; background: linear-gradient(transparent, rgba(243, 234, 217, .3) 10%, rgba(243, 234, 217, .3) 90%, transparent); }
#rail::after { content: ''; position: absolute; right: 3px; top: 3px; width: 1px; height: calc(var(--p, 0) * (100% - 6px)); background: var(--gold-hot); box-shadow: 0 0 8px rgba(255, 200, 120, .7); }
#rail a { position: relative; z-index: 1; display: flex; align-items: center; justify-content: flex-end; gap: 12px; font: 500 12px/1 var(--label); letter-spacing: .24em; text-transform: uppercase; height: 7px; }
#rail a span { opacity: 0; transform: translateX(6px); transition: opacity .35s ease, transform .35s var(--ease); white-space: nowrap; text-shadow: 0 1px 8px rgba(10, 5, 25, .8); }
#rail a:hover span, #rail a:focus-visible span, #rail.named a.on span { opacity: 1; transform: none; }
#rail a i { flex: none; width: 7px; height: 7px; transform: rotate(45deg); border: 1px solid rgba(243, 234, 217, .6); background: rgba(11, 7, 22, .5); transition: background .3s ease, border-color .3s ease, box-shadow .3s ease; }
#rail a.on i { background: var(--gold-hot); border-color: var(--gold-hot); box-shadow: 0 0 10px rgba(255, 200, 120, .9); }

/* ---- scroll cue ---- */
#cue { position: fixed; z-index: 20; left: 50%; bottom: max(env(safe-area-inset-bottom), 26px); transform: translateX(-50%); display: grid; justify-items: center; gap: 12px; opacity: 0; transition: opacity .8s ease; pointer-events: none; }
.live #cue.show { opacity: 1; }
#cue span { font: 500 12px/1 var(--label); letter-spacing: .4em; text-indent: .4em; text-transform: uppercase; text-shadow: 0 1px 10px rgba(10, 5, 25, .8); }
#cue i { width: 1px; height: 44px; background: linear-gradient(var(--gold-hot), transparent); transform-origin: top; animation: drip 2.2s var(--ease) infinite; }
@keyframes drip { 0% { transform: scaleY(0); } 55% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

/* ---- story beats ---- */
#beats { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.beat {
  position: absolute; inset: 0; display: flex; flex-direction: column; padding: 12vh var(--edge); visibility: hidden;
  transition: visibility 0s linear .7s;
  --tx: 0;
}
.beat.on { visibility: visible; transition-delay: 0s; }
.beat.center { align-items: center; justify-content: center; text-align: center; }
.beat.left { align-items: flex-start; justify-content: center; text-align: left; padding-left: max(var(--edge), 8vw); }
.beat.right { align-items: flex-end; justify-content: center; text-align: right; padding-right: max(calc(var(--edge) + 72px), 10vw); }
.beat.low { justify-content: flex-end; padding-bottom: 14vh; }
.beat.high { justify-content: flex-start; padding-top: 15vh; }
.beat .inner { max-width: min(760px, 88vw); transform: translate3d(0, var(--drift, 0), 0); }

.kicker { display: block; margin-bottom: 16px; font: 500 clamp(12px, 1.05vw, 14px)/1.2 var(--label); letter-spacing: .44em; text-transform: uppercase; color: var(--gold-hot); text-shadow: 0 1px 14px rgba(10, 5, 25, .75); }
.beat h2, .beat h1 {
  font: 700 clamp(30px, 4.9vw, 74px)/1.08 var(--display); letter-spacing: .035em; color: var(--ivory);
  text-shadow: 0 2px 24px rgba(10, 5, 25, .62), 0 0 2px rgba(10, 5, 25, .35);
  text-wrap: balance;
}
.beat h2.huge { font-size: clamp(42px, 8.8vw, 140px); font-weight: 900; letter-spacing: .02em; }
.beat p { margin-top: 18px; max-width: 34em; font: 400 clamp(17px, 1.5vw, 21px)/1.42 var(--label); letter-spacing: .03em; color: var(--ivory); text-shadow: 0 1px 14px rgba(10, 5, 25, .8); }
.beat.center p { margin-inline: auto; }

/* words arrive one at a time and leave together */
.w { display: inline-block; opacity: 0; transform: translateY(.42em); filter: blur(6px); transition: opacity .45s ease, transform .45s ease, filter .45s ease; }
.beat.on .w { opacity: 1; transform: none; filter: none; transition: opacity 1s ease, transform 1.2s var(--ease), filter 1s ease; transition-delay: calc(var(--i) * 70ms + 80ms); }
.fade { opacity: 0; transition: opacity .45s ease; }
.beat.on .fade { opacity: 1; transition: opacity 1.2s ease .35s; }
.beat .interactive { pointer-events: auto; }

/* the final call to action */
.gate-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; margin-top: 34px; padding: 22px 54px 21px;
  font: 700 clamp(15px, 1.25vw, 19px)/1 var(--display); letter-spacing: .3em; text-indent: .3em; text-transform: uppercase;
  color: #2a1608; background: linear-gradient(180deg, #ffeec4 0%, #e8bd6d 46%, #c1862f 100%);
  clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 16px 100%, 0 50%);
  transition: filter .35s ease, transform .5s var(--ease);
  filter: drop-shadow(0 0 22px rgba(255, 196, 110, .55));
  pointer-events: auto;
}
.gate-btn:hover, .gate-btn:focus-visible { filter: drop-shadow(0 0 40px rgba(255, 214, 140, 1)) brightness(1.08); transform: scale(1.035); }

/* ---- no WebGL or no JS: a still page ---- */
html.flat, html.flat body { background: var(--ink) url(../assets/img/concept_key_art.png) center top / cover fixed no-repeat; }
html.flat #gl, html.flat #rail, html.flat #cue, html.flat #track { display: none; }
html.flat #beats { position: static; }
html.flat .beat { position: relative; inset: auto; visibility: visible; min-height: 70vh; background: rgba(11, 7, 22, .45); }
html.flat .w, html.flat .fade { opacity: 1; transform: none; filter: none; }
.noscript { position: relative; z-index: 60; max-width: 760px; margin: 0 auto; padding: 48px 24px; text-align: center; }
.noscript img { width: 100%; height: auto; }
.noscript h1 { font: 700 40px/1.1 var(--display); margin: 24px 0; }
.noscript p { font-size: 19px; line-height: 1.4; margin-bottom: 16px; }

@media (max-width: 760px) {
  #rail { gap: 16px; right: 10px; top: auto; bottom: 150px; transform: none; }
  #rail a span { display: none; }
  .beat { padding: 13vh 22px; }
  .beat.left, .beat.right { padding-inline: 22px; }
  .beat.right { padding-right: 34px; }
  .beat .inner { max-width: 100%; }
  .kicker { letter-spacing: .32em; }
  .gate-btn { padding: 20px 34px 19px; letter-spacing: .22em; text-indent: .22em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; transition-delay: 0s !important; }
}
