:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-subtle: #f8f9fb;
  --ink: #18212b;
  --muted: #5c6672;
  --line: #d8dde3;
  --line-strong: #aeb7c2;
  --accent: #1f4e79;
  --accent-dark: #173b5c;
  --accent-soft: #edf3f8;
  --signal: #963b34;
  --positive: #246b57;
  --neutral: #6b675f;
  --radius: 4px;
  --radius-lg: 6px;
  --max: 1280px;
  --font-display: "Source Serif 4", Georgia, serif;
  --font-body: "Source Sans 3", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 94px;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

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

.page-shell {
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 76px;
  padding: 12px 36px;
  border-top: 4px solid var(--accent-dark);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.brand {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  min-width: 214px;
}

.brand-kicker {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.2;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.site-nav::-webkit-scrollbar {
  display: none;
}

.site-nav a {
  position: relative;
  padding: 8px 0;
  color: #3e4955;
  font-size: 0.94rem;
  font-weight: 600;
}

.site-nav a::after {
  position: absolute;
  right: 0;
  bottom: 2px;
  left: 0;
  height: 2px;
  content: "";
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 160ms ease;
}

.site-nav a:hover::after,
.site-nav a:focus-visible::after {
  transform: scaleX(1);
}

main {
  display: block;
}

section {
  position: relative;
  padding: 54px 36px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.explorer,
.research,
.trump-supplement {
  background: var(--surface-subtle);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  gap: 44px;
  padding-top: 62px;
}

.hero-copy {
  min-width: 0;
}

.hero-panel {
  min-width: 0;
  padding-left: 34px;
  border-left: 1px solid var(--line-strong);
}

.eyebrow,
.visitors-eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1,
h2 {
  font-family: var(--font-display);
}

h1 {
  max-width: 720px;
  font-size: 3rem;
  line-height: 1.08;
}

h2 {
  font-size: 2rem;
  line-height: 1.2;
}

h3 {
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.35;
}

.hero-lede,
.section-heading p,
.metric-detail,
.method-card p,
.research-card p,
.citation-card p,
.paper-card p,
.supplement-note,
.supplement-subheading p:last-child,
.site-footer,
#chart-caption,
#trump-chart-caption,
#trump-directed-chart-caption {
  color: var(--muted);
  line-height: 1.65;
}

.hero-lede {
  max-width: 650px;
  margin: 20px 0 0;
  font-size: 1.08rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.button,
.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 700;
  line-height: 1.2;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.button-primary {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #ffffff;
}

.button-primary:hover {
  background: #102f4b;
}

.button-secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--accent-dark);
}

.button-secondary:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.hero-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.hero-paper-citation {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 28px;
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid var(--line-strong);
}

.paper-card,
.citation-card {
  min-width: 0;
}

.paper-card h3,
.citation-card h3 {
  font-family: var(--font-display);
}

.paper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.citation-entry {
  margin-top: 16px;
}

.citation-entry + .citation-entry {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.citation-entry strong {
  display: block;
  margin-bottom: 5px;
  color: #36414c;
  font-size: 0.86rem;
}

.citation-entry p {
  margin: 0;
  font-size: 0.9rem;
}

.citation-entry a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line);
}

.metric-card {
  min-height: 132px;
  padding: 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.metric-card-primary {
  grid-column: 1 / -1;
  min-height: 174px;
  border-top: 3px solid var(--accent);
  background: var(--accent-soft);
}

.metric-card-primary h2 {
  margin-top: 6px;
  font-size: 1.6rem;
}

.metric-label,
.toggle-caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metric-value {
  margin: 12px 0 5px;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.05;
}

.metric-detail {
  margin: 0;
  font-size: 0.9rem;
}

.coverage-band,
.supplement-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.coverage-band > div,
.supplement-band > div {
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.coverage-band > div:last-child,
.supplement-band > div:last-child {
  border-right: 0;
}

.coverage-band span,
.supplement-band span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.coverage-band strong,
.supplement-band strong {
  font-size: 1rem;
  line-height: 1.4;
}

.section-heading {
  max-width: 780px;
  margin-bottom: 28px;
}

.section-heading h2 {
  margin-bottom: 12px;
}

.section-heading p:last-child {
  margin: 0;
}

.signal-board-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 18px;
}

.country-board,
.directed-country-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  gap: 10px;
}

.country-card,
.directed-country-card {
  position: relative;
  min-width: 0;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.country-card::before,
.directed-country-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  content: "";
  background: var(--country-color, var(--accent));
}

.country-card:hover,
.directed-country-card:hover {
  border-color: var(--line-strong);
  background: #fafbfd;
}

