/* Townsteading public site — civic atlas visual system.
   Palette and direction: docs/townsteading-website-plan.md §14. */

/* ---------- Fonts (locally bundled, OFL) ---------- */
@font-face {
  font-family: "Archivo Narrow";
  src: url("/fonts/archivo-narrow.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Bitter";
  src: url("/fonts/bitter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Bitter";
  src: url("/fonts/bitter-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --ts-green-900: #163d32;
  --ts-green-800: #1e4b3d;
  --ts-green-700: #285b48;
  --ts-green-500: #4f7c62;
  --ts-orange-600: #e45d2a;
  --ts-orange-700: #c9471b;
  --ts-orange-800: #a93a15;
  --ts-blue-600: #34658a;
  --ts-ochre-500: #c18a32;
  --ts-brick-600: #a74b3f;
  --ts-cream-100: #f4f0e6;
  --ts-paper-50: #faf8f2;
  --ts-concrete-300: #d9ded9;
  --ts-concrete-200: #e6e9e4;
  --ts-ink-900: #172027;
  --ts-muted-700: #56615f;

  --font-display: "Archivo Narrow", "Arial Narrow", sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
  --font-editorial: "Bitter", Georgia, serif;

  --border: 1px solid var(--ts-concrete-300);
  --radius: 2px;
  --max: 72rem;
  --max-narrow: 46rem;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ts-ink-900);
  background: var(--ts-paper-50);
  -webkit-font-smoothing: antialiased;
}
img, svg, video, canvas { max-width: 100%; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  margin: 0 0 0.5em;
  color: var(--ts-ink-900);
}
h1 { font-size: 2.5rem; letter-spacing: 0.01em; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
a { color: var(--ts-green-700); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ts-green-900); }
ul, ol { padding-left: 1.25rem; }
li { margin-bottom: 0.35em; }
hr { border: 0; border-top: var(--border); margin: 2rem 0; }
:focus-visible {
  outline: 2px solid var(--ts-orange-600);
  outline-offset: 2px;
  border-radius: var(--radius);
}
main:focus { outline: none; }

/* ---------- Utilities ---------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.skip-link {
  position: absolute; top: -3rem; left: 1rem; z-index: 60;
  background: var(--ts-orange-700); color: var(--ts-cream-100);
  padding: 0.5rem 1rem; font-weight: 600; text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0.5rem; color: var(--ts-cream-100); }
.eyebrow {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ts-green-500);
  margin: 0 0 0.5rem;
}
.eyebrow--light { color: var(--ts-ochre-500); }
.fine-print { font-size: 0.875rem; color: var(--ts-muted-700); }
.link-arrow { font-weight: 600; text-decoration: none; }
.link-arrow::after { content: " →"; }
.noscript-note {
  border: var(--border);
  border-left: 3px solid var(--ts-ochre-500);
  background: var(--ts-cream-100);
  padding: 0.875rem 1rem;
  font-size: 0.9375rem;
}
.noscript-note--map { margin: 1rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.04em;
  padding: 0.65rem 1.35rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn--primary { background: var(--ts-orange-700); color: var(--ts-cream-100); }
.btn--primary:hover { background: var(--ts-orange-800); color: var(--ts-cream-100); }
.btn--secondary { background: transparent; border-color: var(--ts-green-700); color: var(--ts-green-700); }
.btn--secondary:hover { background: var(--ts-green-700); color: var(--ts-cream-100); }
.btn--outline-light { background: transparent; border-color: var(--ts-cream-100); color: var(--ts-cream-100); }
.btn--outline-light:hover { background: rgba(244, 240, 230, 0.12); color: var(--ts-cream-100); }
.btn--quiet {
  background: transparent; color: var(--ts-green-700);
  border-color: var(--ts-concrete-300); font-size: 0.875rem;
  padding: 0.4rem 0.8rem;
}
.btn--quiet:hover { border-color: var(--ts-green-700); color: var(--ts-green-900); }

/* ---------- Header ---------- */
.site-header {
  background: var(--ts-green-900);
  color: var(--ts-cream-100);
  position: relative;
  z-index: 40;
}
.site-header__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.25rem;
  min-height: 3.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-header__brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  color: var(--ts-cream-100); text-decoration: none;
}
.site-header__mark { display: block; }
.site-header__wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.site-header__beta {
  font-family: var(--font-display);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--ts-cream-100);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius);
  opacity: 0.85;
}
.site-nav { display: flex; align-items: center; }
.site-nav__checkbox { position: absolute; opacity: 0; width: 1px; height: 1px; overflow: hidden; }
.site-nav__toggle { display: none; }
.site-nav__links { display: flex; align-items: center; gap: 0.25rem; }
.site-nav__links a {
  color: var(--ts-cream-100);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.9375rem;
  letter-spacing: 0.05em;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius);
  white-space: nowrap;
}
.site-nav__links a:hover { background: rgba(244, 240, 230, 0.12); color: var(--ts-cream-100); }
.site-nav__links a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--ts-orange-600); }

