/* Weather21 web app. Builds on /styles.css (palette, cards, buttons). */

[hidden] { display: none !important; }

.app { padding-top: 40px; display: grid; gap: 20px; max-width: 900px; }

/* Place finder */
.finder { display: grid; gap: 12px; }
.search { position: relative; }
.search .eyebrow { display: block; }
#search {
  width: 100%; font: inherit; font-size: 1.1rem; padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--rule); background: var(--card); color: var(--ink);
}
#search:focus { outline: none; border-color: var(--blue-dark); box-shadow: 0 0 0 3px rgba(12, 147, 189, 0.18); }
.results { list-style: none; margin: 6px 0 0; padding: 0; border-radius: 12px; overflow: hidden; }
.results:not(:empty) { border: 1px solid var(--rule); background: var(--card); box-shadow: 0 18px 40px -24px rgba(35, 31, 32, 0.35); }
.results li + li { border-top: 1px solid var(--rule); }
.results button { all: unset; display: block; width: 100%; box-sizing: border-box; padding: 12px 16px; cursor: pointer; }
.results button:hover, .results button:focus-visible { background: rgba(12, 147, 189, 0.08); }
.results .quiet { padding: 12px 16px; }
.locate-row { margin: 0; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.saved { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; border: 1px solid var(--rule); border-radius: 999px; background: var(--card); overflow: hidden; }
.chip.on { border-color: var(--pink-dark); box-shadow: inset 0 0 0 1px var(--pink-dark); }
.chip button { all: unset; cursor: pointer; padding: 6px 12px; font-size: 0.92rem; }
.chip .x { padding: 6px 10px 6px 4px; color: var(--muted); }
.chip button:hover { color: var(--pink-dark); }
.chip button:focus-visible { outline: 2px solid var(--blue-dark); }

.small { font-size: 0.85rem; }
.quiet { color: var(--muted); }
.error { background: #fdecea; border: 1px solid #f3c2bc; color: #7a2b1f; padding: 12px 16px; border-radius: 12px; }

/* The live sky, coloured by the core from the sun, cloud and humidity */
#forecast { display: grid; gap: 16px; transition: opacity 0.3s ease; }
#forecast.loading { opacity: 0.55; }
.sky-card {
  --top: #2f6198; --middle: #4f86bd; --horizon: #e8a877; --sun-x: 70%; --sun-y: 30%; --glow: 0.6;
  position: relative; overflow: hidden; border-radius: 22px; color: #fff; padding: 28px 28px 24px;
  background: linear-gradient(180deg, var(--top), var(--middle) 60%, var(--horizon));
  transition: background 1.5s ease;
  min-height: 260px;
}
.sky-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: var(--glow);
  background: radial-gradient(circle at var(--sun-x) var(--sun-y), rgba(255, 248, 232, 0.95) 0, rgba(255, 220, 170, 0.45) 9%, transparent 38%);
}
.sky-card > * { position: relative; margin: 0; text-shadow: 0 1px 14px rgba(8, 16, 32, 0.35); }
.place { font-weight: 600; }
.temp { font-size: clamp(4rem, 14vw, 7rem); font-weight: 200; line-height: 1; margin: 10px 0 6px !important; font-variant-numeric: tabular-nums; }
.change { font-size: 1.2rem; font-weight: 600; max-width: 30em; }
.sky-line { margin-top: 14px !important; display: inline-block; font-family: var(--mono); font-size: 0.8rem; background: rgba(8, 16, 32, 0.45); padding: 8px 12px; border-radius: 10px; text-shadow: none; }

/* Cards */
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-head h2 { font-size: 1.15rem; margin: 0; }
.card-head .label { margin: 0; }
.why { font-size: 0.82rem; font-weight: 600; text-decoration: none; padding: 4px 10px; border-radius: 999px; background: rgba(12, 147, 189, 0.1); color: var(--cool); }
.why:hover { background: rgba(12, 147, 189, 0.18); color: var(--cool); }

/* Warnings, coloured by severity as in the app */
.warn-card { display: grid; gap: 12px; }
.warning { display: grid; gap: 2px; text-decoration: none; color: var(--ink); padding: 10px 14px; border-radius: 10px; border-left: 5px solid #F2C94C; background: var(--paper); }
.warning:hover { color: var(--ink); background: var(--paper-2); }
.warning.r3 { border-left-color: #F4A300; }
.warning.r4 { border-left-color: #F26B1D; }
.warning.r5 { border-left-color: #D7263D; }
.warning.r6 { border-left-color: #8E1B1B; }

/* Plume, rain and storm bars */
.share-bars { display: flex; gap: 3px; align-items: flex-end; height: 42px; margin: 6px 0 4px 40px; }
.share-bars span { --h: 0%; flex: 1; height: max(2px, var(--h)); border-radius: 3px 3px 0 0; opacity: 0.85; }
.share-bars.rain span { background: linear-gradient(180deg, var(--blue-light), var(--blue-dark)); }
.share-bars.storm { height: 30px; }
.share-bars.storm span { background: linear-gradient(180deg, #c9b3f5, #7c5cc4); }
/* The gust plume, in the Centre's blues */
.plume.wind .band-full { fill: rgba(5, 193, 232, 0.16); }
.plume.wind .band-core { fill: rgba(12, 147, 189, 0.38); }
.plume.wind .median { stroke: #0A5F7D; }
.lead-line { margin: 0 0 4px; font-weight: 600; }

/* Hour by hour: swipe sideways */
.hourly { list-style: none; margin: 0; padding: 0 0 6px; display: flex; gap: 4px; overflow-x: auto; scroll-snap-type: x proximity; }
.hourly li { flex: 0 0 64px; display: grid; justify-items: center; gap: 4px; padding: 8px 0; border-radius: 10px; scroll-snap-align: start; }
.hourly li:first-child { background: var(--paper); }
.hourly .h { font-size: 0.82rem; color: var(--muted); }
.hourly li:first-child .h { color: var(--ink); font-weight: 600; }
.hourly strong { font-size: 1.15rem; font-weight: 600; }
.hourly .rain, .days .rain { color: var(--cool); font-family: var(--mono); }
.hourly .gust { font-family: var(--mono); font-size: 0.72rem; }

/* 7 days */
.days { list-style: none; margin: 0; padding: 0; }
.days li { display: grid; grid-template-columns: 56px 44px 38px 1fr 38px; align-items: center; gap: 8px; min-height: 42px; }
.days li + li { border-top: 1px solid var(--rule); }
.days .day-note { grid-column: 1 / -1; margin: -6px 0 8px; font-family: var(--mono); }
.days .d { font-weight: 600; }
.days .lo { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.days .hi { font-weight: 600; font-variant-numeric: tabular-nums; }
.track { position: relative; height: 10px; border-radius: 5px; background: var(--paper-2); }
.track span { --a: 0%; --b: 100%; position: absolute; top: 0; bottom: 0; left: var(--a); width: max(10px, calc(var(--b) - var(--a))); border-radius: 5px; }
.track .spread { background: rgba(244, 133, 127, 0.3); }
.track .typical { top: 2px; bottom: 2px; background: linear-gradient(90deg, var(--pink-light), var(--pink-dark)); }

/* Models */
#models table { border-collapse: collapse; width: 100%; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
#models th, #models td { padding: 8px 10px; border-bottom: 1px solid var(--rule); text-align: center; }
#models th[scope="row"] { text-align: left; white-space: nowrap; }
#models thead th { font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 500; }
#models .agree td { font-size: 0.8rem; font-weight: 600; }
#models .agree .high { color: #2e7d4f; }
#models .agree .moderate { color: #a86a00; }
#models .agree .low { color: var(--pink-dark); }
#models .table { overflow-x: auto; border: 1px solid var(--rule); border-radius: 12px; }
#models tr:last-child td, #models tr:last-child th { border-bottom: 0; }

@media (max-width: 560px) {
  .days li { grid-template-columns: 52px 36px 30px 1fr 30px; gap: 6px; }
  .share-bars { margin-left: 5%; }
  .sky-card { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .sky-card, #forecast { transition: none; }
}

/* Air quality: Australian category colours (green, yellow, orange, red, maroon) */
.aq { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; color: #231F20; }
.aq-good { background: #8FD19E; }
.aq-fair { background: #F6E27A; }
.aq-poor { background: #F5A65B; }
.aq-very_poor { background: #E5533D; color: #fff; }
.aq-extremely_poor { background: #7A1F2B; color: #fff; }
.aq-days { list-style: none; margin: 10px 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.aq-days li { display: grid; gap: 4px; justify-items: start; align-content: start; padding: 6px; border-radius: 10px; background: var(--paper); }
.aq-days .d { font-size: 0.82rem; color: var(--muted); }
.aq-days .aq { font-size: 0.72rem; padding: 2px 6px; }
.mono { font-family: var(--mono); }

/* Latest observation */
.obs-temp { margin: 0 0 2px; }
.obs-temp .big { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Fire danger ratings: the AFDRS colours (green, yellow, orange, red) */
.fdr { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.85rem; font-weight: 700; color: #231F20; background: #eceae4; }
.fdr-moderate { background: #64BF30; }
.fdr-high { background: #FFD600; }
.fdr-extreme { background: #F28C28; }
.fdr-catastrophic { background: #B5121B; color: #fff; }
.fdr-days { list-style: none; margin: 10px 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.fdr-days li { display: grid; gap: 4px; justify-items: start; align-content: start; padding: 6px; border-radius: 10px; background: var(--paper); }
.fdr-days .d { font-size: 0.82rem; color: var(--muted); }
.fdr-days .fdr { font-size: 0.72rem; padding: 2px 6px; }

/* Radar: BOM's images restyled in the core's palette — a quiet map, rain
   that crossfades between frames, a pulsing dot for the place */
.radar-stage { position: relative; width: 100%; max-width: 560px; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: #d6e6ee; box-shadow: inset 0 0 0 1px rgba(35, 31, 32, 0.08); }
.radar-map, .radar-rain, .radar-over { position: absolute; inset: 0; width: 100%; height: 100%; }
.radar-rain { transition: opacity 0.45s ease; }
.radar-dot { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #B7533D; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(35, 31, 32, 0.35); }
.radar-dot::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid rgba(183, 83, 61, 0.55); animation: radar-pulse 2.4s ease-out infinite; }
@keyframes radar-pulse { from { transform: scale(0.4); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .radar-dot::after { animation: none; opacity: 0; } .radar-rain { transition: none; } }
.radar-stage { touch-action: pan-y; cursor: zoom-in; user-select: none; }
.radar-stage.zoomed { cursor: grab; }
.radar-stage.zoomed:active { cursor: grabbing; }
.radar-zoom { display: flex; gap: 6px; margin-top: 10px; max-width: 560px; }
.radar-zoom .button { min-width: 2.6em; }
.radar-zoom .button:disabled { opacity: 0.4; cursor: default; }
.radar-controls { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin: 12px 0 8px; max-width: 560px; }
@media (max-width: 520px) { .radar-controls { grid-template-columns: auto 1fr; } .radar-time { grid-column: 1 / -1; } }
.radar-play { min-width: 4.5em; }
.radar-scrub { width: 100%; accent-color: #0C93BD; }
.radar-time { white-space: nowrap; }
.radar-legend { max-width: 560px; height: 8px; border-radius: 4px; }
.radar-legend-text { display: flex; justify-content: space-between; max-width: 560px; margin-top: 4px !important; }

/* ---- Layout cleanup: status strip, tabbed next-48h, More detail ---- */
.status-strip { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.status-strip:empty { display: none; }
.chip-s { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--rule); background: var(--card); color: var(--ink); font-size: 0.9rem; text-decoration: none; }
a.chip-s:hover { border-color: var(--pink-dark); color: var(--ink); }
a.chip-s:focus-visible { outline: 2px solid var(--blue-dark); }
.chip-s.ok::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #8FD19E; }
.chip-s.warn { border-left: 5px solid #F2C94C; font-weight: 600; }
.chip-s.warn.r3 { border-left-color: #F4A300; }
.chip-s.warn.r4 { border-left-color: #F26B1D; }
.chip-s.warn.r5 { border-left-color: #D7263D; }
.chip-s.warn.r6 { border-left-color: #8E1B1B; }
.chip-s .fdr, .chip-s .aq { font-size: 0.78rem; padding: 1px 8px; }
#warnings:empty { display: none; }
#warnings { scroll-margin-top: 12px; }

.seg { display: flex; gap: 2px; padding: 3px; margin: 0 0 12px; border-radius: 999px; background: var(--paper); width: fit-content; max-width: 100%; overflow-x: auto; }
.seg-b { all: unset; cursor: pointer; padding: 6px 14px; border-radius: 999px; font-size: 0.9rem; color: var(--muted); white-space: nowrap; }
.seg-b:hover { color: var(--ink); }
.seg-b[aria-selected="true"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.seg-b:focus-visible { outline: 2px solid var(--blue-dark); }
#next-panel { min-height: 150px; margin-bottom: 10px; }
.share-bars.tall { height: 90px; }
.aq-strip { display: flex; gap: 1px; height: 22px; margin: 8px 0 2px; border-radius: 6px; overflow: hidden; }
.aq-strip span { flex: 1; }
.aq-strip-axis { display: flex; justify-content: space-between; margin: 0 0 6px !important; }
.days .day-note .fdr, .days .day-note .aq { font-family: var(--sans, inherit); font-size: 0.72rem; padding: 1px 7px; margin-right: 6px; }

details.more > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary h2 { font-size: 1.15rem; margin: 0; }
details.more > summary h2::before { content: "▸"; display: inline-block; width: 1.1em; transition: transform 0.15s; color: var(--muted); }
details.more[open] > summary h2::before { transform: rotate(90deg); }
details.more[open] > summary { margin-bottom: 8px; }
.more-section { padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--rule); scroll-margin-top: 12px; }
.more-section .card-head h3 { font-size: 1rem; margin: 0; }
@media (prefers-reduced-motion: reduce) { details.more > summary h2::before { transition: none; } }

/* ---- Views: forecast, radar, detail ---- */
.views { scroll-margin-top: 72px; display: flex; gap: 4px; padding: 4px; margin: 0 0 4px; border-radius: 999px; background: var(--paper); box-shadow: 0 1px 0 var(--rule); }
.views button { all: unset; flex: 1; text-align: center; cursor: pointer; padding: 9px 12px; border-radius: 999px; font-weight: 500; color: var(--muted); }
.views button:hover { color: var(--ink); }
.views button[aria-selected="true"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.views button:focus-visible { outline: 2px solid var(--blue-dark); }
.view { display: grid; gap: 16px; }
.view[hidden] { display: none; }
#view-detail .card, #view-radar .card { scroll-margin-top: 72px; }

/* Weather drawn over the sky (stars, drifting cloud, rain) */
.sky-card > canvas.sky-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; text-shadow: none; }

/* Bar charts on the same frame as the plume charts */
svg.bars { width: 100%; height: auto; display: block; }
svg.bars .bar { fill: var(--blue-dark); }
svg.bars.storm .bar { fill: #7c5cc4; }
svg .axis.day { font-weight: 700; }
svg.bars .grid { stroke: #e7e4dc; stroke-width: 1; }
svg.bars .grid.faint { stroke-dasharray: 2 4; }
svg.bars .axis { fill: var(--muted); font-size: 11px; font-family: var(--mono); }

/* European Air Quality Index colours (EEA) for places rated on it */
.aq-moderate { background: #F0E641; }
[data-air-scale="eu"] .aq-good { background: #50F0E6; }
[data-air-scale="eu"] .aq-fair { background: #50CCAA; }
[data-air-scale="eu"] .aq-moderate { background: #F0E641; }
[data-air-scale="eu"] .aq-poor { background: #FF5050; color: #fff; }
[data-air-scale="eu"] .aq-very_poor { background: #960032; color: #fff; }
[data-air-scale="eu"] .aq-extremely_poor { background: #7D2181; color: #fff; }
