/* weather.adelaidelive.app — seven days for any South Australian suburb, with
   the ultraviolet, the air and the fire danger on the same screen. */
:root {
  --font-sans: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: clamp(1rem, 3vw, 2.5rem);
}
:root[data-theme="day"] {
  color-scheme: light;
  --bg: #eef1f4; --surface: #fafbfc; --sunk: #e6eaee;
  --ink: #161a1e; --dim: #626a74;
  --line: rgba(22, 26, 30, 0.12); --line-strong: rgba(22, 26, 30, 0.3);
  --accent: #3d6d99; --sun: #e8a317;
  --cold: #4a7fb5; --mild: #58a06a; --warm: #d38a1c; --hot: #c44a24;
  --good: #1d8a6b; --fair: #a8850a; --poor: #d3651f; --very_poor: #c0392b; --extremely_poor: #7d1128;
  --low: #1d8a6b; --moderate: #a8850a; --high: #d3651f; --very_high: #c0392b; --extreme: #7d1128;
  --rain: #5b8fc9;
}
:root[data-theme="night"] {
  color-scheme: dark;
  --bg: #0f1317; --surface: #161b21; --sunk: #1c2229;
  --ink: #e7ecf1; --dim: #939ca7;
  --line: rgba(231, 236, 241, 0.12); --line-strong: rgba(231, 236, 241, 0.3);
  --accent: #6ea3d6; --sun: #f0b53c;
  --cold: #6ea3d6; --mild: #6fc98a; --warm: #e6b24a; --hot: #f0785a;
  --good: #4fcf9f; --fair: #e6c14a; --poor: #f39a5b; --very_poor: #f0655a; --extremely_poor: #e0426b;
  --low: #4fcf9f; --moderate: #e6c14a; --high: #f39a5b; --very_high: #f0655a; --extreme: #e0426b;
  --rain: #7fb0e0;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font-family: var(--font-sans); font-size: clamp(16px, 0.45vw + 11px, 19px); line-height: 1.45; font-variant-ligatures: none; transition: background-color 700ms ease, color 700ms ease; }
body { margin: 0; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; font-variation-settings: "opsz" 14; }
body > *, main > * { min-width: 0; }
a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; text-decoration-color: var(--line-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
p, h1, h2, dl, dd { margin: 0; }
ol, ul { margin: 0; padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.dim { color: var(--dim); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.8rem var(--gutter); font-family: var(--font-mono); font-size: 0.8rem; }
.brand { text-decoration: none; font-weight: 500; }
.top nav { display: flex; align-items: center; gap: 1.1rem; }
.top nav a { color: var(--dim); text-decoration: none; }
.theme { color: var(--dim); background: transparent; border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.22rem 0.75rem; cursor: pointer; }
.theme:hover { color: var(--ink); border-color: var(--ink); }

main { width: min(100% - 2 * var(--gutter), 68rem); margin: 0 auto; padding: 0.6rem 0 2rem; display: grid; gap: clamp(1.1rem, 2.4vh, 1.8rem); align-content: start; }

/* ------------------------------------------------------------- the picker */
.picker { position: relative; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.picker input { flex: 1 1 18rem; min-width: 0; padding: 0.65rem 0.85rem; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 0.6rem; }
.picker input::-webkit-search-cancel-button { cursor: pointer; }
.locate { background: transparent; border: 1px solid var(--line-strong); border-radius: 0.6rem; padding: 0.3rem 0.9rem; font-size: 0.85rem; color: var(--dim); cursor: pointer; white-space: nowrap; }
.locate:hover { color: var(--ink); border-color: var(--ink); }
.locate[disabled] { opacity: 0.55; cursor: default; }
.matches { position: absolute; z-index: 20; top: calc(100% + 0.3rem); left: 0; right: 0; max-height: 17rem; overflow-y: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 0.6rem; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16); }
.matches li { padding: 0.5rem 0.85rem; cursor: pointer; display: flex; justify-content: space-between; gap: 1rem; font-size: 0.9rem; }
.matches li + li { border-top: 1px solid var(--line); }
.matches li[aria-selected="true"], .matches li:hover { background: var(--sunk); }
.matches .pc { font-family: var(--font-mono); font-size: 0.75rem; color: var(--dim); }
.err { color: var(--very_poor); font-size: 0.85rem; margin-top: 0.5rem; }

/* ------------------------------------------------------------- the alerts */
.alerts:empty { display: none; }
.alerts { display: grid; gap: 0.5rem; }
.alert { padding: 0.7rem 0.95rem; border-radius: 0 0.5rem 0.5rem 0; border-left: 3px solid var(--c, var(--accent)); background: var(--bgc, var(--sunk)); font-size: 0.9rem; line-height: 1.45; }
.alert b { font-weight: 700; }
.alert--ban { --c: var(--extremely_poor); --bgc: rgba(192, 57, 43, 0.1); }
.alert--fire { --c: var(--poor); --bgc: rgba(211, 101, 31, 0.1); }
.alert--air { --c: var(--very_poor); --bgc: rgba(192, 57, 43, 0.08); }
.alert--uv { --c: var(--high); --bgc: rgba(211, 101, 31, 0.08); }
.alert--stale { --c: var(--dim); --bgc: var(--sunk); }

/* ---------------------------------------------------------------- now */
.now { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: clamp(1rem, 3vw, 2.4rem); align-items: center; padding: 1.1rem 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; }
.now .where { font-weight: 600; letter-spacing: -0.01em; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline; }
.now .where .dim { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 400; }
.temp { font-size: clamp(3.2rem, 9vw, 5.4rem); font-weight: 700; letter-spacing: -0.04em; line-height: 1; font-variation-settings: "opsz" 96; margin-top: 0.3rem; }
.temp .deg { color: var(--dim); font-weight: 400; }
.word { font-size: 1.05rem; font-weight: 600; margin-top: 0.1rem; }
.feels { font-size: 0.9rem; margin-top: 0.15rem; }
.now-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: 0.7rem 1.1rem; }
.now-grid div { display: grid; gap: 0.1rem; }
.now-grid dt { font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--dim); }
.now-grid dd { font-size: 0.98rem; font-variant-numeric: tabular-nums; }
.now-grid dd .unit { font-size: 0.75em; color: var(--dim); margin-left: 0.15em; }
.now-grid dd .tone { color: var(--t); font-weight: 600; }

/* --------------------------------------------------------------- the week */
h2 { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); font-weight: 400; margin-bottom: 0.7rem; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.4rem; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: 0.7rem; padding: 0.6rem 0.4rem 0.7rem; display: grid; gap: 0.35rem; justify-items: center; cursor: pointer; text-align: center; }
.day:hover { border-color: var(--line-strong); }
.day[aria-selected="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.day .dow { font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); }
.day .icon { width: 26px; height: 26px; display: block; }
.day .hi { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.day .lo { font-size: 0.82rem; color: var(--dim); font-variant-numeric: tabular-nums; }
.day .rain { font-family: var(--font-mono); font-size: 0.66rem; color: var(--rain); min-height: 1em; }
.day .bar { width: 100%; height: 4px; border-radius: 999px; background: linear-gradient(to right, var(--from), var(--to)); }
.hint { font-size: 0.8rem; margin-top: 0.6rem; }

/* ------------------------------------------------------------- the detail */
.detail-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.tabs { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.tab { background: transparent; border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.18rem 0.7rem; font-size: 0.76rem; color: var(--dim); cursor: pointer; }
.tab[aria-selected="true"] { color: var(--bg); background: var(--ink); border-color: var(--ink); }
.chart { background: var(--surface); border: 1px solid var(--line); border-radius: 0.8rem; padding: 0.8rem 0.9rem 0.5rem; margin-bottom: 0.6rem; }
.chart svg { width: 100%; height: 150px; display: block; overflow: visible; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent); opacity: 0.08; }
.chart .rainbar { fill: var(--rain); opacity: 0.45; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .now { stroke: var(--hot); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .lbl { fill: var(--dim); font-family: var(--font-mono); font-size: 10px; }
.chart .val { fill: var(--ink); font-family: var(--font-mono); font-size: 10px; }
.chart-key { display: flex; gap: 1rem; flex-wrap: wrap; font-family: var(--font-mono); font-size: 0.68rem; color: var(--dim); margin-top: 0.35rem; }
.chart-key i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 0.3rem; }

.hours-wrap { margin-top: 0.2rem; }
.hours-wrap summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.45rem; font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); padding: 0.2rem 0; }
.hours-wrap summary::-webkit-details-marker { display: none; }
.hours-wrap summary::after { content: ""; width: 0.4rem; height: 0.4rem; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: translateY(-1px) rotate(45deg); transition: transform 0.15s ease; }
.hours-wrap[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.hours-wrap summary:hover { color: var(--ink); }
.hours-wrap[open] summary { margin-bottom: 0.35rem; }
.table-scroll { overflow-x: auto; }
.hours { border-collapse: collapse; width: 100%; min-width: 34rem; font-size: 0.84rem; }
.hours th, .hours td { padding: 0.32rem 0.55rem; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.hours th:first-child, .hours td:first-child { text-align: left; }
.hours thead th { font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); font-weight: 400; }
.hours tbody tr.is-now { background: var(--sunk); }
.hours .w { display: inline-flex; align-items: center; gap: 0.35rem; }
.hours .w svg { width: 16px; height: 16px; }

/* -------------------------------------------------------------- the panels */
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 0.85rem; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 0.9rem; padding: 0.95rem 1.05rem 1rem; }
.panel-body { display: grid; gap: 0.55rem; font-size: 0.88rem; }
.big-word { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; color: var(--t, var(--ink)); line-height: 1.1; }
.big-word .n { font-variant-numeric: tabular-nums; }
.scale { display: grid; grid-template-columns: repeat(var(--n, 5), 1fr); gap: 2px; margin: 0.15rem 0 0.1rem; }
.scale span { height: 5px; border-radius: 999px; background: var(--line); }
.scale span.on { background: var(--t); }
.rows { display: grid; gap: 0.25rem; }
.rows div { display: flex; justify-content: space-between; gap: 0.8rem; }
.rows .k { color: var(--dim); }
.rows .v { font-variant-numeric: tabular-nums; }
.panel .note { font-size: 0.78rem; color: var(--dim); line-height: 1.4; border-top: 1px solid var(--line); padding-top: 0.5rem; }
.firedays { display: grid; gap: 0.3rem; }
.fireday { display: flex; justify-content: space-between; gap: 0.7rem; align-items: baseline; }
.fireday .r { font-weight: 600; color: var(--t, var(--ink)); }
.ban-pill { display: inline-block; font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.05em; text-transform: uppercase; padding: 0.1rem 0.4rem; border-radius: 999px; background: var(--extremely_poor); color: #fff; margin-left: 0.35rem; }

.foot { width: min(100% - 2 * var(--gutter), 68rem); margin: 0 auto; padding: 1.2rem 0 2rem; border-top: 1px solid var(--line); font-size: 0.76rem; color: var(--dim); line-height: 1.5; display: grid; gap: 0.55rem; }
.foot a { color: var(--dim); }

@media (max-width: 46rem) {
  .now { grid-template-columns: 1fr; }
  .days { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .day .icon { width: 22px; height: 22px; }
}
@media (max-width: 26rem) {
  .days { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
