/* ocean.css — Ocean Layers workbench. Crisp terminal aesthetic, standalone. */
:root {
    --bg: #0b0e11;
    --panel: #0e1419;
    --panel-2: #10161c;
    --edge: #1c2530;
    --ink: #d7e0e9;
    --ink-2: #7d8b99;
    --ink-3: #5c6b78;
    --teal: #2dd4bf;
    --amber: #fbbf24;
    --violet: #a78bfa;
    --pink: #f472b6;
    --mono: "DM Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--ink); font-family: var(--mono); font-size: 12px; }

#oceanApp { display: flex; height: 100vh; }

/* ---------- sidebar ---------- */
#sidebar {
    width: 272px; flex: 0 0 272px;
    background: var(--panel);
    border-right: 1px solid var(--edge);
    overflow-y: auto;
    padding: 0 0 16px;
}
#sidebar::-webkit-scrollbar { width: 6px; }
#sidebar::-webkit-scrollbar-thumb { background: var(--edge); border-radius: 2px; }

.sb-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--edge);
}
.sb-back {
    color: var(--ink-3); text-decoration: none; font-size: 15px;
    border: 1px solid var(--edge); border-radius: 2px;
    width: 26px; height: 26px; display: grid; place-items: center;
}
.sb-back:hover { color: var(--teal); border-color: var(--teal); }
.sb-title { color: var(--teal); font-weight: 700; letter-spacing: 0.22em; font-size: 12px; }
.sb-3d {
    margin-left: auto; color: var(--violet); text-decoration: none;
    border: 1px dashed var(--edge); border-radius: 2px; padding: 4px 7px;
    font-size: 9px; font-weight: 700; letter-spacing: 0.12em;
}
.sb-3d:hover { border-color: var(--violet); }
.sb-sub { color: var(--ink-3); font-size: 8px; letter-spacing: 0.3em; margin-top: 2px; }

.sb-section { padding: 12px 14px 4px; border-bottom: 1px solid var(--edge); }
.layer-category { padding: 12px 14px 6px; border-bottom: 1px solid var(--edge); }
.cat-title {
    color: var(--ink-3); font-size: 9px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.2em;
    margin-bottom: 8px;
}

.layer-row {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 2px; cursor: pointer; border-radius: 2px;
    user-select: none;
}
.layer-row:hover .layer-name { color: var(--ink); }
.layer-row.soon { cursor: default; opacity: 0.55; }
.layer-row input { display: none; }
.layer-check {
    width: 12px; height: 12px; flex: 0 0 12px;
    border: 1px solid var(--ink-3); border-radius: 2px;
    position: relative; transition: all 0.15s;
}
.layer-row input:checked + .layer-check {
    background: var(--teal); border-color: var(--teal);
    box-shadow: 0 0 6px rgba(45, 212, 191, 0.4);
}
.layer-text { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.layer-name { color: var(--ink-2); font-size: 11px; font-weight: 500; transition: color 0.15s; }
.layer-row input:checked ~ .layer-text .layer-name { color: var(--ink); }
.layer-src { color: var(--ink-3); font-size: 8px; letter-spacing: 0.08em; text-transform: uppercase; }
.layer-badge {
    font-size: 7px; font-weight: 700; letter-spacing: 0.15em;
    padding: 2px 5px; border-radius: 2px; min-width: 0;
}
.layer-badge[data-state="live"] { color: var(--teal); background: rgba(45, 212, 191, 0.1); }
.layer-badge[data-state="loading"] { color: var(--amber); }
.layer-badge[data-state="error"] { color: var(--pink); background: rgba(244, 114, 182, 0.1); }
.layer-row.soon .layer-badge { color: var(--violet); background: rgba(167, 139, 250, 0.1); }

/* time controls */
#timeControls .time-label { float: right; color: var(--teal); font-size: 9px; letter-spacing: 0.06em; text-transform: none; }
#timeSlider {
    width: 100%; -webkit-appearance: none; height: 3px;
    background: linear-gradient(90deg, var(--teal), var(--amber));
    border-radius: 2px; outline: none; margin: 4px 0 10px;
}
#timeSlider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%;
    background: var(--teal); border: 2px solid var(--bg); cursor: pointer;
}
.layer-row.time-faded { opacity: 0.45; }
.layer-badge[data-state="faded"] { color: var(--amber); background: rgba(251, 191, 36, 0.08); }

