/* ed.adelaidelive.app — how busy South Australia's emergency departments are.
   One board, seven cards, and a great deal of care with the words. */
: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: #f0f2f5; --surface: #fafbfc; --ink: #171a1e; --dim: #626a74;
  --line: rgba(23, 26, 30, 0.12); --line-strong: rgba(23, 26, 30, 0.3);
  --accent: #2f6fb0;
  --short: #1d8a6b; --usual: #a8850a; --long: #d3651f; --very_long: #c0392b;
  --siren-bg: rgba(192, 57, 43, 0.07); --siren-ink: #a5311f;
  --bar: rgba(23, 26, 30, 0.09);
}
:root[data-theme="night"] {
  color-scheme: dark;
  --bg: #101418; --surface: #171c22; --ink: #e8ecf1; --dim: #949da8;
  --line: rgba(232, 236, 241, 0.12); --line-strong: rgba(232, 236, 241, 0.3);
  --accent: #5a9fe0;
  --short: #4fcf9f; --usual: #e6c14a; --long: #f39a5b; --very_long: #f0655a;
  --siren-bg: rgba(240, 101, 90, 0.1); --siren-ink: #f0908a;
  --bar: rgba(232, 236, 241, 0.1);
}

*, *::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 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 { margin: 0; }
ol, ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.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); }

/* The one thing on this page that must never be missed. */
/* Same column as main, or it drifts left of everything on a wide screen. */
.siren { width: min(100% - 2 * var(--gutter), 74rem); margin: 0 auto; padding: 0.7rem 0.9rem; background: var(--siren-bg); border-left: 3px solid var(--siren-ink); border-radius: 0 0.5rem 0.5rem 0; color: var(--siren-ink); font-size: 0.88rem; line-height: 1.45; }
.siren b { font-weight: 700; }

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

.hero h1 { font-size: clamp(1.6rem, 3.4vw, 2.7rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.12; font-variation-settings: "opsz" 96; max-width: 26em; }
.hero .sub { color: var(--dim); margin-top: 0.5rem; max-width: 46rem; }
.hero .stamp { font-family: var(--font-mono); font-size: 0.74rem; color: var(--dim); margin-top: 0.7rem; }
.hero .stale { margin-top: 0.7rem; padding: 0.55rem 0.8rem; border-left: 3px solid var(--long); background: rgba(211, 101, 31, 0.09); border-radius: 0 0.4rem 0.4rem 0; font-size: 0.85rem; max-width: 46rem; }

.advice { border: 1px solid var(--line); border-radius: 0.9rem; padding: 1rem 1.1rem; background: var(--surface); max-width: 52rem; }
.advice h2 { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); font-weight: 400; }
.advice > p { margin-top: 0.5rem; font-size: 0.92rem; color: var(--dim); }
.ways { margin-top: 0.8rem; display: grid; gap: 0.5rem; font-size: 0.92rem; }
.ways li { padding-left: 0.9rem; position: relative; line-height: 1.4; }
.ways li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }

.board-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.board-head h2 { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); font-weight: 400; }
.locate { background: transparent; border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.3rem 0.85rem; font-size: 0.8rem; color: var(--dim); cursor: pointer; }
.locate:hover { color: var(--ink); border-color: var(--ink); }
.locate[disabled] { opacity: 0.55; cursor: default; }
.err { color: var(--very_long); font-size: 0.85rem; margin-bottom: 0.7rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(17.5rem, 1fr)); gap: 0.85rem; }
.card { border: 1px solid var(--line); border-radius: 0.9rem; padding: 1rem 1.05rem 0.9rem; background: var(--surface); display: grid; gap: 0.55rem; align-content: start; }
.card .who { display: flex; justify-content: space-between; align-items: baseline; gap: 0.6rem; }
.card .name { font-weight: 600; letter-spacing: -0.01em; }
.card .where { font-family: var(--font-mono); font-size: 0.7rem; color: var(--dim); white-space: nowrap; }

.waitbox { display: grid; gap: 0.12rem; }
.wait { display: flex; align-items: baseline; gap: 0.3rem; }
.wait .n { font-size: clamp(2rem, 4vw, 2.9rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-variation-settings: "opsz" 96; color: var(--tone, var(--ink)); }
.wait .u { font-size: 0.95rem; font-weight: 600; color: var(--tone, var(--dim)); }
.waitbox .caption { font-size: 0.82rem; color: var(--dim); }
.card[data-wait="short"] { --tone: var(--short); }
.card[data-wait="usual"] { --tone: var(--usual); }
.card[data-wait="long"] { --tone: var(--long); }
.card[data-wait="very_long"] { --tone: var(--very_long); }

.rows { display: grid; gap: 0.28rem; font-size: 0.84rem; }
.rows div { display: flex; justify-content: space-between; gap: 0.8rem; }
.rows dt, .rows .k { color: var(--dim); }
.rows .v { font-variant-numeric: tabular-nums; }

/* How full, against the line where the department runs out of treatment spaces. */
.fill { margin-top: 0.15rem; }
.fill .track { position: relative; height: 8px; border-radius: 999px; background: var(--bar); overflow: hidden; }
.fill .val { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--accent); opacity: 0.75; }
.fill .full-line { position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--line-strong); }
.fill .cap { display: flex; justify-content: space-between; align-items: baseline; gap: 0.6rem; font-size: 0.76rem; color: var(--dim); margin-top: 0.3rem; }
.fill .word { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.02em; white-space: nowrap; }

.spark { display: grid; gap: 0.25rem; }
.spark svg { width: 100%; height: 42px; display: block; overflow: visible; }
.spark .l { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark .a { fill: var(--accent); opacity: 0.09; }
.spark .base { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 2 3; }
.spark .axis { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 0.68rem; color: var(--dim); }

.card .note { font-size: 0.8rem; color: var(--dim); border-top: 1px solid var(--line); padding-top: 0.5rem; line-height: 1.35; }
/* A constraint on who the door takes belongs above the number, not under it. */
.card .note-first { border-top: 0; border-left: 2px solid var(--accent); border-radius: 0 0.3rem 0.3rem 0; padding: 0.1rem 0 0.1rem 0.55rem; color: var(--ink); }
.card.is-off .n { color: var(--dim); }

.country { border-top: 1px solid var(--line); padding-top: 1.1rem; }
.country summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); }
.country summary::-webkit-details-marker { display: none; }
.country summary::after { content: ""; width: 0.42rem; height: 0.42rem; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: translateY(-1px) rotate(45deg); transition: transform 0.15s ease; }
.country[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.country summary:hover { color: var(--ink); }
.country .hint { color: var(--dim); font-size: 0.88rem; margin: 0.7rem 0 0.9rem; max-width: 46rem; }
.table-scroll { overflow-x: auto; }
.country-table { border-collapse: collapse; width: 100%; font-size: 0.85rem; min-width: 34rem; }
.country-table th, .country-table td { text-align: right; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.country-table th:first-child, .country-table td:first-child { text-align: left; white-space: normal; }
.country-table thead th { font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); font-weight: 400; }
.country-table td { font-variant-numeric: tabular-nums; }
.country-table .word { font-family: var(--font-mono); font-size: 0.7rem; color: var(--dim); }
.country-table .small { display: block; font-size: 0.72rem; color: var(--dim); }

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

@media (max-width: 32rem) {
  .board-head { align-items: stretch; }
  .locate { width: 100%; padding: 0.5rem 0.85rem; }
}
