/* Shared design for all Seceda pages (dashboard, day, month, snow). */
:root{
  color-scheme:light;
  --plane:#8a8a84;
  --surface:#ffffff;
  --chart:#e9e9e6;        /* chart card background */
  --ink:#0b0b0b;
  --ink2:#52514e;
  --muted:#898781;
  --grid:#e1e0d9;
  --axis:#c3c2b7;
  --border:rgba(11,11,11,.10);
  --s1:#2a78d6;           /* series slot 1 (blue)   */
  --s2:#eb6834;           /* series slot 2 (orange) */
  /* history chart lines */
  --c-temp:#d9412b; --c-wet:#1f9e89; --c-wind:#6b4fd6; --c-gust:#e8902a;
  --c-baro:#c2417a; --c-hum:#2a8fd6; --c-sun:#e0a00a; --c-rain:#2a5bd6; --c-rain2:#13a3a3;
  --good:#0ca30c; --warn:#fab219; --crit:#d03b3b;
  --freeze:#6da7ec;
  --c-snow:#5b6ee1; --c-wet:#1f9e89;
  --c-davis:#6b4fd6; --c-uson:#e07a1f; --c-avg:#2f2f2d;   /* wind compare */
  --r1:#c9d9f6; --r2:#9cbcf0; --r3:#6c99e6; --r4:#4374d6; --r5:#2c53b0; --r6:#1c3580;
  --radius:16px;
  --gap:12px;
  --font:'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --num:'Space Grotesk', 'Manrope', system-ui, sans-serif;
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    color-scheme:dark;
    --plane:#0d0d0d; --surface:#1a1a19; --chart:#161615; --ink:#f0efec; --ink2:#c3c2b7;
    --grid:#2c2c2a; --axis:#383835; --border:rgba(255,255,255,.10);
    --s1:#3987e5; --s2:#d95926; --freeze:#5598e7;
    --c-temp:#f0614a; --c-wet:#3cc2aa; --c-snow:#8f9cf2; --r1:#1f3a6e; --r2:#2a4f95; --r3:#3a68c0; --r4:#5a87e0; --r5:#86a8ee; --r6:#bccff7; --c-wind:#9a85f0; --c-gust:#f2a54a; --c-baro:#e0679c; --c-hum:#4fa8ec; --c-sun:#f5bd2e; --c-rain:#5f88f0; --c-rain2:#3cc6c6; --c-davis:#9a85f0; --c-uson:#f2a54a; --c-avg:#e6e4de;
  }
}
:root[data-theme="dark"]{
  color-scheme:dark;
  --plane:#0d0d0d; --surface:#1a1a19; --chart:#161615; --ink:#f0efec; --ink2:#c3c2b7;
  --grid:#2c2c2a; --axis:#383835; --border:rgba(255,255,255,.10);
  --s1:#3987e5; --s2:#d95926; --freeze:#5598e7;
    --c-temp:#f0614a; --c-wet:#3cc2aa; --c-snow:#8f9cf2; --r1:#1f3a6e; --r2:#2a4f95; --r3:#3a68c0; --r4:#5a87e0; --r5:#86a8ee; --r6:#bccff7; --c-wind:#9a85f0; --c-gust:#f2a54a; --c-baro:#e0679c; --c-hum:#4fa8ec; --c-sun:#f5bd2e; --c-rain:#5f88f0; --c-rain2:#3cc6c6; --c-davis:#9a85f0; --c-uson:#f2a54a; --c-avg:#e6e4de;
}

*{ box-sizing:border-box; }
html, body{ margin:0; height:100%; }
body{
  background:var(--plane);
  color:var(--ink);
  font:14px/1.4 var(--font);
  -webkit-font-smoothing:antialiased;
}
.num{ font-family:var(--num); font-variant-numeric:tabular-nums; letter-spacing:-0.01em; }

