/* Colors are defined once here. Dark values follow the visitor's system setting
   unless the theme button has picked one (data-theme on <html>). */
:root {
  color-scheme: light dark;
  --bg: #f6f6f3;
  --surface: #ffffff;
  --ink: #15171c;
  --ink-2: #4f5460;
  --ink-3: #6f747f;
  --line: #e7e6e1;
  --line-2: #d3d2cb;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-wash: #edf4fd;
  --series-1: #2a78d6;  /* salary as paid, and "this person" */
  --series-2: #eb6834;  /* inflation-adjusted */
  --dot: #a7aebb;
  --box-fill: rgba(21, 23, 28, 0.07);
  --shadow: 0 1px 2px rgba(20, 22, 28, 0.05), 0 10px 28px rgba(20, 22, 28, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101112;
    --surface: #1a1a19;
    --ink: #f3f3f1;
    --ink-2: #c3c2b7;
    --ink-3: #96958d;
    --line: #2c2c2a;
    --line-2: #40403c;
    --accent: #3987e5;
    --accent-ink: #86b6ef;
    --accent-wash: #1b2738;
    --series-1: #3987e5;
    --series-2: #d95926;
    --dot: #5f646e;
    --box-fill: rgba(255, 255, 255, 0.08);
    --shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  }
}

/* The theme button sets data-theme to override the system setting. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101112;
  --surface: #1a1a19;
  --ink: #f3f3f1;
  --ink-2: #c3c2b7;
  --ink-3: #96958d;
  --line: #2c2c2a;
  --line-2: #40403c;
  --accent: #3987e5;
  --accent-ink: #86b6ef;
  --accent-wash: #1b2738;
  --series-1: #3987e5;
  --series-2: #d95926;
  --dot: #5f646e;
  --box-fill: rgba(255, 255, 255, 0.08);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

a { color: var(--accent-ink); }
h1, h2, p { margin: 0; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

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

/* Header */

.site-header { padding: 36px 0 22px; }
.site-header .wrap { position: relative; }

/* Light/dark button, top right */
.theme-toggle {
  position: absolute;
  top: 0;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 6px;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle:active { transform: translateY(1px); }
.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: inline; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}
:root[data-theme="dark"] .icon-sun { display: inline; }
:root[data-theme="dark"] .icon-moon { display: none; }
.brand {
  display: inline-block;
  color: var(--ink);
  font-size: 1.625rem;
  line-height: 1.2;
  text-decoration: none;
}
.tagline { margin-top: 10px; color: var(--ink-2); max-width: 46em; }
.tagline-source { font-style: italic; }

/* Headings: Georgia, regular weight */
.brand, h1, h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: 0;
}

/* Filters */

.controls {
  display: grid;
  grid-template-columns: minmax(200px, 280px) minmax(0, 1fr) 130px;
  grid-template-areas: "org name year";
  gap: 12px;
  margin-bottom: 28px;
}
.field-org { grid-area: org; }
.field-name { grid-area: name; }
.field-year { grid-area: year; }
.field { min-width: 0; }
.field label {
  display: block;
  margin-bottom: 5px;
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 600;
}

select, input[type="search"] {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background-color: var(--surface);
  color: var(--ink);
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
}
select {
  padding-right: 34px;
  text-overflow: ellipsis;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-2) 50%),
    linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
select:disabled { opacity: 0.5; }
input::placeholder { color: var(--ink-3); }
select:focus-visible, input:focus-visible { outline-offset: 0; border-color: var(--accent); }

/* Name suggestions */

