/* Thai Rain, "zoom look". Always dark. Spec: docs/DESIGN.md (tokens §2, type §3, layout §5, components §6).
   Order: fonts, tokens, base, shared pieces, map, components, tooltips, states, mobile, reduced motion. */

/* ---------- fonts (Mulish, self-hosted) ---------- */
@font-face {
  font-family: "Mulish";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("fonts/mulish-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Mulish";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("fonts/mulish-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- tokens ---------- */
:root {
  --panel: rgba(27, 35, 44, 0.625);          /* every floating panel/button group */
  --panel-solid: rgba(20, 26, 34, 0.925);    /* fallback when backdrop-filter is unsupported */
  --panel-dark: #141a22;                     /* mobile logo button, text on white pills */
  --blur: blur(24px) saturate(160%);
  --glow: 0 0 1.5px rgba(255, 255, 255, 0.65);   /* the hairline: box-shadow on every panel/group */
  --text: #ffffff;
  --text-2: rgba(255, 255, 255, 0.85);
  --text-3: rgba(255, 255, 255, 0.6);        /* h4 headers, units, secondary */
  --hover: rgba(255, 255, 255, 0.15);
  --press: rgba(255, 255, 255, 0.2);
  --selected: rgba(255, 255, 255, 0.25);     /* selected menu item / table row */
  --row-dark: rgba(0, 0, 0, 0.25);
  --accent: #0a84ff;  --accent-hover: #1a8cff;  --accent-active: #0073e6;  --link: #57abff;
  --notice: #272d35;
  --sun: #ffd23f;                            /* condition icons */
  --drop: #7cc4ff;
  --radius: 10px;  --radius-clock: 17.5px;  --radius-legend: 6px;
  --edge: 6px;                               /* distance of every panel from the screen edge */
  --panel-top: var(--edge);                  /* top of #search / #about (and #place on phones); desktop #place uses 66px */
  --panel-keep: 158px;                       /* space those panels leave at the bottom: clock row + a one-line toast */
  --font: "Mulish", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --label-shadow: 0 0 2px #000, 0 0 1.5px #000, 0 0 1px #000;  /* white text drawn straight on the map */

  /* safe areas (iPhone PWA, viewport-fit=cover) and the resulting side margins */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --ml: max(var(--edge), var(--safe-left));
  --mr: max(var(--edge), var(--safe-right));
  --side: max(var(--ml), var(--mr));

  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  background: #0b1a33;
  color: var(--text);
  font: 500 14px/1 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
h2, h3, h4, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
button {
  margin: 0; padding: 0; border: 0; background: none; text-align: inherit;
  cursor: pointer; touch-action: manipulation;
  -webkit-appearance: none; appearance: none;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: rgba(10, 132, 255, 0.45); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }
button[disabled] { opacity: 0.25; cursor: default; pointer-events: none; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.noscript { position: fixed; z-index: 40; left: 16px; right: 16px; top: 16px; padding: 14px 16px; border-radius: var(--radius); background: var(--panel-solid); font-size: 15px; line-height: 1.4; }

/* tiny numbers that must not jiggle */
.clock-text, .clock-colon, .c-chance, .c-mm, .days .units td, .hours-axis, .legend-wrap, .coord, .maplibregl-ctrl-scale, .place-sub { font-feature-settings: "tnum"; }

/* ---------- panel recipe: translucent slate, strong blur, hairline glow ---------- */
.logo, .layers, .round, .group, .place, .sheet, .clock, .model, .error {
  background: var(--panel);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--glow);
  border-radius: var(--radius);
  color: #fff;
}
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .logo, .layers, .round, .group, .place, .sheet, .clock, .model, .error { background: var(--panel-solid); }
}

/* ---------- shared pieces ---------- */
.ico { display: block; flex: none; width: 24px; height: 24px; fill: currentColor; stroke-width: 2.4; pointer-events: none; }  /* stroke-width feeds the chevron and close symbols */
.cond { display: block; flex: none; width: 24px; height: 24px; pointer-events: none; }

h4 {
  font-size: 11px; font-weight: 900; line-height: 1.3;
  text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-3);
}

/* 24px chevron that collapses a panel; rotates when collapsed. 40px hit area via ::before. */
.chev {
  position: relative; flex: none; display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%; color: var(--text-2);
}
.chev::before, .close::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; }
.chev .ico { width: 16px; height: 16px; transition: transform 0.2s ease; }
.chev[aria-expanded="false"] .ico, body.layers-min #layers-min .ico, body.place-min #place-min .ico { transform: rotate(180deg); }
.chev:active { background: var(--press); }

/* 26px close circle */
.close {
  position: relative; flex: none; display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); color: #fff;
  transition: background-color 0.125s ease;
}
.close .ico { width: 12px; height: 12px; stroke-width: 3.3; }
.close:active { background: rgba(255, 255, 255, 0.32); }

