:root {
  --ink: #171a1f;
  --muted: #5d6573;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --line: #d8d4ca;
  --teal: #167c80;
  --blue: #3066be;
  --rust: #b24b32;
  --gold: #b98718;
  --plum: #6e4a8e;
  --green: #4d7b3f;
  --pink: #b04473;
  --shadow: 0 12px 28px rgba(23, 26, 31, 0.09);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(48, 102, 190, 0.28);
  outline-offset: 2px;
}

.shell {
  min-height: 100vh;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
  gap: 32px;
  align-items: end;
  padding: 42px 44px 24px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(22, 124, 128, 0.09), transparent 35%),
    linear-gradient(180deg, #ffffff, var(--paper));
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 980px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 5.15rem;
  line-height: 0.98;
  letter-spacing: 0;
}

.lede {
  max-width: 760px;
  margin: 20px 0 0;
  color: #343943;
  font-size: 1.18rem;
  line-height: 1.55;
}

.decision-card {
  display: grid;
  gap: 18px;
  align-self: stretch;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.lens-thesis {
  margin: 12px 0 0;
  color: #343943;
  font-size: 0.94rem;
  line-height: 1.45;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.hero-metrics div {
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.hero-metrics strong {
  display: block;
  font-size: 2.25rem;
  line-height: 1;
}

.hero-metrics span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.journey,
.map-intro {
  padding: 34px 44px;
  border-top: 1px solid var(--line);
}

.journey {
  background:
    linear-gradient(180deg, #f6f3ec, var(--paper));
}

.journey-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  gap: 28px;
  align-items: end;
}

.journey-intro h2,
.map-intro h2 {
  max-width: 960px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.6rem;
  line-height: 1.08;
  letter-spacing: 0;
}

.journey-intro p,
.map-intro p {
  margin: 0;
  color: #3a404a;
  font-size: 1rem;
  line-height: 1.55;
}

.pandemic-compare {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 26px;
}

.pandemic-card {
  display: grid;
  gap: 10px;
  min-height: 238px;
  padding: 15px;
  border-radius: 8px;
  text-align: left;
  background: white;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.pandemic-card:hover,
.pandemic-card.active {
  border-color: var(--ink);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.card-top {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 24px;
}

.relation-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 900;
}

.card-count {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.55rem;
  line-height: 0.95;
}

.card-copy,
.card-cue,
.card-top-book {
  color: #3a404a;
  font-size: 0.82rem;
  line-height: 1.35;
}

.card-cue,
.card-top-book {
  color: var(--muted);
  font-weight: 750;
}

.mini-score {
  display: grid;
  grid-template-columns: 54px 1fr 30px;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.mini-track {
  height: 6px;
  border-radius: 999px;
  background: #ece7dd;
  overflow: hidden;
}

.mini-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.chapter-tabs {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.chapter-tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.chapter-tab.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.chapter-card {
  margin-top: 18px;
  padding: 22px 0 6px;
  border-top: 1px solid var(--line);
}

.chapter-card h3 {
  max-width: 900px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  line-height: 1.12;
  letter-spacing: 0;
}

.chapter-card > p:not(.eyebrow) {
  max-width: 920px;
  margin: 12px 0 0;
  color: #343943;
  font-size: 1.02rem;
  line-height: 1.58;
}

.spotlight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.spotlight-item {
  min-height: 160px;
  padding: 16px 16px 10px;
  border-left: 1px solid var(--line);
}

.spotlight-item:first-child {
  border-left: 0;
}

.spotlight-label {
  display: block;
  margin-bottom: 8px;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.spotlight-item strong {
  display: block;
  font-size: 1rem;
  line-height: 1.25;
}

.spotlight-item span:not(.spotlight-label) {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
}

.spotlight-item p {
  margin: 10px 0 0;
  color: #343943;
  font-size: 0.84rem;
  line-height: 1.45;
}

.signal-matrix {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}

.signal-cell {
  min-height: 156px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.signal-cell span,
.signal-cell em {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 850;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.signal-cell strong {
  display: block;
  margin-top: 8px;
  font-size: 0.96rem;
  line-height: 1.25;
}

.signal-cell em {
  margin-top: 7px;
  color: var(--teal);
}

.signal-cell p {
  margin: 10px 0 0;
  color: #3a404a;
  font-size: 0.82rem;
  line-height: 1.42;
}

.map-intro {
  background: #fffdfa;
}

.map-intro h2 {
  max-width: 760px;
}

.map-intro p {
  max-width: 680px;
  margin-top: 10px;
}

.workbench {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr) 320px;
  gap: 16px;
  min-height: 760px;
  padding: 16px 20px 30px;
}

.control-panel,
.detail-panel,
.graph-stage {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.control-panel,
.detail-panel {
  align-self: start;
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.control-group,
.detail-panel section {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.control-group:last-child,
.detail-panel section:last-child {
  border-bottom: 0;
}

.control-group h2,
.detail-panel h2,
.graph-toolbar h2 {
  margin: 0 0 10px;
  font-size: 0.98rem;
  line-height: 1.25;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.segmented.vertical {
  grid-template-columns: 1fr;
}

.seg {
  min-height: 38px;
  padding: 8px 9px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.seg.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.range-row {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

input[type="search"],
select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: white;
}

.graph-stage {
  min-width: 0;
  overflow: hidden;
}

.graph-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  min-height: 80px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.graph-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

#resetSelection,
#downloadCsv {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 7px;
  font-weight: 800;
}

#graphSvg {
  display: block;
  width: 100%;
  height: 680px;
  background:
    linear-gradient(rgba(23, 26, 31, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 26, 31, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
}

.edge {
  stroke: rgba(93, 101, 115, 0.2);
  stroke-linecap: round;
}

.node circle {
  stroke: white;
  stroke-width: 2;
  transition: stroke-width 140ms ease, opacity 140ms ease;
}

.node text {
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 4px;
  stroke-linejoin: round;
  fill: var(--ink);
  font-size: 11px;
  font-weight: 750;
}

.node.muted,
.edge.muted {
  opacity: 0.16;
}

.node.active circle {
  stroke: var(--ink);
  stroke-width: 3;
}

.selected-detail p:not(.eyebrow),
.combo-result,
.detail-panel section > p:not(.eyebrow) {
  margin: 0;
  color: #3a404a;
  font-size: 0.92rem;
  line-height: 1.5;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8f6f0;
  color: #333943;
  font-size: 0.76rem;
  font-weight: 750;
}

.tag.buttonish {
  border-color: rgba(22, 124, 128, 0.35);
  color: var(--teal);
}

.tag.buttonish.active {
  border-color: var(--teal);
  background: rgba(22, 124, 128, 0.12);
  color: #0d4f52;
}

.rank-list {
  display: grid;
  gap: 9px;
}

.rank-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(216, 212, 202, 0.7);
}

.rank-item:last-child {
  border-bottom: 0;
}

.rank-num {
  color: var(--gold);
  font-weight: 900;
}

.rank-title {
  font-size: 0.86rem;
  font-weight: 850;
  line-height: 1.25;
}

.rank-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.75rem;
}

.score-pill {
  min-width: 44px;
  padding: 4px 7px;
  border-radius: 999px;
  background: #eef4f4;
  color: var(--teal);
  text-align: center;
  font-size: 0.77rem;
  font-weight: 900;
}

.muted-text {
  color: var(--muted);
  font-size: 0.78rem;
}

.talk,
.pandemic-brief,
.schematics,
.table-section,
.sources {
  padding: 34px 44px;
  border-top: 1px solid var(--line);
}

.talk h2,
.pandemic-brief h2,
.schematics h2,
.table-section h2,
.sources h2 {
  max-width: 920px;
  margin: 0 0 20px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.65rem;
  line-height: 1.06;
  letter-spacing: 0;
}

.talk-grid,
.schematic-grid,
.source-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.talk article,
.schematic,
.source-item {
  min-height: 160px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.talk h3,
.schematic h3,
.source-item h3 {
  margin: 0 0 9px;
  font-size: 1rem;
  line-height: 1.28;
}

.talk p,
.schematic p,
.source-item p,
.brief-columns p {
  margin: 0;
  color: #3a404a;
  line-height: 1.58;
}

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

.schematic .combo {
  margin: 10px 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.table-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

table {
  width: 100%;
  min-width: 1060px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(216, 212, 202, 0.78);
  text-align: left;
  vertical-align: top;
  font-size: 0.86rem;
  line-height: 1.45;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f1ea;
  color: #323741;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

td strong {
  display: block;
  margin-bottom: 3px;
}

.score-bars {
  display: grid;
  gap: 5px;
  min-width: 130px;
}

.score-bar {
  display: grid;
  grid-template-columns: 26px 1fr 28px;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.bar-track {
  height: 6px;
  border-radius: 999px;
  background: #ece7dd;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

@media (max-width: 1180px) {
  .hero h1 {
    font-size: 4rem;
  }

  .pandemic-compare,
  .spotlight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .spotlight-item:nth-child(odd) {
    border-left: 0;
  }

  .workbench {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .detail-panel {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .detail-panel section {
    border-bottom: 0;
    border-right: 1px solid var(--line);
  }

  .detail-panel section:last-child {
    border-right: 0;
  }
}

@media (max-width: 820px) {
  .hero {
    padding: 32px 24px 22px;
  }

  .hero h1 {
    font-size: 3.1rem;
  }

  .lede {
    font-size: 1.04rem;
  }

  .hero-metrics strong {
    font-size: 2rem;
  }

  .talk,
  .pandemic-brief,
  .journey,
  .map-intro,
  .schematics,
  .table-section,
  .sources {
    padding: 30px 24px;
  }

  .talk h2,
  .pandemic-brief h2,
  .journey-intro h2,
  .map-intro h2,
  .schematics h2,
  .table-section h2,
  .sources h2 {
    font-size: 2.2rem;
  }

  .hero,
  .journey-intro,
  .brief-columns,
  .talk-grid,
  .schematic-grid,
  .source-list {
    grid-template-columns: 1fr;
  }

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

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

  .control-panel,
  .detail-panel {
    position: static;
    max-height: none;
  }

  .detail-panel {
    display: block;
  }

  .detail-panel section {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  #graphSvg {
    height: 560px;
  }
}

@media (max-width: 560px) {
  .hero {
    padding: 28px 16px 20px;
  }

  .hero h1 {
    font-size: 2.35rem;
  }

  .workbench {
    padding: 14px 12px 24px;
  }

  .talk,
  .pandemic-brief,
  .journey,
  .map-intro,
  .schematics,
  .table-section,
  .sources {
    padding: 28px 16px;
  }

  .talk h2,
  .pandemic-brief h2,
  .journey-intro h2,
  .map-intro h2,
  .schematics h2,
  .table-section h2,
  .sources h2 {
    font-size: 1.9rem;
  }

  .pandemic-compare,
  .spotlight-grid,
  .signal-matrix {
    grid-template-columns: 1fr;
  }

  .spotlight-item,
  .spotlight-item:nth-child(odd) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .spotlight-item:first-child {
    border-top: 0;
  }

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

  .hero-metrics div {
    min-height: 88px;
    padding: 12px 10px;
  }

  .hero-metrics strong {
    font-size: 1.82rem;
  }

  .hero-metrics span {
    font-size: 0.72rem;
  }

  .graph-toolbar,
  .table-heading {
    align-items: stretch;
    flex-direction: column;
  }

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

  #graphSvg {
    height: 500px;
  }
}