.combo { position: relative; }
.suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: min(70vh, 520px);
  overflow-y: auto;
}
.suggestion {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.suggestion[aria-selected="true"] { background: var(--accent-wash); }
.sug-main { flex: 1; min-width: 0; }
.sug-name { display: block; font-weight: 600; }
.sug-sub {
  display: block;
  overflow: hidden;
  color: var(--ink-3);
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sug-side { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sug-year { display: block; color: var(--ink-3); font-size: 0.8125rem; }
.sug-all, .sug-none { color: var(--ink-2); font-size: 0.875rem; }
.sug-none { cursor: default; }

/* Shared pieces */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.muted { color: var(--ink-3); }
.job {
  color: var(--ink-2);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag {
  margin-left: 6px;
  color: var(--ink-3);
  font-size: 0.75rem;
}
#view { transition: opacity 0.15s; }
#view.loading { opacity: 0.5; }
.message { padding: 56px 20px; text-align: center; color: var(--ink-2); }

/* The list */

.list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 20px;
  margin-bottom: 14px;
}
.list-head h1 { font-size: 1.375rem; }
.list-head p { margin-top: 2px; color: var(--ink-2); font-size: 0.9375rem; }

table { width: 100%; border-collapse: collapse; }
th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink-3);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
th.num { text-align: right; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: baseline; }
tbody tr:last-child td { border-bottom: 0; }

.people tbody tr { cursor: pointer; }
.people tbody tr:hover { background: var(--accent-wash); }
.people .rank { width: 1%; color: var(--ink-3); }
.people a { color: var(--ink); font-weight: 600; text-decoration: none; }
.people a:hover { color: var(--accent-ink); text-decoration: underline; }
.people .under { display: none; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
  color: var(--ink-2);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}
.button {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.button:hover { border-color: var(--ink-3); }
.button[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

/* One person */

.back { display: inline-block; margin-bottom: 14px; font-size: 0.9375rem; text-decoration: none; }
.back:hover { text-decoration: underline; }
.person-head h1 { font-size: 2rem; line-height: 1.15; }
.person-head .where { margin-top: 6px; color: var(--ink-2); }
.person-head .recorded { margin-top: 2px; color: var(--ink-3); font-size: 0.8125rem; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.tile { padding: 16px 18px; }
.tile-label { color: var(--ink-2); font-size: 0.8125rem; font-weight: 600; }
.tile-value { margin-top: 2px; font-size: 1.75rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }
.tile-note { color: var(--ink-3); font-size: 0.8125rem; }

.panel { margin-top: 16px; padding: 20px 22px 22px; }
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 20px;
  margin-bottom: 10px;
}
.panel h2 { font-size: 1.125rem; }
.panel .lede { margin-bottom: 12px; color: var(--ink-2); max-width: 52em; }
.panel .note { margin-top: 12px; color: var(--ink-3); font-size: 0.8125rem; max-width: 60em; }
.panel table { margin-top: 14px; font-size: 0.9375rem; }
.panel th:first-child, .panel td:first-child { padding-left: 0; }
.panel th:last-child, .panel td:last-child { padding-right: 0; }
.panel th { white-space: normal; vertical-align: bottom; }
.scroll-x { overflow-x: auto; }

.panel-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.pick { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 0.875rem; white-space: nowrap; }
.pick select { width: auto; height: 34px; font-size: 0.875rem; }
.segmented {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: 9px;
}
.segmented button {
  height: 32px;
  padding: 0 12px;
  border: 0;
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}
.segmented button + button { border-left: 1px solid var(--line-2); }
.segmented button[aria-pressed="true"] { background: var(--accent-wash); color: var(--accent-ink); }
.segmented button:focus-visible { outline-offset: -2px; }

/* Partial-year notice above the salary chart. */
.notice {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg);
  font-size: 0.875rem;
}
.notice .option + .option { margin-top: 10px; }
.notice label { display: flex; align-items: flex-start; gap: 9px; font-weight: 600; cursor: pointer; }
.notice input { flex: none; width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--accent); }
.notice p { margin: 1px 0 0 25px; color: var(--ink-2); max-width: 60em; }
tr.excluded td { color: var(--ink-3); }

.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--ink-2); font-size: 0.8125rem; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend svg { flex: none; }

.namesakes { margin: 10px 0 0; padding: 0; list-style: none; }
.namesakes li { padding: 9px 0; border-top: 1px solid var(--line); }
.namesakes a { font-weight: 600; text-decoration: none; }
.namesakes a:hover { text-decoration: underline; }
.namesakes .job { margin-left: 8px; }

/* Charts */

.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; touch-action: pan-y; }
.chart svg:focus-visible { outline-offset: 6px; border-radius: 4px; }
.chart text { fill: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--line-2); stroke-width: 1; }
.chart .hit { fill: transparent; }

