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

:root {
  --bg-light: #faf9f6;
  --bg-dark: #1a1a2e;
  --text-light: #2c2c2c;
  --text-dark: #e8e8e8;
  --accent: #e94560;
  --accent-soft: #f2a365;
  --font-body: 'Georgia', 'Times New Roman', serif;
  --font-heading: 'Helvetica Neue', 'Arial', sans-serif;
  --max-width: 1100px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--text-light);
  background: var(--bg-light);
  line-height: 1.7;
  font-size: 17px;
}

h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Hero ──────────────────────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
  padding: 2rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.2;
  margin-bottom: 1rem;
  max-width: 800px;
}

.subtitle {
  font-size: 1.15rem;
  opacity: 0.85;
  max-width: 600px;
  margin: 0 auto 2rem;
}

.scroll-hint {
  font-size: 1.5rem;
  opacity: 0.5;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(10px); }
}

/* ── Sticky Nav ────────────────────────────────────────────────────── */
#sticky-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  gap: 0;
  background: #16213e;
  padding: 0;
  justify-content: center;
  border-bottom: 2px solid var(--accent);
}

.nav-link {
  color: #ccc;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover, .nav-link.active {
  color: #fff;
  background: rgba(233, 69, 96, 0.2);
  text-decoration: none;
}

.nav-link.active { border-bottom: 2px solid var(--accent); }

/* ── Narrative Sections ────────────────────────────────────────────── */
.narrative-section {
  display: flex;
  flex-wrap: wrap;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 5rem 2rem;
  gap: 3rem;
  align-items: flex-start;
}

.narrative-section.dark-bg {
  background: var(--bg-dark);
  color: var(--text-dark);
  max-width: 100%;
  padding-left: calc((100% - var(--max-width)) / 2 + 2rem);
  padding-right: calc((100% - var(--max-width)) / 2 + 2rem);
}

.narrative-section.stacked {
  flex-direction: column;
  align-items: center;
}

.narrative-section.stacked .text-column.full-width {
  text-align: center;
  max-width: 700px;
}

.narrative-section.stacked .viz-column.full-width {
  width: 100%;
  max-width: var(--max-width);
}

.text-column {
  flex: 1 1 350px;
  min-width: 300px;
}

.text-column.full-width { flex: 1 1 100%; }

.text-column h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

.dark-bg .text-column h2 { color: var(--accent-soft); }

.text-column p { margin-bottom: 1rem; }

.viz-column {
  flex: 1 1 450px;
  min-width: 350px;
}

/* ── Chart Containers ──────────────────────────────────────────────── */
.chart-container {
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid rgba(0,0,0,0.08);
}

.dark-bg .chart-container {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.1);
}

.chart-title {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  opacity: 0.7;
}

.chart-caption {
  font-size: 0.8rem;
  opacity: 0.6;
  margin-top: 0.75rem;
  font-style: italic;
}

/* ── Stats Grid ────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.stat-card {
  background: linear-gradient(135deg, #16213e, #0f3460);
  color: #fff;
  border-radius: 12px;
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.stat-number {
  display: block;
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-soft);
  margin-bottom: 0.3rem;
}

.stat-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.7;
}

/* ── Scrollytelling ────────────────────────────────────────────────── */
.scrolly-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  padding: 0;
}

.scrolly-graphic {
  position: sticky;
  top: 60px;
  width: 100%;
  padding: 2rem;
  z-index: 1;
}

.scrolly-text {
  position: relative;
  z-index: 2;
  padding: 0 2rem;
}

.step {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.step p {
  background: rgba(26, 26, 46, 0.92);
  color: var(--text-dark);
  padding: 1.5rem 2rem;
  border-radius: 8px;
  max-width: 380px;
  font-size: 1rem;
  line-height: 1.6;
  border-left: 4px solid var(--accent);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* ── SVG Styles ────────────────────────────────────────────────────── */
svg { width: 100%; display: block; }

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

.axis line, .axis path { stroke: #666; }

.tooltip {
  position: absolute;
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font-heading);
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.15s;
}

/* ── Team Table ────────────────────────────────────────────────────── */
.team-table {
  width: 100%;
  max-width: 450px;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.team-table th, .team-table td {
  padding: 0.6rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

.team-table th {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Footer ────────────────────────────────────────────────────────── */
.site-footer {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: var(--text-dark);
  text-align: center;
  padding: 4rem 2rem 3rem;
  border-top: 2px solid var(--accent);
}

.site-footer h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  color: var(--accent-soft);
  margin-bottom: 1rem;
}

.site-footer p {
  margin-bottom: 1rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.site-footer a { color: var(--accent-soft); }

.site-footer .team-table {
  margin: 1.5rem auto;
  max-width: 450px;
}

.site-footer .team-table th,
.site-footer .team-table td {
  color: var(--text-dark);
  border-bottom-color: rgba(255,255,255,0.12);
  text-align: center;
}

.site-footer .team-table th {
  color: var(--accent-soft);
  opacity: 0.8;
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .narrative-section { padding: 3rem 1rem; gap: 2rem; }
  .stats-grid { grid-template-columns: 1fr; }
  .step p { max-width: 100%; }
  .nav-link { padding: 0.5rem 0.8rem; font-size: 0.75rem; }
}

/* ── Event markers on streamgraph ──────────────────────────────────── */
.event-line {
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  opacity: 0.8;
}

.event-label {
  font-family: var(--font-heading);
  font-size: 10px;
  fill: var(--accent);
  text-anchor: middle;
}
