:root {
  color-scheme: light;
  --bg: #f7f8f6;
  --panel: #ffffff;
  --ink: #1f2933;
  --ink-soft: #344054;
  --muted: #667085;
  --line: #d0d5dd;
  --line-soft: #e7e9ec;
  --active: #1f2933;
  --active-ink: #ffffff;
  --focus: #47739f;
  --shadow: 0 16px 40px rgba(31, 41, 51, 0.08);
  --radius: 12px;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-width: 300px;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.page-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 34px 24px 48px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.eyebrow,
.chart-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  text-wrap: pretty;
}

h1 {
  max-width: 830px;
  margin: 5px 0 0;
  font-size: clamp(1.75rem, 3.3vw, 2.75rem);
  font-weight: 770;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.lead {
  max-width: 760px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.1rem);
}

.source-link {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.source-link:hover {
  border-color: var(--ink-soft);
}

.source-link:focus-visible,
.legend-item:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 5px;
}

.controls-card,
.chart-card,
.explanation-card {
  background: var(--panel);
  border: 1px solid rgba(208, 213, 221, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.controls-card {
  margin-bottom: 16px;
  padding: 20px;
}

.chart-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.chart-heading-row > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.chart-heading-row h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 740;
  letter-spacing: -0.012em;
}

.controls-grid {
  display: grid;
  grid-template-columns: 0.82fr 1.2fr 1.2fr;
  gap: 16px;
  margin-top: 0;
}

.control-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.control-group legend {
  margin-bottom: 7px;
  padding: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.segmented {
  display: grid;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(31, 41, 51, 0.04);
}

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

.segmented-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.segmented label {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.15;
  text-align: center;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
  user-select: none;
}

.segmented label:hover {
  background: #f2f4f6;
}

.segmented input:checked + label {
  background: var(--active);
  box-shadow: 0 1px 3px rgba(31, 41, 51, 0.2);
  color: var(--active-ink);
}

.segmented input:focus-visible + label {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.info-control-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.8rem;
}

.checkbox-control {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 680;
}

.checkbox-control input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--active);
  cursor: pointer;
}

.checkbox-control:has(input:disabled) {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.58;
}

.checkbox-control input:disabled {
  cursor: not-allowed;
}

.checkbox-control input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.chart-card {
  padding: 24px 24px 16px;
}

.chart-heading-row {
  align-items: center;
}

.chart-heading-row > div:first-child {
  display: block;
}

.chart-heading-row h2 {
  margin-top: 3px;
  font-size: clamp(1.12rem, 2vw, 1.42rem);
}

.scale-key {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.scale-key strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.scale-line {
  width: 30px;
  height: 1px;
  background: var(--line);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 18px;
  min-height: 33px;
  align-items: center;
  margin: 18px 0 4px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.84rem;
  transition: opacity 180ms ease, color 180ms ease;
}

.legend-item:hover,
.legend-item[aria-pressed="true"] {
  color: var(--ink);
}

.legend-swatch {
  width: 20px;
  height: 3px;
  border-radius: 999px;
  background: var(--series-color);
  box-shadow: 7px 0 0 -5px var(--series-color);
}

.legend-abbrev {
  color: var(--ink);
  font-weight: 760;
}

.context-legend {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.context-legend-swatch {
  width: 20px;
  height: 1px;
  background: #a7afb7;
  opacity: 0.65;
}

.info-legend {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  white-space: nowrap;
}

.info-legend[hidden] {
  display: none;
}

.info-legend-swatch {
  width: 20px;
  height: 10px;
  border: 1px solid rgba(104, 114, 125, 0.72);
  border-radius: 2px;
  background: rgba(146, 155, 165, 0.25);
}

.info-legend strong {
  color: var(--ink);
  font-weight: 760;
}

.chart-wrapper {
  position: relative;
  width: 100%;
}

.chart {
  display: block;
  width: 100%;
  height: clamp(500px, 60vw, 650px);
  overflow: visible;
}

.grid-line {
  stroke: var(--line-soft);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.grid-line.vertical {
  stroke-opacity: 0.62;
}

.tick-label,
.axis-label {
  fill: var(--muted);
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}

.tick-label {
  font-size: 12px;
}

.axis-label {
  fill: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

#axis-layer {
  pointer-events: none;
}

#info-layer {
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

#info-layer.is-visible {
  opacity: 1;
  pointer-events: auto;
}

#info-layer.is-muted-by-target,
#info-layer.is-muted-by-context {
  opacity: 0.14;
}

.info-band {
  fill: #929ba5;
  fill-opacity: 0.24;
  stroke: none;
  cursor: crosshair;
  pointer-events: visiblePainted;
  transition: fill-opacity 120ms ease;
}

.info-boundary {
  fill: none;
  pointer-events: none;
  stroke: #68727d;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-opacity: 0.68;
  stroke-width: 1.15;
  vector-effect: non-scaling-stroke;
}

.info-range-line {
  pointer-events: none;
  stroke: #68727d;
  stroke-opacity: 0.34;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.info-bound-point {
  fill: #ffffff;
  pointer-events: none;
  stroke: #68727d;
  stroke-opacity: 0.88;
  stroke-width: 1.1;
  vector-effect: non-scaling-stroke;
}

.info-target {
  fill: transparent;
  cursor: crosshair;
  outline: none;
  pointer-events: all;
}

#info-layer.is-active .info-band {
  fill-opacity: 0.34;
}

#info-layer.is-active .info-boundary {
  stroke-opacity: 0.95;
  stroke-width: 1.5;
}

#info-layer.is-active .info-bound-point,
.info-point-group:focus-within .info-bound-point {
  stroke: var(--ink);
  stroke-width: 1.7;
}

