:root {
  --ink: #000;
  --panel: rgba(12, 8, 6, 0.72);
  --panel-solid: #0f0906;
  --line: rgba(255, 138, 61, 0.22);
  --line-strong: rgba(255, 138, 61, 0.5);
  --text: #f1ebe6;
  --muted: #b3a59a;
  --accent: #ff7a1a;
  --accent-soft: #ff9a52;
  --accent-ink: #1a0a00;
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --max: 1240px;
  --p: 0;
  --mx: 0;
  --my: 0;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 17px/1.6 var(--body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent-soft); }
a:hover { color: #ffc29a; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 3px; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- The scene: fixed layers driven by scroll (--p: 0 eclipse, 1 deep space) ---------- */
.scene { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: #000; }
.scene > * { position: absolute; inset: 0; will-change: opacity, transform; }
.layer-eclipse {
  background: #000 url("/assets/img/eclipse.jpg") center / cover no-repeat;
  opacity: calc(1 - var(--p) * 1.25);
  transform: scale(calc(1 + var(--p) * 0.45));
}
.layer-space {
  background: #000 url("/assets/img/space.jpg") center / cover no-repeat;
  opacity: clamp(0, calc((var(--p) - 0.2) * 1.6), 1);
  transform: scale(calc(1.18 - var(--p) * 0.12)) translate3d(calc(var(--mx) * -10px), calc(var(--my) * -10px), 0);
}
.layer-astro {
  inset: auto;
  right: 4vw;
  top: 14vh;
  width: min(46vw, 620px);
  opacity: clamp(0, calc((var(--p) - 0.45) * 2.2), 1);
  transform: translate3d(calc(var(--mx) * 22px), calc((1 - var(--p)) * 40vh + var(--my) * 18px), 0);
}
.layer-astro img { width: 100%; animation: drift 14s ease-in-out infinite; }
@keyframes drift {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-22px) rotate(2deg); }
}
.vignette { background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.75) 100%); }
.scene > .grain {
  inset: -10%;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.9s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -3%); } 75% { transform: translate(-2%, -1%); }
}
/* Inner pages: start in deep space */
.page-space { --p: 1; }

/* ---------- Header ---------- */
.site-header { position: fixed; top: 0; left: 0; right: 0; z-index: 20; transition: background .4s, border-color .4s, backdrop-filter .4s; border-bottom: 1px solid transparent; }
.site-header.scrolled, .page-space .site-header { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom-color: var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; flex-wrap: wrap; }
.brand { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: 5px; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--text); }
.nav { display: flex; flex-wrap: wrap; gap: 4px 26px; font-size: 13px; letter-spacing: 2.5px; text-transform: uppercase; }
.nav a { color: var(--muted); text-decoration: none; padding: 10px 0; position: relative; }
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 4px; height: 1px; background: var(--accent); transform: scaleX(0); transition: transform .3s; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }

/* ---------- Type ---------- */
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: 3px; line-height: 1.05; margin: 0; }
.eyebrow { color: var(--accent-soft); font-size: 12px; font-weight: 600; letter-spacing: 5px; text-transform: uppercase; margin: 0 0 14px; }
.lede { color: var(--muted); font-size: 19px; max-width: 600px; margin: 18px 0 0; }