.time-btns { display: flex; gap: 6px; margin-bottom: 6px; }
.time-btns button {
    flex: 1; background: var(--panel-2); color: var(--ink-2);
    border: 1px solid var(--edge); border-radius: 2px;
    font-family: var(--mono); font-size: 10px; font-weight: 600;
    letter-spacing: 0.06em; padding: 6px 0; cursor: pointer;
}
.time-btns button:hover { border-color: var(--ink-3); color: var(--ink); }
.time-btns button.active { border-color: var(--teal); color: var(--teal); background: rgba(45, 212, 191, 0.06); }
.time-note { color: var(--ink-3); font-size: 8px; letter-spacing: 0.04em; padding-bottom: 8px; }

/* display settings */
.opacity-row { display: flex; align-items: center; gap: 10px; padding: 6px 2px 10px; }
.opacity-row .layer-name { flex: 0 0 auto; }
.opacity-row input[type="range"] {
    flex: 1; -webkit-appearance: none; height: 3px;
    background: var(--edge); border-radius: 2px; outline: none;
}
.opacity-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 11px; height: 11px; border-radius: 50%;
    background: var(--teal); border: 2px solid var(--bg); cursor: pointer;
}

/* layer info */
.info-row { display: flex; justify-content: space-between; padding: 3px 2px; }
.info-row span { color: var(--ink-3); font-size: 10px; }
.info-row b { color: var(--ink); font-size: 10px; font-weight: 600; text-align: right; max-width: 150px; }

/* ---------- map ---------- */
#mapWrap { flex: 1; position: relative; }
#oceanMap { position: absolute; inset: 0; background: var(--bg); }

#statusBar {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 1000;
    display: flex; justify-content: space-between; align-items: center;
    padding: 5px 12px;
    background: rgba(11, 14, 17, 0.85); backdrop-filter: blur(4px);
    border-top: 1px solid var(--edge);
    font-size: 10px; color: var(--ink-3); letter-spacing: 0.05em;
    pointer-events: none;
}
#cursorPos { color: var(--teal); }

