/* ============================================================
   The Foundry — inside a machine
   graphite / brass / furnace orange
   ============================================================ */

:root {
  --graphite: #141618;
  --plate:    #1c1f24;
  --brass:    #c4a056;
  --brass-dk: #8a6230;
  --furnace:  #ff5a12;
  --ember:    #ffb24a;
  --paper:    #f0eadc;
  --ink:      #16181c;

  --font-display: "Big Shoulders Display", sans-serif;
  --font-body:    "Barlow", sans-serif;
  --font-mono:    "Share Tech Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--graphite);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 1.18rem;
  font-weight: 400;
  line-height: 1.55;
  overflow-x: hidden;
}

#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

.progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 40;
  background: rgba(240, 234, 220, 0.08);
}
.progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brass), var(--furnace));
}

.crank {
  position: fixed;
  left: 1.4rem;
  bottom: 1.2rem;
  z-index: 40;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(240, 234, 220, 0.5);
}
.crank #crank-deg { color: var(--brass); }

@media (max-width: 700px) { .crank { display: none; } }

.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(--paper);
}
.chapter-nav i {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1px solid var(--brass);
  background: transparent;
  transition: background 0.3s, transform 0.3s;
  flex: none;
}
.chapter-nav em {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 0.68rem;
  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(--brass); transform: scale(1.35); }

@media (max-width: 900px) { .chapter-nav { display: none; } }

main { position: relative; z-index: 10; }

.chapter { position: relative; }
.chapter--hero      { min-height: 100vh; min-height: 100dvh; }
.chapter--cathedral { min-height: 200vh; }
.chapter--pour      { min-height: 170vh; }
.chapter--chamber   { min-height: 190vh; }

.copy-wrap {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  padding: 0 clamp(1.4rem, 6vw, 6rem);
  pointer-events: none;
}
.copy-wrap a { pointer-events: auto; }

.copy {
  max-width: 34rem;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.88), 0 1px 3px rgba(0, 0, 0, 0.95);
}
.copy--left   { margin-right: auto; }
.copy--right  { margin-left: auto; text-align: right; }
.copy--center { margin: 0 auto; text-align: center; max-width: 44rem; }

.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; }

.kicker {
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 1.2vw, 0.88rem);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 1rem;
}
.chapter--pour .kicker { color: var(--furnace); }

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.6rem, 14vw, 10rem);
  line-height: 0.86;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin-bottom: 1.4rem;
}

.copy h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.1rem, 5vw, 3.6rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin-bottom: 1.1rem;
}

.lede {
  font-size: clamp(1.08rem, 1.7vw, 1.32rem);
  opacity: 0.92;
}
.lede em { color: var(--ember); font-style: italic; }

.cta-row { margin-top: 2.2rem; }
.cta {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper);
  text-decoration: none;
  border: 1px solid var(--brass);
  padding: 0.85rem 1.8rem;
  transition: background 0.3s, color 0.3s;
}
.cta:hover { background: var(--brass); color: var(--graphite); }

/* white chamber — scene goes high-key, type goes ink */
.chapter--chamber .copy {
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
.chapter--chamber .kicker { color: var(--brass-dk); }
.chapter--chamber .lede em { color: var(--furnace); }
.chapter--chamber .cta {
  color: var(--ink);
  border-color: var(--brass-dk);
}
.chapter--chamber .cta:hover {
  background: var(--brass-dk);
  color: var(--paper);
}

body.no-webgl #world { display: none; }
body.no-webgl .chapter--hero {
  background:
    radial-gradient(ellipse at 50% 70%, #3a2414 0%, transparent 55%),
    repeating-linear-gradient(90deg, #1a1d22 0 18px, #15181c 18px 20px),
    var(--graphite);
}
body.no-webgl .chapter--cathedral {
  background:
    radial-gradient(ellipse at 40% 50%, #2a2418 0%, transparent 50%),
    linear-gradient(180deg, #121416, #1a1814);
}
body.no-webgl .chapter--pour {
  background:
    radial-gradient(ellipse at 50% 80%, #ff5a12 0%, #4a1808 38%, #120c0a 72%);
}
body.no-webgl .chapter--chamber {
  background: radial-gradient(ellipse at 50% 40%, #fff8ee 0%, #d8d2c6 70%);
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .copy > * { transition: none; opacity: 1; transform: none; }
}
