/* ── Tokens ── */
:root {
  --bg:          #0d0d10;
  --bg-surface:  #18181c;
  --bg-card:     #222228;
  --bg-card-alt: #1e1e23;
  --border:      #2e2e36;
  --text:        #e4dcd2;
  --text-muted:  #7a7470;
  --text-faint:  #44413e;
  --teal:        #469B83;
  --teal-dim:    #2d6b5c;
  --crimson:     #9B4646;
  --crimson-dim: #6b2e2e;
  --heretic:     #9B7241;
  --heretic-dim: #6b4e2a;
  --townsfolk:   #6E9B41;
  --townsfolk-dim: #4a6b2a;
  --purple:      #74419B;
  --purple-dim:  #4e2a6b;
  --gold:        #b8995a;
  --radius-sm:   2px;
  --radius:      4px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg:          #f0ebe2;
    --bg-surface:  #e8e3d8;
    --bg-card:     #dfd9cd;
    --bg-card-alt: #e4dfd4;
    --border:      #c8c3b8;
    --text:        #16110c;
    --text-muted:  #6a6460;
    --text-faint:  #b0aba6;
    --teal:        #2d7a64;
    --teal-dim:    #c8e4dc;
    --crimson:     #832e2e;
    --crimson-dim: #f0d8d8;
    --heretic:     #7a5020;
    --heretic-dim: #f0e4d0;
    --townsfolk:   #4a7a22;
    --townsfolk-dim: #d4e8c0;
    --purple:      #5a2e80;
    --purple-dim:  #e0d0f0;
    --gold:        #8a6a28;
  }
}

:root[data-theme="dark"] {
  --bg:          #0d0d10;
  --bg-surface:  #18181c;
  --bg-card:     #222228;
  --bg-card-alt: #1e1e23;
  --border:      #2e2e36;
  --text:        #e4dcd2;
  --text-muted:  #7a7470;
  --text-faint:  #44413e;
  --teal:        #469B83;
  --teal-dim:    #2d6b5c;
  --crimson:     #9B4646;
  --crimson-dim: #6b2e2e;
  --heretic:     #9B7241;
  --heretic-dim: #6b4e2a;
  --townsfolk:   #6E9B41;
  --townsfolk-dim: #4a6b2a;
  --purple:      #74419B;
  --purple-dim:  #4e2a6b;
  --gold:        #b8995a;
}