.pill-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 40px; padding: 0 16px; border-radius: 20px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 700; line-height: 1;
  transition: background-color 0.125s ease;
}
.pill-btn .ico { width: 20px; height: 20px; }
.pill-btn:active { background: var(--accent-active); }

/* thin scrollbars inside panels */
.place, .sheet, .layers { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.3) transparent; }
.place::-webkit-scrollbar, .sheet::-webkit-scrollbar, .layers::-webkit-scrollbar { width: 8px; }
.place::-webkit-scrollbar-thumb, .sheet::-webkit-scrollbar-thumb, .layers::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3); background-clip: padding-box; border: 2px solid transparent; border-radius: 4px;
}

/* hover only where a real hover exists (touch devices keep no sticky highlight) */
@media (hover: hover) {
  .round:hover, .logo:hover { box-shadow: var(--glow), inset 0 0 0 40px var(--hover); }
  .group > button:hover, .clock-play:hover, .clock-now:hover, .clock-unit .up:hover, .clock-unit .down:hover { background-color: var(--hover); }
  .chev:hover { background: var(--hover); }
  .close:hover { background: rgba(255, 255, 255, 0.3); }
  .pill-btn:hover { background: var(--accent-hover); }
  .menu-item:hover { background-color: var(--hover); }
  .result:hover { background: var(--hover); }
  .days tr[data-d]:hover td { background: var(--hover); }
  .days tr.selected:hover td { background: var(--selected); }
  .hr:hover { background: var(--hover); }
}
.round:active, .logo:active { box-shadow: var(--glow), inset 0 0 0 40px var(--press); }
.group > button:active, .clock-play:active, .clock-now:active, .clock-unit .up:active, .clock-unit .down:active { background-color: var(--press); }
.menu-item:active { background-color: var(--press); }

/* ---------- map and MapLibre controls ---------- */
#map { position: fixed; inset: 0; z-index: 0; background: #0b1a33; }
.maplibregl-canvas:focus, .maplibregl-canvas-container:focus { outline: none; }
/* our own zoom/attribution UI replaces MapLibre's; only the scale control stays */
.maplibregl-ctrl-top-left, .maplibregl-ctrl-top-right, .maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-attrib, .maplibregl-ctrl-group, .maplibregl-ctrl-logo { display: none !important; }
.maplibregl-ctrl-bottom-right { right: var(--mr); bottom: 6px; z-index: 3; }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl.maplibregl-ctrl-scale {
  margin: 0; padding: 0 1px 1px; border: 0; border-bottom: 1.5px solid #fff; border-radius: 0;
  background: transparent; color: #fff;
  font: 700 11px/1.2 var(--font); text-align: right; text-shadow: var(--label-shadow);
  box-shadow: 0 1.5px 1px -0.5px rgba(0, 0, 0, 0.6);
}

/* ---------- logo ---------- */
.logo {
  position: fixed; z-index: 5; left: var(--ml); top: var(--edge);
  display: flex; align-items: center; gap: 7px;
  height: 54px; padding: 0 14px 0 7px;
  box-shadow: var(--glow), inset 0 0 0 40px rgba(255, 255, 255, 0);
  transition: box-shadow 0.125s ease;
}
.logo-icon { flex: none; width: 40px; height: 40px; }
.logo-text { display: flex; flex-direction: column; font-size: 17px; line-height: 17px; letter-spacing: 0.5px; text-align: left; }
.logo-text b { font-weight: 900; }
.logo-text span { font-weight: 500; }