/* ---------- Hero ---------- */
.hero { position: relative; height: 100vh; min-height: 620px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; text-align: center; padding: 0 24px 11vh; }
.hero h1 { font-weight: 800; font-size: clamp(34px, 9vw, 128px); letter-spacing: clamp(3px, 1.4vw, 18px); text-shadow: 0 4px 40px rgba(0, 0, 0, 0.8); }
.hero h1 .word { display: inline-block; white-space: nowrap; }
.hero h1 .ch { display: inline-block; opacity: 0; transform: translateY(0.4em); filter: blur(8px); transition: opacity 1.1s, transform 1.1s cubic-bezier(.2,.7,.2,1), filter 1.1s; transition-delay: calc(0.6s + var(--i) * 0.07s); }
.is-loaded .hero h1 .word { display: inline-block; white-space: nowrap; }
.hero h1 .ch { opacity: 1; transform: none; filter: none; }
.hero .tagline { margin: 18px 0 0; font-size: clamp(16px, 2vw, 20px); color: #e2d3c8; letter-spacing: 1px; opacity: 0; transition: opacity 1.4s 1.6s; text-shadow: 0 2px 20px #000; }
.is-loaded .hero .tagline { opacity: 1; }
.hero-fade { opacity: calc(1 - var(--p) * 2.2); transform: translateY(calc(var(--p) * -60px)); }

/* The sun: the eclipse's dark disc is the play button */
.sun {
  position: absolute; left: 50%; top: 50%; width: var(--disc, 220px); height: var(--disc, 220px);
  transform: translate(-50%, -50%); border-radius: 50%; border: 0; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
  opacity: calc(1 - var(--p) * 3); transition: box-shadow .5s;
}
.sun::before {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  box-shadow: 0 0 60px 10px rgba(255, 122, 26, 0.0), inset 0 0 0 1px rgba(255, 154, 82, 0);
  transition: box-shadow .6s;
  animation: corona 4s ease-in-out infinite;
}
@keyframes corona {
  0%, 100% { box-shadow: 0 0 40px 4px rgba(255, 122, 26, 0.25); }
  50% { box-shadow: 0 0 90px 18px rgba(255, 122, 26, 0.45); }
}
.sun:hover::before, .sun:focus-visible::before { box-shadow: 0 0 140px 40px rgba(255, 122, 26, 0.7); animation: none; }
.sun-label {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-size: 11px; letter-spacing: 4px; text-transform: uppercase; color: #f4d9c4;
  opacity: 0; transition: opacity 1s 2.2s;
}
.is-loaded .sun-label { opacity: 0.85; }
.sun:hover .sun-label { opacity: 1; }
.sun-icon { width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255, 154, 82, 0.6); display: flex; align-items: center; justify-content: center; transition: transform .4s, background .4s; }
.sun:hover .sun-icon { transform: scale(1.12); background: rgba(255, 122, 26, 0.18); }
.scroll-cue { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); width: 1px; height: 44px; background: linear-gradient(var(--accent), transparent); animation: cue 2.4s ease-in-out infinite; }
@keyframes cue { 0% { transform: translateX(-50%) scaleY(0); transform-origin: top; } 50% { transform: translateX(-50%) scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: translateX(-50%) scaleY(0); transform-origin: bottom; } }

/* ---------- Sections ---------- */
section { position: relative; }
.chapter { padding: 120px 0; overflow-x: clip; }
.chapter-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 36px; }
.chapter-head h2 { font-size: clamp(36px, 5vw, 60px); }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity 1s, transform 1s cubic-bezier(.2,.7,.2,1); transition-delay: calc(var(--d, 0) * 1s); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Theater ---------- */
.theater { position: relative; display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); scroll-margin-top: 96px; isolation: isolate; }
.theater::before {
  content: ""; position: absolute; inset: -40px; z-index: -1; background: var(--art, none) center / cover no-repeat;
  filter: blur(60px) saturate(1.4); opacity: 0.45; transition: opacity .8s; pointer-events: none;
}
.stage { position: relative; aspect-ratio: 16 / 9; background: #000; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lite { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; padding: 0; cursor: pointer; background: #000 center / cover no-repeat; }
.lite::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at center, rgba(0,0,0,0.1), rgba(0,0,0,0.55)); }
.lite-play { position: absolute; left: 50%; top: 50%; width: 84px; height: 84px; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(0,0,0,0.55); border: 1px solid var(--line-strong); display: flex; align-items: center; justify-content: center; color: var(--accent-soft); transition: transform .3s, background .3s; box-shadow: 0 0 50px rgba(255,122,26,0.35); }
.lite:hover .lite-play { transform: translate(-50%, -50%) scale(1.08); background: var(--accent); color: var(--accent-ink); }
.info { padding: 32px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.info-title { font-size: clamp(28px, 3vw, 40px); overflow-wrap: anywhere; transition: opacity .35s, transform .35s; }
.info-meta { color: var(--muted); font-size: 14px; letter-spacing: 1px; margin: 0; }
.swap { opacity: 0; transform: translateY(8px); }
.info-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.info-links a { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); text-decoration: none; border: 1px solid var(--line); padding: 7px 12px; }
.info-links a:hover { color: var(--text); border-color: var(--line-strong); }
.transport { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 18px; }
.ctrl { width: 52px; height: 52px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 1px solid var(--line-strong); color: var(--text); cursor: pointer; transition: background .25s, color .25s; }
.ctrl:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.position { margin-left: auto; font-family: var(--display); color: var(--muted); font-size: 15px; letter-spacing: 2px; }

