/* ═══ High Water Access Advisor — styles ═══════════════════════════════
   Light "earthy green" theme, matched to the Outdoors Dashboard (dash/).
   The green nav is provided by the shared rk-nav block (self-contained).
   ═══════════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-dark:  #1b5e20;
  --green:       #2e7d32;
  --green-med:   #388e3c;
  --green-light: #558b2f;
  --amber:       #f57f17;
  --orange:      #e65100;
  --red:         #c62828;
  --blue:        #1565c0;
  --bg:          #f0f4f0;
  --card-bg:     #ffffff;
  --text:        #212121;
  --text-muted:  #666;
  --border:      #e0e0e0;
  --radius:      12px;
  --shadow:      0 2px 8px rgba(0,0,0,.10);

  /* status palette (access level) */
  --good-c:    #2e7d32;  --good-bg:    #e8f5e9;
  --limited-c: #b25e00;  --limited-bg: #fff3e0;
  --flood-c:   #c62828;  --flood-bg:   #ffebee;
  --unk-c:     #546e7a;  --unk-bg:     #eceff1;
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--green-dark); }

/* ─── INTRO / TITLE ─────────────────────────────────────────────────── */
.hw-intro {
  padding: 1rem 1.25rem 0.25rem;
}
.hw-intro h1 {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--green-dark);
  line-height: 1.15;
  letter-spacing: -0.3px;
}
.hw-intro p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  max-width: 60ch;
}