/* Full-window dashboard: header + one row of three columns, no page scroll */
.app{
  height:100vh;
  height:100dvh;
  display:grid;
  grid-template-rows:auto minmax(0, 1fr) auto;
  gap:var(--gap);
  padding-inline:var(--gap);
  padding-block:var(--gap) 6px;
  overflow:hidden;
}

/* ---------- hero (compact) ---------- */
.hero{
  position:relative;
  overflow:hidden;
  border-radius:var(--radius);
  padding:12px 22px 14px;
  color:#fff;
  text-shadow:0 1px 3px rgba(0,0,0,.55);
  /* Seceda photo, darkened at the edges so the text stays readable */
  background:
    linear-gradient(90deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.15) 40%, rgba(0,0,0,.15) 65%, rgba(0,0,0,.5) 100%),
    url('seceda_hero.jpg') 50% 30% / cover no-repeat #3a2a1a;
  display:grid;
  /* equal flexible side columns keep the temperature range exactly in the centre,
     whatever the clock or the live counter show */
  grid-template-columns:minmax(max-content, 1fr) minmax(260px, 520px) minmax(max-content, 1fr);
  align-items:center;
  gap:12px 32px;
}

.place{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; font-weight:600; }
.place b{ font-size:1rem; letter-spacing:.14em; }
.place .alt{ opacity:.8; font-weight:500; font-size:.85rem; }
.station{ display:inline-flex; padding:2px; border-radius:999px; background:rgba(0,0,0,.35); backdrop-filter:blur(6px); }
.station a{ color:#fff; text-decoration:none; font-size:.78rem; font-weight:600; padding:2px 11px; border-radius:999px; }
.station a[aria-current]{ background:rgba(255,255,255,.88); color:#0b0b0b; text-shadow:none; }
.pill{
  display:inline-flex; align-items:center; gap:7px;
  padding:3px 10px; border-radius:999px;
  background:rgba(0,0,0,.35);
  backdrop-filter:blur(6px);
  font-size:.78rem;
}
.pill i{ width:8px; height:8px; border-radius:50%; background:var(--muted); }
.pill.live i{ background:var(--good); animation:pulse 2s infinite; }
.pill.stale i{ background:var(--warn); }
.pill.down i{ background:var(--crit); }
@keyframes pulse{ 0%{ box-shadow:0 0 0 0 rgba(12,163,12,.6); } 70%,100%{ box-shadow:0 0 0 7px rgba(12,163,12,0); } }
@media (prefers-reduced-motion:reduce){ .pill.live i{ animation:none; } }

.temp-row{ display:flex; align-items:flex-end; gap:20px; margin-top:4px; }
.temp-big{ font-size:clamp(2.6rem, 7.5vh, 4.8rem); font-weight:500; line-height:.95; letter-spacing:-0.04em; }
.temp-big sup{ font-size:.38em; vertical-align:top; position:relative; top:.2em; margin-left:3px; font-weight:400; }
.hero-sub{ font-size:.85rem; font-weight:600; opacity:.92; display:grid; gap:1px; padding-bottom:4px; }

.range{
  justify-self:stretch; width:100%;
  padding:12px 20px 10px; border-radius:14px;
  background:rgba(0,0,0,.38);
  border:1px solid rgba(255,255,255,.18);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
}
.range-label{ display:flex; justify-content:space-between; font-size:.95rem; font-weight:600; opacity:.92; }
.range-track{
  position:relative; height:10px; margin:10px 0 7px; border-radius:99px;
  background:linear-gradient(90deg, #6da7ec, #f3c96b, #eb6834);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.3);
}
.range-dot{
  position:absolute; top:50%; width:20px; height:20px; margin:-10px 0 0 -10px;
  border-radius:50%; background:#fff; border:3px solid #0b0b0b;
  transition:left .8s ease;
}
.range-times{ display:flex; justify-content:space-between; font-size:.8rem; opacity:.8; }

.clock{ justify-self:end; display:flex; flex-direction:column; align-items:flex-end; gap:5px; text-align:right; }
.clock .pill{ min-width:150px; justify-content:flex-start; }
.clock .time{ font-size:clamp(1.6rem, 4.5vh, 2.4rem); font-weight:500; line-height:1; }
.clock .date{ opacity:.85; font-weight:600; font-size:.85rem; }

/* ---------- body columns ---------- */
.grid{
  display:grid;
  grid-template-columns:minmax(240px, 1fr) minmax(250px, 1fr) minmax(0, 2.6fr);
  grid-template-rows:minmax(0, 1fr) minmax(0, .4fr);
  gap:var(--gap);
  min-height:0;
}
.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:12px 14px;
  min-width:0;
  min-height:0;
  display:flex;
  flex-direction:column;
}
.card h2{
  margin:0 0 8px; font-size:.72rem; font-weight:700;
  letter-spacing:.14em; text-transform:uppercase; color:var(--ink2);
  display:flex; justify-content:space-between; align-items:center; gap:10px;
  flex:none;
}
.card h2 small{ font-size:.75rem; letter-spacing:0; text-transform:none; font-weight:600; color:var(--muted); }

/* compass */
.compass-wrap{ flex:1 1 auto; min-height:0; display:flex; align-items:center; justify-content:center; }
#compass{ width:100%; height:100%; max-height:100%; overflow:visible; }
#compass .tick{ stroke:var(--axis); stroke-width:1; }
#compass .tick.major{ stroke:var(--ink2); stroke-width:2; }
#compass .lbl{ fill:var(--ink2); font:600 12px var(--font); text-anchor:middle; dominant-baseline:central; }
#compass .lbl.cardinal{ fill:var(--ink); font-size:16px; font-weight:700; }
#compass .sector{ fill:var(--s1); stroke:var(--surface); stroke-width:2; }
#compass .trail{ fill:var(--s1); }
#compass .center{ fill:var(--surface); stroke:var(--border); }
#compass .needle{ fill:var(--ink); transition:transform .9s cubic-bezier(.3,.7,.3,1); }
#compass .avg{ fill:none; stroke:var(--s2); stroke-width:3; transition:transform .9s cubic-bezier(.3,.7,.3,1); }
#compass .speed{ fill:var(--ink); font:500 44px var(--num); text-anchor:middle; dominant-baseline:central; }
#compass .unit{ fill:var(--muted); font:600 12px var(--font); text-anchor:middle; }
.wind-legend{ flex:none; display:flex; gap:4px 12px; flex-wrap:wrap; justify-content:center; font-size:.72rem; color:var(--ink2); margin-top:4px; }
.wind-legend span{ display:inline-flex; align-items:center; gap:5px; }
.key-dot{ width:9px; height:9px; border-radius:50%; background:var(--s1); display:inline-block; }
.key-tri{ width:0; height:0; border:5px solid transparent; border-top:9px solid var(--ink); border-bottom:0; display:inline-block; }
.key-ring{ width:10px; height:10px; border-radius:50%; border:3px solid var(--s2); display:inline-block; }
.key-sector{ width:11px; height:9px; background:var(--s1); opacity:.6; border-radius:2px; display:inline-block; }
.beaufort{ flex:none; text-align:center; margin-top:6px; font-weight:700; color:var(--ink2); font-size:.85rem; }
.wind-stats{ flex:none; display:grid; grid-template-columns:repeat(3, 1fr); gap:8px; margin-top:8px; text-align:center; }
.card.wind, .card.now{ background:var(--chart); }
.wind-stats div{ padding:6px 4px; border-radius:10px; background:var(--surface); }
.wind-stats b{ display:block; font:500 clamp(1rem, 2.6vh, 1.3rem) var(--num); font-variant-numeric:tabular-nums; }
.wind-stats span{ font-size:.68rem; color:var(--muted); font-weight:600; }

/* tiles */
.tiles{ flex:1 1 auto; min-height:0; display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); grid-auto-rows:minmax(0, 1fr); gap:8px; }
.tile{ background:var(--chart); border:1px solid var(--border); border-radius:12px; padding:10px 12px; min-width:0; min-height:0; overflow:hidden; display:flex; flex-direction:column; justify-content:center; }
.tile .k{ font-size:.66rem; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); }
.tile .v{ font:500 clamp(1.25rem, 3.6vh, 2rem)/1.1 var(--num); font-variant-numeric:tabular-nums; margin-top:2px; letter-spacing:-0.02em; white-space:nowrap; }
.tile .v small{ font:600 .8rem var(--font); color:var(--ink2); margin-left:3px; letter-spacing:0; }
.tile .d{ font-size:.74rem; color:var(--ink2); margin-top:3px; font-weight:500; line-height:1.3; }
.trend-up{ color:var(--good); }
.trend-down{ color:var(--crit); }
.bar{ height:5px; border-radius:99px; background:var(--grid); margin-top:6px; overflow:hidden; }
.bar > i{ display:block; height:100%; background:var(--s1); border-radius:99px; transition:width .8s; }