.country-card.is-active,
.directed-country-card.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.country-card.is-placeholder {
  border-style: dashed;
}

.country-card.is-placeholder .country-score {
  font-size: 1.35rem;
}

.country-card-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.country-card-heading h3 {
  min-width: 0;
}

.country-flag {
  display: block;
  flex: 0 0 auto;
  width: 26px;
  height: 18px;
  border: 1px solid rgba(24, 33, 43, 0.2);
  border-radius: 2px;
  background: #ffffff;
  object-fit: contain;
}

.country-meta,
.directed-country-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.country-score,
.directed-country-score {
  margin-top: 16px;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.1;
}

.country-tone,
.directed-country-tone {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.9rem;
}

.explorer-shell,
.supplement-shell {
  padding-top: 20px;
  border-top: 1px solid var(--line-strong);
}

.explorer-toolbar,
.supplement-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.toggle-stack {
  display: grid;
  gap: 7px;
}

.tabs,
.series-toggle {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0;
}

.tab-button,
.toggle-button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-right-width: 0;
  border-radius: 0;
  background: var(--surface);
  color: #48535e;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}

.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.country-flag-tab {
  width: 18px;
  height: 12px;
  margin-right: 7px;
  border-radius: 1px;
}

.tab-button:first-child,
.toggle-button:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.tab-button:last-child,
.toggle-button:last-child {
  border-right-width: 1px;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.tab-button:only-child,
.toggle-button:only-child {
  border-radius: var(--radius);
}

.tab-button:hover,
.toggle-button:hover {
  background: #f3f5f7;
}

.tab-button.is-active,
.toggle-button.is-active {
  border-color: var(--accent-dark);
  border-right-width: 1px;
  background: var(--accent-dark);
  color: #ffffff;
}

.tab-button.is-active + .tab-button,
.toggle-button.is-active + .toggle-button {
  border-left-width: 0;
}

.chart-frame {
  margin-top: 20px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.chart {
  min-height: 520px;
}

.chart-compact {
  min-height: 450px;
}

.chart-foot {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.chart-foot p {
  margin: 0;
}

.event-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.event-chip {
  padding: 6px 9px;
  border: 1px solid #dcc8c5;
  border-radius: var(--radius);
  background: #fbf6f5;
  color: #743c37;
  font-size: 0.82rem;
  font-weight: 600;
}

.method-grid,
.research-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line);
}

.method-card,
.research-card {
  min-width: 0;
  padding: 22px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.method-card h3,
.research-card h3 {
  margin-bottom: 10px;
}

.method-card p,
.research-card p {
  margin: 0;
  font-size: 0.95rem;
}

.method-index {
  display: block;
  margin-bottom: 14px;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}

.research-card-teaser {
  border-top: 3px solid var(--accent);
  background: var(--accent-soft);
}

.download-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line);
}

.download-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 96px;
  padding: 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.download-item-wide {
  grid-column: 1 / -1;
}

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

.download-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.download-link {
  flex: 0 0 auto;
  min-width: 100px;
  border-color: var(--accent);
  background: var(--surface);
  color: var(--accent-dark);
}

.download-link:hover {
  background: var(--accent-soft);
}

.download-link-secondary {
  border-color: var(--line-strong);
  color: #4b5661;
}

.download-link.is-disabled {
  border-color: var(--line);
  background: #f1f3f5;
  color: var(--muted);
  cursor: not-allowed;
}

.supplement-band {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 0;
}

.supplement-toolbar {
  margin-top: 18px;
}

.supplement-note {
  max-width: 700px;
  margin: 0;
  font-size: 0.92rem;
}

.trump-metric-grid,
.directed-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line);
}

.directed-metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.supplement-card {
  position: relative;
  min-width: 0;
  min-height: 142px;
  padding: 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.supplement-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  content: "";
}

.supplement-card-tone::before {
  background: var(--signal);
}

.supplement-card-geo::before {
  background: var(--accent);
}

.supplement-card-shock::before {
  background: #343e49;
}

.supplement-card-meta::before {
  background: var(--neutral);
}

.supplement-chart-frame {
  margin-top: 18px;
}

.supplement-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.supplement-subheading {
  max-width: 820px;
  margin: 42px 0 22px;
  padding-top: 28px;
  border-top: 1px solid var(--line-strong);
}

.supplement-subheading h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
}

.directed-shell {
  border-top: 0;
}

.directed-country-board {
  margin-top: 18px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 22px 36px 68px;
  border-top: 3px solid var(--accent-dark);
  background: #eef1f4;
  font-size: 0.88rem;
}

.site-footer p {
  margin: 0;
}

