/* The weather pages' own parts. Everything sits under .wx and takes its colours
   from the Almanac's tokens, so day and night both work. No literal colours.

   Drawings: the shapes are an SVG stretched to the width of the column, and the
   words (month letters, scale figures, marks) are ordinary text laid over it, so
   the words stay the same size on a phone and on a desk. */

.wx-head { padding-block: clamp(1.5rem, 4vw, 2.5rem) 0; }
.wx-head h1 { font-size: clamp(2rem, 3vw + 1rem, 3rem); }
.wx-head .lede { font-size: var(--step-1); line-height: 1.45; max-width: var(--measure); }

.wx-date { font-family: var(--display); font-weight: 400; font-size: var(--step-3); line-height: 1.15; }
.wx p { max-width: var(--measure); }
.wx .today-strip dd.figure-lg small { font-weight: 600; }
.wx-list { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.4rem; max-width: var(--measure); }

/* ----- a drawing ----- */
.wx-plot { --yw: 2.2rem; margin: 0; display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
/* The scale's figures stand in a margin to the left of the drawing, never on it. */
.wx-plot-area { position: relative; height: var(--h, 150px); margin-left: var(--yw); }
.wx-plot .wx-x { margin-left: var(--yw); }
.wx-plot-area svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.wx-plot-area svg * { vector-effect: non-scaling-stroke; }
.wx-plot figcaption { font-size: var(--step--1); color: var(--ink-soft); max-width: var(--measure); }

.wx-grid { stroke: var(--rule); stroke-width: 1; fill: none; }
.wx-base { stroke: var(--ink-soft); stroke-width: 1; fill: none; }
.wx-y { position: absolute; left: calc(-1 * var(--yw)); width: calc(var(--yw) - 0.4rem); text-align: right; white-space: nowrap; transform: translateY(-50%); font-size: 0.7rem; line-height: 1; color: var(--ink-soft); font-variant-numeric: tabular-nums lining-nums; }
.wx-x { display: grid; grid-template-columns: repeat(var(--n, 12), minmax(0, 1fr)); font-size: 0.7rem; line-height: 1.2; color: var(--ink-soft); text-align: center; }
.wx-x--days { grid-template-columns: 31fr 29fr 31fr 30fr 31fr 30fr 31fr 31fr 30fr 31fr 30fr 31fr; }
.wx-x span { min-width: 0; overflow: hidden; }
.wx-x .wide { display: none; }
@media (min-width: 40rem) { .wx-x .wide { display: inline; } .wx-x .narrow { display: none; } }
.wx-x--free { display: block; position: relative; height: 1.1rem; }
.wx-x--free span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.wx-x--free span.first { transform: none; }
.wx-x--free span.last { transform: translateX(-100%); }

/* words set on a drawing */
.wx-mark { position: absolute; transform: translate(-50%, -100%); font-size: 0.72rem; font-weight: 600; line-height: 1.1; white-space: nowrap; color: var(--ink); font-variant-numeric: tabular-nums lining-nums; padding-bottom: 0.2rem; }
.wx-mark--under { transform: translate(-50%, 0); padding: 0.2rem 0 0; }
.wx-mark--plate { background: var(--plot-ground, var(--sheet)); border-radius: 3px; padding: 0.12rem 0.3rem; margin-top: -0.25rem; }
.wx-mark small { font-weight: 500; color: var(--ink-soft); font-size: 1em; }

/* shapes, by what they show */
.wx-warm { fill: var(--signal); }
.wx-warm-line { stroke: var(--signal); stroke-width: 2; fill: none; }
.wx-range { fill: var(--land-edge); }
.wx-wet { fill: var(--accent); }
.wx-wet-soft { fill: var(--accent); fill-opacity: 0.22; }
.wx-wet-line { stroke: var(--accent); stroke-width: 2; fill: none; stroke-linejoin: round; }
.wx-air { fill: var(--gold); }
.wx-light { fill: var(--gold); fill-opacity: 0.55; }
.wx-middle { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 4 3; fill: none; }
.wx-none { fill: var(--rule); }
.wx-night { fill: var(--ink); fill-opacity: 0.07; }

/* today's place on a drawing of the whole year */
.wx-today { position: absolute; top: -0.35rem; bottom: 0; width: 0; border-left: 2px solid var(--ink); pointer-events: none; }
.wx-today::before { content: ""; position: absolute; top: 0; left: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.wx-today[hidden] { display: none; }
.wx-dot { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--ink); border: 2px solid var(--sheet); }
.wx-pin { position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--sheet); border: 2px solid var(--accent); }

