/* The website's one stylesheet. Colours are the app's (app/src/theme.ts), light and dark. Mobile first. */

:root {
  --bg: #f4f4f6;
  --surface: #ffffff;
  --surface-muted: #f0f0f3;
  --text: #15171a;
  --muted: #5b6069;
  --border: #e1e2e6;
  --accent: #e0651c;          /* the app's accent: decoration, markers */
  --accent-strong: #b0490c;   /* buttons and links: 5:1 on white */
  --on-accent: #ffffff;
  --link: #b0490c;
  --success: #16a34a;
  --danger: #d93025;
  --danger-bg: #fdecea;
  --good-bg: #e8f6ee;
  --info-bg: #eef2fd;
  --indoor: #2563eb;
  --candidate: #9b5cf6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 2px 8px rgba(0, 0, 0, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1012;
    --surface: #1d1e22;
    --surface-muted: #2a2b30;
    --text: #f3f4f6;
    --muted: #a3a8b1;
    --border: #34363c;
    --accent: #f07a32;
    --accent-strong: #f07a32;
    --on-accent: #15171a;
    --link: #f59a62;
    --success: #34c26a;
    --danger: #f2685f;
    --danger-bg: #3a1f1d;
    --good-bg: #17301f;
    --info-bg: #1c2540;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  overflow-wrap: break-word;
}
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 28px; margin: 8px 0 10px; }
h2 { font-size: 20px; margin: 32px 0 10px; }
h3 { font-size: 16px; margin: 20px 0 6px; }
p { margin: 10px 0; }
.small, .hint { color: var(--muted); font-size: 14px; }
.lede { font-size: 17px; color: var(--muted); max-width: 62ch; }

.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 16px; top: 8px; z-index: 10; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

/* Header and footer */
header.site { background: var(--surface); border-top: 4px solid var(--accent); border-bottom: 1px solid var(--border); }
.bar, main, footer.site .wrap { max-width: 1040px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 18px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 800; font-size: 18px; text-decoration: none; }
.logo { flex: none; }
header.site nav { display: flex; flex-wrap: wrap; gap: 2px 16px; }
header.site nav a, footer.site nav a { color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; padding: 6px 0; }
header.site nav a[aria-current="page"] { color: var(--link); }
main { padding-top: 18px; padding-bottom: 48px; }
footer.site { border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 14px; }
footer.site .wrap { padding-top: 18px; padding-bottom: 28px; }
.foot-brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.foot-brand .logo { width: 20px; height: 20px; }
footer.site nav { display: flex; flex-wrap: wrap; gap: 0 16px; }
.fine { font-size: 13px; }

/* Breadcrumbs */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 6px; padding: 0; font-size: 14px; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin: 0 6px 0 2px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs [aria-current] { color: var(--text); }

/* Buttons */
.button, .search button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border: 0; border-radius: 12px;
  background: var(--accent-strong); color: var(--on-accent);
  font: 700 16px/1.2 var(--font); text-decoration: none; cursor: pointer;
}
.button:hover, .search button:hover { filter: brightness(1.08); }
.button.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }

/* Search */
.search { margin: 18px 0; max-width: 620px; }
.search label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.search-row { display: flex; gap: 8px; }
.search input {
  flex: 1; min-width: 0; min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
  font: 16px var(--font);
}
.search input:focus { border-color: var(--accent); }

