@font-face {
  font-family: 'Bricolage';
  src: url('../fonts/bricolage-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Bricolage';
  src: url('../fonts/bricolage-800.woff2') format('woff2');
  font-weight: 800; font-style: normal; font-display: swap;
}

:root {
  --display: 'Bricolage', system-ui, sans-serif;
  /* Sky (weather-reactive) */
  --sky-a: #2f7fd4;
  --sky-b: #9fd0f4;
  --sky-ink: #ffffff;
  --sky-ink-2: rgba(255,255,255,0.78);
  --sky-chip: rgba(255,255,255,0.16);
  --sky-line: rgba(255,255,255,0.28);
  /* Ground (day/night surface) */
  --surface: #eef1f5;
  --card: #ffffff;
  --ink: #17222e;
  --ink-2: rgba(23,34,46,0.6);
  --line: rgba(23,34,46,0.1);
  --accent: #0d6fc2;
  --accent-soft: rgba(13,111,194,0.12);
  --on-accent: #ffffff;
  --danger: #c0392b;
  --nav-bg: rgba(255,255,255,0.88);
  --shadow: 0 8px 28px rgba(23,34,46,0.1);
  --skel-a: rgba(23,34,46,0.07);
  --skel-b: rgba(23,34,46,0.16);
  --transition: all 0.3s ease;
}

[data-weather="cloudy"] { --sky-a: #5e7288; --sky-b: #a7b5c3; }
[data-weather="rain"]   { --sky-a: #414f63; --sky-b: #7b8ea3; }
[data-weather="snow"]   { --sky-a: #5d7ea8; --sky-b: #c6d6e6; }
[data-weather="night"]  { --sky-a: #0d1530; --sky-b: #31436b; }

[data-phase="night"] {
  --surface: #0f141f;
  --card: #182031;
  --ink: #e9eef6;
  --ink-2: rgba(233,238,246,0.62);
  --line: rgba(233,238,246,0.1);
  --accent: #7fb8ef;
  --accent-soft: rgba(127,184,239,0.16);
  --on-accent: #0f141f;
  --danger: #ff9d92;
  --nav-bg: rgba(20,27,42,0.88);
  --shadow: 0 8px 28px rgba(0,0,0,0.4);
  --skel-a: rgba(233,238,246,0.07);
  --skel-b: rgba(233,238,246,0.15);
}

* { box-sizing: border-box; }
img.wx { width: 1.4em; height: 1.4em; vertical-align: middle; }
html { background: var(--sky-a); }
body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--surface);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.4s ease;
}
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container { max-width: 480px; margin: 0 auto; padding: 0 1.1rem; }

/* ===== Sky zone ===== */
.sky {
  background: linear-gradient(170deg, var(--sky-a) 20%, var(--sky-b) 140%);
  color: var(--sky-ink);
  padding-top: calc(env(safe-area-inset-top) + 0.5rem);
  padding-bottom: 2.8rem;
  transition: background 0.5s ease;
}
.top-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.6rem; padding: 0.5rem 0 1.5rem; }
.loc-block { cursor: pointer; min-width: 0; }
.location {
  font-family: var(--display); font-weight: 600;
  font-size: 1.35rem; line-height: 1.15;
  display: flex; align-items: center; gap: 0.35rem;
}
.location .caret { font-size: 0.65em; opacity: 0.7; }
.updated { font-size: 0.76rem; color: var(--sky-ink-2); margin-top: 0.2rem; }
.updated.stale { color: #ffd28a; }
.nearest-for { font-size: 0.76rem; color: var(--sky-ink-2); margin-top: 0.15rem; font-style: italic; display: none; }
.nearest-for.show { display: block; }
.nearest-for .nf-typed { font-weight: 600; color: var(--sky-ink); font-style: normal; }
.top-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.top-actions button {
  background: var(--sky-chip);
  border: 1px solid var(--sky-line);
  color: var(--sky-ink); font-size: 0.85rem; font-weight: 600;
  padding: 0.42rem 0.7rem; border-radius: 999px; cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.top-actions button:hover { background: rgba(255,255,255,0.28); }
.top-actions button:active { transform: scale(0.94); }
#install-btn { display: none; }
#refresh-btn.loading i { animation: ptr-spin 0.9s linear infinite; }

.hero { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.hero-main { min-width: 0; }
.current-temp {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(4.4rem, 21vw, 5.6rem);
  line-height: 0.95; letter-spacing: -0.03em;
}
.current-condition { font-size: 1.1rem; font-weight: 600; margin-top: 0.4rem; }
.feels-like { font-size: 0.88rem; color: var(--sky-ink-2); margin-top: 0.2rem; }
.hero-meta { font-size: 0.8rem; color: var(--sky-ink-2); margin-top: 0.15rem; }
.hero-meta:empty, .feels-like:empty { display: none; }
/* Station footer: the observation's own details */
.station { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 0.7rem 0.95rem; font-size: 0.85rem; }
.st-head { font-size: 0.75rem; color: var(--ink-2); margin-bottom: 0.35rem; }
.st-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.3rem 0; border-top: 1px solid var(--line); }
.st-row span:first-child { color: var(--ink-2); }
.st-row span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.st-trend { font-weight: 400; color: var(--ink-2); }
#hero-icon { flex-shrink: 0; line-height: 0; }
#hero-icon img.wx {
  width: clamp(6rem, 30vw, 7.6rem); height: auto;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.2));
}

.hero-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 1.1rem; }
#normals-line {
  font-size: 0.8rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.32rem 0.75rem; border-radius: 999px;
  background: var(--sky-chip); border: 1px solid var(--sky-line);
}
#normals-line.warmer { color: #ffd28a; }
#normals-line.cooler { color: #c9e4ff; }
#normals-line:empty { display: none; }