.series {
  transition: opacity 180ms ease;
}

.context-series {
  transition: opacity 180ms ease;
}

#context-layer.is-muted-by-target:not(.has-active-context) .context-series,
#context-layer.has-active-context .context-series:not(.is-active),
#context-layer.is-muted-by-info .context-series,
#series-layer.is-muted-by-context .series,
#series-layer.is-muted-by-info .series {
  opacity: 0.16;
}

.context-path {
  fill: none;
  pointer-events: none;
  stroke: #929ba5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-opacity: 0.2;
  stroke-width: 0.8;
  transition: stroke 120ms ease, stroke-opacity 120ms ease, stroke-width 120ms ease;
  vector-effect: non-scaling-stroke;
}

.context-series:hover .context-path,
.context-series.is-active .context-path {
  stroke: #68727d;
  stroke-opacity: 0.78;
  stroke-width: 1.45;
}

.context-point {
  fill: #ffffff;
  pointer-events: none;
  stroke: #929ba5;
  stroke-opacity: 0.58;
  stroke-width: 0.85;
  transition: stroke 120ms ease, stroke-opacity 120ms ease, stroke-width 120ms ease;
  vector-effect: non-scaling-stroke;
}

.context-series:hover .context-point,
.context-series.is-active .context-point {
  stroke: #68727d;
  stroke-opacity: 0.95;
  stroke-width: 1.25;
}

.context-target {
  fill: transparent;
  cursor: crosshair;
  outline: none;
  pointer-events: all;
}

.series.is-muted {
  opacity: 0.16;
}

.series-path {
  fill: none;
  pointer-events: none;
  stroke: var(--series-color);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.plot-point {
  fill: var(--series-color);
  pointer-events: none;
  stroke: #ffffff;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
  transition: r 120ms ease;
}

.point-target {
  fill: transparent;
  cursor: crosshair;
  outline: none;
  pointer-events: all;
}

.point-group:hover .plot-point,
.point-group:focus-within .plot-point {
  r: 7;
}

.point-target:focus-visible + .plot-point {
  stroke: var(--ink);
  stroke-width: 3;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  width: min(310px, calc(100% - 16px));
  padding: 11px 12px;
  border: 1px solid rgba(208, 213, 221, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 10px 28px rgba(31, 41, 51, 0.14);
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.36;
  pointer-events: none;
}

.chart-tooltip[hidden] {
  display: none;
}

.tooltip-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.tooltip-heading strong {
  font-size: 0.84rem;
}

.tooltip-heading span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tooltip-university {
  margin: -1px 0 5px;
  color: var(--muted);
  font-size: 0.74rem;
}

.tooltip-value {
  margin: 0;
  color: var(--ink-soft);
}

.tooltip-value strong {
  color: var(--ink);
  font-size: 1.02rem;
  font-variant-numeric: tabular-nums;
}

.tooltip-components {
  display: grid;
  gap: 3px;
  margin: 8px 0 0;
  padding: 7px 0 0;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
}

.tooltip-components div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.tooltip-components span:last-child {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.chart-help {
  margin: -1px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.explanation-card {
  margin-top: 16px;
  padding: 24px;
}

.explanation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.explanation-grid h2 {
  margin: 0 0 7px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 730;
}

.explanation-grid p,
.interpretation {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.info-explanation {
  margin-top: 21px;
  padding: 15px 17px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f7f8f8;
}

.info-explanation[hidden] {
  display: none;
}

.info-explanation h2 {
  margin: 0 0 5px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 730;
}

.info-explanation p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.info-explanation a {
  color: var(--ink-soft);
  font-weight: 650;
  text-underline-offset: 2px;
}

.formula {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px !important;
  color: var(--ink) !important;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.fraction {
  display: inline-grid;
  text-align: center;
}

.fraction span {
  padding: 0 5px;
}

.fraction span:first-child {
  border-bottom: 1px solid var(--ink-soft);
}

.interpretation {
  margin-top: 22px;
  padding-top: 17px;
  border-top: 1px solid var(--line-soft);
}

.interpretation strong {
  color: var(--ink-soft);
}

.footer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px;
  padding: 22px 4px 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.footer p {
  margin: 0;
}

.footer strong {
  color: var(--ink-soft);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.noscript {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 20;
  padding: 12px 16px;
  border: 1px solid #a62d2d;
  border-radius: 8px;
  background: #fff3f3;
  color: #7f1d1d;
  text-align: center;
}

@media (max-width: 900px) {
  .controls-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .footer {
    grid-template-columns: 1fr;
    gap: 9px;
  }
}

@media (max-width: 680px) {
  .page-shell {
    padding: 20px 13px 32px;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
  }

  .controls-card,
  .chart-card,
  .explanation-card {
    border-radius: 10px;
  }

  .controls-card {
    padding: 16px;
  }

  .info-control-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .chart-card {
    padding: 18px 10px 14px;
  }

  .chart-heading-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 0 6px;
  }

  .scale-key {
    align-self: flex-end;
  }

  .legend {
    gap: 3px 12px;
    padding: 0 6px;
  }

  .context-legend {
    margin-left: 0;
  }

  .legend-name {
    display: none;
  }

  .chart {
    height: 510px;
  }

  .chart-help {
    padding: 0 8px;
  }

  .explanation-card {
    padding: 19px 17px;
  }

  .explanation-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 390px) {
  .segmented label {
    padding-inline: 5px;
    font-size: 0.8rem;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}

@media print {
  .page-shell {
    width: 100%;
    padding: 0;
  }

  .source-link,
  .controls-card,
  .chart-help {
    display: none;
  }

  .chart-card,
  .explanation-card {
    border: 1px solid #cccccc;
    box-shadow: none;
  }
}