/* Home */
.hero { padding: 12px 0 4px; }
.hero h1 { font-size: 32px; }
.points { display: grid; gap: 12px; margin: 20px 0; }
.points > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2px 16px 6px; box-shadow: var(--shadow); }
.points h2 { font-size: 17px; margin: 14px 0 4px; }
.points p { color: var(--muted); margin-top: 4px; }
.get-app { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 18px 18px; margin: 28px 0; box-shadow: var(--shadow); }
.get-app-head { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.get-app-head h2 { margin: 0; }
.app-icon { flex: none; border-radius: 22.5%; box-shadow: var(--shadow); }

/* Store buttons */
.stores { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 4px; }
.store {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 16px; border-radius: 12px;
  background: #15171a; color: #ffffff; text-decoration: none; font-weight: 700; font-size: 16px; line-height: 1.1;
  position: relative;
}
@media (prefers-color-scheme: dark) { .store { background: #f3f4f6; color: #15171a; } }
.store small { display: block; font-weight: 500; font-size: 11px; }
.store .soon { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 6px; background: var(--accent-strong); color: var(--on-accent); margin-left: 4px; }

/* Lists of states, places */
.state-grid, .place-list, .chips, .courts { list-style: none; padding: 0; margin: 10px 0; }
.state-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.state-grid a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 6px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600;
}
.state-grid a:hover { border-color: var(--accent); }
.count { color: var(--muted); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.place-list { columns: 2 160px; column-gap: 24px; }
.place-list.wide { columns: 1; }
.place-list li { break-inside: avoid; margin: 0; padding: 4px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 15px; }
.chips a:hover { border-color: var(--accent); }
.letters { display: flex; flex-wrap: wrap; gap: 2px 10px; font-weight: 700; }
.letters a { padding: 4px 2px; }

/* Court lists */
.courts { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.courts li + li { border-top: 1px solid var(--border); }
.courts a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--text); text-decoration: none; }
.courts a:hover { background: var(--surface-muted); }
.court-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.court-name { font-weight: 650; color: var(--link); }
.court-meta { color: var(--muted); font-size: 14px; }
.court-meta em { font-style: normal; }
.court-dist { color: var(--muted); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dot { flex: none; display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); vertical-align: -1px; }
.dot-verified { background: #e0651c; }
.dot-indoor, .dot-school { background: var(--indoor); }
.dot-school { background: transparent; border: 3px solid var(--indoor); box-shadow: none; }
.dot-candidate { background: var(--candidate); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 13px; margin: 4px 0 8px; }
.legend .dot { margin-right: 6px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 14px 0; font-weight: 600; }

/* Maps */
.map { margin: 14px 0; }
.map-canvas {
  position: relative; height: 220px; border-radius: var(--radius); overflow: hidden;
  background: var(--surface-muted); border: 1px solid var(--border);
}
.map-tall .map-canvas { height: 340px; }
.map-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.map-canvas.ready .map-fallback { display: none; }
.map figcaption { color: var(--muted); font-size: 12px; margin-top: 6px; }
.map figcaption a { color: var(--muted); }
.maplibregl-popup-content { font: 14px/1.4 var(--font); color: #15171a; padding: 10px 12px; }
.maplibregl-popup-content a { color: #b0490c; font-weight: 650; }

/* Court page */
.court-head { margin-bottom: 10px; }
.kicker { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: 14px; margin: 6px 0 0; }
.court-head h1 { margin: 4px 0 6px; }
.status { display: inline-block; margin: 0; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--good-bg); color: var(--success); }
.status-unconfirmed { background: var(--info-bg); color: var(--text); }
.banner, .note { border-radius: 12px; padding: 10px 14px; margin: 12px 0; background: var(--info-bg); }
.banner-bad { background: var(--danger-bg); color: var(--danger); font-weight: 700; }
.court-grid { display: grid; gap: 4px 28px; }
/* The court from above (USDA NAIP via USGS): full width under the title, a ring on the spot. */
.aerial { margin: 4px 0 18px; }
.aerial-frame { position: relative; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
.aerial-frame img { display: block; width: 100%; height: auto; aspect-ratio: 8 / 5; max-height: 400px; object-fit: cover; }
.aerial-mark { position: absolute; left: 50%; top: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px #E0651C, 0 2px 8px rgba(0, 0, 0, 0.5); pointer-events: none; }
.aerial figcaption { color: var(--muted); font-size: 12px; margin-top: 6px; }
.facts { margin: 8px 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 16px; }
.facts div { display: flex; gap: 12px; padding: 9px 0; }
.facts div + div { border-top: 1px solid var(--border); }
.facts dt { flex: 0 0 92px; color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; min-width: 0; }
.tags { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.tag { padding: 10px 14px; border-radius: 12px; background: var(--info-bg); }
.tag strong { display: block; }
.tag span { color: var(--muted); font-size: 14px; }
.tag-bad { background: var(--danger-bg); }
.tag-bad strong { color: var(--danger); }
.tag-good { background: var(--good-bg); }
.tag-good strong { color: var(--success); }
.busy { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.directions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 10px 0 0; }
.directions .button { min-height: 40px; padding: 8px 14px; font-size: 15px; }
.directions .osm { font-size: 14px; color: var(--muted); }
.open { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 18px 16px; margin: 24px 0; box-shadow: var(--shadow); }
.open-app .button { margin-top: 4px; }
.open-app .hint { margin: 10px 0 0; }
.source { color: var(--muted); font-size: 13px; margin-top: 24px; }
.source a { color: var(--muted); }

/* Run link, cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 18px; margin: 18px 0; }
.run h1 { max-width: 28ch; }

/* Policy pages (built from ../site/) */
.prose { max-width: 720px; }
.prose h1 { margin-top: 8px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose dl { margin: 0; }
.prose dt { font-weight: 700; margin-top: 14px; }
.prose dd { margin: 2px 0 0; }
.prose .why, .prose .muted, .prose .updated { color: var(--muted); }
.prose .updated { font-size: 14px; margin: 0 0 20px; }
.prose details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin: 10px 0; padding: 0 14px; }
.prose summary { cursor: pointer; font-weight: 700; padding: 12px 0; }
.prose details[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.prose .card { padding: 4px 16px; }
.prose .card > h2:first-child { margin-top: 12px; }
.todo { background: var(--info-bg); border-radius: 6px; padding: 1px 6px; font-weight: 600; }
.credits h2 { margin-top: 28px; }
.credits dl > div { padding: 10px 0; border-top: 1px solid var(--border); }
.credits dt { font-weight: 700; }
.credits dd { margin: 4px 0 0; color: var(--muted); }

@media (min-width: 720px) {
  h1 { font-size: 34px; }
  .hero h1 { font-size: 42px; }
  .points { grid-template-columns: repeat(3, 1fr); }
  .court-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .court-grid .map { margin-top: 8px; }
  .map-canvas { height: 280px; }
  .map-tall .map-canvas { height: 420px; }
  .place-list { columns: 3 180px; }
}

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