/* CEN4 Wx: OneSixty palette, day (cream) and night (navy) */

:root {
  --paper: #eeedea;      /* OneSixty warm grey 100 */
  --sheet: #faf9f6;      /* OneSixty cream */
  --ink: #0c1829;        /* OneSixty navy */
  --ink-2: #4a4944;
  --ink-3: #6b6a66;
  --rule: #dddcd8;
  --rule-strong: #c4c3bf;
  --accent: #86692a;     /* OneSixty gold, deepened for contrast on cream */
  --accent-wash: rgba(201, 168, 76, 0.22);
  --blue: #152238;       /* OneSixty navy light */
  --runway: #152238;
  --runway-mark: #faf9f6;
  --ok: #2f7d4f;
  --warn: #b0561a;
  --bad: #b4372b;
  --bad-wash: #f6e1dc;
  --warn-wash: #f5e6d6;
  --vfr: #2f7d4f;
  --mvfr: #1f5c99;
  --ifr: #b4372b;
  --lifr: #a3226f;

  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --s-1: 0.8125rem;
  --s0: 1rem;
  --s1: 1.25rem;
  --s2: 1.5625rem;
  --s3: 1.953rem;
  --s4: 2.441rem;
  --s5: 3.815rem;
  --s6: 5.2rem;

  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0c1829;
    --sheet: #152238;
    --ink: #faf9f6;
    --ink-2: #c4c3bf;
    --ink-3: #8a8985;
    --rule: #23324a;
    --rule-strong: #34465f;
    --accent: #c9a84c;   /* OneSixty gold */
    --accent-wash: rgba(201, 168, 76, 0.2);
    --blue: #d4bf7a;     /* OneSixty gold light */
    --runway: #c4c3bf;
    --runway-mark: #152238;
    --ok: #63c38b;
    --warn: #e8955a;
    --bad: #f07466;
    --bad-wash: #3a1d1f;
    --warn-wash: #33261a;
    --vfr: #63c38b;
    --mvfr: #86b7e8;
    --ifr: #f07466;
    --lifr: #e466ad;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0c1829;
  --sheet: #152238;
  --ink: #faf9f6;
  --ink-2: #c4c3bf;
  --ink-3: #8a8985;
  --rule: #23324a;
  --rule-strong: #34465f;
  --accent: #c9a84c;   /* OneSixty gold */
  --accent-wash: rgba(201, 168, 76, 0.2);
  --blue: #d4bf7a;     /* OneSixty gold light */
  --runway: #c4c3bf;
  --runway-mark: #152238;
  --ok: #63c38b;
  --warn: #e8955a;
  --bad: #f07466;
  --bad-wash: #3a1d1f;
  --warn-wash: #33261a;
  --vfr: #63c38b;
  --mvfr: #86b7e8;
  --ifr: #f07466;
  --lifr: #e466ad;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--s0);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, dl, dd, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--blue); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 4px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ── Masthead ─────────────────────────────────────────── */

.masthead {
  max-width: 1180px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) var(--gutter) 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.masthead__id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.mark { width: 44px; height: 44px; color: var(--accent); flex: none; }
.ident {
  font-size: var(--s3);
  font-stretch: 72%;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.01em;
}
.aerodrome { color: var(--ink-2); font-size: var(--s-1); margin-top: 3px; }
.masthead__right { display: flex; align-items: center; gap: 16px; }
.masthead__time { text-align: right; }

/* LiveATC toggle */
.atc {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  background: var(--sheet);
  color: var(--ink-2);
  text-decoration: none;
  font-size: var(--s-1);
  line-height: 1.1;
  flex: none;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.atc:hover { border-color: var(--accent); color: var(--ink); }
.atc__icon { width: 24px; height: 24px; flex: none; }
.atc__wave { opacity: 0.35; transition: opacity 0.2s; }
.atc__text { display: flex; flex-direction: column; }
.atc__label { font-weight: 700; color: var(--ink); letter-spacing: 0.02em; }
.atc__state { color: var(--ink-3); }
.atc.is-on { background: var(--accent-wash); border-color: var(--accent); color: var(--accent); }
.atc.is-on .atc__state { color: var(--accent); font-weight: 650; }
.atc.is-on .atc__wave { opacity: 1; animation: atc-pulse 1.6s ease-in-out infinite; }
.atc.is-on .atc__wave--2 { animation-delay: 0.3s; }
@keyframes atc-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) {
  .atc.is-on .atc__wave { animation: none; }
}
.colophon__atc { margin-top: 8px; }
.clock {
  font-stretch: 80%;
  font-weight: 650;
  font-size: var(--s1);
  line-height: 1.1;
}
.clock__local { color: var(--ink-2); font-weight: 500; font-size: var(--s0); margin-left: 6px; }
.status {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 6px;
  font-size: var(--s-1);
  color: var(--ink-2);
}
.status__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.status[data-status="fresh"] .status__dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.status[data-status="stale"] .status__dot { background: var(--warn); }
.status[data-status="stale"] { color: var(--warn); }
.status[data-status="offline"] .status__dot,
.status[data-status="error"] .status__dot { background: var(--bad); }
.status[data-status="offline"],
.status[data-status="error"] { color: var(--bad); font-weight: 600; }

.banner {
  max-width: 1180px;
  margin: 0 auto 16px;
  padding: 0 var(--gutter);
}
.banner > p {
  padding: 12px 16px;
  border-radius: 10px;
  border-left: 4px solid var(--bad);
  background: var(--bad-wash);
  color: var(--ink);
  max-width: none;
}
.banner[data-level="stale"] > p { border-left-color: var(--warn); background: var(--warn-wash); }

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section-title {
  font-size: var(--s0);
  font-weight: 650;
  color: var(--ink-2);
  margin-bottom: 12px;
}

/* ── Hero: rose + wind ────────────────────────────────── */

.hero {
  background: var(--sheet);
  border-radius: 22px;
  border: 1px solid var(--rule);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 56px);
  padding: clamp(18px, 3.5vw, 44px);
  align-items: center;
}
.rose-wrap { width: 100%; max-width: 520px; justify-self: center; }
.rose { width: 100%; height: auto; display: block; overflow: visible; }