.line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.line.paid, .key-line.paid { stroke: var(--series-1); }
.line.real, .key-line.real { stroke: var(--series-2); }
.key-line { stroke-width: 2; stroke-linecap: round; }
/* Markers wear a ring in the surface color so they stay legible where lines cross. */
.marker { stroke: var(--surface); stroke-width: 2; }
.marker.paid { fill: var(--series-1); }
.marker.real { fill: var(--surface); stroke: var(--series-2); }
.crosshair { stroke: var(--line-2); stroke-width: 1; }

.strip-dot { fill: var(--dot); }
.box { fill: var(--box-fill); stroke: var(--ink-2); stroke-width: 1.5; }
.whisker { stroke: var(--ink-2); stroke-width: 1.5; stroke-linecap: round; }
.whisker.arrow { fill: none; stroke-linejoin: round; }
.median { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.you-line { stroke: var(--series-1); stroke-width: 1.5; }
.you-dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart text.row-label { fill: var(--ink-2); font-size: 13px; }
.chart text.you-label { fill: var(--ink); font-size: 13px; font-weight: 600; }
/* A halo in the surface color keeps labels readable where the person's line passes behind them. */
.chart text.row-label, .chart text.you-label, .chart text.edge-label {
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 5px;
  stroke-linejoin: round;
}

.tooltip {
  position: fixed;
  z-index: 50;
  max-width: 280px;
  padding: 9px 11px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.8125rem;
  pointer-events: none;
}
.tip-head { margin-bottom: 4px; color: var(--ink-2); }
.tip-head strong { color: var(--ink); }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-row .label { flex: 1; color: var(--ink-2); }
.tip-row .value { font-weight: 650; font-variant-numeric: tabular-nums; }
.tip-key { width: 12px; height: 2px; border-radius: 1px; }
.tip-key.paid { background: var(--series-1); }
.tip-key.real { background: var(--series-2); }

/* Footer */

.site-footer {
  margin-top: 48px;
  padding-top: 22px;
  padding-bottom: 56px;
  border-top: 1px solid var(--line-2);
  color: var(--ink-3);
  font-size: 0.8125rem;
}
.site-footer p { max-width: 62em; }
.site-footer p + p { margin-top: 8px; }
.site-footer strong { color: var(--ink-2); font-weight: 600; }

/* Narrow screens: stack the filters and fold job and institution under the name. */
@media (max-width: 720px) {
  .site-header { padding: 24px 0 18px; }
  /* No room beside the title: give the button its own row above it. */
  .theme-toggle { position: static; width: fit-content; margin: -10px -6px 4px auto; }
  .controls {
    grid-template-columns: minmax(0, 1fr) 110px;
    grid-template-areas: "org year" "name name";
  }
  .people .rank, .people .col-job, .people .col-org { display: none; }
  .people .under { display: block; margin-top: 1px; color: var(--ink-3); font-size: 0.8125rem; }
  th, td { padding-left: 12px; padding-right: 12px; }
  .person-head h1 { font-size: 1.625rem; }
  .panel { padding: 16px 14px 18px; }
  .panel table { font-size: 0.8125rem; }
  .panel th, .panel td { padding: 8px 5px; }
  .panel th { letter-spacing: 0.02em; }
  .panel .job { font-size: 0.75rem; letter-spacing: 0; }
  .panel td .tag { display: block; margin-left: 0; }
  .tile-value { font-size: 1.5rem; }
}
