@font-face {
  font-family: "Syllabics";
  src: url("/fonts/syllabics-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

/* Brand (see /brand/README.md): navy #122A3F, white, wind blue #8CB4CD.
   Flat like the logo: a solid navy page, solid panels, no glass or gradients.
   Wind blue is the accent; amber and red only appear when something's wrong. */
:root {
  --navy: #122A3F;
  --sky-a: #122A3F; /* the phone's status bar colour */
  --panel: #183650;
  --panel-2: #1E405D;
  --wind: #8CB4CD;
  --card: var(--panel);
  --card-line: var(--panel);
  --soft: #A9C2D3;
  --faint: #2A4C69;
  --hot: #ffb340;
  --danger: #ff6b5e;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { background: #122A3F; }
body {
  margin: 0;
  min-height: 100vh;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  background: var(--navy);
}

a { color: inherit; }
button { font: inherit; color: inherit; }

.sky, #snow, .veil { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.veil { background: #8CB4CD; opacity: 0; transition: opacity 2s; }

.app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 40px) 16px calc(env(safe-area-inset-bottom) + 32px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

/* ---------- brand bar ---------- */

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: -16px 0 4px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
/* A hairline outline so the navy mark still reads against the navy night sky. */
.brand img, .foot-mark { box-shadow: 0 0 0 1px rgba(140, 180, 205, 0.45); }
.brand img { width: 30px; height: 30px; border-radius: 7px; display: block; }
.foot-mark { display: block; margin: 0 auto 14px; border-radius: 8px; }

/* ---------- top ---------- */

.top { text-align: center; padding: 8px 0 20px; }
.top p { margin: 0; }
.place { font-size: 30px; font-weight: 500; letter-spacing: -0.01em; }
.syl { font-family: "Syllabics", "Euphemia UCAS", "Noto Sans Canadian Aboriginal", sans-serif; font-weight: 600; font-size: 0.6em; opacity: 0.75; margin-left: 4px; vertical-align: 0.15em; }
.top .temp { font-size: 96px; font-weight: 200; line-height: 1; letter-spacing: -0.04em; margin: 4px 0 4px 0.12em; }
.cond { font-size: 20px; font-weight: 500; }
.feels { font-size: 17px; color: var(--soft); }

/* ---------- cards ---------- */

.card {
  background: var(--panel);
  border-radius: 12px;
  padding: 16px;
}
.col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; }
.app { animation: appear 0.5s ease-out backwards; }
@keyframes appear { from { opacity: 0; } }

h2 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--wind);
}
.hint { margin: 6px 0 0; font-size: 14px; color: var(--soft); }

/* ---------- status ---------- */