.rose .bezel { fill: none; stroke: var(--paper); stroke-width: 26; }
.rose .ring { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.rose .ring--inner { stroke: var(--rule-strong); stroke-width: 1; }
.rose .tick { stroke: var(--ink); stroke-width: 1; }
.rose .tick--10 { stroke-width: 1.4; }
.rose .tick--30 { stroke-width: 2.2; }
.rose .tick-label {
  fill: var(--ink);
  font-family: var(--font);
  font-stretch: 75%;
  font-weight: 700;
  font-size: 17px;
  text-anchor: middle;
  dominant-baseline: central;
}
.rose .tick-label--card { font-size: 21px; font-weight: 800; }
.rose .runway--paved { fill: var(--runway); }
.rose .runway--gravel { fill: none; stroke: var(--runway); stroke-width: 2; }
.rose .runway-cl { stroke: var(--runway-mark); stroke-width: 1.4; stroke-dasharray: 7 6; }
.rose .runway-end {
  fill: var(--ink-2);
  font-family: var(--font);
  font-stretch: 75%;
  font-weight: 700;
  font-size: 15px;
  text-anchor: middle;
  dominant-baseline: central;
}
.rose .is-favoured.runway--paved { fill: var(--accent); }
.rose .is-favoured.runway--gravel { stroke: var(--accent); stroke-width: 2.6; }
.rose .runway-end.is-favoured { fill: var(--accent); font-size: 18px; font-weight: 800; }
.rose .vary { fill: none; stroke: var(--accent-wash); stroke-width: 26; }
.rose .arrow {
  transform-box: view-box;
  transform-origin: 0 0;
  transition: transform 1.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s;
}
.rose .arrow__shaft { stroke: var(--accent); stroke-width: 10; }
.rose .arrow__head { fill: var(--accent); }
.rose .arrow__tail { fill: var(--sheet); stroke: var(--accent); stroke-width: 4; }
.rose .calm {
  fill: var(--ink-2);
  font-family: var(--font);
  font-size: 19px;
  font-weight: 600;
  text-anchor: middle;
}
@media (prefers-reduced-motion: reduce) {
  .rose .arrow { transition: none; }
}

.wind__now { display: flex; align-items: baseline; gap: 0.28em; flex-wrap: wrap; line-height: 0.9; }
.wind__dir, .wind__speed {
  font-size: clamp(3.4rem, 9vw, var(--s6));
  font-stretch: 68%;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.wind__speed { color: var(--accent); }
.wind__now .deg {
  display: inline-flex;
  align-items: flex-start;
  align-self: flex-start;
  font-size: 0.42em;
  font-weight: 600;
  line-height: 1;
  color: var(--ink-2);
  margin-top: 0.12em;
}
.wind__now .deg span { font-size: 0.62em; margin: 0.08em 0 0 1px; font-stretch: 85%; }
.wind__now .unit { font-size: 0.36em; font-weight: 600; margin-left: 0.15em; color: var(--ink-2); font-stretch: 85%; }
.wind__now.is-calm .deg,
.wind__now.is-calm .wind__speed { display: none; }
.wind__gust { font-size: var(--s1); font-weight: 600; margin-top: 10px; min-height: 1.5em; }
.wind__detail { color: var(--ink-2); margin-top: 4px; max-width: 46ch; }

.field-elev {
  margin-top: 22px;
  color: var(--ink-2);
  font-size: var(--s-1);
}
.field-elev strong { color: var(--ink); font-weight: 700; font-size: var(--s0); margin-left: 4px; }
.runways {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: var(--s0);
}
.runways th {
  text-align: left;
  font-weight: 500;
  font-size: var(--s-1);
  color: var(--ink-3);
  padding: 0 8px 6px 0;
  border-bottom: 1px solid var(--rule-strong);
}
.runways td {
  padding: 9px 8px 9px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: baseline;
}
.runways .rwy-id {
  font-stretch: 72%;
  font-weight: 800;
  font-size: var(--s2);
  line-height: 1;
  white-space: nowrap;
}
.runways .rwy-surface { font-size: var(--s-1); color: var(--ink-3); font-weight: 500; font-stretch: 100%; margin-left: 6px; }
.runways .tail { color: var(--warn); }
.runways .num { font-weight: 650; }
.runways tr.is-favoured td { background: var(--accent-wash); }
.runways tr.is-favoured td:first-child { box-shadow: inset 4px 0 0 var(--accent); padding-left: 12px; }
.runways tr.is-favoured .rwy-id { color: var(--accent); }
.runways td:first-child { padding-left: 4px; }
.footnote { color: var(--ink-3); font-size: var(--s-1); margin-top: 10px; }

/* ── Advisory band ────────────────────────────────────── */

.advisory {
  margin-top: 36px;
  padding: 16px 20px;
  border-radius: 14px;
  border: 1px solid var(--rule);
  border-left: 5px solid var(--blue);
  background: var(--sheet);
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 4px 20px;
}
.advisory__title { font-size: var(--s0); font-weight: 700; color: var(--blue); }
.advisory__text { max-width: 72ch; white-space: pre-line; }
.advisory__contact { grid-column: 2; color: var(--ink-2); font-size: var(--s-1); }

/* ── Sponsor ──────────────────────────────────────────── */

.sponsor { margin-top: 16px; }
.sponsor__link {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px;
  border-radius: 14px;
  border: 1px solid var(--rule);
  background: var(--sheet);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s;
}
.sponsor__link:hover { border-color: var(--accent); }
.sponsor__logo { width: 48px; height: 48px; flex: none; border-radius: 11px; }
.sponsor__body { display: flex; flex-direction: column; min-width: 0; }
.sponsor__label { font-size: var(--s-1); color: var(--ink-3); }
.sponsor__name {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  font-weight: 600;
  font-size: var(--s1);
  line-height: 1.25;
  color: var(--accent);
}
.sponsor__tagline {
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 2px;
}

/* ── Readouts ─────────────────────────────────────────── */

.readouts {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 16px;
}
.readout { padding: 18px 18px 20px; border-left: 1px solid var(--rule); min-width: 0; }
.readout:first-child { border-left: 0; }
.readout h3 { font-size: var(--s-1); font-weight: 500; color: var(--ink-2); }
.readout__value {
  font-size: var(--s4);
  font-stretch: 72%;
  font-weight: 700;
  line-height: 1.05;
  margin-top: 6px;
  white-space: nowrap;
}
.readout__value .unit { font-size: 0.42em; font-weight: 600; color: var(--ink-2); margin-left: 0.2em; font-stretch: 85%; }
.readout__sub { color: var(--ink-2); font-size: var(--s-1); margin-top: 6px; }
.readout__sub.is-warn { color: var(--warn); font-weight: 600; }

.is-stale .readout__value,
.is-stale .wind__now,
.is-stale .runways .num { color: var(--ink-3); }
.is-stale .wind__speed { color: var(--ink-3); }

/* ── Lower panels ─────────────────────────────────────── */

.lower {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 24px clamp(24px, 4vw, 56px);
  margin-top: 36px;
}
.lower__col { display: grid; gap: 36px; align-content: start; }
.panel { border-top: 2px solid var(--ink); padding-top: 14px; }

.trend + .trend { margin-top: 16px; }
.trend__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.trend__head h3 { font-size: var(--s0); font-weight: 600; }
.trend__head p { color: var(--ink-2); font-size: var(--s-1); }
.spark { width: 100%; height: 64px; display: block; margin-top: 6px; overflow: visible; }
.spark .area { fill: var(--accent-wash); }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark .line--temp { stroke: var(--blue); }
.spark .area--temp { fill: color-mix(in srgb, var(--blue) 14%, transparent); }
.spark .base { stroke: var(--rule); stroke-width: 1; vector-effect: non-scaling-stroke; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; }
.facts dt { color: var(--ink-2); }
.facts dd { font-weight: 600; text-align: right; }
.facts dd small { font-weight: 400; color: var(--ink-2); font-size: var(--s-1); }

.daybar {
  position: relative;
  height: 10px;
  border-radius: 5px;
  background: var(--rule);
  margin: 4px 0 16px;
}
.daybar span { position: absolute; top: 0; bottom: 0; border-radius: 5px; }
.daybar__twilight { background: color-mix(in srgb, var(--blue) 35%, var(--rule)); }
.daybar__day { background: color-mix(in srgb, var(--warn) 55%, var(--sheet)); }
.daybar .daybar__now { width: 3px; top: -5px; bottom: -5px; background: var(--ink); border-radius: 2px; }

.cam {
  display: block;
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--rule);
}
.cam img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam img:not([src]) { visibility: hidden; }
.cam__empty {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--ink-2); font-size: var(--s-1);
  text-align: center; padding: 16px;
}