/* history: each chart is its own card on the page background */
.card.history{ grid-column:3; grid-row:1 / span 2; background:transparent; border:0; padding:0; }
.card.history .panel{ background:var(--chart); border:1px solid var(--border); border-radius:12px; padding:6px 10px 4px; }
.card.solar{ grid-column:1 / span 2; background:var(--chart); }
.hist-head{ flex:none; display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:8px; padding-inline:4px; }
.hist-head h2{ margin:0; color:var(--ink); }
.seg{ display:inline-flex; background:var(--chart); border:1px solid var(--border); border-radius:9px; padding:2px; }
.seg button{
  border:0; background:transparent; color:var(--ink2);
  font:600 .78rem var(--font); padding:4px 11px; border-radius:7px; cursor:pointer;
}
.seg button[aria-pressed="true"]{ background:var(--surface); color:var(--ink); box-shadow:0 1px 2px rgba(0,0,0,.15); }
.hover-time{ font:500 .85rem var(--num); color:var(--ink); min-height:1.3em; margin-left:auto; }

.panels{ flex:1 1 auto; min-height:0; display:flex; flex-direction:column; gap:8px; touch-action:pan-y; }
.panel{ flex:var(--w, 1) 1 0; min-height:0; display:flex; flex-direction:column; }
.panel-head{ flex:none; display:flex; align-items:baseline; gap:4px 14px; flex-wrap:nowrap; overflow:hidden; white-space:nowrap; }
.panel-title{ font-weight:700; font-size:.8rem; min-width:84px; }
.readout{ display:inline-flex; align-items:baseline; gap:5px; font-size:.74rem; color:var(--ink2); }
.readout b{ font:500 .95rem var(--num); color:var(--ink); font-variant-numeric:tabular-nums; }
.readout .key{ width:12px; height:0; border-top:2px solid; align-self:center; }
.readout .key.dash{ border-top-style:dashed; }
.readout .key.bar{ height:8px; border-top:0; border-radius:2px; opacity:.85; }
.plot{ position:relative; flex:1 1 auto; min-height:0; }
.plot svg{ position:absolute; inset:0; width:100%; height:100%; overflow:visible; }
.plot svg text{ fill:var(--muted); font:500 10.5px var(--font); }
.plot .gridline{ stroke:var(--grid); stroke-width:1; }
.plot .freeze{ stroke:var(--freeze); stroke-width:1; stroke-dasharray:3 4; }
.plot .series{ fill:none; stroke-linejoin:round; stroke-linecap:round; }
.plot .area{ stroke:none; opacity:.14; }
.plot .bars{ opacity:.85; }
.plot .cross{ stroke:var(--ink2); stroke-width:1; }
.plot .hdot{ stroke:var(--surface); stroke-width:2; }
.plot .empty{ fill:var(--muted); font:600 12px var(--font); }

