/* Stormy Fans · site stylesheet
   Direction F, "Swiss Bulletin with weather icons". Tokens and rules follow
   docs/design-spec-v1.md section 3. Layout is mobile first: the base rules are
   the phone layout (board G), and the media queries widen it to desktop (board F). */

/* ---------------------------------------------------------------- tokens */

:root {
  --paper: #F7F6F2;
  --ink: #121212;
  --muted: #555550;        /* 6.9:1 on paper */
  --hairline: #D8D6CF;
  --red: #D52B1E;          /* 4.6:1 on paper; white on red 5.0:1 */
  --warn-1: #A6D07A;       /* levels 1, 4, and 5 are provisional (spec 12.1) */
  --warn-2: #F2D22E;
  --warn-3: #F29A2E;
  --warn-4: #D52B1E;
  --warn-5: #8B0D0D;

  --sans: "Hanken Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --gutter: 20px;
  --gap: 28px;
}

/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  border-top: 6px solid var(--red);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--red); }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

p, h1, h2, h3, ul, ol, dl, dd, pre { margin: 0; }
ul, ol { padding: 0; list-style: none; }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.icon { flex-shrink: 0; display: block; }

.vh {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip { position: absolute; left: -9999px; top: 12px; z-index: 10; padding: 10px 14px; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 13px; }
.skip:focus { left: 12px; }

/* Section heads in forecast discussion style: ".CURRENT CONDITIONS..." */
.sh {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.sh::before { content: "."; }
.sh::after { content: "..."; }
.sh-note { font-weight: 700; }

/* ---------------------------------------------------------------- frame */

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--gutter) 32px;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

main { display: flex; flex-direction: column; gap: var(--gap); }

.product {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
  font-size: 10.5px;
  letter-spacing: .05em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.product-issued, .product-page { display: none; }

.masthead { display: flex; flex-direction: column; gap: 12px; margin-bottom: -12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand .logo { width: 46px; height: 46px; }
.wordmark { font-size: 38px; line-height: .95; font-weight: 700; letter-spacing: -.045em; }
.tagline { font-size: 11.5px; line-height: 1.5; font-weight: 500; letter-spacing: .02em; text-transform: uppercase; max-width: 22em; text-wrap: balance; }

.nav {
  display: flex;
  gap: 22px;
  margin: 0 calc(var(--gutter) * -1);
  padding: 0 var(--gutter);
  overflow-x: auto;
  white-space: nowrap;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--hairline);
  scrollbar-width: none;
}
.nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  flex-shrink: 0;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.nav a[aria-current="page"] { color: var(--red); font-weight: 700; border-bottom: 2px solid var(--red); margin-bottom: -1px; }

.foot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 14px;
  border-top: 2px solid var(--ink);
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ----------------------------------------------------- current conditions */

.conditions { display: grid; gap: var(--gap); }
.now { display: flex; flex-direction: column; gap: 10px; }
.now-figure { display: flex; align-items: center; gap: 16px; }
.numeral {
  font-size: 150px;
  line-height: .8;
  font-weight: 300;
  letter-spacing: -.06em;
  margin-left: -6px;
  font-variant-numeric: tabular-nums;
}
.now-icon { width: 96px; height: 96px; }
.label { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.summary { font-size: 19px; line-height: 1.35; font-weight: 500; }

.observations dl { margin-top: 10px; border-top: 2px solid var(--ink); }
.observations dl > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--hairline);
}
.observations dt { font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.observations dd { font-size: 24px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.observations small { font-size: 14px; font-weight: 500; letter-spacing: 0; }

.warnings ul { margin-top: 14px; }
.warnings li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--hairline); }
.warnings li:first-child { border-top: 2px solid var(--ink); }
.warnings li p:last-child { font-size: 14.5px; line-height: 1.4; }
.level {
  width: 36px; height: 36px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: var(--ink);
}
.level-1 { background: var(--warn-1); }
.level-2 { background: var(--warn-2); }
.level-3 { background: var(--warn-3); }
.level-4 { background: var(--warn-4); color: #FFFFFF; }
.level-5 { background: var(--warn-5); color: #FFFFFF; }
.warn-title { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

/* ------------------------------------------------------------- coded lines */

code, pre { font-family: var(--mono); }
.metar { display: block; font-size: 11px; line-height: 1.55; color: var(--muted); overflow-wrap: anywhere; }

.metar-strip { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.metar-strip .metar { font-size: 13px; font-weight: 500; color: var(--ink); letter-spacing: .01em; }

/* ---------------------------------------------------------- precipitation */

.precip { display: flex; flex-direction: column; gap: 12px; }
.bars { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.bars li { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bars .area { height: 80px; width: 100%; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--ink); }
.bars .bar { width: 10px; height: var(--h); background: var(--ink); }
.bars .day { color: var(--muted); }
.bars .d-long { display: none; }
.bars .today .count, .bars .today .day { color: var(--red); font-weight: 700; }
.bars .today .bar { background: var(--red); }

/* ---------------------------------------------------------------- systems */

.systems > h2 { padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.sys-head { display: none; }

.sys {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "status date" "name name" "forecast forecast";
  gap: 8px 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--hairline);
  scroll-margin-top: 16px;
}
.sys-status { grid-area: status; display: flex; align-items: center; gap: 10px; }
.sys-status .icon { width: 36px; height: 36px; }
.sys-codes { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-name { font-size: 13px; color: var(--muted); }
.sys-name { grid-area: name; display: flex; flex-direction: column; gap: 4px; }
.sys-name h3 { font-size: 19px; line-height: 1.25; font-weight: 700; }
.sys-name h3 a { text-decoration: none; }
.sys-name h3 a:hover { text-decoration: underline; }
.sys-name p { font-size: 14px; line-height: 1.4; }
.sys-forecast { grid-area: forecast; display: flex; flex-direction: column; gap: 8px; font-size: 15px; line-height: 1.5; }
.sys-date { grid-area: date; align-self: center; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sys-name .flag { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

.chip {
  display: inline-block;
  padding: 2px 7px;
  border: 1.5px solid var(--ink);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.chip-solid { background: var(--ink); color: var(--paper); }
.chip-alert { background: var(--red); border-color: var(--red); color: #FFFFFF; }
.chip-dashed { border-style: dashed; }

/* Key to codes */
.key { border-top: 2px solid var(--ink); border-bottom: 1px solid var(--hairline); margin-top: 28px; }
.key summary { min-height: 52px; display: flex; align-items: center; cursor: pointer; list-style: none; }
.key summary::-webkit-details-marker { display: none; }
.key summary::after { content: "... ▸"; }
.key[open] summary::after { content: "... ▾"; }
.key-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 24px; padding: 4px 0 18px; font-size: 12px; color: var(--muted); }
.key-grid li { display: flex; align-items: flex-start; gap: 10px; }
.key-grid .icon { width: 26px; height: 26px; }
.key-grid li > span { display: flex; flex-direction: column; gap: 2px; }
.key-code { color: var(--ink); }
.key-meaning { font-family: var(--sans); font-size: 14px; }

/* ------------------------------------------------------ lower three columns */

.lower { display: grid; gap: var(--gap); }
.lower > section { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; border-top: 2px solid var(--ink); }

.discussion p { font-size: 15px; line-height: 1.6; }
.discussion .lead { font-size: 11.5px; font-weight: 700; }
.discussion .sep { font-size: 11.5px; color: var(--muted); }
.aviation { display: flex; flex-direction: column; gap: 6px; }
.taf { font-size: 11px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.signoff { font-size: 11.5px; font-weight: 700; }

.tiers li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
}
.tier, .free { font-size: 12px; font-weight: 700; text-transform: uppercase; }
.tiers .muted { grid-column: 1 / -1; font-size: 14px; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 16px;
  border: 1.5px solid var(--ink);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: center;
}
.btn:hover { color: var(--red); border-color: var(--red); }
.btn-solid { background: var(--ink); color: var(--paper); }
.btn-solid:hover { background: var(--red); border-color: var(--red); color: #FFFFFF; }

.cleared li { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--hairline); scroll-margin-top: 16px; }
.cleared-head { display: flex; align-items: center; gap: 10px; }
.cleared-head h3 { flex-grow: 1; font-size: 16px; font-weight: 700; }
.cleared-head h3 a { text-decoration: none; }
.cleared-head time { font-size: 11.5px; color: var(--muted); }
.cleared p { font-size: 14px; line-height: 1.45; }

/* ------------------------------------------------------------------- 404 */

.lost { padding: 24px 0 48px; gap: 16px; }
.lost-code { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.lost-title { font-size: clamp(44px, 9vw, 96px); line-height: .95; font-weight: 700; letter-spacing: -.045em; }
.lost .btn { display: inline-flex; }

/* ---------------------------------------------------------- tablet and up */

@media (min-width: 700px) {
  :root { --gutter: 40px; --gap: 36px; }
  body { border-top-width: 8px; }
  .product { font-size: 12.5px; padding-top: 28px; }
  .product-issued, .product-page { display: inline; }
  .masthead { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 0; }
  .brand { gap: 20px; }
  .brand .logo { width: 88px; height: 88px; }
  .wordmark { font-size: clamp(64px, 8.4vw, 108px); line-height: .88; letter-spacing: -.05em; }
  .tagline { font-size: 14px; max-width: 16em; }
  .nav { gap: 28px; margin: 0; padding: 0; overflow: visible; }
  .nav a { min-height: 48px; font-size: 13px; }
  .sh { font-size: 13px; }

  .conditions { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
  .warnings { grid-column: 1 / -1; }
  .numeral { font-size: 200px; margin-left: -8px; }
  .now-icon { width: 128px; height: 128px; }
  .summary { font-size: 21px; }
  .observations dd { font-size: 30px; }
  .observations small { font-size: 16px; }

  .metar-strip { flex-direction: row; align-items: baseline; gap: 24px; padding: 14px 0; }
  .metar-strip h2 { flex-shrink: 0; }
  .metar-strip .metar { font-size: 15px; }

  .bars { font-size: 12.5px; }
  .bars .area { height: 112px; }
  .bars .bar { width: 18px; }
  .bars .d-long { display: inline; }
  .bars .d-short { display: none; }

  .lower { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 40px; }
  .foot { flex-direction: row; justify-content: space-between; gap: 24px; font-size: 12.5px; }
}

/* ----------------------------------------------------------------- desktop */

@media (min-width: 1100px) {
  :root { --gutter: 64px; }
  .brand .logo { width: 116px; height: 116px; }

  .conditions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .warnings { grid-column: auto; }

  .sys-head, .sys {
    grid-template-columns: minmax(0, 2.1fr) minmax(0, 3fr) minmax(0, 4.4fr) 64px;
    grid-template-areas: "status name forecast date";
    column-gap: 24px;
  }
  .sys-head {
    display: grid;
    padding: 10px 0;
    border-bottom: 2px solid var(--ink);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
  }
  .sys-head span:last-child { text-align: right; }
  .systems > h2 { padding-bottom: 14px; border-bottom: 0; }
  .sys { padding: 18px 0; align-items: start; }
  .sys-status { align-items: center; }
  .sys-status .icon { width: 40px; height: 40px; }
  .sys-codes { flex-direction: column; align-items: flex-start; gap: 5px; }
  .sys-name h3 { font-size: 18px; }
  .sys-name p { font-size: 14.5px; }
  .sys-forecast { font-size: 15.5px; }
  .metar { font-size: 12px; }
  .sys-date { align-self: start; text-align: right; font-size: 13px; }

  .lower { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