@media (max-width: 60rem) {
  .site-nav__toggle {
    display: inline-flex; align-items: center; gap: 0.5rem;
    cursor: pointer;
    color: var(--ts-cream-100);
    font-family: var(--font-display); font-weight: 600; letter-spacing: 0.06em;
    padding: 0.45rem 0.7rem;
    border: 1px solid rgba(244, 240, 230, 0.35);
    border-radius: var(--radius);
  }
  .site-nav__toggle-bars,
  .site-nav__toggle-bars::before,
  .site-nav__toggle-bars::after {
    display: block; width: 18px; height: 2px; background: var(--ts-cream-100);
    content: ""; position: relative;
  }
  .site-nav__toggle-bars::before { position: absolute; top: -6px; }
  .site-nav__toggle-bars::after { position: absolute; top: 6px; }
  .site-nav__checkbox:checked ~ .site-nav__toggle { background: rgba(244, 240, 230, 0.12); }
  .site-nav__checkbox:focus-visible ~ .site-nav__toggle { outline: 2px solid var(--ts-orange-600); outline-offset: 2px; }
  .site-nav__links {
    display: none;
    position: absolute; right: 1.25rem; top: calc(100% + 0.35rem);
    flex-direction: column; align-items: stretch;
    background: var(--ts-green-900);
    border: 1px solid rgba(244, 240, 230, 0.25);
    border-radius: var(--radius);
    min-width: 15rem;
    padding: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  }
  .site-nav__checkbox:checked ~ .site-nav__links { display: flex; }
  .site-nav__links a { padding: 0.65rem 0.8rem; }
}

/* ---------- Footer ---------- */
.site-footer { background: var(--ts-green-900); color: var(--ts-cream-100); margin-top: 4rem; }
.site-footer__inner {
  max-width: var(--max); margin: 0 auto; padding: 2.75rem 1.25rem;
  display: grid; gap: 2rem; grid-template-columns: 2fr 1fr 1fr 1.4fr;
}
.site-footer__wordmark {
  font-family: var(--font-display); font-weight: 700; font-size: 1.25rem;
  letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 0.25rem;
}
.site-footer__tagline { color: var(--ts-ochre-500); font-weight: 600; margin: 0 0 0.75rem; }
.site-footer__note { font-size: 0.875rem; opacity: 0.85; }
.site-footer__heading {
  font-family: var(--font-display); font-size: 0.8125rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ts-cream-100); margin: 0 0 0.65rem;
}
.site-footer__col a { display: block; color: var(--ts-cream-100); text-decoration: none; padding: 0.2rem 0; opacity: 0.9; }
.site-footer__col a:hover { opacity: 1; text-decoration: underline; }
.site-footer__fine { font-size: 0.8125rem; opacity: 0.8; margin: 0 0 0.6rem; }
.site-footer__fine a { color: var(--ts-cream-100); }
@media (max-width: 56rem) { .site-footer__inner { grid-template-columns: 1fr 1fr; } }
@media (max-width: 34rem) { .site-footer__inner { grid-template-columns: 1fr; } }

/* ---------- Hero ---------- */
.hero {
  background: var(--ts-green-900);
  color: var(--ts-cream-100);
  position: relative;
  overflow: hidden;
}
.hero__grid-lines {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(244, 240, 230, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 240, 230, 0.05) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(120deg, rgba(0,0,0,0.9), rgba(0,0,0,0.25));
}
.hero__inner { position: relative; max-width: var(--max); margin: 0 auto; padding: 5rem 1.25rem 4.5rem; }
.hero__wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 1rem;
  color: var(--ts-cream-100);
}
.hero__wordmark::after {
  content: "";
  display: block;
  width: 4.5rem; height: 4px;
  background: var(--ts-orange-600);
  margin-top: 1.25rem;
}
.hero__headline {
  font-size: clamp(1.6rem, 3.6vw, 2.4rem);
  color: var(--ts-cream-100);
  max-width: 22em;
}
.hero__lede { font-size: 1.1875rem; max-width: 34em; opacity: 0.92; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }

/* ---------- Stat strip ---------- */
.stat-strip { background: var(--ts-green-800); color: var(--ts-cream-100); }
.stat-strip__inner {
  max-width: var(--max); margin: 0 auto; padding: 1rem 1.25rem;
  display: flex; flex-wrap: wrap; gap: 2.5rem;
}
.stat { display: flex; align-items: baseline; gap: 0.6rem; margin: 0; }
.stat dt { font-family: var(--font-display); font-size: 0.8125rem; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.85; }
.stat dd { margin: 0; font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; }

/* ---------- Sections ---------- */
.section { padding: 3rem 0; }
.section--flush-top { padding-top: 1.25rem; }
.section--tinted { background: var(--ts-cream-100); }
.section--dark { background: var(--ts-green-900); color: var(--ts-cream-100); }
.section--dark h2 { color: var(--ts-cream-100); }
.section__inner { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }
.section__inner--narrow { max-width: var(--max-narrow); }
.section__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.section__head h2 { margin: 0; }
.section__title { margin-top: 0; }
.section__lede { color: var(--ts-muted-700); max-width: 44em; margin: 0.25rem 0 0; }
.section__more { margin-top: 1.5rem; }
.section--404 { padding: 5rem 0; }

/* ---------- Page head ---------- */
.page-head { background: var(--ts-green-900); color: var(--ts-cream-100); }
.page-head__inner { max-width: var(--max); margin: 0 auto; padding: 3rem 1.25rem 2.5rem; }
.page-head h1 { color: var(--ts-cream-100); margin: 0 0 0.5rem; }
.page-head__lede { font-size: 1.1875rem; max-width: 40em; opacity: 0.92; margin: 0; }
.page-head--compact .page-head__inner { padding: 2rem 1.25rem 1.75rem; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { background: var(--ts-concrete-200); font-size: 0.875rem; }
.breadcrumbs ol {
  max-width: var(--max); margin: 0 auto; padding: 0.5rem 1.25rem;
  list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem;
}
.breadcrumbs li { margin: 0; }
.breadcrumbs li + li::before { content: "›"; margin-right: 0.35rem; color: var(--ts-muted-700); }
.breadcrumbs [aria-current] { color: var(--ts-muted-700); }

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 1rem;
}
.card-grid--compact { grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.town-card {
  background: var(--ts-paper-50);
  border: var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 0.9rem;
  display: flex; flex-direction: column;
  transition: border-color 0.15s ease;
}
.town-card:hover { border-color: var(--ts-green-500); }
.town-card__head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; margin-bottom: 0.5rem; }
.town-card__name { font-size: 1.1875rem; margin: 0; }
.town-card__name a { color: var(--ts-ink-900); text-decoration: none; }
.town-card__name a:hover { color: var(--ts-green-700); text-decoration: underline; }
.town-card__score {
  font-family: var(--font-display); font-weight: 700; font-size: 1.0625rem;
  color: var(--ts-green-700);
  border: 1px solid var(--ts-concrete-300);
  border-radius: var(--radius);
  padding: 0.05rem 0.45rem;
  background: var(--ts-cream-100);
  white-space: nowrap;
}
.town-card__metrics { margin: 0 0 0.6rem; }
.town-card__action { margin: auto 0 0; }
.town-card .metric { display: flex; justify-content: space-between; gap: 1rem; padding: 0.18rem 0; border-top: 1px solid var(--ts-concrete-200); }
.town-card .metric dt { color: var(--ts-muted-700); font-size: 0.875rem; }
.town-card .metric dd { margin: 0; font-size: 0.9375rem; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- Metrics ---------- */
.metric-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--ts-concrete-300);
  border: var(--border);
  margin: 0;
}
.metric-grid .metric { background: var(--ts-paper-50); padding: 0.9rem 1rem; }
.metric-grid .metric dt {
  font-family: var(--font-display); font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ts-muted-700);
  margin-bottom: 0.3rem;
}
.metric-grid .metric dd { margin: 0; font-family: var(--font-display); font-size: 1.375rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric-grid--compact .metric dd { font-size: 1.125rem; }
@media (max-width: 46rem) { .metric-grid { grid-template-columns: 1fr 1fr; } }

.data-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 56rem) { .data-columns { grid-template-columns: 1fr; gap: 1.5rem; } }
.data-table { margin: 0; }
.data-table .metric {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1.5rem;
  padding: 0.45rem 0; border-bottom: 1px solid var(--ts-concrete-200);
}
.data-table .metric dt { color: var(--ts-muted-700); }
.data-table .metric dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.data-table__heading {
  font-family: var(--font-display); font-size: 0.8125rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ts-green-700);
  border-bottom: 2px solid var(--ts-green-700); padding-bottom: 0.3rem;
}