.foot{ display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; color:var(--ink); font-size:.75rem; }
.foot a{ color:var(--ink); font-weight:600; margin-right:12px; }

/* Small or short screens: a single-page fit is impossible, fall back to scrolling */
@media (max-width:1000px), (max-height:560px){
  .app{ height:auto; overflow:visible; }
  .hero{ grid-template-columns:minmax(0, 1fr) auto; }
  .range{ grid-column:1 / -1; grid-row:2; justify-self:stretch; max-width:none; }
  .grid{ grid-template-columns:1fr 1fr; grid-template-rows:none; }
  .card.history, .card.solar{ grid-column:1 / -1; grid-row:auto; }
  .compass-wrap{ height:300px; flex:none; }
  .tiles{ grid-auto-rows:auto; }
  .panels{ flex:none; }
  .panel{ flex:none; }
  .plot{ flex:none; height:calc(var(--w, 1) * 110px); }
}
@media (max-width:640px){
  .grid{ grid-template-columns:1fr; }
  .hero{ padding:12px 14px; }
  .clock .date{ display:none; }
  .clock .pill{ min-width:0; }
}

.foot a[aria-current]{ text-decoration:none; opacity:.6; }

/* ===================== sub pages (day, month, snow) ===================== */
.page{ max-width:1600px; margin:0 auto; padding:var(--gap); display:grid; gap:var(--gap); }
.hero.sub{ padding:16px 22px; }
.hero.sub h1{ margin:6px 0 0; font-size:clamp(1.4rem, 3.4vh, 2rem); font-weight:600; letter-spacing:-0.01em; }
.hero.sub .nav-live{ color:#fff; font-weight:700; text-decoration:none; font-size:.85rem; }
.hero.sub .nav-live:hover{ text-decoration:underline; }
.ctrls{ justify-self:center; display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:center;
  padding:10px 14px; border-radius:14px; background:rgba(0,0,0,.38); border:1px solid rgba(255,255,255,.18);
  backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px); }