:root[data-theme="light"] {
  --bg:          #f0ebe2;
  --bg-surface:  #e8e3d8;
  --bg-card:     #dfd9cd;
  --bg-card-alt: #e4dfd4;
  --border:      #c8c3b8;
  --text:        #16110c;
  --text-muted:  #6a6460;
  --text-faint:  #b0aba6;
  --teal:        #4a7a22;
  --teal-dim:    #d4e8c0;
  --crimson:     #7a5020;
  --crimson-dim: #f0e4d0;
  --purple:      #5a2e80;
  --purple-dim:  #e0d0f0;
  --gold:        #8a6a28;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Crimson Text', Georgia, serif;
  font-size: clamp(17px, 1.8vw, 20px);
  line-height: 1.65;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

/* ── Type scale ── */
.display {
  font-family: 'Amatic SC', serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-wrap: balance;
  line-height: 0.9;
}
.label {
  font-family: 'Amatic SC', serif;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.eyebrow {
  font-family: 'Crimson Text', serif;
  font-size: 0.8rem;
  font-style: italic;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* ── Theme toggle ── */
#theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: 'Amatic SC', serif;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.15s, border-color 0.15s;
}
#theme-toggle:hover { color: var(--text); border-color: var(--teal); }

/* ── Hero ── */
#hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(2rem, 5vw, 4rem);
  overflow: hidden;
}
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1400px;
}
.hero-title {
  font-size: clamp(2rem, 16vw, 18rem);
  color: var(--text);
  margin-bottom: 1.5rem;
}
.hero-title span {
  display: block;
}
.hero-title .word-the {
  font-size: 0.38em;
  color: var(--text-muted);
  letter-spacing: 0.22em;
  margin-bottom: 0.2em;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  max-width: 680px;
}
.hero-meta .pill {
  font-family: 'Amatic SC', serif;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.hero-meta .pill strong {
  color: var(--teal);
  font-weight: 700;
}
.hero-scroll {
  position: absolute;
  bottom: 2rem;
  right: clamp(2rem, 5vw, 4rem);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  font-family: 'Amatic SC', serif;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.hero-scroll-line {
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, var(--text-faint), transparent);
  animation: scroll-pulse 2s ease-in-out infinite;
}
@keyframes scroll-pulse {
  0%, 100% { opacity: 0.4; transform: scaleY(1); }
  50% { opacity: 1; transform: scaleY(0.6); }
}

/* ── Sections ── */
.section-band {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.section {
  padding: clamp(4rem, 8vw, 7rem) clamp(1.5rem, 5vw, 4rem);
  max-width: 1400px;
  margin: 0 auto;
}
.section-full {
  padding: clamp(4rem, 8vw, 7rem) clamp(1.5rem, 5vw, 4rem);
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.section-full-inner {
  max-width: 1400px;
  margin: 0 auto;
}
.section-title {
  font-size: clamp(2.4rem, 5vw, 5rem);
  color: var(--text);
  margin-bottom: 0.5rem;
}
.section-title.accent-teal { color: var(--teal); }
.section-title.accent-crimson { color: var(--crimson); }

/* ── Reveal animation ── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: none;
}
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ── Two-column layout ── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}
.two-col.flip { direction: rtl; }
.two-col.flip > * { direction: ltr; }
@media (max-width: 740px) {
  .two-col { grid-template-columns: 1fr; }
  .two-col.flip { direction: ltr; }
}

/* ── Premise section ── */
.premise-body {
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  line-height: 1.75;
  max-width: 56ch;
}
.premise-body p + p { margin-top: 1em; }
.premise-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}
.stat {
  background: var(--bg-card);
  padding: 1.25rem 1.5rem;
}
.stat-value {
  font-family: 'Amatic SC', serif;
  font-size: clamp(1.8rem, 3.5vw, 3rem);
  font-weight: 700;
  color: var(--teal);
  line-height: 1;
  margin-bottom: 0.2rem;
}
.stat-label {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Factions ── */
.factions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 3rem;
}
@media (max-width: 640px) {
  .factions-grid { grid-template-columns: 1fr; }
}
.faction-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 2rem 1.75rem 2.5rem;
  position: relative;
  overflow: hidden;
}
.faction-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.faction-card.cultist::before { background: var(--purple); }
.faction-card.heretic::before { background: var(--heretic); }
.faction-card.townsfolk::before { background: var(--townsfolk); }
.faction-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.faction-glyph {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.faction-glyph img {
  width: 75%;
  height: 75%;
  object-fit: contain;
}
.cultist .faction-glyph  { background: color-mix(in srgb, var(--purple) 18%, transparent); border: 1px solid var(--purple-dim); }
.heretic .faction-glyph  { background: color-mix(in srgb, var(--heretic) 18%, transparent); border: 1px solid var(--heretic-dim); }
.townsfolk .faction-glyph { background: color-mix(in srgb, var(--townsfolk) 18%, transparent); border: 1px solid var(--townsfolk-dim); }
.faction-name {
  font-family: 'Amatic SC', serif;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}
.cultist  .faction-name  { color: var(--purple); }
.heretic  .faction-name  { color: var(--heretic); }
.townsfolk .faction-name { color: var(--townsfolk); }
.faction-role {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.faction-desc {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-muted);
}
.faction-win {
  margin-top: 1.25rem;
  padding: 0.65rem 0.9rem;
  border-left: 2px solid;
  font-size: 0.85rem;
  font-style: italic;
  line-height: 1.5;
}
.cultist  .faction-win { border-color: var(--purple); background: color-mix(in srgb, var(--purple) 8%, transparent); }
.heretic  .faction-win { border-color: var(--heretic); background: color-mix(in srgb, var(--heretic) 8%, transparent); }
.townsfolk .faction-win { border-color: var(--townsfolk); background: color-mix(in srgb, var(--townsfolk) 8%, transparent); }

/* ── How it plays ── */
.steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.step {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.step:last-child { border-bottom: none; }
.step-num {
  font-family: 'Amatic SC', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-faint);
  padding-top: 0.1rem;
}
.step-title {
  font-family: 'Amatic SC', serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 0.25rem;
}
.step-body {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-muted);
}

.ritual-img {
  aspect-ratio: 4/5;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--text-faint);
  position: relative;
  overflow: hidden;
}
.ritual-img::after {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid var(--border);
  pointer-events: none;
}
.ritual-img-label {
  font-family: 'Amatic SC', serif;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ── God section ── */
.god-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2.5rem;
}
@media (max-width: 560px) { .god-pair { grid-template-columns: 1fr; } }
.god-card {
  border: 1px solid var(--border);
  background: var(--bg-card-alt);
  padding: 0;
  overflow: hidden;
}
.god-card-img {
  aspect-ratio: 5/7;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.god-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.god-card-body { padding: 1.25rem 1.5rem; }
.god-card-type {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.35rem;
}
.god-card-name {
  font-family: 'Amatic SC', serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.god-card-name.quirk  { color: var(--teal); }
.god-card-name.judgement { color: var(--crimson); }
.god-card-desc {
  font-size: 1.0rem;
  line-height: 1.65;
  color: var(--text-muted);
  font-style: italic;
}
.god-equation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2.5rem;
  font-family: 'Amatic SC', serif;
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.god-equation .eq-part { color: var(--text); }
.god-equation .eq-plus { color: var(--text-faint); }
.god-equation .eq-result { color: var(--gold); }

/* ── Components ── */
.component-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  margin-top: 2.5rem;
}
@media (max-width: 740px) { .component-strip { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 440px) { .component-strip { grid-template-columns: repeat(2, 1fr); } }
.component-card {
  aspect-ratio: 5/7;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}
.component-card:hover {
  border-color: var(--teal);
  transform: translateY(-3px);
}
.component-card::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid var(--border);
  pointer-events: none;
  transition: border-color 0.2s;
}
.component-card:hover::before { border-color: var(--teal-dim); }
.component-card-name {
  font-family: 'Amatic SC', serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  color: var(--text-muted);
  line-height: 1.3;
}
.component-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
}