/* ---------- Demographics (People and households) ---------- */
.demo-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;
  margin-top: 1.5rem; align-items: start;
}
@media (max-width: 56rem) { .demo-grid { grid-template-columns: 1fr; } }
.demo-panel {
  background: var(--ts-paper-50);
  border: var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.demo-panel .data-table__heading { margin: 0 0 0.9rem; }
.demo-panel__sub {
  font-family: var(--font-display); font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ts-muted-700);
  margin: 0.9rem 0 0.1rem;
}
.demo-panel__note { font-size: 0.8125rem; color: var(--ts-muted-700); margin: 0.75rem 0 0; }
.demo-note { margin-top: 1.5rem; }

/* ---------- Filter bar ---------- */
.filter-bar {
  background: var(--ts-paper-50);
  border: var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1.5rem;
}
.filter-bar__row { display: flex; gap: 0.9rem; flex-wrap: wrap; }
.filter-bar__row + .filter-bar__row { margin-top: 0.9rem; }
.filter-bar__row--grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); }
.filter-bar__row--meta { align-items: center; gap: 0.75rem; margin-top: 0.9rem; }
.filter-bar label { display: flex; flex-direction: column; gap: 0.25rem; }
.filter-bar__search { flex: 1 1 24rem; }
.filter-bar__label {
  font-family: var(--font-display); font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ts-muted-700);
}
.filter-bar input[type="search"], .filter-bar select {
  font: inherit; color: var(--ts-ink-900);
  background: #fff;
  border: var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.6rem;
  min-height: 2.5rem;
}
.filter-bar input[type="search"]:focus, .filter-bar select:focus { border-color: var(--ts-green-700); }
.filter-bar__count { margin: 0; font-size: 0.9375rem; color: var(--ts-muted-700); flex: 1; }
.filter-bar--compact { padding: 0.9rem 1rem; }
.filter-bar--map { border: 0; padding: 0; margin: 0; }
.filter-bar--map label { margin-bottom: 0.75rem; }

/* ---------- Directory ---------- */
.directory-loading { color: var(--ts-muted-700); }
.directory-more { grid-column: 1 / -1; text-align: center; padding: 1rem 0; }
.state-index {
  list-style: none; padding: 0; margin: 0;
  columns: 4 12rem; column-gap: 2rem;
}
.state-index li { margin: 0 0 0.3rem; break-inside: avoid; display: flex; justify-content: space-between; gap: 0.75rem; }
.state-index a { text-decoration: none; font-weight: 600; }
.state-index a:hover { text-decoration: underline; }
.state-index__count { color: var(--ts-muted-700); font-variant-numeric: tabular-nums; }

/* ---------- Map frames ---------- */
.map-frame { position: relative; border: var(--border); border-radius: var(--radius); overflow: hidden; background: var(--ts-concrete-200); }
.map-frame__canvas { height: 26rem; }
.map-frame--state .map-frame__canvas { height: 22rem; }
.map-frame--town .map-frame__canvas { height: 24rem; }
.map-frame__fallback { padding: 0.75rem 1rem; font-size: 0.9375rem; color: var(--ts-muted-700); margin: 0; background: var(--ts-paper-50); }
.maplibregl-popup-content { font-family: var(--font-body); border-radius: var(--radius); }
.map-popup__name { font-family: var(--font-display); font-weight: 600; font-size: 1.0625rem; margin: 0 0 0.2rem; }
.map-popup__meta { margin: 0 0 0.35rem; font-size: 0.875rem; color: var(--ts-muted-700); }
.map-popup__link { font-weight: 600; }

