:root {
  --navy: #18372b;
  --navy-2: #355844;
  --ink: #302b25;
  --gold: #9a6f3f;
  --ivory: #f3efe5;
  --paper: #fffdf7;
  --line: #d6cbbb;
  --muted: #6f675d;
  --blue-wash: #e7ece2;
  --shadow: 0 22px 60px rgba(44, 54, 39, 0.12);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--ivory);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button, select { font: inherit; }

.site-header {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(20px, 4vw, 64px);
  background: var(--navy);
  color: white;
  border-bottom: 3px solid var(--gold);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.48);
  color: var(--ivory);
  font: 600 16px/1 Georgia, serif;
  letter-spacing: .08em;
}

.brand-copy { display: grid; text-transform: uppercase; letter-spacing: .12em; }
.brand-copy strong { font: 600 15px/1.3 Georgia, serif; }
.brand-copy small { margin-top: 2px; color: #d9d3c7; font-size: 10px; }
.header-label { color: #e4ded2; font: 14px Georgia, serif; letter-spacing: .08em; }

main { width: min(1500px, 100%); margin: 0 auto; padding: 0 clamp(16px, 3vw, 44px) 64px; }

.intro { padding: clamp(32px, 6vw, 72px) 2px 28px; }
.eyebrow { margin: 0 0 8px; color: var(--gold); font-size: 13px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.intro-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; }
h1, h2, h3 { margin: 0; color: var(--navy); font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
h1 { max-width: 800px; font-size: clamp(40px, 6vw, 76px); line-height: .98; letter-spacing: -.035em; }
.lede { max-width: 700px; margin: 18px 0 0; color: #536170; font-size: clamp(17px, 2vw, 21px); }
.source-stamp { display: grid; min-width: 220px; gap: 5px; padding: 18px 20px; border: 1px solid #254c3b; background: var(--navy); color: white; text-decoration: none; }
.source-stamp span, .source-stamp small { color: #ded7ca; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.source-stamp strong { max-width: 210px; color: white; font: 500 23px/1.08 Georgia, serif; }

.workspace { overflow: hidden; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.controls { display: grid; grid-template-columns: 1fr 1.35fr 1fr; gap: 18px; padding: 24px clamp(18px, 3vw, 36px); background: var(--navy); }
.controls label { display: grid; gap: 7px; color: #dce4eb; font-size: 13px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
select { width: 100%; min-height: 48px; padding: 0 40px 0 13px; border: 1px solid #bac3ca; border-radius: 0; background: white; color: var(--ink); font-size: 16px; }
select:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid #d7b778; outline-offset: 2px; }

.result-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 30px clamp(18px, 3vw, 36px) 24px; border-bottom: 1px solid var(--line); }
.result-heading h2 { font-size: clamp(28px, 4vw, 48px); line-height: 1.05; }
.result-heading p:last-child { margin: 10px 0 0; color: var(--muted); }
.secondary-button, .pagination button { min-height: 44px; padding: 0 18px; border: 1px solid var(--navy); background: transparent; color: var(--navy); font-weight: 750; cursor: pointer; }
.secondary-button:hover, .pagination button:hover:not(:disabled) { background: var(--navy); color: white; }

.chart-panel { padding: 26px clamp(18px, 3vw, 36px) 30px; background: var(--blue-wash); border-bottom: 1px solid var(--line); }
.chart-copy h3 { font-size: clamp(23px, 3vw, 34px); }
.chart { display: grid; gap: 11px; margin-top: 22px; }
.bar-row { display: grid; grid-template-columns: minmax(150px, 250px) 1fr 120px; align-items: center; gap: 12px; }
.bar-label { overflow: hidden; color: var(--navy); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 20px; background: rgba(11,39,69,.1); }
.bar-fill { height: 100%; min-width: 3px; background: linear-gradient(90deg, var(--navy-2), var(--gold)); }
.bar-value { color: var(--navy); font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }

.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 58px; padding: 8px clamp(18px, 3vw, 36px); }
.table-toolbar p { margin: 0; color: var(--muted); }
.page-size { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.page-size select { min-height: 38px; width: 82px; font-size: 14px; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
table { width: 100%; min-width: 960px; border-collapse: collapse; }
th { background: #edf1f3; color: var(--navy); font-size: 13px; text-align: left; text-transform: uppercase; letter-spacing: .04em; }
th button { width: 100%; padding: 14px 12px; border: 0; background: transparent; color: inherit; font-weight: 800; text-align: inherit; cursor: pointer; }
th button span { color: var(--gold); }
td { padding: 13px 12px; border-top: 1px solid #e5e1d9; background: white; font-variant-numeric: tabular-nums; }
tbody tr:nth-child(even) td { background: #fbfaf7; }
tbody tr:hover td { background: #f1f5f7; }
.numeric { text-align: right; }
.county-name { color: var(--navy); font-weight: 720; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 18px; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }
.pagination span { min-width: 92px; color: var(--muted); text-align: center; }

.methodology { margin: 28px 0 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.methodology summary { padding: 18px 2px; color: var(--navy); font-weight: 800; cursor: pointer; }
.methodology div { max-width: 900px; padding: 0 2px 18px; color: var(--muted); }
.methodology p { margin: 0 0 10px; }

footer { display: flex; justify-content: space-between; gap: 28px; padding: 26px clamp(20px, 4vw, 64px); background: var(--navy); color: #dce3e8; font-size: 13px; }

@media (max-width: 760px) {
  .header-label, .source-stamp { display: none; }
  .site-header { min-height: 72px; }
  .intro-row, .result-heading { align-items: stretch; flex-direction: column; }
  .controls { grid-template-columns: 1fr; }
  .secondary-button { width: 100%; }
  .bar-row { grid-template-columns: minmax(110px, 150px) 1fr; }
  .bar-value { grid-column: 2; text-align: left; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: no-preference) {
  .bar-fill { transition: width .35s ease; }
  button, select { transition: background-color .16s ease, color .16s ease, border-color .16s ease; }
}