/* ---------- Filters + tiles ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 56px 0 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 12px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--muted); background: rgba(0,0,0,0.5); border: 1px solid var(--line); padding: 10px 16px; cursor: pointer; }
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.count { color: var(--muted); font-size: 13px; letter-spacing: 2px; text-transform: uppercase; }
.tiles { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tile { display: flex; flex-direction: column; text-align: left; padding: 0; cursor: pointer; color: var(--text); background: var(--panel); border: 1px solid var(--line); overflow: hidden; transition: border-color .3s, transform .4s cubic-bezier(.2,.7,.2,1), box-shadow .4s; opacity: 0; transform: translateY(24px); }
.tiles.in .tile { opacity: 1; transform: none; transition-delay: calc(var(--i) * 40ms); }
.tiles.in .tile:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: 0 18px 50px rgba(255, 122, 26, 0.18); transition-delay: 0s; }
.tile.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 18px 50px rgba(255, 122, 26, 0.25); }
.tile-art { position: relative; aspect-ratio: 16 / 9; background: #120a06 center / cover no-repeat; overflow: hidden; }
.tile-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.65), transparent 55%); }
.tile-eq { position: absolute; right: 10px; bottom: 10px; z-index: 1; display: none; gap: 3px; align-items: flex-end; height: 16px; }
.tile.is-active .tile-eq { display: flex; }
.tile-eq i { width: 3px; background: var(--accent); animation: eq 0.9s ease-in-out infinite; }
.tile-eq i:nth-child(2) { animation-delay: .2s; } .tile-eq i:nth-child(3) { animation-delay: .4s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 16px; } }
.tile-badge { position: absolute; top: 10px; left: 10px; z-index: 1; font-size: 10px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; background: var(--accent); color: var(--accent-ink); padding: 3px 8px; }
.tile-body { padding: 14px 16px 16px; display: flex; gap: 12px; align-items: baseline; }
.tile-n { font-family: var(--display); color: var(--accent-soft); font-size: 13px; min-width: 22px; }
.tile-title { display: block; font-weight: 600; font-size: 16px; line-height: 1.3; }
.tile-meta { display: block; color: var(--muted); font-size: 13px; }

/* ---------- Vote + worlds ---------- */
.vote { text-align: center; padding: 150px 0; }
.vote h2 { font-size: clamp(36px, 6vw, 76px); max-width: 980px; margin: 0 auto; text-shadow: 0 4px 40px #000; }
.vote p { color: #d8cbc1; max-width: 560px; margin: 20px auto 0; text-shadow: 0 2px 20px #000; }
.pill { display: inline-flex; align-items: center; gap: 10px; margin-top: 30px; padding: 12px 20px; border: 1px dashed var(--line-strong); color: var(--accent-soft); background: rgba(0,0,0,0.5); font-size: 12px; letter-spacing: 3px; text-transform: uppercase; text-decoration: none; }
.pill:hover { background: rgba(255,122,26,0.12); }
.worlds { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.world { display: flex; flex-direction: column; gap: 10px; padding: 32px; min-height: 230px; text-decoration: none; color: var(--text); background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: border-color .3s, transform .4s; }
.world:hover { color: var(--text); border-color: var(--line-strong); transform: translateY(-4px); }
.world h3 { font-size: 30px; }
.world p { color: var(--muted); margin: 0; }
.world .go { margin-top: auto; font-size: 12px; letter-spacing: 3px; text-transform: uppercase; color: var(--accent-soft); }

/* ---------- Inner pages ---------- */
.construction { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 140px 24px 80px; }
.runes { width: 220px; height: 220px; border-radius: 50%; background: #000 url("/assets/img/runes.jpg") center / 150% no-repeat; box-shadow: 0 0 80px rgba(255,122,26,0.35); margin-bottom: 36px; animation: spin 80s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.construction h1 { font-size: clamp(40px, 7vw, 84px); text-shadow: 0 4px 40px #000; }
.construction .lede { margin-left: auto; margin-right: auto; color: #d8cbc1; }
.btn { display: inline-flex; align-items: center; gap: 10px; margin-top: 32px; padding: 14px 26px; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 13px; letter-spacing: 3px; text-transform: uppercase; text-decoration: none; }
.btn:hover { color: var(--accent-ink); background: var(--accent-soft); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: rgba(0,0,0,0.75); color: var(--muted); font-size: 14px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 30px; padding-bottom: 30px; }
.foot-brand { display: flex; align-items: center; gap: 12px; }
.foot-brand img { width: 36px; height: auto; }
.site-footer nav { display: flex; gap: 22px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

@media (max-width: 900px) {
  .theater { grid-template-columns: 1fr; }
  .info { padding: 22px; }
  .layer-astro { right: -8vw; top: 18vh; width: 80vw; }
}
@media (max-width: 640px) {
  .site-header .wrap { padding-top: 10px; padding-bottom: 6px; }
  .nav { gap: 2px 16px; font-size: 12px; letter-spacing: 2px; }
  .chapter { padding: 88px 0; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile-body { padding: 10px 10px 12px; gap: 8px; }
  .tile-title { font-size: 14px; }
  .tile-n { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .layer-eclipse, .layer-space, .layer-astro, .hero-fade { transform: none !important; }
  .reveal, .tile, .hero h1 .ch, .hero .tagline, .sun-label { opacity: 1 !important; transform: none !important; filter: none !important; }
}
