/* Weather overview, Signal layout: warm paper, near-black ink, and one
   temperature ramp (signal.js) as the only color. Anybody, self-hosted: width
   sets rank, weight sets certainty. */

@font-face {
    font-family: 'Anybody';
    font-style: normal;
    font-weight: 100 900;
    font-stretch: 50% 150%;
    font-display: swap;
    src: url('/fonts/anybody-latin.woff2') format('woff2');
}

:root {
    --paper: #f3f0e8;
    --ink: #141312;
    --ink-rgb: 20, 19, 18;
    --card: #ebe7dc;
    --alert-minor: #e7c64a;
    --alert-moderate: #ec8a2f;
    --alert-severe: #d8412f;
    --missing: #dcd7cb;
    /* variable colors and previous runs, shared with the plume viewer (styles.css) */
    --c-rain: oklch(0.58 0.14 248);
    /* weather glyphs */
    --wx-sun: oklch(0.8 0.16 72);
    --wx-moon: oklch(0.8 0.07 95);
    --wx-cloud: oklch(0.8 0.012 85);
    --wx-cloud-back: oklch(0.88 0.008 85);
    --wx-cloud-wet: oklch(0.66 0.02 250);
    --wx-cloud-storm: oklch(0.45 0.03 270);
    --wx-snow: oklch(0.66 0.11 235);
    --wx-bolt: oklch(0.83 0.17 88);
    --c-snow: oklch(0.6 0.12 290);
    --c-ice: oklch(0.6 0.15 350);
    --c-wind: oklch(0.56 0.09 175);
    --run-1: oklch(0.56 0.22 350);
    --run-2: oklch(0.66 0.15 70);
    --run-3: oklch(0.5 0.17 300);
    --ink-2: #5b5750;
    --rule: rgba(var(--ink-rgb), 0.28);
    --faint: rgba(var(--ink-rgb), 0.12);
    --night: #2a2926;
    --dark: #1d1c1a;
    --gut: max(clamp(16px, 3.4vw, 48px), calc((100vw - 1680px) / 2));
    --wash: rgba(var(--ink-rgb), 0.06);
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    color-scheme: light;
}

:root[data-theme="dark"] {
    --paper: #151413;
    --ink: #efebe2;
    --ink-rgb: 239, 235, 226;
    --ink-2: #a8a397;
    --night: #070706;
    --dark: #0d0c0b;
    --card: #1f1e1b;
    --alert-minor: #b89a2a;
    --alert-moderate: #c0661c;
    --alert-severe: #c2362a;
    --missing: #3a3834;
    --c-rain: oklch(0.72 0.13 245);
    --wx-sun: oklch(0.82 0.15 75);
    --wx-moon: oklch(0.86 0.06 95);
    --wx-cloud: oklch(0.7 0.012 85);
    --wx-cloud-back: oklch(0.52 0.01 85);
    --wx-cloud-wet: oklch(0.6 0.025 250);
    --wx-cloud-storm: oklch(0.42 0.03 270);
    --wx-snow: oklch(0.82 0.08 230);
    --wx-bolt: oklch(0.85 0.16 90);
    --c-snow: oklch(0.8 0.09 290);
    --c-ice: oklch(0.78 0.11 350);
    --c-wind: oklch(0.74 0.09 175);
    --run-1: oklch(0.72 0.19 350);
    --run-2: oklch(0.8 0.14 78);
    --run-3: oklch(0.72 0.15 300);
    color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Anybody', system-ui, sans-serif;
    font-variation-settings: 'wdth' 96;
    background: var(--paper);
    color: var(--ink);
    line-height: 1.35;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    font-variant-numeric: tabular-nums;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.ic { width: 22px; height: 22px; flex: none; }
.ic-sm { width: 18px; height: 18px; }
.ic-xs { width: 14px; height: 14px; }

body.no-scroll { overflow: hidden; }
body { -webkit-tap-highlight-color: transparent; }
.scrub, .sg-svg, .spiral, .plume-svg { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.sg-svg:focus:not(:focus-visible), .spiral:focus:not(:focus-visible), .sg-strip-h:focus:not(:focus-visible) { outline: none; }

/* ============ Nav: place chips ============ */
.sg-nav {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: max(10px, env(safe-area-inset-top)) var(--gut) 10px;
    background: var(--paper);
}

.sg-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
    padding: 2px;
}
.sg-chips::-webkit-scrollbar { display: none; }

.chip {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 40px;
    padding: 0 15px 0 6px;
    border-radius: 20px;
    background: var(--wash);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.chip:hover { background: rgba(var(--ink-rgb), 0.11); }
.chip[aria-current="page"] { background: var(--ink); color: var(--paper); }
.chip-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--faint);
}
.chip-name { font-size: 14px; font-weight: 500; font-variation-settings: 'wdth' 88; }
.chip-temp { font-size: 18px; font-weight: 700; font-variation-settings: 'wdth' 70; }

