/* ── Reset & Base ────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0d1117;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-active: rgba(255, 255, 255, 0.07);
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-dim: #484f58;
  --border: rgba(255, 255, 255, 0.08);

  /* Chart palette */
  --c-agriculture: #66bb6a;
  --c-manufacturing: #42a5f5;
  --c-office: #ffa726;
  --c-datascience: #f06292;
  --c-tech: #64b5f6;
  --c-all: #8b949e;
  --c-positive: #66bb6a;
  --c-negative: #ef5350;
  --c-programmers: #ce93d8;
  --c-security: #4dd0e1;
  --c-software: #42a5f5;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Newsreader', Georgia, serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Hero ────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  position: relative;
}

.hero-inner { max-width: 700px; }

.hero-kicker {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: var(--text-muted);
  line-height: 1.8;
}

.hero-subtitle em {
  color: var(--text);
  font-style: italic;
}

.scroll-cue {
  margin-top: 3rem;
  color: var(--text-dim);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: translateY(0); }
  50% { opacity: 0.8; transform: translateY(4px); }
}

/* ── Act Headers ─────────────────────────────── */
.act-header {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
}

.act-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.act-header h2 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 600;
  color: var(--text);
}

/* ── Scroll Sections ─────────────────────────── */
.scroll-section {
  position: relative;
  display: flex;
  border-top: 1px solid var(--border);
}

.sticky-figure {
  position: sticky;
  top: 0;
  width: 55%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  padding: 2rem;
}

.chart-container {
  width: 100%;
  max-width: 640px;
  height: 70vh;
  max-height: 520px;
  padding-right: 10px;
}

.scroll-section article {
  width: 45%;
  padding: 0 2rem;
}

/* ── Steps ───────────────────────────────────── */
.step {
  min-height: 80vh;
  display: flex;
  align-items: center;
  padding: 2rem 0;
}

.step:first-child { padding-top: 30vh; }
.step:last-child { padding-bottom: 40vh; }

.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  max-width: 400px;
  opacity: 0.2;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease, background 0.5s ease;
}

.step.is-active .step-card {
  opacity: 1;
  transform: translateY(0);
  background: var(--bg-card-active);
}

.step-card p {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 0.8rem;
}

.step-card p:last-child { margin-bottom: 0; }

.step-card strong {
  color: #fff;
  font-weight: 600;
}

.step-card em {
  font-style: italic;
  color: var(--text-muted);
}

.step-card a {
  color: var(--text);
  text-decoration-color: var(--text-dim);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}

.step-card a:hover {
  text-decoration-color: var(--text);
}

.step-outcome {
  color: var(--c-positive) !important;
  font-weight: 500;
  border-left: 3px solid var(--c-positive);
  padding-left: 1rem;
  margin-top: 1rem !important;
}

.step-quote {
  border-left: 3px solid var(--text-dim);
  padding-left: 1rem;
  color: var(--text-muted) !important;
  margin-top: 1rem !important;
}

.step-attribution {
  font-family: var(--font-sans) !important;
  font-size: 0.85rem !important;
  color: var(--text-dim) !important;
}

/* ── Chart Styles ────────────────────────────── */
.chart-container svg {
  overflow: visible;
}

.chart-title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  fill: var(--text);
}

.chart-subtitle {
  font-family: var(--font-sans);
  font-size: 12px;
  fill: var(--text-muted);
}

.axis text {
  font-family: var(--font-sans);
  font-size: 11px;
  fill: var(--text-muted);
}

.axis line,
.axis path {
  stroke: var(--text-dim);
  stroke-width: 0.5;
}

.grid line {
  stroke: var(--border);
  stroke-width: 0.5;
}

.grid path { stroke: none; }

.chart-source {
  font-family: var(--font-sans);
  font-size: 10px;
  fill: var(--text-dim);
}

.annotation-text {
  font-family: var(--font-sans);
  font-size: 11px;
  fill: var(--text-muted);
}

.annotation-value {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
}

.chart-legend {
  font-family: var(--font-sans);
  font-size: 12px;
}

/* ── Prediction Cards ────────────────────────── */
.prediction-card {
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.prediction-label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.prediction-text {
  font-family: var(--font-serif);
  font-size: 14px;
}

.outcome-text {
  font-family: var(--font-serif);
  font-size: 13px;
}

/* ── Coda ────────────────────────────────────── */
.coda {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem 2rem;
  border-top: 1px solid var(--border);
}

.coda-inner {
  max-width: 900px;
  text-align: center;
}

.coda h2 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 3rem;
}

.coda-forces {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  text-align: left;
  margin-bottom: 4rem;
}

.force {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

.force-number {
  display: inline-block;
  width: 32px;
  height: 32px;
  line-height: 32px;
  text-align: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.force h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.force p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.coda-closing {
  max-width: 600px;
  margin: 0 auto;
}

.coda-closing p {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  line-height: 1.9;
  margin-bottom: 1rem;
}

.coda-closing strong { color: #fff; }

/* ── Footer & References ─────────────────────── */
footer {
  padding: 4rem 2rem 3rem;
  border-top: 1px solid var(--border);
}

.references {
  max-width: 800px;
  margin: 0 auto 3rem;
  text-align: left;
}

.references h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  margin-bottom: 2rem;
  text-align: center;
  color: var(--text);
}

.ref-section {
  margin-bottom: 1.5rem;
}

.ref-section h4 {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.ref-section ul {
  list-style: none;
  padding: 0;
}

.ref-section li {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 0.4rem;
  padding-left: 1rem;
  text-indent: -1rem;
}

.ref-section li::before {
  content: "";
}

.ref-section a {
  color: var(--text-muted);
  text-decoration-color: var(--text-dim);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.2s, text-decoration-color 0.2s;
}

.ref-section a:hover {
  color: var(--text);
  text-decoration-color: var(--text);
}

.ref-section em {
  font-style: italic;
}

.footer-note {
  font-size: 0.75rem;
  color: var(--text-dim);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.8;
  text-align: center;
}

/* Coda links */
.force a, .coda-closing a {
  color: var(--text);
  text-decoration-color: var(--text-dim);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}

.force a:hover, .coda-closing a:hover {
  text-decoration-color: var(--text);
}

/* Outcome links */
.step-outcome a {
  color: var(--c-positive);
  text-decoration-color: rgba(102, 187, 106, 0.4);
}

.step-outcome a:hover {
  text-decoration-color: var(--c-positive);
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 900px) {
  .scroll-section {
    flex-direction: column;
  }

  .sticky-figure {
    width: 100%;
    height: 50vh;
    position: sticky;
    top: 0;
    z-index: 1;
  }

  .chart-container {
    max-height: 350px;
    height: 45vh;
  }

  .scroll-section article {
    width: 100%;
    position: relative;
    z-index: 2;
    padding: 0 1rem;
  }

  .step { min-height: 60vh; }
  .step:first-child { padding-top: 10vh; }

  .step-card {
    background: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .coda-forces {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 500px) {
  .step-card { padding: 1.5rem; }
  .step-card p { font-size: 1rem; }
}
