:root {
  color-scheme: light;
  --ink: #10282a;
  --ink-soft: #4f6564;
  --paper: #f4f1e9;
  --white: #fffdf8;
  --line: #d6d8ce;
  --sea: #0f5555;
  --sea-dark: #0d2729;
  --foam: #b9e6d4;
  --sun: #f5ad58;
  --warning: #c26a2f;
  --error: #a44335;
  --caveat: #5f6b75;
  --info: #2d6f74;
  --safe-inline: max(18px, env(safe-area-inset-left));
  --radius: 18px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-synthesis: none;
}

/* The Search. A map over the approved roster, with the roster itself always
   rendered underneath it.

   The list is not a fallback bolted on afterwards -- it is the page, and the
   map is drawn over it. A tile archive that is missing, still building, or
   unreachable therefore costs the reader the map and nothing else, which is
   what "degrades to a usable page, not a blank one" has to mean when the
   archive is an operations artifact that ships separately from this code. */

*, *::before, *::after { box-sizing: border-box; }

html {
  /* Re-measured from the header on every resize, by the trackHeaderHeight()
     that spot-detail.js also carries. The value here is only what holds
     before the first measurement. Kept out of :root, which is the palette
     the stylesheets duplicate byte for byte. */
  --header-height: 58px;
  background: var(--paper);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body { margin: 0; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 12px 18px;
  background: var(--sea-dark);
  color: var(--white);
  z-index: 5;
}
.skip-link:focus { left: 0; }

/* The header pads itself out of the safe-area inset, which is why nothing
   below may hard-code its height -- see trackHeaderHeight() in search.js. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) var(--safe-inline) 10px;
  background: var(--sea-dark);
  color: var(--white);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.13em;
}
.brand-mark { display: block; width: 21px; height: 28px; }
.brand-mark svg { display: block; width: 100%; height: 100%; }

.site-nav { display: flex; gap: 4px; }
.nav-link {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--foam);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}
.nav-link-current {
  background: var(--sea);
  color: var(--white);
}

main { padding-bottom: max(28px, env(safe-area-inset-bottom)); }

.eyebrow {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.search-hero { padding: 22px var(--safe-inline) 10px; }
.search-hero h1 { margin: 5px 0 0; font-size: 1.7rem; letter-spacing: -0.01em; }

.offline-note {
  margin: 9px 0 0;
  font-size: 0.85rem;
  color: var(--caveat);
}

/* Sticky under the header, measured rather than assumed. */
.search-field-wrap {
  position: sticky;
  top: var(--header-height);
  z-index: 3;
  padding: 10px var(--safe-inline) 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.search-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.search-field {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 1rem; /* 16px: anything smaller makes iOS zoom on focus. */
}
.search-field:focus-visible { outline: 2px solid var(--sea); outline-offset: 1px; }
.search-summary { margin: 8px 0 0; font-size: 0.8rem; color: var(--ink-soft); }

.map-section { padding: 14px var(--safe-inline) 0; position: relative; }
.map-canvas {
  height: 56vh;
  min-height: 260px;
  max-height: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--foam);
}
.map-canvas:empty { background: var(--foam); }

.map-fallback {
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--caveat);
}
.map-fallback p:last-child { margin: 6px 0 0; font-size: 0.9rem; }

.map-attribution {
  margin: 7px 0 0;
  font-size: 0.7rem;
  color: var(--caveat);
}
.map-attribution a { color: inherit; }

.coverage-note {
  margin: 12px 0 0;
  padding: 0 var(--safe-inline);
  font-size: 0.8rem;
  color: var(--caveat);
}

/* The map. SVG this page draws from one payload per region -- no library, no
   tiles, no WebGL. Strokes carry vector-effect so a road stays one pixel wide
   at every zoom; anything sized in payload units is rescaled in script. */
.map-regions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}
.map-region {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.map-region-current {
  background: var(--sea);
  border-color: var(--sea);
  color: var(--white);
  font-weight: 700;
}

.map-frame { position: relative; }
.map-zoom {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.map-zoom-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.map-zoom-button[disabled] { opacity: 0.4; cursor: default; }

/* Outside the payload's own box is the page's paper, not sea: the map ends
   there, and what is beyond it was not surveyed as water. */
.map-svg {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  background: var(--paper);
}
.map-sea { fill: var(--foam); }
/* evenodd so a bay or a lagoon enclosed by the outer coastline reads as water.
   It resolves within one path and never across siblings, which is why every
   contour is a subpath of a single `d`. */
.map-land path {
  fill: #eae6da;
  fill-rule: evenodd;
  stroke: #9fb0aa;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.map-highways path,
.map-arterials path {
  fill: none;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.map-highways path { stroke: #c9a06a; stroke-width: 1.6; }
/* Principal arterials are the zoomed-in half of the road rule. */
.map-arterials { display: none; }
.map-detailed .map-arterials { display: inline; }
.map-arterials path { stroke: #d8c5a8; stroke-width: 1; }

.map-area-labels text {
  fill: var(--ink-soft);
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 5;
  text-anchor: middle;
  font-weight: 700;
}
.map-detailed .map-area-labels { display: none; }

/* A pin is drawn, not typed -- the same reason the wind arrows on Surf Check
   are CSS: a glyph is only as thick as the device's font. */
.map-pin circle {
  fill: var(--sea);
  stroke: var(--white);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
}
.map-pin .map-pin-hit {
  fill: transparent;
  stroke: none;
  pointer-events: all;
}
.map-pin-saved circle { fill: var(--sun); }
.map-pin-saved .map-pin-hit { fill: transparent; }
.map-pin text {
  fill: var(--sea-dark);
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 4;
  paint-order: stroke;
  text-anchor: middle;
  font-weight: 600;
  display: none;
}
.map-detailed .map-pin text { display: inline; }
.map-pin-filtered { display: none; }
.map-pin:focus-visible .map-pin-dot {
  stroke: var(--sea-dark);
  stroke-width: 4;
}

.map-coverage {
  margin: 7px 0 0;
  font-size: 0.75rem;
  color: var(--warning);
}

.spot-group { padding: 20px var(--safe-inline) 0; }
.group-heading h2 { margin: 0; font-size: 1.02rem; }
.group-note { margin: 3px 0 0; font-size: 0.78rem; color: var(--ink-soft); }
.area-heading {
  margin: 14px 0 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.spot-list { list-style: none; margin: 8px 0 0; padding: 0; }
.spot-row { border-bottom: 1px solid var(--line); }
.spot-row:last-child { border-bottom: 0; }
.spot-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px;
  color: inherit;
  text-decoration: none;
}
.spot-link:focus-visible { outline: 2px solid var(--sea); outline-offset: -2px; }
.spot-name { font-weight: 600; }
.spot-where { font-size: 0.78rem; color: var(--ink-soft); }

.state-panel {
  margin: 26px var(--safe-inline);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  text-align: center;
  color: var(--ink-soft);
}
.error-panel { border-color: var(--error); color: var(--ink); }
.error-panel h1 { margin: 6px 0 8px; font-size: 1.15rem; }

.loading-mark {
  display: block;
  width: 26px;
  height: 26px;
  margin: 0 auto 12px;
  border: 3px solid var(--foam);
  border-top-color: var(--sea);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .loading-mark { animation: none; }
}

.retry-button {
  margin-top: 12px;
  padding: 10px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--sea);
  color: var(--white);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