.sg-nav-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.sg-find {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border-radius: 20px;
    background: var(--wash);
    font-size: 14px;
    color: var(--ink-2);
}
.sg-find:hover { color: var(--ink); background: rgba(var(--ink-rgb), 0.11); }

.wx-icon-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--ink);
}
.wx-icon-btn:hover { background: rgba(var(--ink-rgb), 0.07); }

/* ============ Top: the color field, the number, the spiral ============ */
.sg-top {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 700px);
    gap: 24px 40px;
    align-items: center;
    padding: 36px var(--gut) 0;
    min-height: min(820px, 90vh);
    background: var(--faint);
}


.sg-sky {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 10px;
    display: flex;
}
.sg-sky i { flex: 1; background: var(--ink); }

.sg-strip {
    grid-column: 1 / -1;
    align-self: end;
    display: grid;
    grid-template-columns: repeat(24, minmax(0, 1fr));
    margin: 0 calc(-1 * var(--gut));
}
.sg-strip-h { display: flex; flex-direction: column; padding: 8px 0 10px 6px; min-width: 0; cursor: default; transition: background 0.15s var(--ease), color 0.15s var(--ease); }
.sg-strip-h.on, .sg-strip-h.on:nth-child(n) { background: var(--ink); color: var(--paper); }
.sg-strip-h span { font-size: 11px; font-weight: 500; white-space: nowrap; }
.sg-strip-h b { font-size: 18px; font-weight: 820; font-variation-settings: 'wdth' 64; }
.sg-strip-h:nth-child(3n+1) { background: rgba(var(--ink-rgb), 0.05); }

.sg-hero { align-self: stretch; display: flex; flex-direction: column; min-width: 0; }
.sg-label { font-size: 14px; font-weight: 500; }
.sg-num {
    font-size: clamp(200px, 36vw, 600px);
    line-height: 0.92;
    font-weight: 820;
    font-variation-settings: 'wdth' 52;
    letter-spacing: -0.03em;
    margin: 6px 0 0 -0.04em;
}
.sg-skeleton { opacity: 0.25; }
.sg-sentence {
    margin-top: auto;
    max-width: 640px;
    font-size: clamp(20px, 2.4vw, 34px);
    line-height: 1.15;
    font-weight: 500;
    font-variation-settings: 'wdth' 92;
    padding-top: 16px;
}
/* The next two hours: a bar a minute on a plate (columns set per answer), only when rain is near */
.sg-minutes {
    display: grid;
    grid-template-rows: 44px auto;
    max-width: 640px;
    margin-top: 14px;
}
.sg-minutes:empty { display: none; }
.sg-minutes b { grid-area: 1 / 1 / 2 / -1; background: rgba(var(--ink-rgb), 0.06); }
.sg-minutes i { grid-row: 1; align-self: end; background: var(--c-rain); }
.sg-minutes i.snow { background: var(--c-snow); }
.sg-minutes i.ice { background: var(--c-ice); }
.sg-minutes span { grid-row: 2; padding-top: 4px; font-size: 11px; font-weight: 500; white-space: nowrap; }
/* Alerts: under the color field, only when one covers the place; tinted by severity, opening in place */
.sg-alertbox { display: grid; gap: 8px; margin: 20px var(--gut) 0; }
.sg-alertbox:empty { display: none; }
.sg-alert {
    --sev: var(--alert-minor);
    background: color-mix(in oklch, var(--sev) 22%, var(--paper));
    border-radius: 6px;
    padding: 14px 18px;
    cursor: default;
}
.sg-alert.sev-moderate { --sev: var(--alert-moderate); }
.sg-alert.sev-severe, .sg-alert.sev-extreme { --sev: var(--alert-severe); }
.sg-alert-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.sg-alert-head strong { font-size: 22px; font-weight: 800; font-variation-settings: 'wdth' 70; }
.sg-alert-until { font-size: 14px; font-weight: 500; }
.sg-alert-lead { margin: 6px 0 0; max-width: 72ch; font-size: 15px; line-height: 1.4; }
.sg-alert-more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.35s var(--ease); }
.sg-alert.open .sg-alert-more { grid-template-rows: 1fr; }
.sg-alert-more-inner { overflow: hidden; min-height: 0; }
.sg-alert-more-inner p { margin: 10px 0 0; max-width: 72ch; font-size: 14px; line-height: 1.45; }
.sg-alert-k { font-weight: 700; margin-right: 8px; }