.status h1 { margin: 0 0 4px; font-size: 26px; font-weight: 700; line-height: 1.15; letter-spacing: -0.015em; }
.status p { margin: 0; color: var(--soft); }
.status .when:not(:empty) { margin-top: 10px; color: #fff; font-weight: 500; }
/* The card itself warms up as the risk goes up. */
body[data-level="3"] .status { box-shadow: inset 0 0 0 2px var(--hot); }
body[data-level="4"] .status { background: #4A2A35; box-shadow: inset 0 0 0 2px var(--danger); }

/* ---------- alerts ---------- */

#alerts { display: grid; gap: 12px; }
#alerts:empty { display: none; }
.sign {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--hot); color: #2b1a00;
  font-size: 19px; font-weight: 800; font-style: normal; line-height: 1;
}
.alert.red .sign { background: var(--danger); color: #fff; }
.alert .toggle > .sign { flex: none; }
.alert .toggle > span { flex: 1; min-width: 0; }
.alert b { display: block; font-size: 17px; }
.alert .hint { margin-top: 2px; }

/* ---------- announcement (posted from the admin app) ---------- */

.notice { display: flex; gap: 12px; align-items: flex-start; box-shadow: inset 0 0 0 2px var(--wind); }
.notice[hidden] { display: none; }
.notice p { margin: 0; }
#notice-text { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
#notice-when:empty { display: none; }
#notice-when { margin-top: 2px; }
.notice-icon {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--wind);
  display: grid; place-items: center;
}
.notice-icon::before { content: "i"; font-size: 19px; font-weight: 800; line-height: 1; color: var(--navy); }
.notice.warning { box-shadow: inset 0 0 0 2px var(--hot); }
.notice.warning .notice-icon { background: var(--hot); }
.notice.warning .notice-icon::before { content: "!"; color: #2b1a00; }

/* ---------- smooth expanders (alerts and forecast days) ---------- */

.toggle { display: flex; width: 100%; align-items: center; gap: 12px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.toggle > :first-child { flex: 1; min-width: 0; }
.chev { width: 9px; height: 9px; border-right: 2px solid var(--soft); border-bottom: 2px solid var(--soft); transform: rotate(45deg) translate(-2px, -2px); transition: transform 0.35s var(--ease); flex: none; }
.open .chev { transform: rotate(225deg) translate(-2px, -2px); }
.more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.4s var(--ease); }
.open .more { grid-template-rows: 1fr; }
.more > div { overflow: hidden; }
.more p { margin: 10px 0 2px; color: var(--soft); font-size: 15px; white-space: pre-line; }

/* ---------- blizzard check ---------- */

.check + .check { margin-top: 16px; }
.check .row { display: flex; align-items: baseline; gap: 8px; }
.check .row span:first-child { flex: 1; font-weight: 500; }
.check .val { font-size: 17px; font-variant-numeric: tabular-nums; }
.tick { width: 20px; height: 20px; align-self: center; flex: none; fill: none; stroke: var(--soft); stroke-width: 1.6; }
.tick path { stroke: #2b1a00; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.check.met .tick circle { fill: var(--hot); stroke: var(--hot); }
.check.met .tick path { opacity: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.track { position: relative; height: 8px; margin-top: 8px; border-radius: 99px; background: var(--faint); }
.track .fill { height: 100%; width: 0; border-radius: inherit; background: var(--wind); transition: width 1.1s var(--ease), background-color 0.4s; }
.check.met .fill { background: var(--hot); }
.notch { position: absolute; top: -4px; bottom: -4px; width: 2px; border-radius: 2px; background: #fff; opacity: 0.85; }

/* ---------- blizzard chance ---------- */

.seg {
  --i: 1;
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 3px;
  border-radius: 10px;
  background: var(--navy);
}
.seg .thumb {
  position: absolute;
  top: 3px; bottom: 3px; left: 3px;
  width: calc((100% - 6px) / 3);
  border-radius: 8px;
  background: var(--wind);
  transform: translateX(calc(var(--i) * 100%));
  transition: transform 0.35s var(--ease);
}
.seg button {
  position: relative;
  padding: 6px 0;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--soft);
  cursor: pointer;
  transition: color 0.2s;
}
.seg button[aria-pressed="true"] { color: var(--navy); }
.seg button:active { transform: none; }

.chance-main { display: flex; align-items: center; gap: 16px; margin: 14px 0 12px; }
.chance-main p { margin: 0; }
.pct { font-size: 56px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; min-width: 2.4em; }
.word { font-size: 20px; font-weight: 700; }

/* Hour-by-hour chance: lit inside the chosen range, faded outside it. */
.odds { position: relative; margin-top: 4px; padding-top: 18px; }
.odds-range {
  position: absolute;
  left: -4px; top: 0; height: 78px;
  width: calc(var(--range, 0.5) * (100% + 4px) + 4px);
  border-radius: 10px;
  background: var(--panel-2);
  transition: width 0.45s var(--ease);
  pointer-events: none;
}
.odds-range span { position: absolute; right: 8px; top: 3px; font-size: 11px; font-weight: 600; color: var(--soft); white-space: nowrap; }
.odds-bars { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 56px; border-bottom: 1px solid var(--faint); cursor: pointer; }
.odds-bars i {
  flex: 1;
  min-width: 0;
  border-radius: 2px 2px 0 0;
  background: var(--wind);
  opacity: 0.3;
  transition: opacity 0.35s var(--ease), height 0.6s var(--ease), background-color 0.3s;
}
.odds-bars i.in { opacity: 1; }
.odds-bars i.warm { background: var(--hot); }
.odds-bars i.hot { background: var(--danger); }
.odds-bars i.on { outline: 2px solid #fff; outline-offset: 1px; }
.odds-days { position: relative; height: 18px; font-size: 11px; font-weight: 600; color: var(--soft); }
.odds-days span { position: absolute; top: 3px; }
.odds-info { margin-top: 2px; min-height: 2.8em; }

.why { list-style: none; margin: 6px 0 0; padding: 0; }
.why li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--faint); font-size: 15px; }
.why .tick { margin-top: 1px; align-self: flex-start; }
.why .yes .tick circle { fill: var(--hot); stroke: var(--hot); }
.why .yes .tick .ck { opacity: 1; }
.why .some .tick .dash { opacity: 1; stroke: #fff; }

.how { margin-top: 2px; padding-top: 10px; border-top: 1px solid var(--faint); }
.how .toggle span { font-size: 14px; font-weight: 500; color: var(--soft); }
.how .more p { font-size: 14px; }

/* ---------- hourly ---------- */

.hours-head { display: flex; align-items: center; gap: 12px; }
.hours-head > :first-child { flex: none; }
.hour-info { flex: 1; min-width: 0; text-align: right; font-weight: 500; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: none; gap: 6px; }
.nav button {
  width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%;
  background: var(--faint); font-size: 18px; line-height: 1; cursor: pointer;
}
.nav button:hover { background: var(--wind); color: var(--navy); }

.hours {
  display: flex;
  scroll-behavior: smooth;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  /* Snap to the card's inner padding, not its outer edge, so "Now" never sits against the side. */
  scroll-padding-inline: 16px;
  margin: 0 -16px;
  padding: 0 16px 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.hours::-webkit-scrollbar { display: none; }
/* Hours fade out at the card edges instead of being cut off. */
.hours { -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 24px), transparent); }
.hr {
  flex: none;
  width: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  scroll-snap-align: start;
  font-variant-numeric: tabular-nums;
  padding: 4px 0 6px;
  border-radius: 14px;
  cursor: pointer;
  transition: background-color 0.2s;
}
.hr.on { background: var(--panel-2); }
.hr .d { font-size: 11px; font-weight: 700; color: var(--soft); height: 14px; letter-spacing: 0.02em; }
.hr .t { font-size: 13px; font-weight: 500; }
.hr .bar { position: relative; width: 8px; height: 90px; border-radius: 99px; background: var(--faint); overflow: hidden; }
.hr .bar i { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 99px; background: var(--wind); transform-origin: bottom; animation: grow 0.9s var(--ease) both; transition: height 0.6s var(--ease); }
.hours.settled .bar i { animation: none; }
.hr.hot .bar i { background: var(--hot); }
.hr .w { font-size: 15px; font-weight: 700; }
.hr .g { font-size: 12px; color: var(--soft); height: 16px; }
@keyframes grow { from { transform: scaleY(0); } }

.windows { list-style: none; margin: 12px 0 0; padding: 0; }
.windows:empty { display: none; }
.windows li { padding-top: 12px; border-top: 1px solid var(--faint); font-size: 15px; }
.windows li + li { margin-top: 12px; }
.windows b { display: block; }
.windows span { color: var(--soft); }

/* ---------- tiles ---------- */

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tiles > :last-child { grid-column: 1 / -1; }
.tile .big { margin: 0; font-size: 30px; font-weight: 500; letter-spacing: -0.02em; }
.tile .big small { font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--soft); }
.compass { float: right; width: 34px; height: 34px; margin-top: 2px; border-radius: 50%; background: var(--faint); display: grid; place-items: center; }
.compass svg { width: 22px; height: 22px; transition: transform 1.2s var(--ease); }

/* ---------- forecast days ---------- */

.day + .day { border-top: 1px solid var(--faint); }
.day { padding: 12px 0; }
.day:first-child { padding-top: 2px; }
.day:last-child { padding-bottom: 0; }
.day .toggle > :first-child { font-weight: 500; }
.day .temp-s { font-variant-numeric: tabular-nums; font-weight: 500; }
.day .temp-s small { color: var(--soft); font-weight: 400; margin-right: 4px; font-size: 13px; }

/* ---------- footer ---------- */

footer { padding: 16px 8px 0; text-align: center; font-size: 13px; color: var(--soft); }
footer p { margin: 8px 0 0; }
footer button {
  padding: 8px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--panel);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

/* ---------- reports from town ---------- */

.rep-none { margin: 0; }
.rep-head { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.rep-sub { margin-top: 2px; }
.rep-trend { margin: 10px 0 0; font-size: 15px; font-weight: 500; }
.rep-trend.worse { color: var(--hot); }
#reports-card h3 { margin: 18px 0 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.02em; color: var(--soft); }
.rep-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.rep-bars li { display: grid; grid-template-columns: 8.2em minmax(0, 1fr) 1.6em; align-items: center; gap: 10px; font-size: 14px; color: var(--soft); }
.rep-bars i { display: block; height: 8px; border-radius: 99px; background: var(--faint); overflow: hidden; }
.rep-bars i b { display: block; height: 100%; border-radius: inherit; background: var(--wind); transition: width 0.6s var(--ease); }
.rep-bars em { font-style: normal; text-align: right; font-variant-numeric: tabular-nums; }
.rep-bars li.lead { color: #fff; font-weight: 600; }
.rep-facts { list-style: none; margin: 14px 0 0; padding: 0; }
.rep-facts li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 9px 0; border-top: 1px solid var(--faint); font-size: 15px; }
.rep-facts span { flex: none; color: var(--soft); }
.rep-facts b { font-weight: 600; text-align: right; }
.reports { list-style: none; margin: 0; padding: 0; }
.reports li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--faint); font-size: 15px; }
.reports b { display: block; }
.reports span { color: var(--soft); }
.reports time { flex: none; font-size: 13px; color: var(--soft); }
.rep-all .toggle { padding: 12px 0; border-top: 1px solid var(--faint); font-size: 15px; font-weight: 600; color: var(--wind); }
.rep-note { margin-top: 12px; }

/* ---------- plain text pages (privacy) ---------- */

.doc-head { padding: 8px 4px 8px; }
.doc-head h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.015em; }
.doc .card p { margin: 0; line-height: 1.5; }
.doc .card a { color: var(--wind); }