.wx-key { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; font-size: var(--step--1); color: var(--ink-soft); margin: 0; padding: 0; list-style: none; }
.wx-key li { display: inline-flex; align-items: center; gap: 0.4rem; }
.wx-key i { width: 0.9rem; height: 0.9rem; border-radius: 2px; flex: none; }
.wx-key .k-warm { background: var(--signal); }
.wx-key .k-range { background: var(--land-edge); }
.wx-key .k-wet { background: var(--accent); }
.wx-key .k-none { background: var(--rule); }
.wx-key .k-today { width: 2px; border-radius: 0; background: var(--ink); }
.wx-key .k-middle { height: 0; width: 1.1rem; border-top: 1px dashed var(--ink); border-radius: 0; }

/* ----- the island's year: six small drawings ----- */
.wx-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17.5rem), 1fr)); gap: 1rem; list-style: none; margin: 0; padding: 0; }
.wx-panel { --plot-ground: var(--land); min-width: 0; background: var(--land); border: 1px solid var(--land-edge); border-radius: 6px; padding: 1.1rem 1.15rem 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.wx-panel h3 { font-size: 0.76rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--gold); }
.wx-panel .says { font-family: var(--display); font-size: 1.22rem; line-height: 1.25; }
.wx-panel .says b { font-weight: 600; }
.wx-panel .wx-plot { margin-top: auto; padding-top: 1.1rem; }
.wx-panel .from { font-size: 0.8rem; color: var(--ink-soft); }

/* ----- tide ----- */
.wx-tide { --plot-ground: var(--water); background: var(--water); border: 1px solid var(--water-edge); border-radius: 6px; padding: 1.1rem 1.15rem 0.9rem; display: flex; flex-direction: column; gap: 0.9rem; }
.wx-tide .wx-plot-area { margin-top: 1.2rem; margin-bottom: 1.2rem; }
.wx-sea-fill { fill: var(--accent); fill-opacity: 0.2; }

.wx details { border-top: 1px solid var(--rule); padding-top: 0.75rem; }
.wx summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.wx details[open] summary { margin-bottom: 0.75rem; }
.wx table.data td, .wx table.data th { white-space: nowrap; }
.wx table.data td.wrap { white-space: normal; }

/* the week's tides must fit a small phone without sliding sideways */
@media (max-width: 23rem) {
  .wx-week { font-size: 0.85rem; }
  .wx-week th, .wx-week td { padding-right: 0.5rem; }
  .wx-week .mo { display: none; }
  .wx-week .figure-note { font-size: 1em; }
}

/* ----- live: now, the week, the sea, storms, pictures from above ----- */
.wx-wind { display: flex; align-items: center; gap: 0.55rem; }
.wx-dial { width: 2.5rem; height: 2.5rem; flex: none; }
.wx-dial-ring, .wx-dial-ticks { fill: none; stroke: var(--ink-soft); stroke-width: 1.5; }
.wx-dial-arrow { fill: none; stroke: var(--accent); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.wx-now { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }

.wx-week-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.wx-week-list li { border-bottom: 1px solid var(--rule); }
.wx .wx-week-list details { border: 0; padding: 0; }
.wx .wx-week-list summary { display: grid; grid-template-columns: 9.5rem 6rem 9.5rem 7.5rem minmax(0, 1fr); gap: 0.15rem 1rem; align-items: baseline; padding: 0.7rem 0; margin: 0; color: var(--ink); font-weight: 400; list-style: none; }
.wx-week-list summary::-webkit-details-marker { display: none; }
.wx-week-list summary .d { font-weight: 700; }
.wx-week-list summary .d::after { content: " +"; color: var(--accent); font-weight: 400; }
.wx-week-list details[open] summary .d::after { content: " \2212"; }
.wx-week-list summary .t b { font-weight: 700; }
.wx-week-list summary .w, .wx-week-list summary .r { color: var(--ink-soft); }
.wx-week-list details p { margin: 0 0 0.7rem; color: var(--ink-soft); }
@media (max-width: 52rem) {
  .wx .wx-week-list summary { grid-template-columns: minmax(0, 1fr) auto; }
  .wx-week-list summary .s { grid-column: 1 / -1; grid-row: 2; }
  .wx-week-list summary .w { grid-row: 3; }
  .wx-week-list summary .r { grid-row: 3; text-align: right; }
  .wx-week-list summary .w, .wx-week-list summary .r { font-size: var(--step--1); }
}

.wx-marine { background: var(--water); border: 1px solid var(--water-edge); border-radius: 6px; padding: 1.1rem 1.15rem; display: flex; flex-direction: column; gap: 0.75rem; }
.wx-marine dl { margin: 0; display: grid; gap: 0.6rem; max-width: var(--measure); }
.wx-marine dt { font-weight: 700; }
.wx-marine dd { margin: 0; }
.wx-quote { border-left: 3px solid var(--rule); padding-left: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.wx-buttons { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.wx-pics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17.5rem), 1fr)); gap: 1rem; }
.wx-pic { margin: 0; display: flex; flex-direction: column; gap: 0.35rem; max-width: 600px; }
.wx-pic img { width: 100%; height: auto; display: block; border-radius: 6px; border: 1px solid var(--rule); }
.wx-pic figcaption { font-size: var(--step--1); color: var(--ink-soft); }
almanac-live[show="alerts"] { display: flex; flex-direction: column; gap: 0.6rem; }
almanac-live[show="alerts"]:empty { display: none; }

