:root {
  --bg: #eef3f9;
  --bg-strong: #e2e9f2;
  --card: #fcfdff;
  --ink: #132031;
  --muted: #42596f;
  --accent: #0f5d7a;
  --accent-2: #1d7f72;
  --border: #ccd8e5;
  --grid: #dde6f0;
  --shadow: 0 14px 30px rgba(15, 37, 63, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Source Sans 3", sans-serif;
  color: var(--ink);
  line-height: 1.5;
  background:
    radial-gradient(circle at 9% 7%, #dce8f8, transparent 45%),
    radial-gradient(circle at 92% 14%, #dcf2ee, transparent 43%),
    linear-gradient(180deg, var(--bg), var(--bg-strong));
}

main {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

.hero {
  text-align: center;
  padding: 2.8rem 1rem 1.8rem;
}

.kicker {
  margin: 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-size: 0.78rem;
}

.hero h1 {
  margin: 0.45rem 0 0.55rem;
  font-size: clamp(2rem, 2.4vw, 2.9rem);
  letter-spacing: -0.03em;
}

.lede {
  margin: 0 auto;
  max-width: 860px;
  color: var(--muted);
  font-size: 1.04rem;
}

.story-wrap {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}

.story-copy {
  display: grid;
  gap: 0.75rem;
  padding-bottom: 0.25rem;
}

.step {
  background: rgba(252, 253, 255, 0.76);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  box-shadow: 0 8px 18px rgba(17, 43, 74, 0.05);
  opacity: 0.46;
  transform: translateX(0);
  transition: opacity 220ms ease, transform 220ms ease, border-color 220ms ease;
  min-height: clamp(210px, 58vh, 520px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  scroll-margin-top: 24vh;
}

.step.is-active {
  opacity: 1;
  border-color: #9cb8d6;
  transform: translateX(4px);
}

.step h2 {
  font-family: "IBM Plex Serif", "Source Serif 4", serif;
  margin: 0 0 0.25rem;
  font-size: 1.08rem;
}

.step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.story-viz {
  position: sticky;
  top: 0.6rem;
  display: grid;
  gap: 1rem;
}

.dashboard-grid {
  margin-top: 1.1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1rem 0.82rem;
  box-shadow: var(--shadow);
}

.card.full {
  grid-column: 1 / -1;
}

.card-head h3 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.015em;
}

.card-head p {
  margin: 0.2rem 0 0.7rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.chip {
  border: 1px solid #afc2d7;
  background: #f3f8ff;
  color: #1b3b58;
  border-radius: 999px;
  font-size: 0.82rem;
  padding: 0.3rem 0.62rem;
  cursor: pointer;
}

.chip.active {
  background: #dff1ff;
  border-color: #5d8dc2;
}

.chart {
  width: 100%;
  min-height: 360px;
}

.chart.medium {
  min-height: 400px;
}

.chart.tall {
  min-height: 500px;
}

.chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.axis text {
  fill: #23364a;
  font-size: 12.5px;
}

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

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

label {
  display: block;
  margin: 0.5rem 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #23364a;
}

select {
  width: 100%;
  border: 1px solid #bdcede;
  border-radius: 10px;
  padding: 0.54rem 0.66rem;
  background: #fff;
  color: var(--ink);
  font-size: 0.94rem;
}

#split-note {
  margin: 0.35rem 0 0.7rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.table-wrap {
  overflow-x: auto;
  max-height: 380px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  border-bottom: 1px solid #d8e2ee;
  text-align: left;
  padding: 0.48rem;
}

th {
  position: sticky;
  top: 0;
  background: #eef4fb;
  z-index: 1;
}

.tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 50;
  padding: 0.5rem 0.62rem;
  border-radius: 8px;
  border: 1px solid #b9cbdd;
  background: rgba(247, 251, 255, 0.96);
  color: #16283d;
  font-size: 0.82rem;
  line-height: 1.35;
  box-shadow: 0 10px 24px rgba(24, 42, 62, 0.2);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.2rem;
}

@media (max-width: 1080px) {
  .story-wrap {
    grid-template-columns: 1fr;
  }

  .story-copy {
    padding-bottom: 0;
  }

  .step {
    min-height: auto;
    display: block;
  }

  .story-viz {
    position: static;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .hero {
    padding-top: 2rem;
  }

  .step {
    opacity: 1;
  }

  .chart {
    min-height: 300px;
  }

  .chart.medium,
  .chart.tall {
    min-height: 320px;
  }
}
