/* Children of Theia · "Living light": a starry night between stone pillars; the only warm colour is golden light. */
:root {
  --night: oklch(0.155 0.022 266);        /* #0b0e17-ish: page */
  --night-2: oklch(0.2 0.025 262);        /* raised surfaces */
  --ivory: oklch(0.93 0.025 80);          /* text */
  --mute: oklch(0.76 0.025 78);           /* secondary text (AA on night) */
  --gold: oklch(0.82 0.13 78);            /* light: rings, focus, numbers */
  --gold-deep: oklch(0.7 0.14 65);        /* glow core */
  --paper: oklch(0.92 0.035 85);          /* book page */
  --paper-ink: oklch(0.27 0.03 60);       /* book text */
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --book: "EB Garamond", Garamond, Georgia, serif;
  --ui: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --measure: min(62ch, 90vw);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--night); color: var(--ivory);
  font: 400 1.0625rem/1.65 var(--ui); text-rendering: optimizeLegibility; overflow-x: hidden;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 6px; }

/* the night sky with pillars stays put while the page scrolls */
.sky { position: fixed; inset: 0; z-index: -1; }
.sky img { width: 100%; height: 100%; object-fit: cover; object-position: center 40%; }
.sky::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 70% 60% at 50% 42%, transparent 40%, oklch(0.12 0.02 266 / .55) 100%), linear-gradient(to bottom, oklch(0.12 0.02 266 / .15), oklch(0.12 0.02 266 / .35)); }

.top { display: flex; justify-content: center; padding: clamp(20px, 4vh, 36px) 16px 0; }
.wordmark { font: 500 .75rem/1 var(--ui); letter-spacing: .38em; text-transform: uppercase; color: var(--ivory); opacity: .9; }

main { display: grid; gap: clamp(88px, 16vh, 168px); padding: 0 16px; }
section { display: grid; justify-items: center; text-align: center; }

/* hero */
.hero { padding-top: clamp(28px, 6vh, 64px); }
h1 { font: 500 clamp(2.75rem, 7.2vw, 5.75rem)/1 var(--serif); letter-spacing: .005em; margin: 0; text-wrap: balance; }
.lede { margin: .9rem 0 0; font: 400 clamp(1.05rem, 1.6vw, 1.3rem)/1.4 var(--serif); color: var(--mute); max-width: 36ch; text-wrap: balance; }

.film {
  position: relative; margin-top: clamp(28px, 5vh, 48px); width: min(1080px, 100%); aspect-ratio: 16 / 9;
  padding: 0; border: 1px solid oklch(0.82 0.13 78 / .55); border-radius: 4px; background: #000; cursor: pointer; isolation: isolate;
  box-shadow: 0 0 0 1px oklch(0 0 0 / .4), 0 30px 80px -30px oklch(0 0 0 / .9);
}
.film img { width: 100%; height: 100%; object-fit: cover; border-radius: 3px; transition: transform .9s var(--ease), filter .6s var(--ease); filter: brightness(.82) saturate(1.02); }
.film-glow { position: absolute; inset: -18% -12%; z-index: -1; background: radial-gradient(ellipse 50% 50% at 50% 55%, oklch(0.7 0.14 65 / .38), transparent 70%); filter: blur(20px); pointer-events: none; animation: breathe 7s ease-in-out infinite; }
.film:hover img, .film:focus-visible img { transform: scale(1.02); filter: brightness(.92); }
.play {
  position: absolute; left: 50%; top: 50%; width: clamp(64px, 8vw, 92px); aspect-ratio: 1; translate: -50% -58%;
  display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--ivory); background: oklch(0.12 0.02 266 / .35);
  backdrop-filter: blur(2px); transition: transform .35s var(--ease), border-color .35s var(--ease), box-shadow .35s var(--ease);
}
.play svg { width: 38%; fill: var(--ivory); translate: 6% 0; }
.film:hover .play, .film:focus-visible .play, .panel:hover .play, .panel:focus-visible .play { transform: scale(1.06); border-color: var(--gold); box-shadow: 0 0 40px oklch(0.82 0.13 78 / .45); }
.film-label { position: absolute; left: 50%; top: calc(50% + clamp(38px, 4.6vw, 54px)); translate: -50% 0; font: 500 clamp(.95rem, 1.3vw, 1.1rem)/1 var(--serif); letter-spacing: .02em; white-space: nowrap; text-shadow: 0 1px 12px oklch(0 0 0 / .8); }

/* sections */
.eyebrow { margin: 0 0 1.1rem; font: 500 .72rem/1 var(--ui); letter-spacing: .34em; text-transform: uppercase; color: var(--mute); }
h2 { font: 500 clamp(1.9rem, 3.8vw, 2.9rem)/1.12 var(--serif); margin: 0 0 1.4rem; max-width: 30ch; text-wrap: balance; }
.prose { max-width: var(--measure); margin: 0 0 1rem; font: 400 clamp(1.15rem, 1.5vw, 1.3rem)/1.6 var(--serif); color: oklch(0.88 0.025 80); text-wrap: pretty; }