.ctrls label{ font-size:.8rem; font-weight:600; opacity:.9; }
.ctrls input, .ctrls select, .ctrls button{
  font:600 .9rem var(--font); color:#0b0b0b; background:rgba(255,255,255,.9);
  border:0; border-radius:9px; padding:6px 10px; text-shadow:none; }
.ctrls button{ cursor:pointer; min-width:36px; }
.ctrls button:disabled{ opacity:.45; cursor:default; }
.ctrls .seg{ background:rgba(255,255,255,.18); border-color:rgba(255,255,255,.25); }
.ctrls .seg button{ background:transparent; color:#fff; min-width:0; }
.ctrls .seg button[aria-pressed="true"]{ background:rgba(255,255,255,.92); color:#0b0b0b; }
.side{ display:flex; flex-direction:column; gap:var(--gap); min-width:0; }
.split{ display:grid; grid-template-columns:minmax(280px, 1fr) minmax(0, 2.6fr); gap:var(--gap); align-items:start; }
.split .card.history{ grid-column:auto; grid-row:auto; }
.page .tiles{ grid-auto-rows:auto; }
.page .tile{ min-height:84px; }
.page .tile.wide{ grid-column:1 / -1; }
.page .panels{ flex:none; }
.page .panel{ flex:none; }
.page .plot{ flex:none; height:calc(var(--w, 1) * 150px); }
.statusline{ font-size:.75rem; color:var(--ink); }
.card.rose{ background:var(--chart); }
.rose-wrap{ aspect-ratio:1; max-height:360px; display:flex; align-items:center; justify-content:center; }
.rose-wrap svg{ width:100%; height:100%; overflow:visible; }
.rose-ring{ fill:none; stroke:var(--grid); stroke-width:1; }
.rose-pct{ fill:var(--muted); font:500 10px var(--font); }
.rose-sector{ stroke:var(--chart); stroke-width:1; }
.rose-wrap .center{ fill:var(--chart); }
.rose-wrap .lbl{ fill:var(--ink2); font:600 12px var(--font); text-anchor:middle; dominant-baseline:central; }
.rose-wrap .lbl.cardinal{ fill:var(--ink); font-size:15px; font-weight:700; }
.key-sq{ width:10px; height:10px; border-radius:2px; display:inline-block; }
.rose-note{ text-align:center; font-weight:700; color:var(--ink2); font-size:.85rem; margin-top:6px; }

/* wind compare */
.rose-line{ stroke-width:2.5; fill-opacity:.10; stroke-linejoin:round; }
.roses{ display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:var(--gap); margin-top:var(--gap); }
.roses .card h2 i{ display:inline-block; width:10px; height:10px; border-radius:2px; margin-right:6px; vertical-align:0; }
.roses .rose-wrap{ max-height:300px; }
.roses-legend{ margin-top:8px; justify-content:center; }
.cmp{ width:100%; border-collapse:collapse; font-size:.84rem; }
.cmp th, .cmp td{ padding:6px 4px; text-align:right; border-bottom:1px solid var(--grid); white-space:nowrap; }
.cmp th:first-child, .cmp td:first-child{ text-align:left; color:var(--ink2); font-weight:600; white-space:normal; }
.cmp thead th{ font-size:.72rem; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); font-weight:700; }
.cmp thead th i{ display:inline-block; width:8px; height:8px; border-radius:2px; margin-right:4px; }
.cmp td{ font-family:var(--num); font-variant-numeric:tabular-nums; }
.cmp tr:last-child td{ border-bottom:0; }
.cmp-note{ font-size:.78rem; color:var(--muted); margin:10px 0 0; line-height:1.45; }

/* snow */
.snow-now{ display:grid; gap:2px; padding:4px 2px 10px; }
.snow-now .big{ font:500 clamp(2.6rem, 7vh, 4rem)/1 var(--num); letter-spacing:-0.03em; }
.snow-now .big small{ font:600 1rem var(--font); color:var(--ink2); margin-left:4px; letter-spacing:0; }
.snow-now .lbl{ font-size:.75rem; color:var(--muted); font-weight:700; letter-spacing:.1em; text-transform:uppercase; }
.badge{ display:inline-flex; align-items:center; gap:6px; padding:2px 10px; border-radius:999px; background:var(--surface);
  border:1px solid var(--border); font-weight:700; font-size:.8rem; width:max-content; margin-top:6px; }
.badge i{ width:8px; height:8px; border-radius:50%; background:var(--muted); }
.badge.snow i{ background:var(--c-snow); } .badge.mix i{ background:var(--c-wet); } .badge.rain i{ background:var(--c-rain); }
.method{ font-size:.82rem; color:var(--ink2); line-height:1.5; margin:0; }
.cam{ background:var(--chart); }
.cam img{ display:block; max-width:100%; max-height:75vh; width:auto; height:auto; margin:0 auto; border-radius:12px; background:var(--surface); }
.cam .cam-err{ color:var(--muted); font-weight:600; padding:30px; text-align:center; }

@media (max-width:1000px){
  .split{ grid-template-columns:1fr; }
  .page .side{ display:grid; grid-template-columns:1fr 1fr; }
  .ctrls{ grid-column:1 / -1; grid-row:2; justify-self:stretch; }
  .roses{ grid-template-columns:1fr 1fr; }
}
@media (max-width:640px){
  .page{ padding:10px; }
  .page .side{ grid-template-columns:1fr; }
  .roses{ grid-template-columns:1fr; }
  .page .plot{ height:calc(var(--w, 1) * 120px); }
  .page .panel-head{ flex-wrap:wrap; }
  .page .panel-title{ flex-basis:100%; }
}
