/* CoastWatch Avalon. Same family as FloodWatch / BloomLine: dark satellite map, floating dark glass panels,
   round icon buttons. Tokens in :root. */
@font-face { font-family: "Poppins"; font-weight: 400; font-display: swap; src: url("../fonts/poppins-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 500; font-display: swap; src: url("../fonts/poppins-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-display: swap; src: url("../fonts/poppins-latin-600-normal.woff2") format("woff2"); }

:root {
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --panel: rgba(13, 22, 35, 0.88);
  --panel-2: rgba(28, 41, 60, 0.92);
  --line: rgba(255, 255, 255, 0.13);
  --text: #eaf0f8;
  --muted: #a4b5ca;
  --accent: #38bdf8;
  --accent-ink: #04263a;
  --fire: #f97316;
  --focus: #8fd0ff;
  --l0: #2dd4a7; --l1: #facc15; --l2: #fb923c; --l3: #ef4444; --l4: #c026d3; --lnull: #64748b;
  --r: 16px; --r-sm: 11px; --edge: 16px;
  --blur: blur(12px) saturate(1.2);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0a1420; color: var(--text); font: 400 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.map { position: fixed; inset: 0; }
.noscript { position: fixed; top: 40%; width: 100%; text-align: center; }

.glass { background: var(--panel); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.icon { width: 18px; height: 18px; flex: none; }

/* ---------- top-left: brand, mode, status ---------- */
.tl { position: fixed; top: var(--edge); left: var(--edge); display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 2 * var(--edge))); z-index: 5; }
.brand-row { display: flex; gap: 8px; align-items: stretch; }
.brand { display: flex; align-items: center; gap: 10px; padding: 9px 16px 9px 10px; font-weight: 600; font-size: 19px; letter-spacing: 0.2px; white-space: nowrap; }
.brand img { width: 30px; height: 30px; }
.brand b { color: var(--fire); font-weight: 600; } .brand i { color: var(--accent); font-style: normal; }
.brand small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.mode { display: flex; padding: 4px; gap: 4px; }
.mode button { border: 0; background: transparent; border-radius: 10px; padding: 6px 10px; font-size: 12.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.mode button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.status { display: flex; align-items: center; gap: 10px; padding: 10px 14px; font-size: 12.5px; }
.status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--l0); box-shadow: 0 0 0 4px rgba(45, 212, 167, 0.18); flex: none; }
.status.replay .dot { background: var(--fire); box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.2); }
.status .grow { flex: 1; }
.search { position: relative; }
.search input { width: 100%; padding: 11px 14px 11px 40px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--panel); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); outline: none; }
.search input::placeholder { color: var(--muted); }
.search .icon { position: absolute; left: 13px; top: 21px; transform: translateY(-50%); color: var(--muted); z-index: 1; pointer-events: none; }
.search ul { list-style: none; margin: 6px 0 0; padding: 6px; position: absolute; left: 0; right: 0; max-height: 260px; overflow: auto; z-index: 9; }
.search li button { width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; display: flex; justify-content: space-between; gap: 10px; }
.search li button:hover, .search li button[aria-selected="true"] { background: rgba(255, 255, 255, 0.08); }
.search li small { color: var(--muted); }