/* ---------- layers menu ---------- */
.layers { position: fixed; z-index: 5; left: var(--ml); top: 66px; width: 174px; padding-bottom: 8px; }
.layers-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 6px 16px; }
.layers-head .chev { margin: -5px 0; }
.layers-sub { padding: 20px 16px 6px; }
.menu-item {
  position: relative; display: block; width: calc(100% - 12px); height: 40px; margin: 0 6px; padding: 0 0 0 45px;
  border-radius: 18px; white-space: nowrap; font-size: 15px; line-height: 40px; font-weight: 500; text-align: left;
  transition: background-color 0.125s ease;
}
.menu-item .ico { position: absolute; left: 11px; top: 8px; }
.menu-item small { font-size: 12px; font-weight: 500; color: var(--text-3); }
.menu-item[aria-checked="true"] { font-weight: 700; background-color: var(--selected); }
.menu-item:focus-visible { outline-offset: -2px; }
.menu-item[aria-disabled="true"] { opacity: 0.4; cursor: default; }
.menu-item[aria-disabled="true"]:hover, .menu-item[aria-disabled="true"]:active { background-color: transparent; }
body.layers-min .layers { padding-bottom: 6px; }
body.layers-min .layers-sub, body.layers-min .menu-item[aria-checked="false"] { display: none; }

/* ---------- toolbar (top right) ---------- */
.toolbar { position: fixed; z-index: 7; right: var(--mr); top: var(--edge); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.round {
  position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  box-shadow: var(--glow), inset 0 0 0 40px rgba(255, 255, 255, 0);
  transition: box-shadow 0.125s ease;
}
.group { display: flex; flex-direction: column; width: 40px; border-radius: 20px; }
.group > button {
  position: relative; display: grid; place-items: center; width: 40px; height: 40px;
  transition: background-color 0.125s ease;
}
.group > button:first-child { border-radius: 20px 20px 0 0; }
.group > button:last-child { border-radius: 0 0 20px 20px; }
.group > button:only-child { border-radius: 50%; }
.round .ico, .group .ico { width: 20px; height: 20px; }
#btn-locate.on .ico { color: var(--link); }
body.searching #btn-search { box-shadow: var(--glow), inset 0 0 0 40px var(--selected); }
body.about-open #btn-info { background-color: var(--selected); }

/* ---------- bottom right: overlay group, zoom, model badge, scale ---------- */
.controls { position: fixed; z-index: 5; right: var(--mr); bottom: 34px; display: flex; flex-direction: column; gap: 8px; }
#btn-clouds { border-radius: 50%; }
#btn-layers { display: none; }
#btn-layers[aria-expanded="true"] { background-color: var(--selected); }
#btn-clouds[aria-pressed="false"] .ico { opacity: 0.5; }
#btn-clouds[aria-disabled="true"], body.mode-radar #btn-clouds { opacity: 0.35; background-color: transparent; cursor: default; }
.model {
  position: fixed; z-index: 5; right: calc(var(--mr) + 46px); bottom: 34px;
  height: 28px; padding: 0 12px; border-radius: 14px;
  font-size: 13px; line-height: 28px; white-space: nowrap; cursor: default;
}
.model b { font-weight: 900; }

/* ---------- legend + coordinates (rendered by app.js) ---------- */
.legend { position: fixed; z-index: 5; left: var(--ml); bottom: 34px; width: 320px; height: 22px; pointer-events: none; }
.legend:empty { display: none; }
.legend-wrap { position: relative; height: 22px; border-radius: var(--radius-legend); box-shadow: var(--glow); overflow: hidden; }
.legend-bar { position: absolute; inset: 0; z-index: 0; background-size: 100% 100%; background-repeat: no-repeat; }
.legend-unit, .legend-label {
  z-index: 1; font-size: 11px; font-weight: 900; line-height: 1; white-space: nowrap; color: #fff;
  text-shadow: 1px 0 1px rgba(0, 0, 0, 0.5), -1px 0 1px rgba(0, 0, 0, 0.5), 0 1px 1px rgba(0, 0, 0, 0.5), 0 -1px 1px rgba(0, 0, 0, 0.5);
}
.legend-unit {
  position: absolute; left: 0; top: 0; bottom: 0; min-width: 15%; padding: 0 7px;
  display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.25);
}
.legend-label { position: absolute; top: 50%; transform: translate(-50%, -50%); }
.coord {
  position: fixed; z-index: 5; left: var(--ml); bottom: 12px; pointer-events: none;
  font-size: 11px; font-weight: 700; line-height: 1; white-space: pre; text-shadow: var(--label-shadow);
}