#aqhi-pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.32rem 0.75rem;
  border-radius: 999px; font-size: 0.8rem; font-weight: 600;
  background: var(--sky-chip); border: 1px solid var(--sky-line);
}
#aqhi-pill:empty { display: none; }
#aqhi-pill.low      { background: rgba(30,120,200,0.85); border-color: transparent; color: white; }
#aqhi-pill.moderate { background: rgba(230,180,60,0.92); border-color: transparent; color: #1a1a1a; }
#aqhi-pill.high     { background: rgba(220,80,60,0.92);  border-color: transparent; color: white; }
#aqhi-pill.very-high{ background: rgba(130,30,30,0.95);  border-color: transparent; color: white; }
#aqhi-pill .aqhi-sub { font-weight: 400; opacity: 0.85; font-size: 0.72rem; }

/* ===== Ground surface (curved horizon) ===== */
.surface {
  position: relative;
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  margin-top: -1.8rem;
  min-height: 55vh;
  padding: 1.3rem 0 calc(110px + env(safe-area-inset-bottom));
  transition: background 0.4s ease;
}
.eyebrow {
  font-family: var(--display); font-weight: 600;
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink-2); margin: 1.5rem 0 0.6rem;
}
#forecast-section .eyebrow { margin-top: 0.4rem; }

.city-result.nearest-hit { background: var(--surface); }
.city-result .cr-sub { display:block; font-size: 0.72rem; color: var(--ink-2); margin-top: 0.15rem; }
.city-result.empty { cursor: default; color: var(--ink-2); justify-content: center; }
.city-result.empty:hover { background: transparent; }

#fav-dots { display: flex; gap: 0.35rem; margin-top: 1.2rem; }
#fav-dots:empty { display: none; }
#fav-dots .dot {
  width: 7px; height: 7px; border-radius: 999px;
  background: rgba(255,255,255,0.42); cursor: pointer;
  transition: background 0.2s, width 0.25s;
}
#fav-dots .dot.active { background: var(--sky-ink); width: 20px; }