.metar + .metar { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--rule); }
.metar__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.metar__name { font-weight: 650; }
.metar__name small { font-weight: 400; color: var(--ink-2); margin-left: 6px; }
.metar__time { color: var(--ink-2); font-size: var(--s-1); }
.cat {
  display: inline-block;
  font-size: var(--s-1);
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 1px 8px;
  border-radius: 999px;
  color: var(--sheet);
  margin-right: 8px;
  vertical-align: 1px;
}
.cat--VFR { background: var(--vfr); }
.cat--MVFR { background: var(--mvfr); }
.cat--IFR { background: var(--ifr); }
.cat--LIFR { background: var(--lifr); }
.coded {
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1.55;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  overflow-wrap: anywhere;
}
.coded__label { font-family: var(--font); font-size: var(--s-1); color: var(--ink-2); margin-top: 14px; }
.coded--taf span { display: block; }
.coded--taf span + span { padding-left: 2ch; }

/* ── Footer ───────────────────────────────────────────── */

.colophon {
  max-width: 1180px;
  margin: 28px auto 0;
  padding: 24px var(--gutter) calc(env(safe-area-inset-bottom) + 36px);
  color: var(--ink-2);
  font-size: var(--s-1);
}
.colophon__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--rule-strong); }
.colophon h2 { font-size: var(--s-1); font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.colophon li + li { margin-top: 4px; }
.colophon li, .advisory__contact { overflow-wrap: anywhere; }
.colophon li strong { color: var(--ink); font-weight: 650; font-size: var(--s0); font-stretch: 85%; }
.colophon__station { margin-top: 16px; }
.colophon__legal { margin-top: 4px; }

/* ── Responsive ───────────────────────────────────────── */

@media (max-width: 1020px) {
  .readouts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .readout:nth-child(4) { border-left: 0; }
  .readout:nth-child(n + 4) { border-top: 1px solid var(--rule); }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .rose-wrap { max-width: 440px; }
  .lower { grid-template-columns: 1fr; gap: 36px; }
  .lower__col:last-child { order: -1; }
}

@media (max-width: 600px) {
  .masthead { align-items: flex-start; }
  .masthead__right { gap: 10px; }
  .atc { width: 44px; padding: 0; justify-content: center; }
  .atc__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .mark { width: 36px; height: 36px; }
  .ident { font-size: var(--s2); }
  .clock { font-size: var(--s0); }
  .clock__local { display: block; margin: 2px 0 0; font-size: var(--s-1); }
  .hero { border-radius: 18px; padding: 14px 16px 20px; }
  .readouts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readout { padding: 14px 14px 16px; }
  .readout:nth-child(odd) { border-left: 0; }
  .readout:nth-child(4) { border-left: 1px solid var(--rule); }
  .readout:nth-child(n + 3) { border-top: 1px solid var(--rule); }
  .readout__value { font-size: var(--s3); }
  .advisory { grid-template-columns: 1fr; padding: 14px 16px; }
  .advisory__contact { grid-column: 1; }
  .colophon__grid { grid-template-columns: 1fr; gap: 16px; }
}