/* ---------- clock ---------- */
.clock {
  position: fixed; z-index: 5; left: 0; right: 0; bottom: 34px; margin: 0 auto;
  display: flex; align-items: center; width: 246px; height: 70px; padding: 0 6px; border-radius: var(--radius-clock);
}
.clock-play, .clock-now { position: relative; flex: none; display: grid; place-items: center; border-radius: 14px; transition: background-color 0.125s ease; }
.clock-play { width: 54px; height: 48px; }
.clock-play .ico { width: 36px; height: 36px; }
.clock-now { width: 40px; height: 40px; }
.clock-now .ico { width: 20px; height: 20px; }
.clock-now.reverse .ico { transform: scaleX(-1); }
.clock-unit { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 70px; }
.clock-date { width: 54px; }
.clock-hour, .clock-min { width: 40px; }
.clock-unit .up, .clock-unit .down {
  position: relative; display: grid; place-items: center; width: 40px; height: 27px; border-radius: 10px;
  opacity: 0.85; transition: background-color 0.125s ease, opacity 0.125s ease;
}
.clock-unit .up:hover, .clock-unit .down:hover { opacity: 1; }
.clock-unit .up[disabled], .clock-unit .down[disabled] { opacity: 0.25; }
.clock-unit .ico { width: 12px; height: 12px; stroke-width: 3.4; }
.clock-text { height: 16px; font-size: 14px; font-weight: 700; line-height: 16px; white-space: nowrap; text-align: center; }
.clock-date .clock-text { font-weight: 500; }
.clock-date .clock-text b { font-weight: 700; }
.clock-colon { flex: none; width: 6px; font-size: 14px; font-weight: 700; line-height: 16px; text-align: center; color: var(--text-3); }

/* ---------- place panel (forecast for the selected spot) ---------- */
.place {
  position: fixed; z-index: 6; right: calc(var(--mr) + 46px); top: var(--panel-top);
  width: 300px; max-height: calc(100% - var(--panel-top) - var(--panel-keep)); padding: 20px;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
}
/* desktop: the place panel hangs level with the layers menu, like zoom.earth's (search/about keep the top edge) */
@media (min-width: 680px) and (min-height: 570px) { .place { --panel-top: 66px; } }
.place-head { display: flex; align-items: center; gap: 8px; }
.place-head h2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; font-weight: 700; line-height: 26px; letter-spacing: -0.1px; }
.place-sub { margin-top: 4px; font-size: 12px; line-height: 1.3; color: var(--text-3); }
.place-sub:empty { display: none; }
.place-summary { margin: 12px 0; font-size: 14px; font-weight: 700; line-height: 1.35; color: var(--text-2); text-wrap: pretty; }
.place-summary:empty { display: none; }
.place-summary.rain::before, .place-summary.wet::before, .place-summary.likely::before, .place-summary .dot {
  content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 8px 0 0; border-radius: 50%;
  background: var(--accent); vertical-align: middle; position: relative; top: -1px;
}
body.searching #place, body.about-open #place { display: none; }
body.place-min .place-sub, body.place-min #place-body { display: none; }
body.place-min .place-summary { margin-bottom: 0; }
body.place-min .place { cursor: pointer; }          /* collapsed: tap anywhere on the card to open it again */

