:root {
  --nav: #024c51; /* the logo's background teal */
  --green: #045c61;
  --green-dark: #033f43;
  --link: #0a6a70;
  --ink: #1b2a22;
  --muted: #647268;
  --panel: #eaeeec;
  --card: #ffffff;
  --card-soft: #f1f7f4;
  --border: #e5eae7;
  --shadow: 0 1px 3px rgba(20, 40, 30, 0.06), 0 6px 20px rgba(20, 40, 30, 0.05);
  --sans: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

/* ── Top navigation ─────────────────────────── */
.topnav {
  position: relative;
  background: var(--nav);
  color: #fff;
}

.nav-toggle {
  display: none;
  position: relative;
  width: 38px;
  height: 38px;
  margin-left: auto;
  padding: 0;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
}

/* Both Ogham glyphs stack on top of each other and cross-fade with a rotate,
   driven by aria-expanded (set by nav.js). */
.nav-toggle svg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%);
  transition: opacity 0.25s ease, transform 0.3s ease;
}

.nav-toggle .ogham-close {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-90deg);
}

.nav-toggle[aria-expanded="true"] .ogham-menu {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(90deg);
}

.nav-toggle[aria-expanded="true"] .ogham-close {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg);
}

.topnav-inner {
  display: flex;
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
}

.brand-logo {
  display: block;
  height: 50px;
  width: auto;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-size: 19px;
  font-weight: 700;
}

.brand-tag {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: auto;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 15px;
}

.nav-links a:hover,
.nav-links a.active {
  color: #fff;
  text-decoration: underline;
}

.nav-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
}


body {
  margin: 0;
  font-family: var(--sans);
  background: #ffffff;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 32px 24px;
}

/* ── Masthead ───────────────────────────────── */
.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 32px;
}

.masthead-text {
  max-width: 620px;
}

h1 {
  margin: 0 0 16px;
  font-family: var(--sans);
  font-size: 46px;
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.lead {
  margin: 0;
  font-size: 17px;
  line-height: 1.5;
  color: var(--muted);
}

.about-card {
  flex: 0 0 320px;
  padding: 22px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.about-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 700;
  color: var(--green);
}

.about-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--card-soft);
}

.about-icon svg {
  width: 20px;
  height: 20px;
  fill: var(--green);
}

.about-card p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.about-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--link);
  text-decoration: none;
}

.about-link:hover {
  text-decoration: underline;
}

/* ── Toolbar ────────────────────────────────── */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#play-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

#play-button:hover {
  background: var(--green-dark);
}

#play-button:focus {
  outline: none;
}

#play-button:focus-visible {
  outline: 2px solid var(--green-dark);
  outline-offset: 2px;
}

.btn-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.toolbar label {
  font-size: 14px;
  color: var(--muted);
}

#year-select {
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

/* ── Explorer (map + sidebar) ───────────────── */
.explorer {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.map-panel {
  position: relative;
  background: var(--panel);
  border-radius: 18px;
  padding: 16px;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 620px;
}

.leaflet-container {
  background: transparent;
  font-family: var(--sans);
}

/* ── Caption row below the map (legend + hint) ── */
.map-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 0 4px;
}

.map-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12.5px;
  color: var(--ink);
}

.legend-head {
  font-weight: 700;
}

.legend-scale {
  flex: 0 0 240px;
}

.legend-bar {
  display: block;
  height: 10px;
  border-radius: 5px;
}

.legend-ticks {
  display: block;
  position: relative;
  height: 14px;
  margin-top: 4px;
}

.legend-ticks .tick {
  position: absolute;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--muted);
}

.legend-nodata {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.legend-nodata i {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: #cccccc;
}

.map-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.map-hint svg {
  width: 16px;
  height: 16px;
  fill: var(--green);
  flex-shrink: 0;
}


/* ── Sidebar cards ──────────────────────────── */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  position: relative;
  padding: 22px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 700;
}

.card-icon {
  width: 20px;
  height: 20px;
  fill: var(--green);
}

.insight-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
}

.summary-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.summary-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.summary-list li:first-child {
  padding-top: 4px;
  border-top: none;
}

.summary-label {
  font-size: 15px;
  color: var(--ink);
}

.summary-figure {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.summary-figure .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.summary-place {
  grid-column: 2;
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}

/* ── Data notes card ────────────────────────── */
.note-card {
  background: var(--card-soft);
  border-color: #dce9e3;
  box-shadow: none;
}

.note-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--green);
}

.note-head svg {
  width: 18px;
  height: 18px;
  fill: var(--green);
}

.note-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

/* ── County panel (inside the sidebar) ──────── */
.county-panel[hidden] {
  display: none;
}

.county-panel-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.county-panel-close:hover {
  color: var(--ink);
}

.county-panel h2 {
  margin: 0 0 2px;
  font-size: 20px;
}

.county-panel .panel-year {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.county-panel .panel-current {
  margin: 0 0 12px;
  font-size: 30px;
  font-weight: 700;
  color: var(--green);
}

.county-panel .panel-current span {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
}

.county-panel .panel-note {
  margin: -6px 0 12px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}

.county-panel .panel-trend-label {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--muted);
}

.county-panel svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ── Prose pages (About, Methodology) ───────── */
.prose {
  max-width: 720px;
}

.prose h2 {
  margin: 28px 0 10px;
  font-size: 20px;
  font-weight: 700;
}

.prose p {
  margin: 0 0 14px;
  font-size: 16px;
  line-height: 1.65;
}

.prose ul {
  margin: 0 0 16px;
  padding-left: 20px;
  font-size: 16px;
  line-height: 1.65;
}

.prose li {
  margin-bottom: 6px;
}

.prose a {
  color: var(--link);
}

.page-hint {
  margin: 26px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.page-hint a {
  color: var(--link);
}

/* ── Methodology ────────────────────────────── */
.methodology {
  max-width: 760px;
  margin: 44px auto 0;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.methodology h2 {
  margin: 0 0 14px;
  font-family: var(--sans);
  font-size: 22px;
}

.methodology p {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.methodology-source a {
  color: var(--link);
}

/* ── Footer ─────────────────────────────────── */
.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--link);
  text-decoration: none;
}

.github-link:hover {
  text-decoration: underline;
}

.github-link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 900px) {
  .topnav-inner {
    padding: 12px 16px;
  }

  .brand-name {
    font-size: 17px;
  }

  .brand-logo {
    height: 44px;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
  }

  /* Links become a dropdown under the bar, toggled by the hamburger. */
  .nav-links {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-left: 0;
    padding: 6px 16px 14px;
    background: var(--nav);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
    z-index: 1200;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 13px 4px;
    font-size: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-links a:first-child {
    border-top: none;
  }

  .page {
    padding: 24px 16px;
  }

  h1 {
    font-size: 34px;
  }

  .masthead {
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
  }

  .about-card {
    flex-basis: auto;
    width: 100%;
  }

  /* Controls stack: Play on its own row, year picker below, pill full width. */
  .controls-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }

  .toolbar-group {
    width: 100%;
    gap: 10px;
  }

  #play-button {
    flex: 1 1 100%;
    justify-content: center;
    padding: 11px 16px;
  }

  .toolbar label {
    margin-left: 2px;
  }

  #year-select {
    flex: 1;
  }

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

  #map {
    height: 46vh;
  }
}