/* ─── KEY GAUGES STRIP ──────────────────────────────────────────────── */
.gauges-strip {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding: 0.9rem 1.25rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.gauge-chip {
  flex: 0 0 auto;
  min-width: 150px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 5px solid var(--unk-c);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  box-shadow: var(--shadow);
}
.gauge-chip .gc-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.gauge-chip .gc-read {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  margin-top: 0.25rem;
}
.gauge-chip .gc-ft { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.gauge-chip .gc-trend { font-size: 1.15rem; font-weight: 700; color: var(--text-muted); }
.gauge-chip .gc-trend.rising  { color: var(--orange); }
.gauge-chip .gc-trend.falling { color: var(--green); }
.gauge-chip .gc-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }
.gauge-chip.st-good    { border-left-color: var(--good-c); }
.gauge-chip.st-limited { border-left-color: var(--limited-c); }
.gauge-chip.st-flooded { border-left-color: var(--flood-c); }
.gauge-chip.st-unknown { border-left-color: var(--unk-c); }

/* ─── CONTROLS BAR ──────────────────────────────────────────────────── */
.hw-bar {
  background: var(--green);
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  position: sticky;
  top: 52px;                 /* below the sticky rk-nav (min-height 52px) */
  z-index: 900;
}
.hw-filters { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.hw-bar select {
  padding: 0.4rem 0.7rem;
  border: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: inherit;
  background: rgba(255,255,255,.95);
  color: var(--text);
  cursor: pointer;
}
.hw-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.btn-icon {
  padding: 0.42rem 0.8rem;
  border: 1.5px solid rgba(255,255,255,.55);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn-icon:hover { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.8); }
.btn-icon.active { background: rgba(255,255,255,.22); border-color: #fff; }
.btn-primary {
  padding: 0.45rem 1rem;
  border: none;
  border-radius: 8px;
  background: #fff;
  color: var(--green-dark);
  font-size: 0.86rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
  white-space: nowrap;
}
.btn-primary:hover { background: #e8f5e9; transform: translateY(-1px); }

/* ─── STATUS SUMMARY LINE ───────────────────────────────────────────── */
.hw-summary {
  padding: 0.75rem 1.25rem 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.hw-summary .pill {
  padding: 0.15rem 0.6rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.8rem;
}
.pill.st-good    { background: var(--good-bg);    color: var(--good-c); }
.pill.st-limited { background: var(--limited-bg); color: var(--limited-c); }
.pill.st-flooded { background: var(--flood-bg);   color: var(--flood-c); }
.pill.st-unknown { background: var(--unk-bg);     color: var(--unk-c); }
.last-updated { margin-left: auto; font-size: 0.76rem; white-space: nowrap; }

/* ─── SPOT LIST ─────────────────────────────────────────────────────── */
.spot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.9rem;
  padding: 0.9rem 1.25rem 1.5rem;
}
.spot-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 6px solid var(--unk-c);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.spot-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.14); }
.spot-card:focus-visible { outline: 3px solid var(--green-med); outline-offset: 2px; }
.spot-card.st-good    { border-left-color: var(--good-c); }
.spot-card.st-limited { border-left-color: var(--limited-c); }
.spot-card.st-flooded { border-left-color: var(--flood-c); }
.spot-card.st-unknown { border-left-color: var(--unk-c); }
.spot-card.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%,100% { box-shadow: var(--shadow); } 25% { box-shadow: 0 0 0 3px var(--green-med); } }

.sc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.sc-name { font-size: 1.02rem; font-weight: 800; color: var(--green-dark); line-height: 1.2; }
.sc-type { font-size: 0.74rem; color: var(--text-muted); margin-top: 0.1rem; }
.status-badge {
  flex: 0 0 auto;
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.status-badge.st-good    { background: var(--good-bg);    color: var(--good-c); }
.status-badge.st-limited { background: var(--limited-bg); color: var(--limited-c); }
.status-badge.st-flooded { background: var(--flood-bg);   color: var(--flood-c); }
.status-badge.st-unknown { background: var(--unk-bg);     color: var(--unk-c); }

.sc-read { display: flex; align-items: baseline; gap: 0.4rem; }
.sc-ft { font-size: 1.7rem; font-weight: 800; line-height: 1; }
.sc-trend { font-size: 1.2rem; font-weight: 700; color: var(--text-muted); }
.sc-trend.rising  { color: var(--orange); }
.sc-trend.falling { color: var(--green); }
.sc-thresh { font-size: 0.76rem; color: var(--text-muted); }
.sc-reason { font-size: 0.86rem; color: var(--text); line-height: 1.4; }
.sc-rising-warn {
  font-size: 0.82rem; font-weight: 600; color: var(--orange);
  background: #fff3e0; border-radius: 6px; padding: 0.35rem 0.55rem;
}
.sc-tip {
  font-size: 0.8rem; color: var(--text-muted); line-height: 1.45;
  border-top: 1px dashed var(--border); padding-top: 0.5rem;
}
.sc-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.sc-alt {
  font-size: 0.8rem; font-weight: 700; color: var(--green-dark);
  background: none; border: none; cursor: pointer; padding: 0; text-align: left;
}
.sc-alt:hover { text-decoration: underline; }
.sc-gauge { font-size: 0.72rem; color: #aaa; }

/* ─── MAP ───────────────────────────────────────────────────────────── */
.map-section {
  margin: 0 1.25rem 1.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.map-section.hidden { display: none; }
.map-header {
  background: var(--green-dark);
  color: #fff;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
}
.map-legend { display: flex; gap: 0.9rem; font-size: 0.74rem; font-weight: 500; flex-wrap: wrap; }
.map-legend span { display: inline-flex; align-items: center; gap: 0.25rem; }
.lg-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.lg-dot.good { background: var(--good-c); } .lg-dot.limited { background: var(--limited-c); }
.lg-dot.flooded { background: var(--flood-c); } .lg-dot.unknown { background: var(--unk-c); }
#map { height: 60vh; min-height: 340px; }

/* Leaflet colored pin (div-based) */
.hw-pin {
  width: 22px; height: 22px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.hw-pin.good { background: var(--good-c); } .hw-pin.limited { background: var(--limited-c); }
.hw-pin.flooded { background: var(--flood-c); } .hw-pin.unknown { background: var(--unk-c); }

/* ─── DETAIL MODAL ──────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: none; align-items: flex-end; justify-content: center;
  z-index: 5000; padding: 0;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--card-bg);
  width: 100%; max-width: 560px;
  max-height: 92vh; overflow-y: auto;
  border-radius: 16px 16px 0 0;
  padding: 1.2rem 1.3rem 1.6rem;
  animation: slideup 0.22s ease;
}
@keyframes slideup { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 1rem; }
  .modal { border-radius: 16px; }
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.modal-title { font-size: 1.25rem; font-weight: 900; color: var(--green-dark); line-height: 1.2; }
.modal-close {
  background: #f0f0f0; border: none; border-radius: 50%;
  width: 34px; height: 34px; font-size: 1.1rem; cursor: pointer; flex: 0 0 auto; color: var(--text);
}
.modal-close:hover { background: #e0e0e0; }
.modal-status { margin: 0.75rem 0; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.modal-read { display: flex; align-items: baseline; gap: 0.4rem; margin: 0.4rem 0 0.75rem; }
.modal-read .sc-ft { font-size: 2.2rem; }
.modal-section { margin-top: 1rem; }
.modal-section h4 {
  font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); margin-bottom: 0.35rem;
}
.modal-section p { font-size: 0.9rem; line-height: 1.5; color: var(--text); }
.thresh-bar { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.thresh-box { flex: 1; text-align: center; border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem; }
.thresh-box .tb-lbl { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.thresh-box .tb-val { font-size: 1.1rem; font-weight: 800; margin-top: 0.15rem; }
.thresh-box.current { background: var(--good-bg); }
.thresh-box.action  { background: var(--limited-bg); }
.thresh-box.flood   { background: var(--flood-bg); }
.alt-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.35rem; }
.alt-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: 10px;
  background: #fafafa; cursor: pointer; font-family: inherit; text-align: left; width: 100%;
}
.alt-btn:hover { border-color: var(--green-med); background: #f1f8e9; }
.alt-btn .alt-name { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.alt-btn .alt-badge { font-size: 0.7rem; font-weight: 800; padding: 0.15rem 0.55rem; border-radius: 20px; text-transform: uppercase; }
.modal-links { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }
.modal-link {
  font-size: 0.82rem; font-weight: 600; color: var(--green-dark);
  border: 1px solid var(--green-med); border-radius: 8px;
  padding: 0.45rem 0.8rem; text-decoration: none; background: none; cursor: pointer; font-family: inherit;
}
.modal-link:hover { background: #e8f5e9; }

/* ─── TIPS SECTION ──────────────────────────────────────────────────── */
.tips-section { margin: 0 1.25rem 1.5rem; }
.tips-toggle {
  width: 100%; text-align: left; cursor: pointer;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.9rem 1.1rem;
  font-size: 1rem; font-weight: 800; color: var(--green-dark);
  display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow);
}
.tips-body {
  display: none;
  background: var(--card-bg); border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius); padding: 0.5rem 1.1rem 1rem;
  margin-top: -6px;
}
.tips-body.open { display: block; }
.tips-body ul { list-style: none; }
.tips-body li {
  font-size: 0.88rem; line-height: 1.5; color: var(--text);
  padding: 0.5rem 0 0.5rem 1.6rem; position: relative; border-bottom: 1px solid #f2f2f2;
}
.tips-body li::before { content: '🌊'; position: absolute; left: 0; top: 0.5rem; font-size: 0.85rem; }
.tips-body li:last-child { border-bottom: none; }

/* ─── SKELETON / EMPTY ──────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #e8e8e8 25%, #f4f4f4 50%, #e8e8e8 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
  border-radius: 6px; height: 1.1rem; margin-bottom: 0.5rem;
}
.skeleton.tall { height: 3.5rem; }
.skeleton.short { width: 55%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.empty-note { padding: 1.5rem 1.25rem; color: var(--text-muted); font-style: italic; }

/* ─── TOAST ─────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #212121; color: #fff; padding: 0.6rem 1.4rem;
  border-radius: 24px; font-size: 0.88rem; font-weight: 600;
  z-index: 9999; transition: transform 0.3s ease; pointer-events: none; max-width: 90vw; text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ─── FOOTER ────────────────────────────────────────────────────────── */
footer {
  background: var(--green-dark); color: #c8e6c9;
  text-align: center; padding: 1.5rem 1rem; font-size: 0.82rem; margin-top: 1rem;
}
.footer-links { display: flex; justify-content: center; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.footer-links a { color: #a5d6a7; text-decoration: none; }
.footer-links a:hover { color: #fff; }
.footer-note { color: #a5d6a7; font-size: 0.76rem; margin-top: 0.4rem; }

/* ─── ACCESSIBILITY ─────────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ─── RESPONSIVE ────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .hw-bar { top: 0; position: static; }   /* nav collapses on mobile; keep controls in flow */
  .spot-grid { grid-template-columns: 1fr; padding: 0.75rem; }
  .hw-intro { padding: 0.8rem 0.9rem 0; }
  .gauges-strip { padding: 0.7rem 0.9rem; }
  .hw-summary { padding: 0.6rem 0.9rem 0; }
  .last-updated { margin-left: 0; width: 100%; }
}