/* ---------- Map app (/map/) ---------- */
.map-app {
  display: grid;
  grid-template-columns: 22.5rem 1fr;
  height: calc(100vh - 3.75rem);
  min-height: 32rem;
  position: relative;
}
.map-app__sidebar {
  background: var(--ts-paper-50);
  border-right: var(--border);
  display: flex; flex-direction: column;
  min-height: 0;
}
.map-app__head { padding: 1rem 1.1rem 0.5rem; }
.map-app__title { font-size: 1.5rem; margin: 0; }
.map-app__sub { margin: 0; color: var(--ts-muted-700); font-size: 0.9375rem; }
.map-app__filters-wrap { padding: 0.5rem 1.1rem; border-bottom: 1px solid var(--ts-concrete-200); }
.map-app__filters-wrap summary {
  font-family: var(--font-display); font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; font-size: 0.8125rem; color: var(--ts-green-700);
  cursor: pointer; padding: 0.4rem 0;
}
.map-app__sidebar .filter-bar__count { padding: 0.5rem 1.1rem; }
.map-app__results {
  list-style: none; margin: 0; padding: 0;
  overflow-y: auto; flex: 1;
}
.map-app__results li { margin: 0; }
.map-result {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--ts-concrete-200);
  padding: 0.6rem 1.1rem; cursor: pointer; font: inherit;
}
.map-result:hover, .map-result[aria-selected="true"] { background: var(--ts-cream-100); }
.map-result__name { font-weight: 600; display: flex; justify-content: space-between; gap: 0.5rem; }
.map-result__meta { font-size: 0.8125rem; color: var(--ts-muted-700); font-variant-numeric: tabular-nums; }
.map-app__map { position: relative; min-width: 0; }
/* Specificity must beat maplibre-gl.css (.maplibregl-map sets position:relative),
   otherwise the canvas collapses to zero height. */
.map-app__map > .map-app__canvas { position: absolute; inset: 0; }
.map-legend {
  position: absolute; left: 0.75rem; bottom: 0.75rem; z-index: 5;
  background: var(--ts-paper-50); border: var(--border); border-radius: var(--radius);
  padding: 0.45rem 0.7rem; display: flex; gap: 0.9rem; font-size: 0.8125rem;
}
.map-legend__item { display: inline-flex; align-items: center; gap: 0.35rem; }
.map-legend__dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; display: inline-block; }
.map-legend__dot--strong { background: var(--ts-green-700); }
.map-legend__dot--moderate { background: var(--ts-green-500); }
.map-legend__dot--mixed { background: var(--ts-ochre-500); }
/* ---------- Selected-town preview (shared card, see js/lib/town-preview.js) ---------- */
.town-preview {
  position: relative;
  background: var(--ts-paper-50);
  border: var(--border);
  border-top: 3px solid var(--ts-green-700);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem 1rem;
}
.town-preview__close {
  position: absolute; top: 0.6rem; right: 0.6rem;
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.9rem; height: 1.9rem; padding: 0;
  background: transparent; border: var(--border); border-radius: var(--radius);
  color: var(--ts-muted-700); font-size: 1.125rem; line-height: 1; cursor: pointer;
}
.town-preview__close:hover { color: var(--ts-green-900); border-color: var(--ts-green-700); }
.town-preview__eyebrow {
  font-family: var(--font-display); font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ts-green-500);
  margin: 0 2rem 0.15rem 0;
}
.town-preview__name { font-size: 1.25rem; color: var(--ts-green-900); margin: 0 2rem 0.3rem 0; }
.town-preview__fit {
  display: flex; align-items: center; gap: 0.45rem;
  margin: 0 0 0.6rem; font-size: 0.9375rem; font-weight: 600;
}
.town-preview__dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; flex: none; }
.town-preview__dot--strong { background: var(--ts-green-700); }
.town-preview__dot--moderate { background: var(--ts-green-500); }
.town-preview__dot--mixed { background: var(--ts-ochre-500); }
.town-preview__metrics { margin: 0 0 0.8rem; }
.town-preview__metrics .metric {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 0.22rem 0; border-top: 1px solid var(--ts-concrete-200);
}
.town-preview__metrics .metric dt { color: var(--ts-muted-700); font-size: 0.875rem; }
.town-preview__metrics .metric dd { margin: 0; font-size: 0.9375rem; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.town-preview__action { display: block; text-align: center; }

.map-app__preview {
  /* Placed in the map grid column; as an absolutely positioned grid item its
     containing block is that grid area, so the card overlays the map's top
     left corner — clear of the legend and the attribution control. */
  grid-column: 2; grid-row: 1;
  position: absolute; top: 0.75rem; left: 0.75rem; z-index: 6;
  width: min(21rem, calc(100% - 1.5rem));
}
.map-frame__preview {
  position: absolute; top: 0.75rem; left: 0.75rem; z-index: 6;
  width: min(21rem, calc(100% - 1.5rem));
}
.map-app__text { border-top: var(--border); }
@media (max-width: 54rem) {
  .map-app { grid-template-columns: 1fr; grid-template-rows: 42vh auto 1fr; height: auto; }
  .map-app__map { grid-column: 1; grid-row: 1; position: relative; }
  .map-app__map > .map-app__canvas { position: relative; height: 100%; }
  .map-app__preview { grid-column: 1; grid-row: 2; position: static; width: auto; margin: 0.75rem 1.1rem 0; }
  .map-app__sidebar { grid-row: 3; border-right: 0; border-top: var(--border); }
  .map-app__results { max-height: 50vh; }
}
@media (max-width: 46rem) {
  .map-frame__preview { position: static; width: auto; margin: 0.75rem; }
}

/* ---------- Town profile ---------- */
.town-hero { background: var(--ts-green-900); color: var(--ts-cream-100); }
.town-hero__inner { max-width: var(--max); margin: 0 auto; padding: 2.75rem 1.25rem 2.25rem; }
.town-hero__name { color: var(--ts-cream-100); margin: 0 0 0.35rem; }
.town-hero__meta { font-family: var(--font-display); letter-spacing: 0.05em; opacity: 0.9; margin: 0 0 0.9rem; }
.town-hero__intro { font-size: 1.125rem; max-width: 40em; opacity: 0.92; }
.town-hero__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.25rem 0 1.5rem; }
.town-hero__badges { display: flex; flex-wrap: wrap; gap: 1px; background: rgba(244, 240, 230, 0.25); border: 1px solid rgba(244, 240, 230, 0.25); margin: 0 0 1rem; width: fit-content; }
.town-badge { background: var(--ts-green-900); padding: 0.55rem 1rem; }
.town-badge dt { font-family: var(--font-display); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.8; }
.town-badge dd { margin: 0; font-family: var(--font-display); font-size: 1.125rem; font-weight: 600; }
.town-hero__verification { font-size: 0.9375rem; opacity: 0.85; max-width: 44em; margin: 0; }
.town-hero__verification a { color: var(--ts-cream-100); }