#ptr-indicator {
  position: fixed; top: env(safe-area-inset-top); left: 0; right: 0;
  height: 0; z-index: 90;
  display: flex; justify-content: center; align-items: center;
  color: white; opacity: 0;
  pointer-events: none;
  transition: height 0.12s linear, opacity 0.12s linear;
}
#ptr-indicator.pulling { opacity: 1; }
#ptr-indicator.ready i { transform: rotate(180deg); color: #ffd28a; }
#ptr-indicator.refreshing i { animation: ptr-spin 0.9s linear infinite; }
#ptr-indicator i { transition: transform 0.2s; font-size: 1.1rem; }
@keyframes ptr-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.alerts { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.alerts:empty { display: none; }
.alert {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.75rem 0.95rem; border-radius: 14px;
  background: #e8940f; color: #16110a;
  font-weight: 600; font-size: 0.92rem;
  cursor: pointer; text-decoration: none;
}
.alert.red    { background: #cc3a33; color: white; }
.alert.yellow { background: #eec33f; color: #1c160a; }
.alert.orange { background: #e8802e; color: #16110a; }
.alert i { font-size: 1.2rem; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  font-size: 0.88rem;
}
.metric {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.72rem 0.35rem 0.65rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
}
.metric i { font-size: 1.05rem; color: var(--accent); }
.metric .lbl { font-size: 0.66rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; }
.metric .val { font-weight: 600; text-align: center; }

.daily-scroll {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding: 0 1.1rem;   /* keep snapped cards off the screen edge */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 -1.1rem;   /* full-bleed scroll */
  padding: 0.3rem 1.1rem 0.5rem;
}
.daily-scroll::-webkit-scrollbar { display: none; }
.day-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.7rem 0.5rem 0.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 78px;
  flex: 0 0 auto;
  cursor: pointer;
  text-align: center;
  scroll-snap-align: start;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  position: relative;
}
.day-item:hover { transform: translateY(-2px); }
.day-item.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.day-item.outlook {
  opacity: 0.8;
  border-style: dashed;
  background: transparent;
}
.day-item.outlook::before {
  content: attr(data-outlook-label);
  position: absolute; top: 3px; left: 0; right: 0;
  font-size: 0.55rem; opacity: 0.6;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.day-item.outlook.active {
  opacity: 1; border-style: solid;
  background: var(--accent); border-color: var(--accent);
  color: var(--on-accent);
}
.outlook-divider {
  flex: 0 0 auto;
  align-self: stretch;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--line), transparent);
  margin: 0 0.25rem;
}
.day-name { font-size: 0.8rem; font-weight: 600; }
.day-date { font-size: 0.68rem; opacity: 0.6; }
.day-icon { font-size: 1.7rem; margin: 0.15rem 0 0.1rem; }
.day-high { font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
.day-low { font-size: 0.8rem; opacity: 0.6; }
.day-pop { font-size: 0.7rem; color: var(--accent); margin-top: 0.15rem; font-weight: 600; }
.day-item.active .day-pop { color: inherit; opacity: 0.85; }

.detail-view {
  display: none;
  background: var(--card);
  border-radius: 18px;
  margin: 0.5rem 0 0.2rem;
  padding: 0.95rem 1rem 1rem;
  border: 1px solid var(--line);
}
.detail-view.active { display: block; }
.detail-title {
  font-size: 1rem; font-weight: 600; margin-bottom: 0.3rem;
  display: flex; align-items: center; gap: 0.4rem;
}
.detail-summary { font-size: 0.85rem; color: var(--ink-2); margin-bottom: 0.6rem; line-height: 1.4; }
.detail-summary b { color: var(--ink); }
.detail-temps {
  display: flex; gap: 1rem; font-size: 0.9rem; margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.detail-temps b { font-weight: 600; }
/* ===== Meteogram (js: MG) ===== */
/* chart tokens — rain/snow and warm/cool pairs validated (dataviz checks, light + dark) */
:root {
  --mg-ink-3: rgba(23,34,46,0.42); --mg-night: rgba(23,34,46,0.05);
  --mg-rain: #2f7fd4; --mg-snow: #b8478f; --mg-warm: #c8553d; --mg-cool: #1f6fc2;
  --mg-sky-n: #2f3f70; --mg-sky-t: #f2a65a; --mg-sky-d: #8fcaf5;
}
[data-phase="night"] {
  --mg-ink-3: rgba(233,238,246,0.42); --mg-night: rgba(0,0,0,0.22);
  --mg-rain: #3b8ee0; --mg-snow: #c7529c; --mg-warm: #e0703f; --mg-cool: #3b8ee0;
  --mg-sky-n: #22305a; --mg-sky-t: #d98a48; --mg-sky-d: #5c9ad6;
}
.detail-view { overflow: hidden; }
.mg { margin: 0.6rem -1rem 0.6rem; user-select: none; -webkit-user-select: none; }
.mg-empty { padding: 1rem; text-align: center; color: var(--ink-2); font-size: 0.85rem; }
/* readout: icon | day·hour + temperature / condition / two fixed detail lines */
.mg-ro { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; column-gap: 10px; align-items: start; padding: 0 1rem 0.55rem; }
.mg-ro img { grid-row: 1 / span 2; width: 40px; height: 40px; margin-top: -2px; }
.mg-time { grid-column: 2; font-family: var(--display); font-weight: 600; font-size: 0.72rem; line-height: 1.2; padding-top: 1px;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-temp { grid-column: 3; grid-row: 1 / span 2; font-family: var(--display); font-weight: 800; font-size: 1.9rem; line-height: 0.82; padding-top: 1px; letter-spacing: -0.02em; }
.mg-cond { grid-column: 2 / -1; grid-row: 2; height: 20px; line-height: 20px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-line { grid-column: 1 / -1; font-size: 0.78rem; line-height: 1.35; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-l1 { margin-top: 4px; }
.mg-line .ic { font-size: 0.85em; opacity: 0.8; }
@media (max-width: 340px) { .mg-ro { grid-template-columns: 34px minmax(0, 1fr) auto; column-gap: 8px; } .mg-ro img { width: 34px; height: 34px; } }
/* timeline */
.mg-wrap { position: relative; }
.mg-scroll { position: absolute; inset: 0; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none;
  overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; outline: none; }
.mg-scroll::-webkit-scrollbar { display: none; }
.mg-scroll:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.mg-track { position: relative; }
.mg-track svg { display: block; position: absolute; top: 0; left: 0; }
.mg-track image { pointer-events: none; }
.mg-snaps { display: flex; height: 1px; }
.mg-snaps span { flex: none; scroll-snap-align: center; }
.mg-cline { position: absolute; width: 0; border-left: 1.5px solid var(--ink); opacity: 0.45; pointer-events: none; transform: translateX(-0.75px); }
.mg-dot { position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--accent); border: 2px solid var(--card); pointer-events: none; }
.mg-pin { position: absolute; top: 0; left: 0; padding: 1px 8px 3px 1rem; font: 800 10px/14px var(--display); letter-spacing: 0.4px;
  color: var(--ink); background: linear-gradient(to right, var(--card) 80%, transparent); pointer-events: none; white-space: nowrap; }
.mg svg text { font-family: var(--display); text-anchor: middle; }
.mg-tday { font-size: 10px; font-weight: 800; letter-spacing: 0.4px; fill: var(--ink); text-anchor: start !important; }
.mg-tnoon { font-size: 10.5px; font-weight: 800; fill: var(--ink); }
.mg-th6 { font-size: 9.5px; font-weight: 600; fill: var(--ink-2); }
.mg-th { font-size: 9px; fill: var(--mg-ink-3); }
.mg-thi { font-size: 11px; font-weight: 800; fill: var(--ink); }
.mg-tlo { font-size: 11px; font-weight: 800; fill: var(--ink-2); }
.mg-tpk { font-size: 9.5px; font-weight: 800; }
.mg-twind { font-size: 9px; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.mg-tgust { font-weight: 800; fill: var(--ink); }
.mg-legend { display: flex; flex-wrap: wrap; gap: 0.2rem 0.8rem; padding: 0.4rem 1rem 0; }
.mg-legend:empty { display: none; }
.mg-chip { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.7rem; color: var(--ink-2); }
.mg-chip i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.mg-chip i.mg-zero { width: 14px; height: 1px; border-radius: 0; background: var(--mg-ink-3); }
.detail-note { text-align: center; font-size: 0.76rem; color: var(--ink-2); padding: 0.6rem 0 0; }

.bottom-nav {
  position: fixed;
  bottom: calc(0.8rem + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  width: min(92%, 400px);
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  display: flex;
  padding: 5px;
  z-index: 100;
}
.nav-item {
  color: var(--ink-2);
  cursor: pointer;
  padding: 0.5rem 0.4rem;
  flex: 1;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.1rem;
  border-radius: 999px;
  transition: background 0.2s, color 0.2s;
}
.nav-item.active { color: var(--accent); background: var(--accent-soft); }
.nav-icon { font-size: 1.1rem; }
.nav-label { font-size: 0.68rem; font-weight: 600; }

#radar-section { display: none; }
#radar-section.active {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #10131a;
}
#radar-map {
  position: absolute; inset: 0;
  z-index: 0;   /* contain Leaflet's pane z-indexes (200-700) below the controls */
  background: #10131a;
  overflow: hidden;
}
.leaflet-top { top: env(safe-area-inset-top); }
.radar-controls {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(76px + env(safe-area-inset-bottom));
  width: min(96%, 480px);
  margin: 0 auto;
  background: rgba(20,24,36,0.92);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 0.55rem 0.8rem 0.7rem;
  display: flex; flex-direction: column; gap: 0.45rem;
  backdrop-filter: blur(12px);
  color: white;
  z-index: 60;
}
.radar-row { display: flex; align-items: center; gap: 0.5rem; }
.radar-row button {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: white; border-radius: 10px;
  width: 38px; height: 38px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.radar-row button:hover { background: rgba(255,255,255,0.25); }
.radar-row button.active { background: #7ab8ec; color: #10131a; }
.radar-slider { flex: 1; -webkit-appearance: none; appearance: none; height: 6px; background: rgba(255,255,255,0.2); border-radius: 3px; outline: none; }
.radar-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: #7ab8ec; cursor: pointer; border: 2px solid white;
}
.radar-slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #7ab8ec; cursor: pointer; border: 2px solid white;
}
.radar-time { font-variant-numeric: tabular-nums; font-size: 0.9rem; min-width: 90px; text-align: center; opacity: 0.95; }
.radar-layer-btns { display: flex; gap: 0.35rem; }
.radar-layer-btns button { width: auto; padding: 0 0.7rem; font-size: 0.8rem; height: 32px; }
.radar-legend {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.72rem; opacity: 0.85;
}
.radar-legend .bar {
  flex: 1; height: 8px; border-radius: 4px;
  background: linear-gradient(to right, #60a0ff, #3cc73c, #f0e030, #ff8c20, #d03030, #a020a0);
}
#radar-locate { width: 36px; height: 32px; padding: 0; }
#radar-progress {
  font-size: 0.72rem; opacity: 0.7; font-variant-numeric: tabular-nums;
  flex-shrink: 0; min-width: 2.6rem; text-align: right;
}
#radar-progress:empty { display: none; }
.gps-dot {
  width: 14px; height: 14px;
  background: #2f86ff; border: 2px solid #fff; border-radius: 50%;
  box-shadow: 0 0 8px rgba(47,134,255,0.9);
  position: relative;
}
.gps-dot::after {
  content: ''; position: absolute; inset: -7px; border-radius: 50%;
  border: 2px solid rgba(47,134,255,0.55);
  animation: gps-pulse 2s ease-out infinite;
}
@keyframes gps-pulse {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}
#toast {
  position: fixed;
  bottom: calc(70px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(20,24,36,0.95); color: white;
  padding: 0.7rem 1.1rem; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  font-size: 0.88rem; max-width: 90vw; text-align: center;
  z-index: 300; opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.leaflet-container { background: #10131a !important; }
.leaflet-control-attribution { font-size: 0.65rem !important; background: rgba(0,0,0,0.5) !important; color: #ccc !important; }
.leaflet-control-attribution a { color: #9cf !important; }

#locations-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
}
@media (min-width: 600px) { #locations-modal { align-items: center; } }
.modal-content {
  background: var(--card);
  color: var(--ink);
  border-radius: 24px 24px 0 0;
  padding: 1.2rem 1.2rem 1.6rem;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
}
@media (min-width: 600px) { .modal-content { border-radius: 24px; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; font-size: 1.15rem; font-family: var(--display); font-weight: 600; }
#close-modal { font-size: 1.8rem; cursor: pointer; line-height: 1; padding: 0 0.3rem; color: var(--ink-2); }
#search-wrap { position: relative; margin: 1rem 0 0.5rem; }
#location-search {
  width: 100%;
  padding: 0.85rem 2.4rem 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 1rem;
  background: var(--surface);
  color: var(--ink);
}
#location-search::placeholder { color: var(--ink-2); }
#search-clear {
  display: none;
  position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%);
  font-size: 1.3rem; line-height: 1; padding: 0.4rem 0.6rem;
  cursor: pointer; color: var(--ink-2);
}
#search-clear:hover { color: var(--ink); }
.city-result, .fav-item {
  padding: 0.75rem 0.6rem;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.city-result:hover, .fav-item:hover { background: var(--surface); }
.fav-remove { color: var(--ink-2); cursor: pointer; padding: 0.3rem 0.5rem; }
.fav-remove:hover { color: #d9534f; }
.modal-btn {
  margin-top: 0.5rem; padding: 0.85rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; width: 100%; color: var(--ink); cursor: pointer;
  font-size: 0.95rem; font-weight: 600;
}
.modal-btn:hover { background: var(--accent-soft); }
.section-sub {
  margin: 1.2rem 0 0.3rem; font-size: 0.74rem; color: var(--ink-2);
  font-family: var(--display); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
}
.loading { text-align: center; padding: 1.5rem; color: var(--ink-2); }
.error-msg { color: var(--danger); text-align: center; padding: 1rem; font-weight: bold; }

/* Skeleton loaders */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.9; }
}
@keyframes skeleton-shimmer {
  0%   { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}
.skel {
  display: inline-block;
  background: linear-gradient(90deg, var(--skel-a), var(--skel-b), var(--skel-a));
  background-size: 400px 100%;
  animation: skeleton-shimmer 1.4s linear infinite, skeleton-pulse 2s ease-in-out infinite;
  border-radius: 8px;
  color: transparent;
  vertical-align: middle;
}
.sky .skel { --skel-a: rgba(255,255,255,0.14); --skel-b: rgba(255,255,255,0.32); }
.skel-temp    { width: 7rem; height: 4.6rem; border-radius: 14px; }
.skel-cond    { width: 60%;  height: 1.3rem; margin-top: 0.3rem; }
.skel-icon    { width: 6.5rem; height: 6.5rem; border-radius: 50%; }
.skel-metric  { width: 100%; height: 74px; border-radius: 16px; }

@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
  .gps-dot::after { animation: none; }
  .day-item, .nav-item, .top-actions button { transition: none; }
}
.offline-badge {
  display: inline-block; background: rgba(255,165,0,0.9); color: #111;
  font-size: 0.7rem; padding: 0.15rem 0.5rem; border-radius: 999px;
  margin-left: 0.4rem; vertical-align: middle;
}

/* Inline SVG icons (sprite in index.html) */
.ic { display: inline-block; width: 1em; height: 1em; line-height: 1; vertical-align: -0.125em; }
.ic svg { display: block; width: 100%; height: 100%; fill: currentColor; overflow: visible; }
.ic.spin { animation: ptr-spin 0.9s linear infinite; }

/* ---- v22: semantic buttons (look unchanged) ---- */
.day-item, .nav-item, .city-result, .fav-go, .fav-act, #close-modal, #search-clear, #fav-dots .dot, .alert-head {
  font: inherit; color: inherit; background: none; border: 0; margin: 0;
  -webkit-appearance: none; appearance: none;
}
.day-item { background: var(--card); border: 1px solid var(--line); }
.day-item.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.nav-item { color: var(--ink-2); }
.nav-item.active { color: var(--accent); background: var(--accent-soft); }
.city-result { width: 100%; text-align: left; color: var(--ink); }
#close-modal { font-size: 1.8rem; color: var(--ink-2); }
#search-clear { font-size: 1.3rem; color: var(--ink-2); }
#location-search::-webkit-search-cancel-button { display: none; }
:is(.day-item, .nav-item, .city-result, .fav-go, .fav-act, #close-modal, #search-clear, #fav-dots .dot, .alert-head):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
#fav-dots .dot { padding: 0; background: rgba(255,255,255,0.42); }
#fav-dots .dot.active { background: var(--sky-ink); }

/* Favorite switch: brief place-name flash under the dots */
#place-flash {
  height: 0; overflow: visible; opacity: 0; pointer-events: none;
  font-size: 0.8rem; font-weight: 600; color: var(--sky-ink-2); margin-top: 0.35rem;
}
#place-flash.show { animation: place-flash 1.8s ease forwards; }
@keyframes place-flash { 0% { opacity: 0; } 12% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }

/* Favorites list: name + province/station, reorder / rename / remove */
.fav-item { gap: 0.4rem; cursor: default; padding: 0.45rem 0.3rem 0.45rem 0.6rem; }
.fav-go { flex: 1; min-width: 0; text-align: left; cursor: pointer; padding: 0.3rem 0; color: var(--ink); }
.fav-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-sub { display: block; font-size: 0.72rem; color: var(--ink-2); }
.fav-actions { display: flex; gap: 0.1rem; flex-shrink: 0; }
.fav-act { width: 34px; height: 34px; border-radius: 10px; cursor: pointer; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; }
.fav-act:hover:not([disabled]) { background: var(--surface); color: var(--ink); }
.fav-act[disabled] { opacity: 0.3; cursor: default; }
.fav-act.fav-remove:hover { color: #d9534f; }
.cr-prov { font-size: 0.72rem; color: var(--ink-2); margin-left: 0.25rem; }

/* Alerts: headline button + expandable full text */
.alert { flex-direction: column; align-items: stretch; gap: 0; padding: 0; cursor: default; overflow: hidden; }
.alert-head { display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.75rem 0.95rem; text-align: left; cursor: pointer; font-weight: 600; }
.alert-title { flex: 1; }
.alert .alert-chev { font-size: 0.85rem; transition: transform 0.2s; }
.alert.open .alert-chev { transform: rotate(180deg); }
.alert-body { padding: 0 0.95rem 0.85rem; font-weight: 400; font-size: 0.86rem; line-height: 1.45; }
.alert-body p { margin: 0 0 0.55rem; }
.alert-body a { color: inherit; font-weight: 600; }
.alert-until { font-size: 0.78rem; font-weight: 600; opacity: 0.8; margin-bottom: 0.45rem; }

/* Nowcast: "Rain likely in ~20 min" */
#nowcast-line {
  display: none; align-items: center; gap: 0.5rem;
  margin: 0 0 0.4rem; padding: 0.65rem 0.95rem;
  background: var(--accent-soft); color: var(--ink);
  border-radius: 14px; font-size: 0.88rem; font-weight: 600;
}
#nowcast-line.show { display: flex; }
#nowcast-line .ic { color: var(--accent); }
#nowcast-line { width: 100%; border: 0; font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
#nowcast-line span { flex: 1; min-width: 0; }
#nowcast-line .nc-go { color: var(--ink-2); font-size: 0.75em; }
#nowcast-line.muted { background: none; color: var(--ink-2); font-weight: 500; font-size: 0.8rem; padding: 0.2rem 0.3rem; }
#nowcast-line.muted .ic { color: var(--ink-2); }
#nowcast-line:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#radar-locate.following { box-shadow: 0 0 0 2px rgba(122,184,236,0.45); }

@media (prefers-reduced-motion: reduce) {
  .ic.spin, #place-flash.show { animation: none; }
  #place-flash.show { opacity: 1; }
}

/* NRCan base map is light; invert it into the radar's dark look */
.nrcan-base, .nrcan-labels { filter: invert(1) hue-rotate(180deg) brightness(0.8) contrast(0.9); }
.nrcan-labels { opacity: 0.85; }

/* Radar time label: "Latest" on the newest observed frame, amber "Forecast +n min" after it */
.radar-time .rt-tag { font-size: 0.7rem; font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 999px; margin-right: 0.3rem; background: rgba(255,255,255,0.14); }
.radar-time.forecast { color: #ffc45c; }
.radar-time.forecast .rt-tag { background: rgba(255,196,92,0.2); }
.radar-time { white-space: nowrap; }
/* Tag stacked over the clock so "Prévision +72 min" fits next to the buttons */
.radar-time { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; gap: 0.1rem; }
.radar-time .rt-tag { margin-right: 0; font-size: 0.66rem; }

/* AQ pill: always one line; index + rating never shrink, details truncate */
.hero-chips #aqhi-pill { max-width: 100%; min-width: 0; white-space: nowrap; }
#aqhi-pill .aqhi-main { flex-shrink: 0; }
#aqhi-pill .aqhi-sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* Normals chip: one line too; the "(Normales 14° / 5°)" detail truncates first */
.hero-chips #normals-line { max-width: 100%; min-width: 0; white-space: nowrap; }
#normals-line .nl-main { flex-shrink: 0; }
#normals-line .nl-sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; opacity: 0.6; font-size: 0.72rem; }

/* Day card totals (model): "12 mm" / "❄ 8 cm" */
.day-amt { font-size: 0.68rem; font-weight: 600; color: var(--mg-rain); margin-top: 0.1rem; white-space: nowrap; }
.day-amt .ic { margin-right: 0.15em; font-size: 0.9em; }
.day-item.active .day-amt { color: inherit; opacity: 0.85; }

/* Highlights: what stands out in the next 3 days */
#highlights { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin: 0 0 0.5rem; }
#highlights:empty { display: none; }
.hl-title { font-family: var(--display); font-weight: 600; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-2); margin-right: 0.15rem; }
.hl { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-size: 0.8rem; font-weight: 600; padding: 0.35rem 0.7rem; border-radius: 999px; cursor: pointer; }
.hl .ic { color: var(--accent); }
.hl-ice .ic, .hl-wind .ic { color: #e8802e; }
.hl-heat .ic { color: var(--mg-warm); }
.hl:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Favourites at a glance */
.fav-go { display: flex; align-items: center; gap: 0.6rem; }
.fav-txt { flex: 1; min-width: 0; }
.fav-now { display: inline-flex; align-items: center; gap: 0.25rem; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.fav-now img { width: 26px; height: 26px; }
.fav-now b { font-size: 1rem; min-width: 2.2ch; text-align: right; }
.fav-alert { color: #e8802e; }
/* Radar: narrow screens keep the time visible — rain/snow buttons become icon-only */
@media (max-width: 440px) {
  .radar-layer-btns button span { display: none; }
  .radar-layer-btns button { padding: 0 0.6rem; }
}