kbd { font: inherit; font-size: 12px; padding: 1px 6px; border-radius: 6px; background: var(--faint); }
.keys { display: none; }

button { transition: transform 0.2s var(--ease); }

/* ---------- mouse and trackpad niceties ---------- */

@media (hover: hover) and (pointer: fine) {
  .card { transition: background-color 0.3s; }
  .card:hover { background: var(--panel-2); }
  footer button:hover { background: var(--wind); color: var(--navy); }
  .nav { display: flex; }
  .keys { display: block; }
  .hr:hover { background: var(--panel-2); }
  .toggle:hover .chev { border-color: #fff; }
}

/* ---------- desktop: two columns, now on the left, ahead on the right ---------- */

@media (min-width: 1000px) {
  .app {
    max-width: 1180px;
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 20px;
    padding: 56px 32px 40px;
    align-items: start;
  }
  .col { gap: 16px; }
  footer { grid-column: 1 / -1; }
  .notice { grid-column: 1 / -1; }
  .brand { grid-column: 1 / -1; justify-content: flex-start; margin: -24px 0 8px 4px; font-size: 16px; }
  .brand img { width: 34px; height: 34px; border-radius: 8px; }

  .top { text-align: left; padding: 0 4px 12px; }
  .top .temp { font-size: 128px; margin: 0 0 6px -0.04em; }
  .place { font-size: 34px; }

  .card { padding: 20px; border-radius: 14px; }
  .hours { margin: 0 -20px; padding: 0 20px 4px; scroll-padding-inline: 20px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 40px), transparent); }
  .hr { width: 52px; }
  .hr .bar { height: 130px; width: 10px; }

  .tiles { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .tiles > :last-child { grid-column: auto; }

  /* Room to show every forecast day at once, so no tapping needed. */
  .days { display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; }
  .day, .day:first-child, .day:last-child { padding: 14px 0; }
  .day + .day { border-top: 0; }
  .day:nth-child(n + 3) { border-top: 1px solid var(--faint); }
  .day .toggle { pointer-events: none; }
  .day .chev { display: none; }
  .day .more { grid-template-rows: 1fr; }
  .day .more p { margin-top: 6px; }

  /* Text pages stay one readable column on wide screens. */
  .app.doc { max-width: 680px; grid-template-columns: minmax(0, 1fr); }
  .doc .brand { justify-content: center; margin-left: 0; }
}
button:active { transform: scale(0.97); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