.sg-spiral { width: 100%; max-width: 700px; justify-self: end; padding-bottom: 12px; }
/* the spiral's space is held while it waits for the observed lap, so nothing below moves */
.sg-spiral:empty::before { content: ''; display: block; aspect-ratio: 600 / 612; }
.spiral { display: block; width: 100%; height: auto; touch-action: pan-y; user-select: none; }
.spiral .sp-disk { fill: var(--paper); }
:root[data-theme="dark"] .spiral .sp-disk { fill: #262522; }
.spiral .sp-drop { fill: var(--c-rain); }
.spiral .sp-missing { fill: var(--missing); stroke: var(--missing); stroke-width: 0.6; }
/* the plate behind the laps: pale blue, deeper at night; cloud bars a shade off the plate (felt, not loud);
   the cursor's hour washed in its temperature color (set inline) */
.spiral .sp-sky { fill: oklch(0.93 0.035 232); }
.spiral .sp-night { fill: oklch(0.5 0.09 262); }
.spiral .sp-cloud { fill: oklch(0.965 0.016 234); }
.spiral .sp-cloud-night { fill: oklch(0.57 0.07 262); }
:root[data-theme="dark"] .spiral .sp-sky { fill: oklch(0.38 0.04 240); }
:root[data-theme="dark"] .spiral .sp-night { fill: oklch(0.2 0.04 266); }
:root[data-theme="dark"] .spiral .sp-cloud { fill: oklch(0.45 0.03 240); }
:root[data-theme="dark"] .spiral .sp-cloud-night { fill: oklch(0.26 0.035 264); }
.spiral .sp-wedge { fill: transparent; opacity: 0.4; }
.spiral .sp-sweep { stroke-dasharray: 1; animation: sp-draw 2.2s cubic-bezier(0.4, 0, 0.2, 1) 0.15s both; }
.spiral .sp-wind line { stroke: var(--c-wind); stroke-width: 2; stroke-linecap: round; }
.spiral .sp-wind path { fill: var(--c-wind); }
.spiral .sp-now { fill: var(--paper); stroke: var(--ink); stroke-width: 3; }
.spiral .sp-now-label { font-size: 12px; font-weight: 800; letter-spacing: 1.5px; fill: var(--ink); }
.spiral .sp-th { font-size: 12px; font-weight: 700; fill: var(--ink); }
.spiral .sp-td { font-size: 28px; font-weight: 820; font-variation-settings: 'wdth' 56; fill: var(--ink); }
.spiral .sp-tl { font-size: 12px; font-weight: 600; fill: var(--ink); }
.spiral .sp-cursor { fill: none; stroke: var(--ink); stroke-width: 2.5; }   /* a ring: the band's color shows through */

@keyframes sp-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
/* the wind outside the lap arrives as the band finishes growing */
.spiral .sp-late { animation: sp-late 0.6s ease-out 1.8s both; }
@keyframes sp-late { from { opacity: 0; } }

/* ============ Readouts ============ */
.sg-cells {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin: 40px var(--gut) 0;
}
.sg-cell {
    display: flex;
    flex-direction: column;
    text-align: left;
    min-height: max(190px, var(--cell-h, 0px));   /* --cell-h: the tallest reading (readouts' lock) */
    padding: 14px 14px 12px;
    border-radius: 6px;
    min-width: 0;
    transition: background 0.2s var(--ease);
}
button.sg-cell:hover { background: var(--wash); }
button.sg-cell[aria-expanded="true"] { background: var(--ink); color: var(--paper); }
button.sg-cell[aria-expanded="true"] .mini * { fill: var(--paper); stroke: var(--paper); }
button.sg-cell[aria-expanded="true"] .mini .sq:not(.sq-on) { fill: none; }
.sg-cell-k { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-cell-v {
    font-size: 50px;
    line-height: 1.05;
    font-weight: 820;
    font-variation-settings: 'wdth' 56;
    margin-top: 6px;
    white-space: nowrap;
}
.sg-cell-sub { font-size: 13px; line-height: 1.35; margin-top: 4px; flex: 1; }
.sg-cell-mini { height: 30px; margin-top: 10px; }
.mini { width: 140px; max-width: 100%; height: 30px; display: block; }
.mini-track { fill: rgba(var(--ink-rgb), 0.15); }
.mini-mark { stroke: var(--ink); stroke-width: 1.2; }
.mini-dot { fill: var(--ink); }
.mini-band { stroke: none; }
.mini-label { font-size: 11px; font-weight: 700; fill: var(--ink); }
.mini-shaft { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.mini-head { fill: var(--ink); }
.mini-night { fill: #2a2926; }
.mini-day { fill: #f3f0e8; }
:root[data-theme="dark"] .mini-night { fill: #000; }
:root[data-theme="dark"] .mini-day { fill: #efe9db; }
.mini .sq { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.mini .sq-on { fill: var(--ink); }
.mini-rain .mini .sq-on { fill: var(--c-rain); }
.mini-shaft { stroke: var(--c-wind) !important; }
.mini-head { fill: var(--c-wind) !important; }

/* ============ Card details, sliding open under the row ============ */
.sg-detail {
    grid-column: 1 / -1;
    display: grid;
    grid-template-rows: 0fr;
    margin: 0;
    transition: grid-template-rows 0.42s var(--ease), margin 0.42s var(--ease);
}
.sg-detail.open { grid-template-rows: 1fr; margin: 8px 0 12px; }
.sg-detail-inner {
    overflow: hidden;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.sg-detail-inner .detail-rows { columns: 3 260px; column-gap: 40px; display: block; }
.sg-detail-inner .detail-rows dt, .sg-detail-inner .detail-rows dd { break-inside: avoid; }
.sg-detail.open .sg-detail-inner { padding: 20px; background: var(--wash); border-radius: 8px; }

/* ============ Section heads ============ */
.sg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.sg-h2 {
    font-size: clamp(34px, 4vw, 56px);
    line-height: 1;
    font-weight: 800;
    font-variation-settings: 'wdth' 58;
}

/* ============ 48 hours ============ */
.sg-hours { margin: 48px var(--gut) 0; }
.sg-chart { position: relative; margin-top: 20px; }
.sg-svg { display: block; touch-action: pan-y; user-select: none; overflow: visible; }
.sg-svg .g-grid { stroke: var(--ink); stroke-width: 0.5; opacity: 0.25; }
.sg-svg .g-axis { font-size: 13px; font-weight: 600; fill: var(--ink); }
.sg-svg .g-day { stroke: var(--ink); stroke-width: 1; opacity: 0.25; }
.sg-svg .g-dayname { font-size: 14px; font-weight: 700; fill: var(--ink); }
.sg-svg .g-band { fill: var(--ink); opacity: 0.16; }
.sg-svg .g-band-mid { opacity: 0.2; }
.sg-svg .g-lane-bg { fill: var(--wash); }
.sg-svg .g-cloud { fill: var(--ink); opacity: 0.32; }
.sg-svg .g-line { fill: none; stroke: var(--ink); stroke-width: 3.5; stroke-linejoin: round; }
.sg-svg .g-end { font-size: 13px; font-weight: 800; fill: var(--ink); }
.sg-svg .g-end-soft { font-weight: 500; }
.sg-svg .g-rain { fill: var(--c-rain); }
.sg-svg .g-snow { fill: var(--c-snow); }
.sg-svg .g-lane { font-size: 13px; font-weight: 700; fill: var(--ink); }
.sg-svg .g-wind line { stroke: var(--c-wind); stroke-width: 2; stroke-linecap: round; }
.sg-svg .g-wind path, .sg-svg .g-wind circle { fill: var(--c-wind); }
.sg-svg .g-speed { font-size: 12px; font-weight: 500; fill: var(--ink); }
.sg-svg .g-speed.strong { font-weight: 800; }
.sg-svg .g-hour { font-size: 12px; font-weight: 600; fill: var(--ink); }
.sg-svg .g-now { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 4; }
.sg-svg .g-cursor { stroke: var(--ink); stroke-width: 2; }
.sg-svg .g-dot { fill: var(--ink); }


.sg-card {
    position: absolute;
    top: 34px;
    background: var(--ink);
    color: var(--paper);
    padding: 12px 14px;
    border-radius: 4px;
    pointer-events: none;
}
.sg-card-k { font-size: 13px; font-weight: 500; }
.sg-card-v { font-size: 52px; line-height: 1.05; font-variation-settings: 'wdth' 58; }
.sg-card-sub { font-size: 13px; line-height: 1.4; }

/* ============ Days ============ */
.sg-days { margin: 48px var(--gut) 0; }
.sg-day {
    display: grid;
    grid-template-columns: 130px 70px 40px minmax(0, 1fr) 200px 80px;
    grid-template-rows: 56px auto;
    align-items: center;
    border-radius: 6px;
    cursor: default;
    transition: background 0.2s var(--ease);
}
.sg-day:not(.sg-day-axis):hover, .sg-day:focus-visible, .sg-day.open { background: var(--wash); }
.sg-day-axis { grid-template-rows: 30px; align-items: end; font-size: 12px; font-weight: 600; }
.sg-day-more { grid-column: 1 / -1; display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.35s var(--ease); }
.sg-day.open .sg-day-more { grid-template-rows: 1fr; }
@media (hover: hover) { .sg-day:hover .sg-day-more { grid-template-rows: 1fr; } .sg-day:hover .sg-day-more-inner { padding-bottom: 14px; } }
.sg-day-more-inner { overflow: hidden; min-height: 0; padding: 0 12px; }
.sg-day.open .sg-day-more-inner { padding-bottom: 14px; }
.sg-ribbon { display: grid; grid-template-columns: 5.5rem repeat(var(--hrs), minmax(0, 1fr)); grid-auto-rows: auto; column-gap: 1px; row-gap: 3px; align-items: stretch; padding-top: 4px; }
.sg-ribbon-k { font-size: 11px; font-weight: 600; color: var(--ink-2); align-self: center; white-space: nowrap; }
.sg-rb-t { height: 26px; font-size: 12px; font-weight: 800; font-variation-settings: 'wdth' 64; padding-top: 5px; color: #141312; white-space: nowrap; overflow: visible; }
.sg-rb-t, .sg-rb-h { text-align: center; }
.sg-rb-c, .sg-rb-r { position: relative; height: 26px; background: var(--wash); }
.sg-rb-r { height: 18px; }
.sg-rb-c i { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(var(--ink-rgb), 0.38); }
.sg-rb-r i { position: absolute; left: 20%; right: 20%; bottom: 0; background: var(--c-rain); }
.sg-rb-h { font-size: 11px; font-weight: 600; white-space: nowrap; }
.sg-day-stats { display: flex; flex-wrap: wrap; gap: 10px 36px; padding-top: 2px; }
.sg-stat { display: flex; flex-direction: column; min-width: 120px; }
.sg-stat span { font-size: 12px; color: var(--ink-2); }
.sg-stat b { font-size: 24px; font-weight: 820; font-variation-settings: 'wdth' 60; }
.sg-stat > i { display: block; height: 4px; margin-top: 4px; background: var(--wash); }
.sg-stat > i > i { display: block; height: 100%; background: var(--ink); }
.sg-day-colh { padding-bottom: 4px; }
.sg-right { text-align: right; }
.sg-day-name { padding-left: 10px; font-size: 34px; font-weight: 800; font-variation-settings: 'wdth' 58; }
.sg-day-date { font-size: 13px; font-weight: 500; }
.sg-day-ic { display: flex; }
.sg-day-ic .ic { width: 32px; height: 32px; }
.sg-day-bar { position: relative; height: 100%; margin: 0 56px 0 64px; }
.sg-tick { position: absolute; bottom: 4px; transform: translateX(-50%); }
.sg-day-fill {
    position: absolute;
    top: 18px;
    height: 20px;
    min-width: 6px;
    border-radius: 10px;
}
.sg-day-lo, .sg-day-hi { position: absolute; top: 14px; font-variation-settings: 'wdth' 64; white-space: nowrap; }
.sg-day-lo { transform: translateX(calc(-100% - 10px)); font-size: 22px; font-weight: 500; }
.sg-day-hi { top: 10px; padding-left: 10px; font-size: 30px; font-weight: 800; font-variation-settings: 'wdth' 58; }
.sg-squares { display: grid; grid-template-columns: repeat(10, 12px); gap: 3px; align-content: center; }
.sg-squares i { width: 12px; height: 12px; background: rgba(var(--ink-rgb), 0.13); }
.sg-squares i.on { background: var(--c-rain); }
.sg-day-amt { font-size: 14px; font-weight: 600; padding-right: 10px; }

/* ============ Radar and plumes ============ */
.sg-more {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 40px;
    margin: 56px var(--gut) 0;
    align-items: start;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.text-link { font-weight: 600; color: var(--ink); }

.radar-panel { min-width: 0; }
.radar-frame { position: relative; height: 460px; border-radius: 8px; overflow: hidden; background: #0e0e0d; }
.radar-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.radar-expand, .radar-close { position: absolute; z-index: 2; top: 8px; right: 8px; background: rgba(var(--ink-rgb), 0.78); color: var(--paper); }
.radar-close { display: none; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
.radar-panel.full { position: fixed; inset: 0; z-index: 20; border-radius: 0; padding: 0; border: 0; }
.radar-panel.full .radar-expand { display: none; }
.radar-panel.full .radar-frame { height: 100%; border-radius: 0; }
.radar-panel.full .radar-close { display: grid; }

.plume-trend { font-size: 26px; line-height: 1.1; font-weight: 800; font-variation-settings: 'wdth' 58; margin-bottom: 8px; }
.plume-trend:empty { display: none; }
.plume-readout { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; min-height: 36px; }
.plume-readout .det { font-weight: 600; }
.plume-readout .prev { color: var(--ink-2); }
.plume-chart { margin-top: 6px; }
.plume-svg { display: block; touch-action: pan-y; }
.plume-svg .grid { stroke: var(--ink); stroke-width: 0.5; opacity: 0.22; }
.plume-svg .grid-day { stroke-dasharray: 3 4; opacity: 0.5; }
.plume-svg .axis { font-size: 11px; font-weight: 600; fill: var(--ink); }
.plume-svg .axis-y { text-anchor: end; }
.plume-svg { --plume: var(--ink); }
.plume-precip { --plume: var(--c-rain); }
.plume-snow { --plume: var(--c-snow); }
.plume-wind { --plume: var(--c-wind); }
.plume-outer { fill: var(--plume); opacity: 0.16; }
.plume-inner { fill: var(--plume); opacity: 0.24; }
.plume-mean { fill: none; stroke: var(--plume); stroke-width: 3; }
.plume-det { fill: none; stroke: var(--plume); stroke-width: 1.5; stroke-dasharray: 5 4; }
.plume-prev { fill: none; stroke-width: 2; }
.plume-prev.prev0 { stroke: var(--run-1); }
.plume-prev.prev1 { stroke: var(--run-2); }
.plume-cursor { stroke: var(--ink); stroke-width: 1; }
.plume-dot { fill: var(--ink); }
.series-line { fill: none; stroke-width: 2.2; }
.line-main { stroke: var(--ink); }
.line-alt { stroke: var(--ink-2); stroke-dasharray: 4 3; }
.line-gust { stroke: var(--ink-2); stroke-dasharray: 2 3; }
.bar-rain, .bar-snow { fill: var(--ink); }
.bar-snow { opacity: 0.5; }
.plume-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; margin-top: 8px; }
.plume-legend .key { display: inline-flex; align-items: center; gap: 6px; }
.plume-legend .key i { width: 18px; height: 2.5px; background: var(--ink); }
.plume-legend .key-det i { height: 1.5px; background: repeating-linear-gradient(90deg, var(--ink) 0 4px, transparent 4px 7px); }
.plume-legend .key-prev i { height: 2px; }
.plume-legend .prev0 i { background: var(--run-1); }
.plume-legend .prev1 i { background: var(--run-2); }
.plume-readout .prev:nth-of-type(1) { color: var(--run-1); }

.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--wash); border-radius: 999px; }
.seg-btn { padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.seg-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.seg-btn[hidden] { display: none; }
.seg-btn:disabled { opacity: 0.3; cursor: default; }

/* ============ Footer ============ */
.sg-foot {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: 48px var(--gut) 0;
    padding: 10px 0 max(28px, env(safe-area-inset-bottom));
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 500;
}
.sg-foot-links { display: flex; gap: 16px; }

.sg-empty { padding: 80px var(--gut); display: flex; flex-direction: column; align-items: flex-start; gap: 16px; font-size: 24px; }
.sg-btn { background: var(--ink); color: var(--paper); border-radius: 22px; padding: 10px 20px; font-weight: 700; }

/* ============ Sheets: search, settings, details ============ */
.wx-sheet {
    margin: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    border: none;
    background: transparent;
    color: var(--ink);
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left));
}
.wx-sheet[open] { display: flex; flex-direction: column; align-items: center; animation: sheet-in 0.24s var(--ease); }
.wx-sheet::backdrop { background: color-mix(in srgb, var(--paper) 94%, transparent); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(10px); } }
.wx-sheet > * { width: min(720px, 100%); }

.wx-search { display: flex; gap: 12px; align-items: center; }
.wx-field {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    height: 52px;
    border-radius: 26px;
    background: rgba(var(--ink-rgb), 0.08);
}
.wx-field input { flex: 1; min-width: 0; height: 100%; font: inherit; font-size: 18px; color: var(--ink); background: none; border: none; outline: none; }
.wx-cancel { font-weight: 700; padding: 8px; }
.wx-results { list-style: none; margin-top: 16px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.wx-result { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px 12px; border-radius: 6px; }
.wx-result:hover, .wx-result:focus-visible { background: rgba(var(--ink-rgb), 0.05); }
.wx-result-text { display: flex; flex-direction: column; min-width: 0; }
.wx-result-name { font-size: 18px; font-weight: 700; }
.wx-result-detail { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx-empty { padding: 12px 4px; color: var(--ink-2); font-size: 14px; }

.settings-card { background: var(--card); border-radius: 10px; padding: 20px; max-height: 100%; overflow-y: auto; }
.settings-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.settings-head h2 { font-size: 30px; font-weight: 800; font-variation-settings: 'wdth' 58; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; flex-wrap: wrap; }
.setting-label { font-weight: 600; }
.setting-h { margin-top: 22px; font-size: 20px; font-weight: 800; font-variation-settings: 'wdth' 64; }
.setting-places { list-style: none; }
.setting-place { display: flex; align-items: center; gap: 6px; padding: 8px 0; flex-wrap: wrap; }
.setting-place-name { flex: 1; min-width: 140px; font-weight: 600; }
.setting-place .seg-btn { background: var(--wash); }

.detail-rows { font-size: 15px; }
.detail-rows dt { color: var(--ink-2); float: left; clear: left; padding: 3px 0; }
.detail-rows dd { font-weight: 600; text-align: right; padding: 3px 0; }
.detail-moon { display: flex; justify-content: center; }
.series-readout { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; min-height: 22px; }
.sun-arc { width: 100%; max-width: 420px; height: auto; align-self: center; }
.sun-arc .sun-night { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 2 3; opacity: 0.5; }
.sun-arc .sun-day { fill: none; stroke: var(--ink); stroke-width: 2.2; }
.sun-arc .horizon { stroke: var(--ink); stroke-width: 1; }
.sun-arc .sun-dot { fill: var(--ink); }
.sun-arc .sun-below { fill: var(--ink-2); }
.moon .moon-dark { fill: var(--night); }
.moon .moon-lit { fill: #fbf9f4; }

/* ============ Narrower screens ============ */
@media (max-width: 1180px) {
    .sg-cells { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    /* ten cards in rows of four: rain's squares and the sun's day take two columns */
    .sg-cell-rain, .sg-cell-sun { grid-column: span 2; }
    .sg-more { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    /* the color field fills the first screen and ends on the hour blocks; the spiral follows */
    .sg-top { grid-template-columns: 1fr; grid-template-rows: 1fr auto; min-height: calc(100svh - 62px); }
    .sg-top > .sg-hero { align-self: stretch; }
    .sg-spiral { margin: 28px auto 0; padding: 0 var(--gut); }
    .spiral .sp-disk { fill: var(--card); }
    .sg-sentence { margin-top: 14px; }
    .sg-chips {
        -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
        mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
        scroll-snap-type: x proximity;
        scroll-padding-inline: 2px;
        padding-right: 28px;
    }
    .chip { scroll-snap-align: start; }
    .sg-spiral { justify-self: center; max-width: 560px; }
    .sg-strip { grid-template-columns: repeat(12, minmax(0, 1fr)); }
    .sg-strip-h:nth-child(2n) { display: none; }
    .sg-strip-h:nth-child(3n+1) { background: none; }
    .sg-strip-h:nth-child(4n+1) { background: rgba(var(--ink-rgb), 0.05); }
    .sg-day { grid-template-rows: 54px auto; }
    .sg-ribbon-k { display: none; }
    .sg-ribbon { grid-template-columns: repeat(var(--hrs), minmax(0, 1fr)); }
    .sg-day { grid-template-columns: 60px 30px minmax(0, 1fr) 70px; }
    .sg-day-ic .ic { width: 24px; height: 24px; }
    .sg-day-date, .sg-day-amt, .sg-day-colh { display: none; }
    .sg-day-name { font-size: 24px; padding-left: 8px; }
    .sg-day-bar { margin: 0 34px 0 30px; }
    .sg-day-lo { font-size: 14px; transform: translateX(calc(-100% - 5px)); }
    .sg-day-hi { padding-left: 5px; }
    .sg-day-hi { font-size: 20px; top: 14px; }
    .sg-squares { grid-template-columns: repeat(10, 6px); gap: 2px; justify-content: end; padding-right: 8px; }
    .sg-squares i { width: 6px; height: 6px; }
    .sg-day-axis { display: none; }
    .sg-find span { display: none; }
    .sg-find { width: 40px; padding: 0; justify-content: center; border-radius: 50%; }
}

@media (max-width: 560px) {
    .sg-top { padding-top: 24px; gap: 8px; }
    .sg-sentence { font-size: 20px; padding-top: 8px; }
    .sg-spiral { margin-top: 8px; }
    .sg-cells { margin-top: 24px; gap: 4px; }
    .sg-cell { padding: 12px 10px 10px; }
    .sg-hours, .sg-days { margin-top: 32px; }
    .sg-more { margin-top: 36px; gap: 28px; }
    .sg-detail.open .sg-detail-inner { padding: 14px; }
    .sg-detail-inner .detail-rows { columns: 1; }
    .sg-cells { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sg-cell-rain, .sg-cell-sun { grid-column: auto; }
    .sg-cell { min-height: max(150px, var(--cell-h, 0px)); }
    .sg-cell-v { font-size: 38px; }
    .sg-num { font-size: 260px; }
    .sg-nav-actions .wx-icon-btn[href] { display: none; }
    .radar-frame { height: 260px; }
}

@media (prefers-reduced-motion: reduce) {
    .spiral .sp-sweep, .spiral .sp-late, .wx-sheet[open] { animation: none; }
    .sg-detail, .sg-day-more, .sg-strip-h { transition: none; }
}