/* headline: the weather at the clock's date + time (icon + "Light rain · 0.8 mm/h", then time · chance · cloud) */
.place-summary .ps-main { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; line-height: 1.25; color: var(--text); }
.place-summary .ps-main .cond { width: 26px; height: 26px; flex: none; }
.place-summary .ps-sub { display: block; margin-top: 5px; font-size: 12.5px; font-weight: 600; line-height: 1.3; color: var(--text-3); font-variant-numeric: tabular-nums; }
/* the day's outlook, above the seven-day table */
.place-daysum { margin: 0 0 12px; font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--text-2); text-wrap: pretty; }
.place-daysum b { color: var(--text); font-weight: 700; }
.place-daysum:empty { display: none; }

/* seven-day table: rows run edge to edge, so it breaks out of the panel padding */
.days { width: calc(100% + 40px); margin: 0 -20px; border-spacing: 0; table-layout: fixed; font-size: 15px; }
.days th, .days td { height: 36px; padding: 0; font-weight: inherit; text-align: left; white-space: nowrap; }
.days .c-day { width: 25%; padding-left: 20px; }
.days .c-icon { width: 12%; }
.days .c-chance { width: 19%; padding-right: 6px; text-align: right; }
.days .c-bar { width: 24%; }
.days .c-mm { width: 20%; padding-right: 20px; text-align: right; }
.days .title th { height: 24px; padding-bottom: 4px; vertical-align: bottom; font-size: 11px; font-weight: 900; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-3); }
.days .units td { height: 22px; vertical-align: top; font-size: 14px; color: var(--text-3); }
.days tbody td { transition: background-color 0.125s ease; }
.days tr[data-d] { cursor: pointer; }
.days tr.selected td { font-weight: 700; background: var(--selected); }
.days tr.past td { color: var(--text-3); }
.days tr[data-d]:focus-visible { outline: none; }
.days tr[data-d]:focus-visible td { box-shadow: inset 0 2px 0 var(--link), inset 0 -2px 0 var(--link); }
.days tr[data-d]:focus-visible td:first-child { box-shadow: inset 2px 0 0 var(--link), inset 0 2px 0 var(--link), inset 0 -2px 0 var(--link); }
.days tr[data-d]:focus-visible td:last-child { box-shadow: inset -2px 0 0 var(--link), inset 0 2px 0 var(--link), inset 0 -2px 0 var(--link); }
.days .c-icon .cond { margin: 0 auto 0 0; }
.meter { display: block; width: 56px; height: 6px; margin: 0 auto; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.meter i { display: block; height: 100%; min-width: 0; border-radius: 3px; }

/* hourly chance strip */
.hourly { margin-top: 18px; }
.hourly h4 { margin-bottom: 10px; }
.hours { display: flex; align-items: stretch; gap: 1px; height: 64px; }
.hr { position: relative; flex: 1 1 0; min-width: 0; display: flex; align-items: flex-end; border-radius: 2px; }
.hr i { display: block; width: 100%; height: var(--p, 0%); min-height: 2px; background: var(--c, #fff); border-radius: 2px 2px 0 0; }
.hr.past i { opacity: 0.4; }
.hr.sel { background: var(--selected); box-shadow: inset 0 0 0 1px #fff; }
.hr:focus-visible { outline-offset: 0; }
.hours-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; line-height: 1; color: var(--text-3); }
.nodata { font-size: 14px; line-height: 1.4; color: var(--text-2); }

/* ---------- search + about sheets ---------- */
.sheet {
  position: fixed; z-index: 6; right: calc(var(--mr) + 46px); top: var(--panel-top);
  max-height: calc(100% - var(--panel-top) - var(--panel-keep)); padding: 20px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
}
.search { width: 320px; }
.about { width: 340px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sheet-head h3 { font-size: 18px; font-weight: 700; line-height: 26px; letter-spacing: -0.1px; }

.field { position: relative; display: block; height: 44px; border-radius: 10px; background: rgba(255, 255, 255, 0.12); }
.field .ico { position: absolute; left: 12px; top: 12px; width: 20px; height: 20px; color: var(--text-3); }
.field input {
  display: block; width: 100%; height: 44px; margin: 0; padding: 0 12px 0 42px; border: 0; border-radius: 10px;
  background: transparent; color: #fff; font-size: 16px; font-weight: 500; line-height: 44px; outline: none;
  -webkit-appearance: none; appearance: none;
}
.field input::placeholder { color: var(--text-3); opacity: 1; }
.field input::-webkit-search-cancel-button, .field input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.field:focus-within { box-shadow: 0 0 0 2px var(--link); }
.search .pill-btn { margin-top: 10px; }
.results { margin-top: 14px; }
.results li + li { margin-top: 6px; }
.result { display: block; width: 100%; padding: 14px; border-radius: 10px; background: rgba(255, 255, 255, 0.08); text-align: left; transition: background-color 0.125s ease; }
.result:focus-visible { outline-offset: -2px; }
.r-name { display: block; font-size: 15px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.r-sub { display: block; margin-top: 4px; font-size: 12px; line-height: 1.3; color: var(--text-3); overflow-wrap: anywhere; }
.r-empty { padding: 14px; font-size: 14px; line-height: 1.35; color: var(--text-3); }

.about-body p { font-size: 15px; line-height: 1.45; color: var(--text-2); text-wrap: pretty; }
.about-body p + p { margin-top: 12px; }
.about-body h4 { margin: 22px 0 8px; }
.about-body a { color: var(--link); }
.about-body .updated { margin-top: 12px; font-size: 13px; line-height: 1.35; color: var(--text-3); }
.about-body .updated:empty { display: none; }
.about-body .updated.warn { color: #f5b04a; }
.about-body .credits { font-size: 13px; line-height: 1.5; color: var(--text-3); }

/* ---------- map tooltip (desktop hover), placed by app.js with transform ---------- */
.tip {
  position: fixed; z-index: 40; left: 0; top: 0; display: flex; align-items: center; gap: 4px;
  height: 30px; padding: 0 10px 0 6px; border-radius: 8px;
  background: rgba(20, 26, 34, 0.92); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  font-size: 14px; font-weight: 700; line-height: 1; white-space: nowrap; pointer-events: none; will-change: transform;
}
.tip::after {
  content: ""; position: absolute; top: 100%; left: var(--tip-ax, 50%); width: 12px; height: 6px; margin-left: -6px;
  background: rgba(20, 26, 34, 0.92); clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.tip .cond { width: 22px; height: 22px; }
body.no-hover .tip { display: none !important; }

/* ---------- notices ---------- */
.notice {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 116px; margin: 0 auto;
  width: fit-content; max-width: calc(100vw - 32px); min-height: 36px; padding: 8px 14px; border-radius: 18px;
  text-align: center; background: var(--notice); color: #fff; font-size: 14px; font-weight: 500; line-height: 20px; box-shadow: var(--glow); text-wrap: balance;
}
.notice a, .notice strong { color: var(--link); font-weight: 700; }
.notice:not([hidden]) { animation: notice-in 0.225s ease-out both; }
.dots { display: inline-flex; gap: 3px; margin-left: 4px; vertical-align: middle; }
.dots i { display: block; width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: dot-blink 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
.error {
  position: fixed; z-index: 25; left: 0; right: 0; top: 50%; margin: 0 auto; transform: translateY(-50%);
  width: min(340px, calc(100vw - 32px)); padding: 24px 20px 20px; text-align: center;
}
.error strong { display: block; font-size: 18px; font-weight: 700; line-height: 1.3; letter-spacing: -0.1px; text-wrap: balance; }
.error p { margin: 10px 0 18px; font-size: 15px; line-height: 1.45; color: var(--text-2); text-wrap: pretty; }

/* ---------- markers ---------- */
.pin {
  width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); cursor: default;
}
.me { position: relative; width: 16px; height: 16px; cursor: default; }
.me::before {
  content: ""; position: absolute; inset: 0; z-index: 1; border-radius: 50%;
  background: var(--accent); border: 2.5px solid #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
}
.me::after {
  content: ""; position: absolute; inset: -11px; z-index: 0; border-radius: 50%;
  background: rgba(10, 132, 255, 0.3); animation: me-pulse 2s ease-out infinite;
}

/* ---------- attribution ---------- */
.attrib {
  position: fixed; z-index: 4; left: 0; right: 0; bottom: 8px; margin: 0 auto;
  width: fit-content; max-width: calc(100vw - 264px); padding: 1px 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center;
  font-size: 10px; line-height: 12px; color: var(--text-2); text-shadow: var(--label-shadow);
}
.attrib:empty { display: none; }
.attrib a { color: inherit; text-decoration: none; }
.attrib a:hover { text-decoration: underline; }

/* ---------- CSS tooltips for [data-tip]: desktop pointers only ---------- */
[data-tip] { position: relative; }
@media (hover: hover) and (pointer: fine) {
  body:not(.no-hover) [data-tip]::before, body:not(.no-hover) [data-tip]::after {
    position: absolute; z-index: 60; opacity: 0; pointer-events: none; transition: opacity 0.125s ease;
  }
  body:not(.no-hover) [data-tip]::after {
    content: attr(data-tip); padding: 4px 10px; border-radius: 8px; background: var(--notice); color: #fff;
    font-size: 13px; font-weight: 700; line-height: 18px; letter-spacing: 0; white-space: nowrap; text-transform: none;
  }
  body:not(.no-hover) [data-tip]::before { content: ""; width: 8px; height: 8px; border-radius: 1px; background: var(--notice); }
  body:not(.no-hover) [data-tip]:hover::before, body:not(.no-hover) [data-tip]:hover::after,
  body:not(.no-hover) [data-tip]:focus-visible::before, body:not(.no-hover) [data-tip]:focus-visible::after { opacity: 1; transition-delay: 0.15s; }

  /* toolbar: to the left of the button */
  body:not(.no-hover) .toolbar [data-tip]::after { right: calc(100% + 10px); top: 50%; transform: translateY(-50%); }
  body:not(.no-hover) .toolbar [data-tip]::before { right: calc(100% + 6px); top: 50%; margin-top: -4px; transform: rotate(45deg); }
  /* clock and bottom-right controls: above, with --tip-gap = distance from the button's top edge to the tooltip */
  body:not(.no-hover) .clock [data-tip]::after, body:not(.no-hover) .controls [data-tip]::after {
    bottom: calc(100% + var(--tip-gap, 10px)); left: 50%; transform: translateX(-50%);
  }
  body:not(.no-hover) .clock [data-tip]::before, body:not(.no-hover) .controls [data-tip]::before {
    bottom: calc(100% + var(--tip-gap, 10px) - 4px); left: 50%; margin-left: -4px; transform: rotate(45deg);
  }
  .clock-play { --tip-gap: 21px; }
  .clock-now { --tip-gap: 25px; }
  .clock-unit .down { --tip-gap: 53px; }
  /* the controls hug the right screen edge, so their tooltip is right-aligned instead of centred */
  body:not(.no-hover) .controls [data-tip]::after { left: auto; right: 0; transform: none; }
  body:not(.no-hover) .controls [data-tip]::before { left: auto; right: 16px; margin-left: 0; }
}

/* ---------- in-between widths ---------- */
/* iPad portrait and small windows (desktop layout, under 914px): the 320px legend would run into the centred clock,
   so it moves up above the clock row */
@media (min-width: 680px) and (max-width: 913px) {
  .legend { bottom: 112px; }
  .notice { bottom: 144px; }
  .place, .sheet { --panel-keep: 188px; }
}
/* very narrow phones: the 246px clock sits left so it clears the right-hand buttons */
@media (max-width: 349px) {
  .clock { left: var(--ml); right: auto; margin: 0; }
}
/* very narrow phones: the place panel is only ~215px wide, so the day table drops its meter column */
@media (max-width: 339px) {
  .days .c-bar { display: none; }
  .days .c-day { width: 30%; }
  .days .c-icon { width: 15%; }
  .days .c-chance { width: 30%; }
  .days .c-mm { width: 25%; }
}

/* ======================================================================================================
   Mobile: (max-width: 679px), (max-height: 569px). Overrides the desktop rules above.
   ====================================================================================================== */
@media (max-width: 679px), (max-height: 569px) {
  /* legend = blur strip across the very top; bar and labels sit in its bottom 22px */
  .legend {
    top: 0; left: 0; right: 0; bottom: auto; width: auto; height: calc(22px + var(--safe-top)); padding-top: var(--safe-top);
    background: var(--panel); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  }
  .legend-wrap { border-radius: 0; box-shadow: none; }
  @supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .legend { background: var(--panel-solid); }
  }

  /* logo: round dark button, icon only */
  .logo {
    top: calc(28px + var(--safe-top)); width: 40px; height: 40px; padding: 0; justify-content: center; gap: 0; border-radius: 50%;
    background: var(--panel-dark); -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .logo-icon { width: 34px; height: 34px; }
  .logo-text { display: none; }

  .toolbar { top: calc(28px + var(--safe-top)); }

  /* layers: popover above the bottom-right controls, opened by #btn-layers */
  .layers { display: none; }
  body.layers-open .layers {
    display: block; z-index: 12; left: auto; top: auto; right: var(--mr); bottom: calc(108px + var(--safe-bottom));
    width: 200px; max-height: calc(100% - 160px); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  }
  .layers-head .chev { display: none; }
  body.layers-min .layers { padding-bottom: 8px; }
  body.layers-min .layers-sub { display: block; }
  body.layers-min .menu-item[aria-checked="false"] { display: block; }

  .controls { bottom: calc(20px + var(--safe-bottom)); }
  .controls .zoom { display: none; }
  #btn-layers { display: grid; }
  #btn-clouds { border-radius: 20px 20px 0 0; }
  .clock { bottom: calc(20px + var(--safe-bottom)); }

  /* place panel: centred between the logo button and the toolbar */
  .place {
    left: 0; right: 0; margin: 0 auto; top: calc(28px + var(--safe-top));
    width: min(340px, calc(100vw - 2 * (46px + var(--side))));
    max-height: calc(100% - 28px - var(--safe-top) - 146px - var(--safe-bottom));
  }
  .place-head { cursor: pointer; }

  /* search + about: full-screen sheets that slide up */
  .sheet {
    inset: 0; z-index: 20; width: auto; max-height: none; border-radius: 0;
    padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(16px + var(--safe-left));
    animation: sheet-up 0.45s cubic-bezier(0.25, 1, 0.5, 1) both;
  }
  .sheet > * { max-width: 560px; margin-left: auto; margin-right: auto; }

  .model, .coord, .maplibregl-ctrl-bottom-right { display: none; }
  .attrib { bottom: calc(4px + var(--safe-bottom)); max-width: calc(100vw - 24px); font-size: 9px; line-height: 11px; }
  .notice { bottom: calc(100px + var(--safe-bottom)); }
}
/* landscape phones: the popover steps left of the right-hand button column so it never covers the toolbar;
   from 766px wide it also clears the centred clock, so it may use the full height */
@media (max-height: 569px) {
  body.layers-open .layers { right: calc(var(--mr) + 46px); }
}
@media (max-height: 569px) and (min-width: 766px) {
  body.layers-open .layers { bottom: calc(20px + var(--safe-bottom)); max-height: calc(100% - 28px - var(--safe-top) - 20px - var(--safe-bottom)); }
}

/* very short viewports (landscape phone with browser bars): tighter toolbar so it clears the bottom-right buttons */
@media (max-height: 329px) {
  .toolbar { gap: 4px; }
  .toolbar, .logo { top: calc(24px + var(--safe-top)); }
}

/* ---------- animations ---------- */
@keyframes notice-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes dot-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@keyframes me-pulse { from { transform: scale(0.4); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  .dots i { opacity: 0.6; }
  .me::after { opacity: 0.5; transform: none; }
}
