:root {
  color-scheme: light;
  --ink: #20242b;
  --muted: #626a73;
  --line: #d7dde4;
  --surface: #ffffff;
  --wash: #f4f7f9;
  --accent: #2f7a67;
  --accent-strong: #1f5d4e;
  --gold: #c28a25;
  --red: #b4514d;
  --blue: #326fa8;
  --text: #20242b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.site-header,
main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 36px 0 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 8px;
  font-size: clamp(1.4rem, 3.5vw, 3rem);
  line-height: 0.95;
  white-space: nowrap;
}

.hook {
  max-width: 680px;
  margin-bottom: 6px;
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--muted);
}

.hook-question {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  margin-right: 0.5rem;
  text-decoration: underline dotted;
  transition: color 120ms ease, text-decoration-style 120ms ease;
}

.hook-question:hover {
  color: var(--accent-strong);
  text-decoration: underline solid;
}

.intro {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.repo-link {
  flex: 0 0 auto;
  border: 1px solid var(--ink);
  border-radius: 6px;
  color: var(--ink);
  padding: 10px 14px;
  font-weight: 750;
  text-decoration: none;
}

.repo-link:hover,
.repo-link:focus-visible {
  background: var(--ink);
  color: white;
}

.explore-questions {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 28px;
}

.explore-label {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.explore-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.explore-pill {
  cursor: pointer;
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  padding: 8px 18px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  transition: background 0.15s, color 0.15s;
}

.explore-pill:hover {
  background: var(--accent);
  color: white;
}

.explore-pill:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.dashboard {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 20px 0 28px;
}

.story-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding: 22px 0 24px;
  border-top: 1px solid var(--line);
}

.story-band p {
  margin: 0;
  border-left: 4px solid var(--accent);
  padding-left: 14px;
  color: var(--muted);
}

.story-band strong {
  color: var(--ink);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 18px;
  margin-bottom: 18px;
}

label,
legend {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

select {
  display: block;
  min-width: min(260px, 100%);
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  padding: 10px 36px 10px 12px;
}

fieldset {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(82px, 1fr));
  gap: 1px;
  margin-top: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
}

.metric-button {
  min-height: 42px;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.metric-button:hover,
.metric-button:focus-visible {
  background: #edf3f0;
}

.metric-button.active {
  background: var(--accent);
  color: white;
}

.viz-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  align-items: stretch;
}

.chart-panel,
.stats-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.chart-panel {
  min-width: 0;
  padding: 18px;
}

.chart-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.chart-heading h2,
.stats-panel h2,
.writeup h2 {
  margin-bottom: 2px;
  font-size: 1.22rem;
}

#chart-subtitle {
  margin-bottom: 0;
  color: var(--muted);
}

output {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 0.86rem;
  font-weight: 750;
  white-space: nowrap;
}

.chart-wrap {
  position: relative;
  min-height: 500px;
}

svg {
  display: block;
  width: 100%;
  height: 500px;
}

.bar {
  fill: var(--accent);
  transition: fill 140ms ease, opacity 140ms ease;
}

.bar-positive {
  fill: var(--accent);
}

.bar-negative {
  fill: var(--red);
}

.bar:hover,
.bar:focus {
  fill: var(--gold);
}

.axis path,
.axis line {
  stroke: var(--line);
}

.axis text,
.bar-label,
.value-label {
  fill: var(--muted);
  font-size: 12px;
}

.bar-label {
  font-weight: 760;
}

.value-label {
  fill: var(--ink);
}

.grid-line {
  stroke: #e8ecef;
  stroke-width: 1;
}

.average-line {
  stroke: var(--blue);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  opacity: 0.75;
}

.average-label,
.divider-label,
.focus-note {
  fill: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.focus-note {
  fill: var(--ink);
  font-style: normal;
  font-weight: 700;
}

.tooltip {
  position: absolute;
  z-index: 3;
  max-width: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgb(31 42 55 / 14%);
  padding: 10px 12px;
  color: var(--ink);
  font-size: 0.92rem;
  pointer-events: none;
}

.tooltip strong {
  display: block;
  margin-bottom: 4px;
}

.stats-panel {
  padding: 18px;
}

.video-section {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 36px 0;
  border-bottom: 1px solid var(--line);
}

.video-copy h2 {
  margin-bottom: 8px;
  font-size: 1.35rem;
}

.video-copy p {
  color: var(--muted);
}

.video-link {
  display: inline-flex;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  padding: 9px 12px;
  font-weight: 750;
  text-decoration: none;
}

.video-link:hover,
.video-link:focus-visible {
  background: var(--accent);
  color: white;
}

.video-frame {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101418;
  aspect-ratio: 16 / 9;
}

.video-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

dl {
  display: grid;
  gap: 14px;
  margin: 14px 0 0;
}

dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 3px 0 0;
  font-size: 1.55rem;
  font-weight: 820;
}

.takeaway {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 64px;
  border-top: 1px solid var(--line);
}

.takeaway-heading {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 20px;
}

.takeaway-body p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text);
  max-width: 720px;
  margin: 0 0 16px;
}

.takeaway-body p:last-child {
  margin-bottom: 0;
}

@media (max-width: 860px) {
  .site-header {
    display: block;
  }

  .repo-link {
    display: inline-flex;
    margin-top: 18px;
  }

  .viz-grid,
  .story-band,
  .video-section,
  .writeup {
    grid-template-columns: 1fr;
  }

  .stats-panel dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .story-band {
    gap: 14px;
  }
}

@media (max-width: 560px) {
  .site-header,
  main {
    width: min(100% - 24px, 1180px);
  }

  .segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  fieldset,
  label,
  select {
    width: 100%;
  }

  .chart-heading {
    display: block;
  }

  output {
    display: inline-block;
    margin-top: 10px;
  }

  .chart-wrap,
  svg {
    min-height: 430px;
    height: 430px;
  }

  .stats-panel dl {
    grid-template-columns: 1fr;
  }
}