.map-text-alt { margin-top: 1.25rem; }
.map-text-alt__title { font-size: 1.0625rem; margin: 1rem 0 0.4rem; }
.daily-life { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.daily-life li { margin: 0; }
.daily-life__count { font-family: var(--font-display); font-weight: 700; color: var(--ts-green-700); }

.walkable-destination-key {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem 0.8rem;
  width: fit-content; max-width: 100%; margin-top: 0.65rem;
  padding: 0.45rem 0.65rem; border: var(--border); border-radius: var(--radius);
  background: var(--ts-paper-50); font-size: 0.875rem;
}
.walkable-destination-key__title {
  font-family: var(--font-display); font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ts-muted-700);
}
.walkable-destination-key ul {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.8rem;
  list-style: none; padding: 0; margin: 0;
}
.walkable-destination-key li { display: inline-flex; align-items: center; gap: 0.35rem; }
.walkable-destination-symbol {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 1.2rem; height: 1.2rem; border: 2px solid var(--ts-paper-50);
  color: #fff; background: var(--ts-muted-700);
  font-family: var(--font-display); font-size: 0.6875rem; font-weight: 700;
  line-height: 1; box-shadow: 0 0 0 1px rgba(23, 32, 39, 0.35);
}
.walkable-destination-symbol--library,
.walkable-destination-symbol--civic { background: var(--ts-blue-600); border-radius: 2px; }
.walkable-destination-symbol--park { background: var(--ts-green-500); border-radius: 50%; }
.walkable-destination-symbol--grocery,
.walkable-destination-symbol--general-retail { background: var(--ts-ochre-500); border-radius: 35%; }
.walkable-destination-symbol--pharmacy { background: var(--ts-brick-600); border-radius: 50%; }
.walkable-destination-symbol--restaurant-cafe { background: var(--ts-orange-600); border-radius: 50%; }
.walkable-destination-symbol--post-office,
.walkable-destination-symbol--bank { background: var(--ts-green-900); border-radius: 2px; }
.walkable-destination-symbol--school { background: var(--ts-blue-600); border-radius: 50% 50% 2px 2px; }
.walkable-destination-symbol--place-of-worship { background: var(--ts-muted-700); border-radius: 50% 50% 2px 2px; }
.walkable-destination-symbol--other { border-radius: 50%; }
.walkable-destination-marker {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; padding: 0; border: 0;
  background: transparent; cursor: pointer;
}
.walkable-destination-marker .walkable-destination-symbol {
  width: 1.45rem; height: 1.45rem; font-size: 0.75rem;
  box-shadow: 0 1px 4px rgba(23, 32, 39, 0.45);
}
.walkable-destination-marker:focus-visible {
  outline: 3px solid var(--ts-orange-600); outline-offset: 2px; border-radius: 50%;
}
.destination-popup h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.destination-popup p { margin: 0.1rem 0; font-size: 0.875rem; }
.walkable-destination-list ul {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 1.25rem; list-style: none; padding: 0; margin: 0.5rem 0 0;
}
.walkable-destination-list li {
  display: flex; flex-direction: column; gap: 0.05rem;
  padding: 0.55rem 0.7rem; border-left: 3px solid var(--ts-green-500);
  background: var(--ts-paper-50);
}
.walkable-destination-list li span { color: var(--ts-muted-700); font-size: 0.9rem; }
@media (max-width: 46rem) {
  .walkable-destination-key { align-items: flex-start; }
  .walkable-destination-key__title { width: 100%; }
  .walkable-destination-list ul { grid-template-columns: 1fr; }
}