/* ── Quote ── */
.pullquote {
  padding: clamp(3rem, 6vw, 6rem) clamp(1.5rem, 5vw, 4rem);
  text-align: center;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.pullquote-text {
  font-family: 'Crimson Text', serif;
  font-size: clamp(1.3rem, 3.5vw, 2.4rem);
  font-style: italic;
  line-height: 1.45;
  max-width: 800px;
  margin: 0 auto 1rem;
  color: var(--text);
}
.pullquote-attribution {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ── In the box ── */
.box-contents {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-top: 2.5rem;
}
@media (max-width: 960px) { .box-contents { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 740px) { .box-contents { grid-template-columns: repeat(2, 1fr); } }
.box-item {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.box-item-img {
  aspect-ratio: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-family: 'Amatic SC', serif;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.box-item-name {
  font-family: 'Amatic SC', serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}
.box-item-count {
  font-size: 1.0rem;
  color: var(--text-muted);
}

/* ── CTA ── */
.cta-section {
  padding: clamp(5rem, 10vw, 9rem) clamp(1.5rem, 5vw, 4rem);
  text-align: center;
  position: relative;
  overflow: hidden;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
}
.cta-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 100%, color-mix(in srgb, var(--teal) 8%, transparent), transparent);
  pointer-events: none;
}
.cta-title {
  font-size: clamp(2.5rem, 6vw, 7rem);
  margin-bottom: 1.25rem;
  position: relative;
}
.cta-body {
  max-width: 520px;
  margin: 0 auto 2.5rem;
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.7;
  position: relative;
}
.btn-group {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
}
.btn {
  font-family: 'Amatic SC', serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.75rem 2rem;
  border: 1px solid;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #0d0d10;
}
.btn-primary:hover { background: color-mix(in srgb, var(--teal) 80%, white); border-color: color-mix(in srgb, var(--teal) 80%, white); text-decoration: none; }
.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-secondary:hover { border-color: var(--text-muted); color: var(--text); text-decoration: none; }

/* ── Footer ── */
footer {
  padding: 2rem clamp(1.5rem, 5vw, 4rem);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: var(--bg);
}
.footer-name {
  font-family: 'Amatic SC', serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.footer-copy {
  font-size: 0.75rem;
  color: var(--text-faint);
}
