/* mapofamerica.net — shared stylesheet
   Palette: survey-atlas. Paper #F5F7F3, ink #17263F, water #1D5C8F, land #DDE8DA, survey red #9E3524 */

:root {
  --paper: #f5f7f3;
  --card: #fdfefc;
  --ink: #17263f;
  --ink-soft: #46536b;
  --water: #cfe3ed;
  --link: #1d5c8f;
  --land: #dde8da;
  --land-line: #9db3a0;
  --survey: #9e3524;
  --rule: #c8d1c8;
  --max: 72rem;
  --prose: 70ch;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, .wordmark {
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin: 0 0 0.4rem; }
h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); margin: 2.5rem 0 0.75rem; }
h3 { font-size: 1.15rem; margin: 1.75rem 0 0.5rem; }

p, li { max-width: var(--prose); }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--survey); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--survey);
  outline-offset: 2px;
}

/* ---------- Title block (header) ---------- */
.site-head {
  border-bottom: 2px solid var(--ink);
  background: var(--card);
}
.site-head .inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.wordmark {
  font-size: 1.25rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.wordmark span { color: var(--survey); }
.site-nav { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.92rem; }
.site-nav a { text-decoration: none; color: var(--ink-soft); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--survey); }

/* ---------- Neatline frame for maps & figures ---------- */
.neatline {
  border: 1.5px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: 4px;
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 12.5%) border-box;
}

/* ---------- Interactive map ---------- */
.map-frame {
  max-width: var(--max);
  margin: 1.5rem auto 0;
  padding: 0 1rem;
}
#usmap {
  aspect-ratio: 16 / 9.6;
  width: 100%;
  background: var(--water);
  border: 1.5px solid var(--ink);
}
@media (max-width: 640px) { #usmap { aspect-ratio: 4 / 3.4; } }
.map-caption {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0.5rem 0 0;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.leaflet-container { font: inherit; }
.leaflet-container a { color: var(--link); }
.state-tip {
  background: var(--card);
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 0.35rem 0.6rem;
  font-size: 0.9rem;
  box-shadow: none;
}

/* ---------- Layout ---------- */
main { max-width: var(--max); margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.lede { font-size: 1.1rem; color: var(--ink-soft); max-width: var(--prose); }
.crumbs { font-size: 0.85rem; color: var(--ink-soft); margin: 0 0 1rem; }
.crumbs a { color: var(--ink-soft); }
.crumbs a:hover { color: var(--survey); }

/* Sheet index — the site's navigation directory, styled as an atlas plate index */
.sheet-index {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  border-top: 1.5px solid var(--ink);
}
.sheet-index li { max-width: none; border-bottom: 1px solid var(--rule); }
.sheet-index a {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1rem;
  align-items: baseline;
  padding: 0.85rem 0.25rem;
  text-decoration: none;
  color: inherit;
}
.sheet-index a:hover { background: var(--card); }
.sheet-index a:hover .sheet-title { color: var(--survey); }
.sheet-no {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.sheet-title { font-weight: 600; }
.sheet-desc { grid-column: 2; font-size: 0.92rem; color: var(--ink-soft); max-width: var(--prose); }

/* Link columns (e.g., all 50 states) */
.link-grid {
  columns: 4 12rem;
  gap: 2rem;
  padding: 0;
  margin: 1rem 0;
  list-style: none;
}
.link-grid li { break-inside: avoid; padding: 0.2rem 0; border-bottom: 1px dotted var(--rule); }
.link-grid a { text-decoration: none; }

/* ---------- Tables ---------- */
.data-table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 0.95rem; }
.data-table caption { text-align: left; font-size: 0.85rem; color: var(--ink-soft); padding: 0.4rem 0; caption-side: bottom; }
.data-table th {
  text-align: left;
  border-bottom: 2px solid var(--ink);
  padding: 0.45rem 0.75rem 0.45rem 0;
  font-weight: 600;
}
.data-table td { border-bottom: 1px solid var(--rule); padding: 0.45rem 0.75rem 0.45rem 0; }
.data-table tr:hover td { background: var(--card); }
.table-scroll { overflow-x: auto; }

/* ---------- Quiz ---------- */
.quiz-panel {
  border: 1.5px solid var(--ink);
  background: var(--card);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}
#quizmap {
  aspect-ratio: 16 / 9.6;
  width: 100%;
  background: var(--water);
  border: 1.5px solid var(--ink);
}
.quiz-choices { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1rem 0 1.5rem; }
.quiz-choices .btn { flex: 1 1 12rem; }
.quiz-prompt { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-size: 1.3rem; font-weight: 600; }
.quiz-score { color: var(--ink-soft); font-size: 0.95rem; }
.btn {
  font: inherit;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
}
.btn:hover { background: var(--survey); }
.correct { color: #2f6b3a; font-weight: 600; }
.wrong { color: var(--survey); font-weight: 600; }

/* ---------- Printable figure ---------- */
.print-figure { margin: 1.5rem 0; }
.print-figure img, .print-figure svg { width: 100%; height: auto; display: block; background: var(--card); }
.print-actions { display: flex; gap: 0.75rem; margin: 0.75rem 0; flex-wrap: wrap; }

/* ---------- Footer ---------- */
.site-foot {
  border-top: 2px solid var(--ink);
  background: var(--card);
  margin-top: 3rem;
}
.site-foot .inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1.5rem;
  font-size: 0.9rem;
}
.site-foot h2 { font-size: 0.95rem; margin: 0 0 0.5rem; }
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li { padding: 0.15rem 0; }
.site-foot a { color: var(--ink-soft); text-decoration: none; }
.site-foot a:hover { color: var(--survey); }
.colophon {
  grid-column: 1 / -1;
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

@media print {
  .site-head, .site-foot, .print-actions, .crumbs { display: none; }
  body { background: #fff; }
}