/* ---------- Closest Orthodox parish (town profile) ---------- */
.parish-card {
  display: flex; gap: 1rem; align-items: flex-start;
  max-width: 42rem;
  background: var(--ts-paper-50);
  border: var(--border);
  border-left: 3px solid var(--ts-brick-600);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.parish-card__icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: var(--ts-brick-600); color: #fff;
  box-shadow: 0 0 0 2px var(--ts-paper-50), 0 0 0 3px rgba(23, 32, 39, 0.25);
}
.parish-card__body { flex: 1; min-width: 0; }
.parish-card__name { margin: 0 0 0.5rem; font-size: 1.25rem; }
.parish-card__action { margin: 0.75rem 0 0.25rem; }
.parish-card .fine-print { margin: 0.5rem 0 0; }

/* The map key entry is itself the layer toggle, so the key can never drift
   out of sync with the visible layers. */
.parish-map-control { margin-top: 0.65rem; }
.parish-map-toggle {
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.45rem 0.65rem;
  border: var(--border); border-radius: var(--radius);
  background: var(--ts-paper-50); color: var(--ts-ink-900);
  font: inherit; font-size: 0.875rem; cursor: pointer;
}
.parish-map-toggle:hover { border-color: var(--ts-brick-600); }
.parish-map-toggle__icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 1.2rem; height: 1.2rem; border-radius: 50%;
  background: var(--ts-brick-600); color: #fff;
}
.parish-map-toggle__route {
  display: inline-block; width: 1.6rem; flex: none;
  border-top: 3px dotted var(--ts-brick-600);
}
.parish-map-toggle[aria-pressed="false"] { opacity: 0.6; }
.parish-map-toggle:disabled { cursor: default; opacity: 0.55; }
.parish-map-toggle:disabled:hover { border-color: var(--ts-concrete-300); }

.orthodox-parish-marker {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; padding: 0;
  border: 2px solid var(--ts-paper-50); border-radius: 50%;
  background: var(--ts-brick-600); color: #fff;
  cursor: pointer; box-shadow: 0 1px 4px rgba(23, 32, 39, 0.45);
}
.orthodox-parish-marker:focus-visible {
  outline: 3px solid var(--ts-orange-600); outline-offset: 2px;
}
.parish-popup h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.parish-popup p { margin: 0.1rem 0; font-size: 0.875rem; }
.parish-popup__drive { font-weight: 600; }
.parish-popup__address { color: var(--ts-muted-700); }

/* ---------- Orthodox-parish map filter (/map/) ---------- */
.filter-bar label.filter-bar__check {
  flex-direction: row; align-items: center; gap: 0.55rem;
  min-height: 2.5rem; cursor: pointer; margin-bottom: 0.1rem;
}
.filter-bar__check input[type="checkbox"] {
  width: 1.1rem; height: 1.1rem; margin: 0; flex: none;
  accent-color: var(--ts-green-700);
}
.filter-bar__check-text { font-size: 0.9375rem; }
.filter-bar__note { margin: 0.15rem 0 0.75rem; font-size: 0.8125rem; color: var(--ts-muted-700); }


