/* ============================================================
   The Lord of the Rings — scroll-driven 3D world
   ============================================================ */

:root {
  --dusk:      #39301a;   /* Shire golden dusk                    */
  --wilds:     #1e2530;   /* cold blue of the road east           */
  --dark:      #04060a;   /* Moria black                          */
  --wood:      #0c1c15;   /* Lothlórien deep green                */
  --shadow:    #180705;   /* Mordor red-black                     */
  --silver:    #2a3a4c;   /* Grey Havens                          */
  --parchment: #ece2c8;
  --gold:      #c8a24a;
  --fire:      #d96b2f;

  --font-brand:   "Cinzel Decorative", serif;
  --font-display: "Cinzel", serif;
  --font-body:    "EB Garamond", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--dusk);
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 1.25rem;
  line-height: 1.55;
  overflow-x: hidden;
}

/* ---------- fixed WebGL canvas ---------- */

#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

/* ---------- progress bar ---------- */

.progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 40;
  background: rgba(236, 226, 200, 0.08);
}
.progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--fire));
}

/* ---------- chapter nav ---------- */

.chapter-nav {
  position: fixed;
  right: 1.4rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.chapter-nav a {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--parchment);
}
.chapter-nav i {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: transparent;
  transition: background 0.3s, transform 0.3s;
  flex: none;
}
.chapter-nav em {
  font-family: var(--font-display);
  font-style: normal;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
}
.chapter-nav a:hover em,
.chapter-nav a.active em { opacity: 0.9; transform: none; }
.chapter-nav a.active i { background: var(--gold); transform: scale(1.35); }

@media (max-width: 900px) { .chapter-nav { display: none; } }

/* ---------- chapters ---------- */

main { position: relative; z-index: 10; }

.chapter { position: relative; }
.chapter--hero   { min-height: 100vh; min-height: 100dvh; }
.chapter--road   { min-height: 200vh; }
.chapter--moria  { min-height: 220vh; }
.chapter--lorien { min-height: 160vh; }
.chapter--mordor { min-height: 200vh; }
.chapter--havens { min-height: 200vh; }

.copy-wrap {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  padding: 0 clamp(1.4rem, 6vw, 6rem);
}

.copy {
  max-width: 34rem;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.85), 0 1px 3px rgba(0, 0, 0, 0.9);
}
.copy--left   { margin-right: auto; }
.copy--right  { margin-left: auto; text-align: right; }
.copy--center { margin: 0 auto; text-align: center; max-width: 46rem; }

/* reveal */
.copy > * {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
.copy > *:nth-child(2) { transition-delay: 0.12s; }
.copy > *:nth-child(3) { transition-delay: 0.24s; }
.copy > *:nth-child(4) { transition-delay: 0.36s; }
.is-inview .copy > * { opacity: 1; transform: none; }

/* type */
.kicker {
  font-family: var(--font-display);
  font-size: clamp(0.78rem, 1.3vw, 0.95rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.1rem;
}
.brand {
  font-family: var(--font-brand);
  font-weight: 400;
  font-size: clamp(2.6rem, 9vw, 6.6rem);
  line-height: 1.02;
  letter-spacing: 0.03em;
  margin-bottom: 1.4rem;
}
.copy h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.9rem, 4.2vw, 3.1rem);
  line-height: 1.12;
  margin-bottom: 1.1rem;
}
.lede {
  font-size: clamp(1.1rem, 1.7vw, 1.35rem);
  opacity: 0.92;
}
.lede em { color: var(--gold); font-style: italic; }

.cta-row { margin-top: 2.2rem; }
.cta {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--parchment);
  text-decoration: none;
  border: 1px solid var(--gold);
  padding: 0.9rem 2.1rem;
  transition: background 0.3s, color 0.3s;
}
.cta:hover { background: var(--gold); color: #1d1608; }

/* ---------- no-WebGL fallback ---------- */

body.no-webgl #world { display: none; }
body.no-webgl .chapter--hero   { background: radial-gradient(ellipse at 50% 100%, #6b5a2a 0%, var(--dusk) 62%); }
body.no-webgl .chapter--road   { background: radial-gradient(ellipse at 50% 55%, #35405a 0%, var(--wilds) 70%); }
body.no-webgl .chapter--moria  { background: radial-gradient(ellipse at 50% 45%, #10161f 0%, var(--dark) 70%); }
body.no-webgl .chapter--lorien { background: radial-gradient(ellipse at 50% 30%, #3a4a1f 0%, var(--wood) 70%); }
body.no-webgl .chapter--mordor { background: radial-gradient(ellipse at 60% 60%, #4a1408 0%, var(--shadow) 70%); }
body.no-webgl .chapter--havens { background: radial-gradient(ellipse at 50% 60%, #4a5d73 0%, var(--silver) 70%); }

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .copy > * { transition: none; opacity: 1; transform: none; }
}