/* this year's days, over the usual band */
.wx-year { stroke: var(--ink); stroke-width: 1; fill: none; opacity: 0.6; }
.wx-key .k-year { width: 2px; border-radius: 0; background: var(--ink); opacity: 0.6; }

/* the next two days, hour by hour */
almanac-live[show="hours"]:empty { display: none; }
.wx-x--wind { color: var(--ink); font-variant-numeric: tabular-nums lining-nums; }
.wx-x--free b { color: var(--ink); }

/* rain over the island, by radar: blocks, on purpose */
.wx-rain { --yw: 0rem; max-width: 42rem; gap: 0.6rem; }
.wx-rain canvas { width: 100%; height: auto; display: block; border: 1px solid var(--water-edge); border-radius: 6px; image-rendering: pixelated; }
.wx-rain .wx-buttons { align-items: center; margin: 0; }
.wx-rain-key { display: flex; flex-direction: column; gap: 0.3rem; margin: 0; }
.wx-rain-key img { width: 100%; max-width: 31.25rem; height: auto; border-radius: 3px; }

/* a long caution must wrap on a small phone, not push the page wide */
.wx-marine .tag { white-space: normal; line-height: 1.35; }

/* ----- the look: the shell's tiles, dial and days, with the few fittings these pages add ----- */
.wx-alerts { padding-top: 1rem; }
.wx-alerts:has(almanac-live:empty) { padding-top: 0; }
.wx .tiles { align-items: stretch; }
.wx-wind { display: flex; gap: 1rem; align-items: center; }
.wx-wind-say { font-size: 0.95rem; color: var(--ink); }
.wx-wind-say span { color: var(--ink-soft); font-size: var(--step--1); }
@media (max-width: 24rem) { .wx-wind { flex-direction: column; align-items: flex-start; } }
.wx-gauge { display: block; width: 100%; height: auto; max-width: 44rem; }
.wx .band-head h2 span { white-space: nowrap; }
.wx .fold .table-wrap { margin: 0; }

/* a short row of tiles fills its column, as a long one does */
.wx .tiles { grid-template-columns: repeat(auto-fit, minmax(min(10.5rem, 46%), 1fr)); }
/* on a wide screen the rain map sits beside its words */
@media (min-width: 60rem) { almanac-live[show="rain"] { display: grid; grid-template-columns: minmax(0, 42rem) minmax(0, 1fr); gap: 1rem 2rem; align-items: start; } almanac-live[show="rain"] > p { grid-column: 2; grid-row: 1; margin: 0; } almanac-live[show="rain"] > figure { grid-column: 1; grid-row: 1 / span 2; } }

/* the sky about an hour ago: the satellite's picture, in its own dots */
.wx-sky canvas { background: var(--forest); }
almanac-live[show="skynow"] { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem 2rem; align-items: start; }
@media (min-width: 60rem) { almanac-live[show="skynow"] { grid-template-columns: minmax(0, 42rem) minmax(0, 1fr); } almanac-live[show="skynow"] > .tiles { grid-template-columns: minmax(0, 1fr); } }