.fit-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 46rem) { .fit-columns { grid-template-columns: 1fr; } }
.fit-panel { border: var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; background: var(--ts-paper-50); }
.fit-panel--strengths { border-left: 3px solid var(--ts-green-500); }
.fit-panel--limitations { border-left: 3px solid var(--ts-ochre-500); }
.fit-panel h3 { margin-top: 0; }
.fit-panel ul { margin: 0; }

.disclosure { display: grid; grid-template-columns: 1fr 1.4fr; gap: 2rem; }
@media (max-width: 46rem) { .disclosure { grid-template-columns: 1fr; } }
.source-list { margin: 0; font-size: 0.9375rem; }
.warning-panel {
  margin-top: 1.5rem;
  background: var(--ts-cream-100);
  border: var(--border);
  border-left: 3px solid var(--ts-brick-600);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.warning-panel h3 { margin-top: 0; font-size: 1.0625rem; }

/* ---------- State overview ---------- */
.state-overview { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 56rem) { .state-overview { grid-template-columns: 1fr; } }
.state-overview__summary { font-size: 1.0625rem; }

/* ---------- Four tests ---------- */
.four-tests {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  border: var(--border); border-radius: var(--radius);
  background: var(--ts-paper-50);
  margin-top: 1.25rem;
}
.four-tests__item { padding: 1.35rem 1.4rem; }
.four-tests__item + .four-tests__item { border-left: 1px solid var(--ts-concrete-200); }
.four-tests__item h3 { font-size: 1.25rem; color: var(--ts-green-700); }
.four-tests__item p { margin: 0; color: var(--ts-muted-700); }
@media (max-width: 56rem) {
  .four-tests { grid-template-columns: 1fr 1fr; }
  .four-tests__item:nth-child(3) { border-left: 0; border-top: 1px solid var(--ts-concrete-200); }
  .four-tests__item:nth-child(4) { border-top: 1px solid var(--ts-concrete-200); }
}
@media (max-width: 34rem) {
  .four-tests { grid-template-columns: 1fr; }
  .four-tests__item + .four-tests__item { border-left: 0; border-top: 1px solid var(--ts-concrete-200); }
}

/* ---------- Argument ---------- */
.argument__copy { font-size: 1.1875rem; max-width: 36em; }

/* ---------- Articles ---------- */
.article-list { display: grid; gap: 1.75rem; }
.article-list__item { border-bottom: 1px solid var(--ts-concrete-200); padding-bottom: 1.75rem; }
.article-list__item:last-child { border-bottom: 0; }
.article-list__meta { font-size: 0.875rem; color: var(--ts-muted-700); margin: 0 0 0.25rem; }
.article-list__title { margin: 0 0 0.35rem; font-size: 1.375rem; }
.article-list__title a { color: var(--ts-ink-900); text-decoration: none; }
.article-list__title a:hover { color: var(--ts-green-700); text-decoration: underline; }
.article-list__summary { margin: 0 0 0.35rem; color: var(--ts-muted-700); }
@media (min-width: 46rem) { .card-grid + .article-list, .section .article-list { grid-template-columns: repeat(3, 1fr); } }
.section .article-list { display: grid; gap: 1.5rem; }
@media (min-width: 46rem) { .section .article-list { grid-template-columns: repeat(3, 1fr); } }
.section .article-list .article-list__item { border-bottom: 0; padding-bottom: 0; }

/* ---------- Prose ---------- */
.prose { max-width: var(--max-narrow); }
.prose__title { font-size: 2.25rem; }
.prose__lede { font-size: 1.1875rem; color: var(--ts-muted-700); }
.prose__p { margin: 0 0 1em; }
.prose h2 { margin-top: 1.8em; }
.prose h3 { margin-top: 1.5em; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.25rem 0; font-size: 0.9375rem; }
.prose th, .prose td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--ts-concrete-300); }
.prose th { font-family: var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.8125rem; color: var(--ts-green-700); border-bottom: 2px solid var(--ts-green-700); }
.prose--editorial p, .prose--editorial li { font-family: var(--font-editorial); font-size: 1.0625rem; line-height: 1.7; }
.prose--editorial h2, .prose--editorial h3 { font-family: var(--font-display); }
.prose__rule { margin: 2.5rem 0 1.5rem; }

/* ---------- Reduced motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
@media print {
  .site-header, .site-footer, .filter-bar, .map-frame, .town-hero__actions, .breadcrumbs { display: none; }
  .town-hero, .page-head { background: none; color: var(--ts-ink-900); }
  .town-hero__name, .page-head h1 { color: var(--ts-ink-900); }
}