/* cast */
.faces { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(14px, 2.6vw, 34px); max-width: 1100px; }
.face { display: grid; justify-items: center; gap: .7rem; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 12px; }
.face img {
  width: clamp(96px, 11vw, 148px); height: auto; aspect-ratio: 1; border-radius: 50%; object-fit: cover;
  border: 2px solid oklch(0.82 0.13 78 / .7); box-shadow: 0 0 0 4px oklch(0.12 0.02 266 / .6), 0 0 28px -6px oklch(0.82 0.13 78 / .35);
  transition: transform .45s var(--ease), box-shadow .45s var(--ease), border-color .45s var(--ease);
}
.face span { font: 500 1.08rem/1.2 var(--serif); letter-spacing: .01em; }
.face:hover img, .face:focus-visible img, .face[aria-pressed="true"] img { transform: scale(1.07); border-color: var(--gold); box-shadow: 0 0 0 4px oklch(0.12 0.02 266 / .6), 0 0 46px 2px oklch(0.82 0.13 78 / .55); }
.face:focus-visible { outline-offset: 8px; }
.who { min-height: 3.4em; max-width: 46ch; margin: 1.6rem 0 0; font: 400 1.2rem/1.5 var(--serif); color: var(--mute); text-wrap: balance; transition: opacity .3s var(--ease); }
.who strong { color: var(--ivory); font-weight: 600; }

/* read */
.book-cover { width: min(620px, 100%); padding: 0; border: 0; background: none; cursor: pointer; border-radius: 8px; margin: -8px 0 8px; }
.book-cover img { width: 100%; height: auto; transition: transform .7s var(--ease), filter .6s var(--ease); mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, #000 55%, transparent 100%); }
.book-cover:hover img, .book-cover:focus-visible img { transform: translateY(-4px) rotate(-.6deg); filter: brightness(1.08); }

.pill {
  min-height: 48px; padding: .75rem 2.1rem; border-radius: 999px; border: 1px solid oklch(0.82 0.13 78 / .65); background: oklch(0.12 0.02 266 / .45);
  font: 500 1.08rem/1 var(--serif); letter-spacing: .02em; cursor: pointer; transition: background .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease);
}
.pill:hover { background: oklch(0.82 0.13 78 / .12); border-color: var(--gold); box-shadow: 0 0 28px -6px oklch(0.82 0.13 78 / .5); }
.pill:active { transform: translateY(1px); }

