:root {
  --bg: #f4f0e8;
  --paper: #fffcf7;
  --ink: #1c1915;
  --muted: #5e584e;
  --line: #e3d9cc;
  --accent: #1f4d3a;
  --accent-hover: #16382a;
  --chip: #e7efe9;
  --focus: #8c4a2f;
  --shadow: 0 1px 2px rgba(28, 25, 21, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1.05rem;
  line-height: 1.5;
}

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

.skip {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  background: var(--ink);
  color: white;
  padding: 0.4rem 0.7rem;
  z-index: 10;
}
.skip:focus { top: 0.75rem; }

.wrap {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 0.85rem 0;
}

.brand {
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
}

.site-header nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
}

.site-header nav a[aria-current="page"],
.site-header nav a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

main { padding: 1.5rem 0 2.5rem; }

h1, h2, h3 {
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  line-height: 1.2;
  font-weight: 700;
}

h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); margin: 0.2rem 0 0.6rem; }
h2 { font-size: 1.45rem; margin: 1.6rem 0 0.6rem; }
h3 { font-size: 1.15rem; margin: 1.2rem 0 0.4rem; }

.lede p { font-size: 1.08rem; max-width: 42rem; }
.intro { max-width: 42rem; }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
}
.crumbs a { color: var(--muted); }

.nation-grid, .county-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.75rem;
  padding: 0;
  list-style: none;
}

.nation-grid a, .county-grid a, .site-list a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
}

.nation-grid a:hover, .county-grid a:hover, .site-list a:hover { text-decoration: underline; }

.nation-grid li, .county-grid li, .site-list li {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 0.8rem 0.95rem;
}

.nation-grid span, .county-grid span, .meta {
  display: block;
  color: var(--muted);
  font-weight: 450;
  font-size: 0.92rem;
  margin-top: 0.15rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: end;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem;
  margin: 1rem 0;
}

.filters fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: min(100%, 16rem);
}

.filters legend, .filter-search label {
  display: block;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.filters label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0.15rem 0.55rem 0.15rem 0;
  font-size: 0.95rem;
}

.filter-search input[type="search"] {
  width: min(100%, 18rem);
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.filters button {
  font: inherit;
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
}

.filters button:hover { background: var(--accent-hover); }

.count { color: var(--muted); margin-top: 0; }

.map {
  height: min(70vh, 640px);
  min-height: 320px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #d9e2d6;
}

.site-map {
  height: 320px;
  min-height: 240px;
}

.site-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.75rem;
  padding: 0;
  list-style: none;
}

.site-list li[hidden] { display: none; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(17rem, 0.85fr);
  gap: 1.25rem 1.5rem;
  align-items: start;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem 1.15rem;
}

.facts {
  display: grid;
  grid-template-columns: minmax(7.5rem, 11rem) minmax(0, 1fr);
  gap: 0.35rem 0.8rem;
  margin: 0;
}

.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.links, .refs { padding-left: 1.15rem; }
.links li, .refs li { margin: 0.25rem 0; }
.refs { font-size: 0.95rem; }

.popup a { font-weight: 650; }
.popup div { color: #333; font-size: 0.92rem; }

.attribution, .site-footer {
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.2rem 0 2rem;
}

.site-footer a { color: var(--muted); }

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
  margin: 0 0 0.7rem;
}

.footer-nav button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.footer-nav button:hover { color: var(--accent-hover); }

.prose { max-width: 40rem; }
.prose .meta { margin: 0 0 1rem; }
.prose h2 { margin-top: 1.8rem; }
.prose ul { margin: 0.4rem 0 1rem; padding-left: 1.2rem; }
.prose li { margin: 0.3rem 0; }
.prose a { overflow-wrap: anywhere; }

.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  max-height: 70vh;
  overflow: auto;
  background: var(--paper);
  border-top: 1px solid var(--line);
  box-shadow: 0 -1px 2px rgba(28, 25, 21, 0.06);
  padding: 0.9rem 0 calc(0.9rem + env(safe-area-inset-bottom));
}

.cookie-banner[hidden] { display: none; }

.cookie-banner:focus { outline: none; }
.cookie-banner:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

.cookie-banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1.5rem;
}

.cookie-banner-copy { max-width: 42rem; }
.cookie-banner-copy a { white-space: nowrap; }
.cookie-banner-title {
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-weight: 700;
  margin: 0 0 0.2rem;
}
.cookie-banner-copy p { margin: 0; }

.cookie-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cookie-choice {
  font: inherit;
  font-size: 0.95rem;
  min-width: 8.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.9rem;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

.cookie-choice:hover { background: var(--accent-hover); }

body:has(.cookie-banner:not([hidden])) { padding-bottom: 12rem; }

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

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .map { height: 60vh; }
}

@media (max-width: 640px) {
  .cookie-banner-actions { width: 100%; }
  .cookie-choice { flex: 1 1 8.5rem; }
}

@media (max-width: 520px) {
  .facts { grid-template-columns: 1fr; }
  .facts dd { margin-bottom: 0.55rem; }
  body { font-size: 1rem; }
}