/* floating panels (tides / moon) */
#panelDock {
    position: absolute; left: 12px; bottom: 34px; z-index: 1000;
    display: flex; flex-direction: column; gap: 8px; width: 250px;
}
.ocean-panel {
    background: rgba(14, 20, 25, 0.92); backdrop-filter: blur(4px);
    border: 1px solid var(--edge); border-radius: 2px;
    padding: 10px 12px;
}
.op-title {
    color: var(--ink); font-size: 10px; font-weight: 700; letter-spacing: 0.12em;
    margin-bottom: 6px; display: flex; justify-content: space-between; align-items: baseline;
}
.op-src { color: var(--ink-3); font-size: 7px; font-weight: 500; letter-spacing: 0.1em; }
/* interactive tide chart — ocean-blue line + gradient fill, now-marker, hover */
.tide-chart-wrap { position: relative; width: 100%; margin-bottom: 7px; }
.tide-chart { width: 100%; height: 46px; display: block; overflow: visible; }
.tide-area { fill: url(#tideFill); stroke: none; }
.tf-top { stop-color: rgba(56,189,248,0.34); }
.tf-bot { stop-color: rgba(56,189,248,0.02); }
.tide-line { fill: none; stroke: #38bdf8; stroke-width: 1.6; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.tide-now { stroke: rgba(45,212,191,0.7); stroke-width: 1; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
.tide-cursor { stroke: rgba(215,224,233,0.55); stroke-width: 1; vector-effect: non-scaling-stroke; }
.tide-cdot { fill: #38bdf8; stroke: #0b0e11; stroke-width: 1; }
.tide-tip {
    position: absolute; top: -3px; transform: translateX(-50%);
    background: rgba(11,14,17,0.94); border: 1px solid #223040; border-radius: 3px;
    color: #d7e0e9; font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.04em;
    padding: 2px 5px; white-space: nowrap; pointer-events: none; z-index: 5;
}
.tide-tip b { color: #7dd3fc; font-weight: 600; }
/* SVG moon phase glyph — teal-lit disc, on-brand (replaces the multicolor emoji) */
.moon-row { display: flex; align-items: center; gap: 11px; margin-bottom: 7px; }
.moon-svg { width: 30px; height: 30px; flex: 0 0 30px; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4)); }
.moon-svg .moon-dark { fill: #1b2833; }
.moon-svg .moon-lit { fill: #7fe3d5; }
.moon-svg .moon-ring { fill: none; stroke: rgba(45,212,191,0.4); stroke-width: 2; }
.moon-row b { font-size: 11px; }
.moon-sub { color: var(--ink-3); font-size: 9px; }

/* buoy popups + leaflet chrome */
.bp-row { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.bp-row span { color: var(--ink-3); font-size: 8px; letter-spacing: 0.12em; }
.bp-row b { color: var(--teal); font-size: 10px; }
.buoy-pop { font-family: var(--mono); min-width: 130px; }
.bp-title { color: var(--ink); font-size: 10px; font-weight: 700; letter-spacing: 0.06em; margin-bottom: 4px; }
.bp-status { margin-top: 5px; font-size: 7px; letter-spacing: 0.2em; font-weight: 700; }

/* ---- light mode for the docked side panels (moon / tides / tidal currents) ---- */
:root[data-theme="light"] .ocean-panel {
    background: rgba(255, 255, 255, 0.92); border-color: #dde4ec;
    box-shadow: 0 6px 20px rgba(16, 33, 44, 0.12);
}
:root[data-theme="light"] .op-title { color: #16212c; }
:root[data-theme="light"] .op-src { color: #8a97a4; }
:root[data-theme="light"] .moon-row b { color: #16212c; }
:root[data-theme="light"] .moon-sub { color: #8a97a4; }
:root[data-theme="light"] .bp-row span { color: #55636f; }
:root[data-theme="light"] .bp-row b { color: #0d9488; }
:root[data-theme="light"] .bp-title { color: #16212c; }
:root[data-theme="light"] .tide-line { stroke: #0284c7; }
:root[data-theme="light"] .tf-top { stop-color: rgba(2,132,199,0.24); }
:root[data-theme="light"] .tf-bot { stop-color: rgba(2,132,199,0.02); }
:root[data-theme="light"] .tide-cdot { fill: #0284c7; stroke: #ffffff; }
:root[data-theme="light"] .tide-tip { background: rgba(255,255,255,0.96); border-color: #dde4ec; color: #16212c; }
:root[data-theme="light"] .tide-tip b { color: #0284c7; }
:root[data-theme="light"] .tide-cursor { stroke: rgba(85,99,111,0.5); }
:root[data-theme="light"] .moon-svg .moon-dark { fill: #d7dfe8; }
:root[data-theme="light"] .moon-svg .moon-lit { fill: #0d9488; }
:root[data-theme="light"] .moon-svg .moon-ring { stroke: rgba(13,148,136,0.35); }
.bp-status.on { color: var(--teal); }
.bp-status.off { color: var(--pink); }

/* MapLibre zoom control: dark by default (matches the dark map), light in light mode */
.maplibregl-ctrl-group { background: rgba(14,20,25,0.92) !important; border: 1px solid var(--edge) !important; box-shadow: 0 2px 10px rgba(0,0,0,0.4) !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--edge) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(0.82) !important; }
.maplibregl-ctrl-group button:hover { background: rgba(45,212,191,0.14) !important; }
:root[data-theme="light"] .maplibregl-ctrl-group { background: rgba(255,255,255,0.95) !important; border-color: #dde4ec !important; box-shadow: 0 2px 10px rgba(16,33,44,0.12) !important; }
:root[data-theme="light"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: none !important; }
:root[data-theme="light"] .maplibregl-ctrl-group button:hover { background: rgba(13,148,136,0.1) !important; }

/* Quick Presets — SURF / FISH / SAIL, each in its own accent */
.preset-btns { display: flex; gap: 6px; }
.preset-btn {
    flex: 1; padding: 7px 0; background: transparent;
    border: 1px solid var(--edge); border-radius: 4px;
    color: var(--ink-2); font: 600 11px/1 'Space Grotesk', system-ui, sans-serif;
    letter-spacing: 0.22em; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.preset-btn[data-preset="surf"] { color: #38bdf8; }
.preset-btn[data-preset="fish"] { color: #2dd4bf; }
.preset-btn[data-preset="sail"] { color: #fbbf24; }
.preset-btn[data-preset="surf"].active, .preset-btn[data-preset="surf"]:hover { background: rgba(56,189,248,0.15); border-color: #38bdf8; }
.preset-btn[data-preset="fish"].active, .preset-btn[data-preset="fish"]:hover { background: rgba(45,212,191,0.15); border-color: #2dd4bf; }
.preset-btn[data-preset="sail"].active, .preset-btn[data-preset="sail"]:hover { background: rgba(251,191,36,0.15); border-color: #fbbf24; }

/* forecast-horizon tag on each layer row: teal = scrubs to 5 days, amber = now-only */
.layer-horizon {
    font-size: 6.5px; font-weight: 700; letter-spacing: 0.1em;
    padding: 1px 4px; border-radius: 3px; vertical-align: middle; position: relative; top: -1px; white-space: nowrap;
}
.layer-horizon.hz-fc { color: #2dd4bf; background: rgba(45,212,191,0.15); }
.layer-horizon.hz-obs { color: #f0a92a; background: rgba(251,191,36,0.16); }

.leaflet-popup-content-wrapper {
    background: var(--panel); color: var(--ink);
    border: 1px solid var(--edge); border-radius: 2px; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.leaflet-popup-content { margin: 10px 12px; }
.leaflet-popup-tip { background: var(--panel); }
.leaflet-control-zoom a {
    background: var(--panel) !important; color: var(--ink-2) !important;
    border: 1px solid var(--edge) !important;
}
.leaflet-control-zoom a:hover { color: var(--teal) !important; }
.leaflet-control-attribution {
    background: rgba(11, 14, 17, 0.75) !important; color: var(--ink-3) !important;
    font-family: var(--mono) !important; font-size: 8px !important;
}
.leaflet-control-attribution a { color: var(--ink-2) !important; }
/* MapLibre GL attribution: dark, compact, unobtrusive */
/* The particle/crest overlay canvas sits at z-index 3 over the map — lift the
   bottom control corners above it. Also raise them above the full-width
   #statusBar (~26px tall at bottom:0) so the attribution sits just above the
   bar instead of colliding with the "toggle layers · 2D/3D…" hint. */
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { z-index: 6 !important; bottom: 28px !important; }
.maplibregl-ctrl-attrib {
    background: rgba(11,14,17,0.78) !important; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    border-radius: 5px !important; font-family: var(--mono) !important; font-size: 8px !important;
    line-height: 15px !important; padding: 0 6px !important; color: var(--ink-3) !important;
}
.maplibregl-ctrl-attrib a { color: var(--ink-2) !important; }
.maplibregl-ctrl-attrib-button { background-color: rgba(11,14,17,0.55) !important; border-radius: 50% !important; filter: invert(0.62); }
.maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show) { background: rgba(11,14,17,0.55) !important; }
:root[data-theme="light"] .maplibregl-ctrl-attrib { background: rgba(255,255,255,0.88) !important; color: #55636f !important; }
:root[data-theme="light"] .maplibregl-ctrl-attrib a { color: #0d9488 !important; }
:root[data-theme="light"] .maplibregl-ctrl-attrib-button { filter: none; }
.leaflet-tooltip {
    background: var(--panel); color: var(--ink); border: 1px solid var(--edge);
    font-family: var(--mono); font-size: 10px;
}

/* GOES GeoColor runs dark, especially the night side — lift it */
.bwf-goes { filter: brightness(1.12) contrast(1.03) saturate(1.08); }

/* surf spot labels on the Waves layer */
.surf-spot-tip {
    background: rgba(14, 20, 25, 0.92) !important;
    border: 1px solid #1c2530 !important;
    border-radius: 2px !important;
    color: #d7e0e9 !important;
    font-family: "DM Mono", "JetBrains Mono", monospace !important;
    font-size: 9px !important;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 2px 5px !important;
    box-shadow: none !important;
}
.surf-spot-tip::before { display: none; }


/* on-map legend for colored raster layers */
.ocean-legend {
    position: absolute; right: 10px; bottom: 30px; z-index: 700;
    display: flex; flex-direction: column; gap: 6px;
    max-width: 220px; pointer-events: none;
}
.ocean-legend .leg-item {
    background: rgba(14, 20, 25, 0.92); border: 1px solid #1c2530;
    border-radius: 2px; padding: 6px 8px; font-family: "DM Mono", "JetBrains Mono", monospace;
}
.ocean-legend .leg-title {
    color: #d7e0e9; font-size: 9px; font-weight: 700; letter-spacing: 0.1em;
    text-transform: uppercase; margin-bottom: 4px;
}
.ocean-legend .leg-bar { height: 8px; border-radius: 2px; border: 1px solid #1c2530; }
.ocean-legend .leg-ends {
    display: flex; justify-content: space-between; margin-top: 2px;
    color: #7d8b99; font-size: 8px; letter-spacing: 0.04em;
}
.ocean-legend .leg-note {
    color: #5c6b78; font-size: 7.5px; line-height: 1.35; margin-top: 4px;
    letter-spacing: 0.02em;
}
/* ---------- unified cursor readout (HoverPanel) ---------- */
/* One cohesive box every active field layer contributes a section to. */
.ocean-hover {
  position: absolute; z-index: 1200; pointer-events: none;
  min-width: 128px; max-width: 250px; padding: 6px 9px;
  background: linear-gradient(180deg, rgba(14,20,25,0.96), rgba(11,14,17,0.96));
  border: 1px solid var(--edge); border-left: 2px solid var(--teal);
  border-radius: 2px; box-shadow: 0 6px 22px rgba(0,0,0,0.45);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  font-family: var(--mono); font-size: 10px; line-height: 1.5; color: var(--ink);
}
.ocean-hover .oh-sec { display: flex; flex-direction: column; gap: 1px; padding: 3px 0; }
.ocean-hover .oh-sec + .oh-sec { border-top: 1px solid rgba(28,37,48,0.85); }
.ocean-hover .oh-k {
  font-size: 8.5px; font-weight: 700; letter-spacing: 0.15em;
  text-transform: uppercase; margin-bottom: 1px;
}
.ocean-hover .oh-v { color: var(--ink); font-weight: 600; white-space: nowrap; }
.ocean-hover .oh-tag {
  display: inline-block; min-width: 48px; margin-right: 6px;
  font-style: normal; font-size: 8.5px; font-weight: 700; letter-spacing: 0.1em;
}

/* softened, ocean-tinted place labels (base map ships harsh bright white) */
.bwf-map-labels {
  filter: brightness(0.6) contrast(0.9) sepia(0.4) hue-rotate(135deg) saturate(0.65);
  opacity: 0.7;
}

body { font-synthesis: none; }

/* elegant display face for the workbench title */
:root { --font-display: "Space Grotesk", "DM Mono", ui-monospace, monospace; }
.sb-title { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.14em; }

/* ============================================================
   Mobile / tablet: map fills the screen, the sidebar becomes a
   drag-up bottom sheet (mapsheet.js adds body.mapsheet-on + a
   .mapsheet-grip handle). Desktop (>820px) is untouched.
   ============================================================ */
.mapsheet-grip { display: none; }
@media (max-width: 820px) {
  #oceanApp { display: block; }
  body.mapsheet-on #mapWrap { position: fixed; inset: 0; }
  body.mapsheet-on #oceanMap { position: absolute; inset: 0; }

  body.mapsheet-on #sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: auto; flex: none;
    height: 40vh;
    border-right: none; border-top: 1px solid var(--edge);
    border-radius: 16px 16px 0 0;
    z-index: 1200;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.55);
    transition: height 0.26s cubic-bezier(.22,.61,.36,1);
    overscroll-behavior: contain;
  }
  body.mapsheet-on #sidebar.dragging { transition: none; }

  .mapsheet-grip {
    display: flex; align-items: center; justify-content: center;
    padding: 9px 0 7px; cursor: grab; touch-action: none;
    position: sticky; top: 0; z-index: 3; background: var(--panel);
    border-radius: 16px 16px 0 0;
  }
  .mapsheet-grip span { width: 40px; height: 4px; border-radius: 3px; background: var(--ink-3); opacity: 0.7; }

  /* the brand row is redundant on the sheet — a slim back chip is enough */
  body.mapsheet-on .sb-brand { padding: 8px 14px 10px; }
  body.mapsheet-on .sb-sub { display: none; }

  /* fatter touch targets */
  .layer-row { padding: 9px 4px; }
  .layer-check { width: 16px; height: 16px; flex-basis: 16px; }
  .time-btns button { padding: 9px 0; }
  #timeSlider { height: 5px; }
  #timeSlider::-webkit-slider-thumb { width: 18px; height: 18px; }
  .opacity-row input[type="range"] { height: 5px; }
  .opacity-row input[type="range"]::-webkit-slider-thumb { width: 16px; height: 16px; }

  /* Dock the tide/moon panels from the TOP with a capped, scrollable height —
     bottom-anchoring ran them off the top of the screen when 2-3 panels stacked
     taller than the space above the sheet. Sits over the map's upper-left, clear
     of the sheet below. */
  body.mapsheet-on #panelDock {
    top: 12px; bottom: auto; left: 8px; width: 208px;
    max-height: 56vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  body.mapsheet-on #panelDock::-webkit-scrollbar { display: none; }
  body.mapsheet-on #statusBar { display: none; }
}

/* ============================================================
   LIGHT THEME  (data-theme="light") — lights the SIDEBAR chrome;
   the map + its floating overlays stay dark (immersive). The light
   palette is scoped to #sidebar so map-overlay elements that share
   these vars are unaffected.
   ============================================================ */
:root[data-theme="light"] body { background: #eef1f6; }
:root[data-theme="light"] #sidebar {
  --panel: #ffffff; --panel-2: #f3f6f9; --edge: #dde4ec;
  --ink: #16212c; --ink-2: #55636f; --ink-3: #8a97a4;
  --teal: #0d9488; --amber: #b45309; --violet: #7c3aed; --pink: #db2777;
  background: rgba(255,255,255,0.82);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
/* on the phone sheet the sidebar floats over the map — keep it frosted light */
:root[data-theme="light"].mapsheet-on #sidebar,
body.mapsheet-on :root[data-theme="light"] #sidebar { background: rgba(255,255,255,0.9); }

/* theme toggle button in the sidebar brand row */
.sb-theme {
  margin-left: 4px; color: var(--ink-3); cursor: pointer;
  border: 1px solid var(--edge); border-radius: 2px;
  width: 26px; height: 26px; display: grid; place-items: center; background: transparent;
}
.sb-theme:hover { color: var(--teal); border-color: var(--teal); }
.sb-theme svg { width: 14px; height: 14px; }
.sb-theme .ic-moon { display: none; }
:root[data-theme="light"] .sb-theme .ic-sun { display: none; }
:root[data-theme="light"] .sb-theme .ic-moon { display: block; }

/* ---- light mode: map overlays (over the now-light basemap) -> light + cohesive ---- */
:root[data-theme="light"] .bwf-map-labels { filter: none; opacity: 0.92; }
:root[data-theme="light"] .leaflet-control-zoom a {
  background: rgba(255,255,255,0.92) !important; color: #55636f !important; border-color: #dde4ec !important;
}
:root[data-theme="light"] .leaflet-control-zoom a:hover { color: #0d9488 !important; }
:root[data-theme="light"] .leaflet-control-attribution {
  background: rgba(255,255,255,0.82) !important; color: #55636f !important;
}
:root[data-theme="light"] .leaflet-control-attribution a { color: #0d9488 !important; }
:root[data-theme="light"] #statusBar {
  background: rgba(255,255,255,0.86); border-top-color: #dde4ec; color: #55636f;
}
:root[data-theme="light"] #cursorPos { color: #0d9488; }
:root[data-theme="light"] .ocean-hover {
  --ink: #16212c; --ink-2: #55636f; --ink-3: #8a97a4;
  background: linear-gradient(180deg, rgba(255,255,255,0.97), rgba(244,247,250,0.97));
  border-color: #dde4ec; border-left-color: #0d9488; color: #16212c;
}
:root[data-theme="light"] .ocean-hover .oh-sec + .oh-sec { border-top-color: rgba(20,40,60,0.12); }
/* section titles carry an inline light accent (set by the sampler) — dark it for the white panel */
:root[data-theme="light"] .ocean-hover .oh-k { color: #0f766e !important; }
:root[data-theme="light"] .ocean-legend .leg-item { background: rgba(255,255,255,0.92); border-color: #dde4ec; }
:root[data-theme="light"] .ocean-legend .leg-title { color: #16212c; }
:root[data-theme="light"] .ocean-legend .leg-ends { color: #55636f; }
:root[data-theme="light"] .ocean-legend .leg-note { color: #8a97a4; }
:root[data-theme="light"] .leaflet-popup-content-wrapper,
:root[data-theme="light"] .leaflet-popup-tip { background: #ffffff; color: #16212c; border-color: #dde4ec; }
:root[data-theme="light"] .buoy-pop .bp-title { color: #16212c; }
:root[data-theme="light"] .surf-spot-tip {
  background: rgba(255,255,255,0.94) !important; color: #16212c !important; border-color: #dde4ec !important;
}
:root[data-theme="light"] .leaflet-tooltip { background: #ffffff; color: #16212c; border-color: #dde4ec; }
