/* ============================================================
   SWFL Marine Conditions — dark instrument-panel dashboard
   ============================================================ */

:root {
  --bg-0: #071320;
  --bg-1: #0b1f33;
  --panel: #0f2942;
  --panel-2: #12314f;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eaf2fb;
  --muted: #8aa2ba;
  --accent: #38bdf8;
  --accent-2: #22d3ee;
  --good: #34d399;
  --fair: #fbbf24;
  --rough: #fb923c;
  --danger: #f43f5e;

  --font-display: "Sora", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --radius: 16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(90% 70% at 80% -10%, #103457 0%, transparent 55%),
    radial-gradient(70% 60% at 0% 100%, #0c2740 0%, transparent 55%),
    var(--bg-0);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); }
.wrap { max-width: 1080px; margin-inline: auto; padding: 32px 22px 60px; }

/* Header */
.top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.top__title h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  letter-spacing: -0.02em;
}
.top__title p { color: var(--muted); font-size: 0.98rem; margin-top: 4px; }
.top__controls { display: flex; align-items: flex-end; gap: 12px; }
.control { display: flex; flex-direction: column; gap: 5px; }
.control span { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 600; }
.control select {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  min-width: 190px;
}
.control select:focus { outline: none; border-color: var(--accent); }
.refresh {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.refresh:hover { background: var(--panel-2); border-color: var(--accent); }
.refresh__icon { font-size: 1.1rem; display: inline-block; }
.refresh.is-loading .refresh__icon { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.updated { color: var(--muted); font-size: 0.85rem; margin: 14px 0 20px; }

/* Status / error */
.status {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
}

/* Sea state banner */
.seastate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}
.seastate::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 6px;
  background: var(--muted);
  transition: background 0.3s var(--ease);
}
.seastate[data-level="0"]::before { background: var(--good); }
.seastate[data-level="1"]::before { background: var(--fair); }
.seastate[data-level="2"]::before { background: var(--rough); }
.seastate[data-level="3"]::before { background: var(--danger); }

.seastate__left { display: flex; align-items: center; gap: 16px; }
.seastate__dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 5px rgba(255,255,255,0.05);
  flex-shrink: 0;
}
.seastate[data-level="0"] .seastate__dot { background: var(--good); box-shadow: 0 0 14px 2px rgba(52,211,153,0.6); }
.seastate[data-level="1"] .seastate__dot { background: var(--fair); box-shadow: 0 0 14px 2px rgba(251,191,36,0.6); }
.seastate[data-level="2"] .seastate__dot { background: var(--rough); box-shadow: 0 0 14px 2px rgba(251,146,60,0.6); }
.seastate[data-level="3"] .seastate__dot { background: var(--danger); box-shadow: 0 0 14px 2px rgba(244,63,94,0.6); }
.seastate__label { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; }
.seastate__advice { color: var(--muted); font-size: 0.92rem; max-width: 420px; }
.seastate__cond { display: flex; align-items: center; gap: 14px; }
.seastate__emoji { font-size: 2.6rem; line-height: 1; }
.seastate__temp { font-family: var(--font-display); font-weight: 800; font-size: 2rem; line-height: 1; }
.seastate__desc { color: var(--muted); font-size: 0.9rem; }

/* Tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.tile--accent { border-color: rgba(56, 189, 248, 0.35); background: linear-gradient(160deg, rgba(56,189,248,0.08), var(--panel)); }
.tile__label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.tile__value { font-family: var(--font-display); font-weight: 800; font-size: 2.1rem; line-height: 1; letter-spacing: -0.01em; }
.tile__unit { font-size: 0.95rem; font-weight: 600; color: var(--muted); margin-left: 4px; }
.tile__sub { font-size: 0.85rem; color: var(--muted); margin-top: 8px; }
.arrow { display: inline-block; color: var(--accent); font-weight: 700; transition: transform 0.3s var(--ease); }

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
}
.card__title { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; margin-bottom: 18px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.card__head .card__title { margin-bottom: 0; }
.card__link { font-size: 0.85rem; font-weight: 600; }

/* Legend */
.legend { display: flex; gap: 16px; flex-wrap: wrap; }
.legend__item { display: inline-flex; align-items: center; gap: 7px; font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.legend__line { width: 20px; height: 0; border-top: 2.5px solid; border-radius: 2px; }
.legend__line--wind { border-color: var(--accent); }
.legend__line--gust { border-top-style: dashed; border-color: var(--accent-2); }
.legend__swatch { width: 16px; height: 12px; border-radius: 3px; background: rgba(45,212,191,0.3); border: 1.5px solid #2dd4bf; }

/* Charts */
.chart { width: 100%; }
.chart--wave { margin-top: 4px; }
.chart__svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart__svg .grid { stroke: rgba(255,255,255,0.07); stroke-width: 1; }
.chart__svg .ylabel { fill: var(--muted); font-size: 12px; text-anchor: end; font-family: var(--font-body); }
.chart__svg .xlabel { fill: var(--muted); font-size: 12px; text-anchor: middle; font-family: var(--font-body); }

/* Tides & water temp */
.tides__station { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.tides__grid { display: grid; grid-template-columns: 190px 1fr; gap: 22px; align-items: center; }
.watertemp {
  background: linear-gradient(160deg, rgba(45,212,191,0.12), var(--bg-1));
  border: 1px solid rgba(45,212,191,0.3);
  border-radius: 12px;
  padding: 18px 20px;
  text-align: center;
}
.watertemp__val { font-family: var(--font-display); font-weight: 800; font-size: 2.6rem; line-height: 1; color: #5eead4; margin: 6px 0; }
.watertemp__note { font-size: 0.85rem; color: var(--muted); }
.tides__main { min-width: 0; }
.tides__next { text-align: center; color: var(--muted); font-size: 0.92rem; margin-top: 6px; }
.tides__next b { color: var(--accent-2); }

.tide__svg .tide-area { fill: rgba(56,189,248,0.14); stroke: none; }
.tide__svg .tide-line { stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.tide__svg .tide-now { stroke: var(--fair); stroke-width: 1.5; stroke-dasharray: 4 4; }
.tide__svg .tide-nowlabel { fill: var(--fair); font-size: 11px; text-anchor: middle; font-weight: 600; }
.tide__svg .tide-dot { stroke: var(--bg-1); stroke-width: 2; }
.tide__svg .tide-dot.is-high { fill: var(--accent-2); }
.tide__svg .tide-dot.is-low { fill: #7c93a8; }
.tide__svg .tide-mark { fill: var(--text); font-size: 12px; text-anchor: middle; font-weight: 600; }
.tide__svg .tide-markft { fill: var(--muted); font-size: 11px; text-anchor: middle; }

/* Wind map */
.map { position: relative; width: 100%; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-strong); background: var(--bg-1); }
.map iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.map__note { font-size: 0.82rem; color: var(--muted); margin-top: 10px; text-align: center; }

/* Today */
.today__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 16px; }
.mini { display: flex; flex-direction: column; gap: 4px; }
.mini__label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; }
.mini__val { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; }

/* 7-day forecast */
.forecast { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.day {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 8px;
  text-align: center;
}
.day--today { border-color: var(--accent); background: linear-gradient(160deg, rgba(56,189,248,0.12), var(--bg-1)); }
.day__name { font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.day__emoji { font-size: 1.7rem; margin: 8px 0; }
.day__temp { font-family: var(--font-display); font-weight: 700; font-size: 0.98rem; }
.day__temp .lo { color: var(--muted); font-weight: 500; }
.day__row { font-size: 0.78rem; color: var(--muted); margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.day__row b { color: var(--text); font-weight: 600; }

/* Footer */
.foot { margin-top: 28px; color: var(--muted); font-size: 0.85rem; text-align: center; }
.foot__disclaimer { background: rgba(251, 146, 60, 0.08); border: 1px solid rgba(251,146,60,0.25); border-radius: 12px; padding: 14px 18px; margin-bottom: 12px; }
.foot__credit { opacity: 0.8; }

/* Responsive */
@media (max-width: 820px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .forecast { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 560px) {
  .top { align-items: flex-start; }
  .top__controls { width: 100%; }
  .control select { flex: 1; min-width: 0; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .forecast { grid-template-columns: repeat(3, 1fr); }
  .seastate { padding: 20px; }
  .tides__grid { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .tiles { grid-template-columns: 1fr; }
  .forecast { grid-template-columns: repeat(2, 1fr); }
}
