/* ShoreForecast — one hand-written stylesheet, mobile-first.
   Most users check conditions on a phone at the beach: big numbers,
   readable in sunlight, minimal payload. */

:root {
  --blue: #0b6e99;
  --blue-dark: #085575;
  --ink: #16303c;
  --muted: #5f7783;
  --bg: #f4f9fb;
  --card: #ffffff;
  --line: #d9e6ec;
  --calm: #8fa3ad;
  --fair: #2e9e5b;
  --good: #e8830c;
  --strong: #d43d2a;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}

img { max-width: 100%; }
a { color: var(--blue); }
h1 { font-size: 1.45rem; line-height: 1.25; margin: 0.4em 0; }
h2 { font-size: 1.15rem; margin: 1.6em 0 0.6em; }
h3 { font-size: 1rem; margin: 0; }
.muted { color: var(--muted); font-size: 0.9rem; }

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 14px 40px;
}

/* ── Header / footer ─────────────────────────────────────────────────── */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--blue);
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.brand .tagline {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  opacity: 0.85;
}

.lang-switch {
  color: #fff;
  font-size: 0.9rem;
  text-decoration: underline;
  white-space: nowrap;
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 30px;
  padding: 18px 14px 30px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.breadcrumb { font-size: 0.85rem; margin: 12px 0 0; color: var(--muted); }
.updated-line { margin-top: -0.3em; }

/* ── Webcam ──────────────────────────────────────────────────────────── */

.cam-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0c1e27;
  border-radius: var(--radius);
  overflow: hidden;
}

.cam-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.cam-image { width: 100%; border-radius: var(--radius); display: block; }

.cam-placeholder {
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e6eef2;
  color: var(--muted);
  border-radius: var(--radius);
  border: 1px dashed var(--line);
}

.cam-attribution { font-size: 0.78rem; margin: 6px 2px; color: var(--muted); }
.cam-attribution a { color: var(--muted); }

/* ── Current conditions ──────────────────────────────────────────────── */

.conditions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.cond-tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cond-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.cond-value { font-size: 1.5rem; font-weight: 700; }
.cond-value small { font-size: 0.85rem; font-weight: 400; color: var(--muted); }

.wind-arrow {
  display: inline-block;
  font-weight: 700;
  transform-origin: 50% 50%;
}

/* Wind color coding: grey <8, green 8–15, orange 15–25, red >25 kts */
.wind-chip { border-radius: 6px; padding: 0 6px; color: #fff; display: inline-block; }
.wind-calm { background: var(--calm); }
.wind-fair { background: var(--fair); }
.wind-good { background: var(--good); }
.wind-strong { background: var(--strong); }

.score-badge {
  display: inline-block;
  min-width: 2.1em;
  text-align: center;
  border-radius: 999px;
  padding: 1px 8px;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}
.score-high { background: var(--fair); }
.score-mid { background: var(--good); }
.score-low { background: var(--calm); }

/* ── Forecast table (Windguru-style) ─────────────────────────────────── */

.fc-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

table.fc {
  border-collapse: collapse;
  font-size: 0.72rem;
  line-height: 1.2;
}

.fc th,
.fc td {
  border: 1px solid var(--line);
  padding: 3px 4px;
  text-align: center;
  min-width: 27px;
  white-space: nowrap;
  color: #16303c; /* fixed dark ink — cells have their own light backgrounds */
}

.fc .fc-label {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--card);
  text-align: left;
  font-weight: 600;
  padding: 3px 8px;
}

.fc thead th { background: #eaf3f7; font-weight: 600; }
.fc .fc-day th { background: #dcecf3; }

.fc-arrow {
  display: inline-block;
  font-weight: 700;
  transform-origin: 50% 50%;
}

.fc-note { margin: 6px 2px 14px; font-size: 0.75rem; }

/* ── Chart (inline SVG) ──────────────────────────────────────────────── */

.chart { margin: 0; }
.chart-scroll { overflow-x: auto; }
.chart-scroll svg {
  min-width: 700px;
  width: 100%;
  height: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .grid-day { stroke: #c3d6de; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .axis-left { text-anchor: end; }
.chart .axis-right { text-anchor: start; }
.chart .axis-day { text-anchor: middle; }
.chart .line-wind { fill: none; stroke: var(--blue); stroke-width: 2.2; }
.chart .line-gust { fill: none; stroke: var(--good); stroke-width: 1.4; stroke-dasharray: 5 4; }
.chart .bar-wave { fill: #9fd8ef; opacity: 0.75; }

.chart-legend { display: flex; gap: 16px; font-size: 0.8rem; color: var(--muted); margin-top: 6px; }
.swatch { display: inline-block; width: 14px; height: 4px; margin-right: 5px; vertical-align: middle; border-radius: 2px; }
.swatch-wind { background: var(--blue); }
.swatch-gust { background: var(--good); }
.swatch-wave { background: #9fd8ef; height: 10px; }

.tide-note { margin-top: 8px; }

/* ── Spot info ───────────────────────────────────────────────────────── */

.spot-facts { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }

.chip {
  display: inline-block;
  background: #e2eff5;
  color: var(--blue-dark);
  border-radius: 999px;
  padding: 1px 10px;
  font-size: 0.85rem;
  margin: 0 4px 4px 0;
}
.chip-dir { background: #fdeed8; color: #8a5a0a; }

.spot-description { max-width: 65ch; }

/* ── Spot cards / lists ──────────────────────────────────────────────── */

.spot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.spot-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-decoration: none;
  color: var(--ink);
}

.spot-card:hover { border-color: var(--blue); }
.spot-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.spot-card-conditions { margin: 8px 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.spot-card-updated { margin: 6px 0 0; font-size: 0.75rem; }

/* Ranked list on the home page */
.rank-list { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.rank-list > li { counter-increment: rank; }
.rank-list .spot-card { margin-bottom: 10px; position: relative; padding-left: 44px; }
.rank-list .spot-card::before {
  content: counter(rank);
  position: absolute;
  left: 12px;
  top: 14px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--calm);
}

/* ── Map (Leaflet) ───────────────────────────────────────────────────── */

#map {
  height: 62vh;
  min-height: 320px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  z-index: 0; /* keep Leaflet panes under the sticky header */
}

.map-marker {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.map-popup a { font-weight: 700; }

@media (min-width: 700px) {
  h1 { font-size: 1.8rem; }
  .brand .tagline { display: inline; margin-left: 6px; }
}