.site-credit {
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
  padding: 10px 36px 22px;
  border: 1px solid var(--line-strong);
  border-top: 0;
  border-radius: 0;
  background: #eef1f4;
  color: #56616c;
  font-size: 0.76rem;
  text-align: right;
}

.site-credit a {
  color: var(--accent-dark);
  font-weight: 600;
}

.site-credit a:hover,
.site-credit a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-visitors {
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
}

.visitors-card {
  display: grid;
  grid-template-columns: 170px 220px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 4px 24px;
  width: 100%;
  padding: 20px 36px;
  border: 1px solid var(--line-strong);
  border-top: 0;
  border-radius: var(--radius);
  background: #ffffff;
}

.visitors-eyebrow {
  grid-column: 1;
  grid-row: 1;
  margin-bottom: 5px;
}

.visitors-title {
  grid-column: 1;
  grid-row: 2;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.25;
}

.visitors-stats {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-self: start;
  margin-top: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.visitor-stat {
  padding: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
}

.visitor-stat-label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.visitor-stat-value {
  display: block;
  font-size: 0.96rem;
  font-weight: 700;
}

.visitors-list {
  grid-column: 3;
  grid-row: 1 / span 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  align-self: start;
  margin-top: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.visitor-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.visitor-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  border: 1px solid #c5d3df;
  border-radius: 2px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.visitor-country {
  min-width: 0;
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visitor-count {
  color: var(--signal);
  font-size: 0.8rem;
  font-weight: 700;
}

.visitors-empty {
  padding: 9px 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.tone-negative,
.signal-hot {
  color: var(--signal);
}

.tone-positive,
.signal-cool {
  color: var(--positive);
}

.tone-neutral {
  color: var(--neutral);
}

.tone-muted {
  color: var(--muted);
}

@media (max-width: 1040px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .site-nav {
    width: 100%;
  }

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

  .hero-panel {
    padding-top: 30px;
    padding-left: 0;
    border-top: 1px solid var(--line-strong);
    border-left: 0;
  }

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

  .supplement-band,
  .trump-metric-grid,
  .directed-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .visitors-card {
    grid-template-columns: 170px minmax(0, 1fr);
  }

  .visitors-stats {
    grid-column: 2;
  }

  .visitors-list {
    grid-column: 1 / -1;
    grid-row: 3;
    margin-top: 12px;
  }
}

@media (max-width: 760px) {
  html {
    scroll-padding-top: 130px;
  }

  .page-shell {
    width: 100%;
    border-right: 0;
    border-left: 0;
  }

  .site-header {
    min-height: 0;
    padding: 10px 18px 12px;
  }

  .site-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    overflow-x: visible;
    padding-bottom: 2px;
    white-space: normal;
  }

  .site-nav a {
    width: max-content;
    padding: 5px 0;
  }

  .site-nav a:nth-child(5) {
    grid-column: 2 / span 2;
  }

  section {
    padding: 38px 18px;
  }

  .hero {
    gap: 30px;
    padding-top: 42px;
  }

  h1 {
    font-size: 2.35rem;
  }

  h2 {
    font-size: 1.7rem;
  }

  .hero-paper-citation,
  .metric-grid,
  .coverage-band,
  .method-grid,
  .research-grid,
  .download-list,
  .supplement-band,
  .trump-metric-grid,
  .directed-metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-card-primary,
  .download-item-wide {
    grid-column: auto;
  }

  .coverage-band > div,
  .supplement-band > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .coverage-band > div:last-child,
  .supplement-band > div:last-child {
    border-bottom: 0;
  }

  .country-board,
  .directed-country-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .explorer-toolbar,
  .supplement-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs,
  .series-toggle {
    display: flex;
  }

  .tab-button,
  .toggle-button {
    flex: 1 1 auto;
    min-width: 0;
    padding: 7px 9px;
    line-height: 1.2;
  }

  .chart {
    min-height: 420px;
  }

  .download-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-footer {
    padding: 20px 18px 32px;
  }

  .site-visitors,
  .site-credit {
    width: 100%;
  }

  .site-credit {
    padding: 10px 18px 20px;
  }

  .visitors-card {
    grid-template-columns: 1fr;
    padding: 18px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .visitors-eyebrow,
  .visitors-title,
  .visitors-stats,
  .visitors-list {
    grid-column: 1;
    grid-row: auto;
  }

  .visitors-stats {
    margin-top: 10px;
  }

  .visitors-list {
    grid-template-columns: 1fr;
    margin-top: 10px;
  }
}

@media (max-width: 440px) {
  .country-board,
  .directed-country-board {
    grid-template-columns: 1fr;
  }
}