/* how it's made */
.panel { position: relative; width: min(900px, 100%); aspect-ratio: 16 / 9; padding: 0; border: 1px solid oklch(0.82 0.13 78 / .45); border-radius: 4px; background: #000; cursor: pointer; overflow: hidden; margin-bottom: 1.6rem; }
.panel img { width: 100%; height: 100%; object-fit: cover; filter: brightness(.7); transition: filter .5s var(--ease), transform .8s var(--ease); }
.panel:hover img, .panel:focus-visible img { filter: brightness(.85); transform: scale(1.015); }
.play.small { width: clamp(56px, 6vw, 76px); translate: -50% -50%; }
.numbers { display: grid; grid-template-columns: repeat(3, auto); justify-content: center; margin: 2.6rem 0 0; padding: 0; }
.numbers div { padding: 0 clamp(18px, 4vw, 48px); display: flex; flex-direction: column-reverse; align-items: center; }
.numbers div + div { border-left: 1px solid oklch(0.93 0.025 80 / .22); }
.numbers dd { margin: 0; font: 500 clamp(1.6rem, 3vw, 2.1rem)/1.1 var(--serif); color: var(--gold); font-variant-numeric: lining-nums; }
.numbers dt { font-size: .86rem; color: var(--mute); margin-top: .3rem; }

.foot { display: grid; justify-items: center; gap: 1.2rem; padding: clamp(96px, 16vh, 160px) 16px 56px; }
.foot a { color: var(--ivory); text-decoration: none; letter-spacing: .06em; font-size: .92rem; padding: .6rem .4rem; border-bottom: 1px solid oklch(0.82 0.13 78 / .4); }
.foot a:hover { border-color: var(--gold); color: var(--gold); }
.sun { width: 34px; stroke: var(--gold); fill: none; stroke-width: 1.4; opacity: .8; }
.sun circle { fill: var(--gold); stroke: none; }

/* reveal on scroll */
.reveal { opacity: 0; translate: 0 22px; transition: opacity .9s var(--ease), translate .9s var(--ease); }
.reveal.in { opacity: 1; translate: 0 0; }

/* ---------- full-screen viewers ---------- */
.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; color: var(--ivory); }
.viewer::backdrop { background: oklch(0.08 0.01 266 / .96); }
.viewer[open] { animation: fade .35s var(--ease); }
.viewer video, .viewer iframe { width: 100%; height: 100%; border: 0; display: block; background: #000; }
.close {
  position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: 3; width: 48px; height: 48px;
  border-radius: 50%; border: 1px solid oklch(0.93 0.025 80 / .35); background: oklch(0.12 0.02 266 / .6); font: 300 28px/1 var(--ui); cursor: pointer;
}
.close:hover { border-color: var(--gold); color: var(--gold); }

/* the book */
.viewer.book { background: radial-gradient(ellipse 60% 55% at 50% 45%, oklch(0.24 0.03 70 / .55), oklch(0.1 0.015 266) 70%), var(--night); display: none; }
.viewer.book[open] { display: grid; grid-template-rows: 1fr auto; align-items: center; justify-items: center; }
.book-stage { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: clamp(4px, 2vw, 28px); width: min(1240px, 100%); padding: 64px clamp(4px, 2vw, 24px) 0; }
.spread {
  --pw: min(470px, 40vw); --ph: min(640px, calc(100dvh - 220px));
  position: relative; width: calc(var(--pw) * 2 + 1px); height: var(--ph); margin: 0 auto; overflow: hidden;
  background: linear-gradient(to right, oklch(0.86 0.04 80), var(--paper) 6%, var(--paper) 46%, oklch(0.8 0.04 75) 50%, var(--paper) 54%, var(--paper) 94%, oklch(0.86 0.04 80));
  border-radius: 6px 6px 8px 8px; box-shadow: 0 0 0 7px oklch(0.34 0.06 55), 0 0 0 9px oklch(0.25 0.05 50), 0 40px 90px -20px #000, 0 0 120px -30px oklch(0.82 0.13 78 / .35);
}
.pages {
  height: 100%; columns: var(--pw); column-gap: 0; column-fill: auto; padding: clamp(28px, 5vh, 52px) 0 clamp(24px, 4vh, 44px);
  font: 400 clamp(1.02rem, 1.25vw, 1.14rem)/1.62 var(--book); color: var(--paper-ink);
  transition: transform .7s var(--ease);
}
.pages > * { margin-inline: clamp(26px, 3.4vw, 54px); }
.pages p { margin-top: 0; margin-bottom: .72em; text-align: justify; hyphens: auto; text-wrap: pretty; }
.chapter-head + p::first-letter { float: left; font: 500 3.6em/.82 var(--book); padding: .06em .08em 0 0; color: oklch(0.42 0.08 55); }
.chapter-head { text-align: center; padding-top: clamp(4px, 2vh, 20px); margin-bottom: 1.6em; break-inside: avoid; }
.chapter-head p { margin: 0 0 .5rem; font: 400 .8rem/1 var(--ui); letter-spacing: .3em; text-transform: uppercase; color: oklch(0.45 0.04 60); }
.chapter-head h2 { font: 500 clamp(1.5rem, 2.4vw, 2rem)/1.15 var(--book); color: var(--paper-ink); margin: 0 auto; max-width: none; }
.pages .fin { text-align: center; letter-spacing: .5em; color: oklch(0.45 0.04 60); margin-top: 1.4em; }
.turn { width: 52px; height: 52px; border-radius: 50%; border: 1px solid oklch(0.93 0.025 80 / .3); background: oklch(0.12 0.02 266 / .5); font: 300 34px/1 var(--serif); cursor: pointer; display: grid; place-items: center; padding-bottom: 4px; }
.turn:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.turn:disabled { opacity: .25; cursor: default; }
.book-foot { width: min(420px, 80vw); padding: 18px 0 max(22px, env(safe-area-inset-bottom)); text-align: center; }
.progress { height: 2px; background: oklch(0.93 0.025 80 / .15); border-radius: 2px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--gold); transition: width .5s var(--ease); }
.page-no { margin: .7rem 0 0; font-size: .82rem; color: var(--mute); letter-spacing: .08em; }

/* one page at a time on narrow screens */
@media (max-width: 760px) {
  .spread { --pw: calc(100vw - 32px); width: var(--pw); background: var(--paper); }
  .book-stage { grid-template-columns: 1fr; padding-top: 72px; }
  .turn { display: none; }
  .numbers { grid-template-columns: 1fr; gap: 1.4rem; }
  .numbers div + div { border-left: 0; }
}

@keyframes breathe { 50% { opacity: .7; transform: scale(.97); } }
@keyframes fade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; translate: none; }
}

html { overflow-x: clip; }
.viewer { overflow: hidden; }

/* legibility over the lit ruins */
.prose, .who, .lede, h2, .eyebrow, .face span { text-shadow: 0 1px 14px oklch(0.1 0.02 266 / .9), 0 0 2px oklch(0.1 0.02 266 / .6); }
.sky::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(to top, oklch(0.12 0.02 266 / .55), transparent 45
/* legibility over the lit ruins */
.prose, .who, .lede, h2, .eyebrow, .face span { text-shadow: 0 1px 14px oklch(0.1 0.02 266 / .9), 0 0 2px oklch(0.1 0.02 266 / .6); }
.sky::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(to top, oklch(0.12 0.02 266 / .55), transparent 45%); pointer-events: none; }