/* ---------- top-centre: days / timeline ---------- */
.tc { position: fixed; top: var(--edge); left: 50%; transform: translateX(-50%); z-index: 4; }
.days { display: flex; padding: 5px; gap: 4px; }
.days button { border: 0; background: transparent; border-radius: 11px; padding: 7px 16px; min-width: 92px; color: var(--text); line-height: 1.2; }
.days button small { display: block; font-size: 11px; color: var(--muted); }
.days button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.days button[aria-pressed="true"] small { color: rgba(4, 38, 58, 0.75); }
.timeline { display: flex; align-items: center; gap: 12px; padding: 10px 14px; width: clamp(320px, calc(100vw - 880px), 560px); }
.timeline input[type="range"] { flex: 1; accent-color: var(--fire); }
.timeline .when { min-width: 92px; font-weight: 600; text-align: center; line-height: 1.15; }
.timeline .when small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.roundbtn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); display: grid; place-items: center; flex: none; }
.roundbtn.fire { background: var(--fire); color: #1f0d02; border-color: transparent; }

/* ---------- top-right: buttons ---------- */
.tr { position: fixed; top: var(--edge); right: var(--edge); display: flex; gap: 10px; z-index: 6; }
.fab { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; position: relative; padding: 0; color: var(--text); }
.fab[aria-expanded="true"] { background: var(--accent); color: var(--accent-ink); }
.badge { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.badge.zero { background: #334155; }
.legend-btn { display: none !important; }
.menu { position: fixed; top: calc(var(--edge) + 60px); right: var(--edge); width: 320px; max-height: calc(100vh - 100px); overflow: auto; padding: 12px; z-index: 7; }
.menu h2 { font-size: 13px; font-weight: 600; margin: 4px 6px 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.layer { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 10px; }
.layer:hover { background: rgba(255, 255, 255, 0.06); }
.layer[aria-pressed="true"] { background: rgba(56, 189, 248, 0.16); box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.45); }
.layer[disabled] { opacity: 0.4; cursor: not-allowed; }
.layer .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--panel-2); flex: none; }
.layer span small { display: block; color: var(--muted); font-size: 11.5px; }
.seg { display: flex; gap: 6px; margin: 4px 6px; }
.seg button { flex: 1; border: 1px solid var(--line); background: var(--panel-2); border-radius: 9px; padding: 7px; font-size: 12.5px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.check { display: flex; align-items: center; gap: 10px; padding: 7px 10px; font-size: 13px; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---------- legend ---------- */
.legend { position: fixed; right: var(--edge); bottom: 34px; width: 270px; padding: 14px; z-index: 3; }
.legend h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.legend .row { display: flex; align-items: center; gap: 10px; padding: 3px 0; font-size: 13px; }
.legend .row b { margin-left: auto; font-weight: 500; color: var(--muted); }
.sw { width: 13px; height: 13px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15); }
.legend p { margin: 10px 0 0; font-size: 11.5px; color: var(--muted); }
.legend .sym { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.legend .sym span { display: flex; align-items: center; gap: 6px; }
.mk { display: inline-block; width: 11px; height: 11px; flex: none; }
.mk.tide { background: #38bdf8; border-radius: 2px; transform: rotate(45deg); }
.mk.river { background: #60a5fa; border: 2px solid #fff; border-radius: 2px; }
.mk.hot { background: #ff3b1f; border-radius: 50%; box-shadow: 0 0 6px #ff7a1f; }
.mk.perim { background: rgba(255, 90, 31, 0.3); border: 1.5px solid #ff5a1f; }

/* ---------- community panel ---------- */
.panel { position: fixed; left: var(--edge); top: 205px; bottom: var(--edge); width: min(380px, calc(100vw - 2 * var(--edge))); overflow: auto; padding: 16px; z-index: 4; }
.panel header { display: flex; align-items: flex-start; gap: 10px; }
.panel h2 { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.2; }
.panel .sub { color: var(--muted); font-size: 12.5px; }
.close { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.07); display: grid; place-items: center; flex: none; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.tag { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; background: rgba(56, 189, 248, 0.14); color: #bfe8ff; }
.tag.fire { background: rgba(249, 115, 22, 0.16); color: #ffd2b0; }
.levelcard { border-radius: 12px; padding: 12px 14px; background: var(--panel-2); border-left: 4px solid var(--c, var(--l0)); margin-bottom: 12px; }
.levelcard strong { display: block; font-size: 17px; font-weight: 600; }
.levelcard p { margin: 4px 0 0; font-size: 13px; color: #d5deea; }
.drv { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.drv .k { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.drv .v { text-align: right; font-weight: 600; font-size: 14px; }
.drv .note { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); }
.drv .pips { grid-column: 1 / -1; display: flex; gap: 4px; margin-top: 4px; }
.pip { flex: 1; height: 6px; border-radius: 3px; background: var(--lnull); position: relative; }
.pip.on::after { content: ""; position: absolute; inset: -3px 0; border-radius: 4px; box-shadow: 0 0 0 2px #fff; }
.pip-labels { grid-column: 1 / -1; display: flex; gap: 4px; font-size: 10.5px; color: var(--muted); }
.pip-labels span { flex: 1; }
.official { margin: 14px 0 6px; padding: 12px; border-radius: 12px; background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.35); font-size: 12.5px; }
.official.none { background: rgba(255, 255, 255, 0.04); border-color: var(--line); color: var(--muted); }
.official strong { color: #fff; }
.official a, .about a, .modal a, .legend a { color: #9bdcff; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.btn { border: 1px solid var(--line); background: var(--panel-2); border-radius: 12px; padding: 11px 12px; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 500; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.small { font-size: 11.5px; color: var(--muted); }

.probs { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 6px; }
.prob { position: relative; border-radius: 8px; background: rgba(255, 255, 255, 0.05); padding: 5px 6px 6px; overflow: hidden; text-align: center; }
.prob .bar { position: absolute; left: 0; bottom: 0; height: 4px; width: var(--p); background: var(--c); }
.prob b { display: block; font-size: 13px; font-weight: 600; }
.prob small { display: block; font-size: 10px; color: var(--muted); line-height: 1.1; }
.days { max-width: calc(100vw - 800px); min-width: 300px; overflow-x: auto; scrollbar-width: none; }
.days button { min-width: 72px; padding: 7px 9px; flex: none; }
.days button small { font-size: 10px; white-space: nowrap; }
/* ---------- popups, drawers, modal ---------- */
.maplibregl-popup-content { background: var(--panel) !important; color: var(--text); border: 1px solid var(--line); border-radius: 12px !important; padding: 12px 14px !important; font: 13px/1.4 var(--font); box-shadow: var(--shadow) !important; backdrop-filter: var(--blur); }
.maplibregl-popup-tip { display: none; }
.maplibregl-popup-close-button { color: var(--muted); font-size: 18px; right: 4px; top: 2px; }
.pop h4 { margin: 0 0 4px; font-size: 14px; }
.pop dl { display: grid; grid-template-columns: auto auto; gap: 2px 12px; margin: 6px 0 0; }
.pop dt { color: var(--muted); } .pop dd { margin: 0; text-align: right; font-weight: 500; }
.tip { position: fixed; pointer-events: none; z-index: 8; padding: 7px 10px; font-size: 12.5px; border-radius: 10px; }
.drawer { position: fixed; top: calc(var(--edge) + 60px); right: var(--edge); width: 380px; max-height: calc(100vh - 100px); overflow: auto; padding: 14px; z-index: 7; }
.drawer h2 { margin: 0 0 10px; font-size: 16px; }
.alert-item { padding: 10px 12px; border-radius: 12px; background: var(--panel-2); margin-bottom: 8px; border-left: 4px solid var(--c, #facc15); }
.alert-item strong { display: block; text-transform: capitalize; }
.alert-item p { margin: 6px 0 0; font-size: 12.5px; color: #d5deea; white-space: pre-line; }
.scrim { position: fixed; inset: 0; background: rgba(3, 8, 15, 0.55); z-index: 20; display: grid; place-items: center; padding: 16px; }
.modal { width: min(600px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 22px; }
.modal h2 { margin: 0 0 8px; font-size: 20px; }
.modal h3 { margin: 18px 0 6px; font-size: 14px; }
.modal p, .modal li { font-size: 13.5px; color: #d5deea; }
.modal table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
.modal th, .modal td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.modal th { color: var(--muted); font-weight: 500; }
.modal .row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.field { display: grid; gap: 4px; margin: 10px 0; font-size: 13px; }
.field input, .field select { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices label { display: flex; gap: 6px; align-items: center; padding: 7px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); font-size: 12.5px; }
.callout { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(250, 204, 21, 0.1); border: 1px solid rgba(250, 204, 21, 0.35); font-size: 12.5px; }

/* community label pills on the map */
.cpill { border: 0; padding: 3px 8px; border-radius: 999px; background: rgba(10, 20, 32, 0.82); color: #fff; font: 500 11.5px/1.2 var(--font); white-space: nowrap; transform: translateY(-17px); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); }
.cpill.is-sel { background: #fff; color: #0a1420; }
.maplibregl-ctrl-attrib { background: rgba(10, 20, 32, 0.7) !important; color: var(--muted); font-size: 10.5px; }
.maplibregl-ctrl-attrib a { color: #bcd; }

.panel, .menu, .drawer, .modal { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.25) transparent; }
/* medium screens: days and timeline move to the bottom centre so they never cover the side panels */
@media (max-width: 1240px) and (min-width: 761px) {
  .tc { top: auto; bottom: 34px; left: calc(50% + 100px); }
  .timeline { width: min(520px, calc(100vw - 760px)); min-width: 300px; }
}
/* ---------- phones ---------- */
@media (max-width: 760px) {
  :root { --edge: 10px; }
  .brand { font-size: 16px; padding: 7px 12px 7px 8px; } .brand img { width: 26px; height: 26px; } .brand small { display: none; }
  .tl { width: calc(100vw - 2 * var(--edge) - 152px); }
  .brand-row { flex-wrap: wrap; }
  .mode button { padding: 5px 9px; }
  .status { padding: 8px 12px; }
  .legend-btn { display: grid !important; }
  .tr { gap: 6px; } .fab { width: 42px; height: 42px; }
  .tr .fab.info { display: none; }
  .tc { top: auto; bottom: calc(var(--edge) + 6px); transform: translateX(-50%); }
  .days button { min-width: 0; padding: 7px 10px; }
  .days { max-width: calc(100vw - 2 * var(--edge)); }
  .timeline { width: calc(100vw - 2 * var(--edge)); }
  .status .grow { font-size: 12px; }
  .legend { display: none; }
  .legend.open { display: block; bottom: 80px; left: var(--edge); right: var(--edge); width: auto; }
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 62vh; border-radius: 18px 18px 0 0; z-index: 9; }
  .menu, .drawer { left: var(--edge); right: var(--edge); width: auto; }
  .search ul { max-height: 40vh; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
