/* Layout: full-bleed pannable map under floating chrome (season bar across the top, legend top left,
   conditions sheet at the bottom). The chart style skins the chrome through tokens. */
:root {
  /* top of the floating chrome: the safe area, plus the season bar where the app shows one */
  --top: env(safe-area-inset-top, 0px);
  /* side insets: the notch and rounded corners of a phone held sideways */
  --sl: env(safe-area-inset-left, 0px);
  --sr: env(safe-area-inset-right, 0px);
  color-scheme: dark;
  --ui: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --fell: "IM Fell English", "Iowan Old Style", Georgia, serif;
  --glass: rgba(16, 28, 36, .78);
  --glass-line: rgba(255, 255, 255, .14);
  --fg: #f2f4f7;
  --muted: #a9b6c3;
  --chip: rgba(255, 255, 255, .1);
  --chip-on: #f2f4f7;
  --chip-on-fg: #0d1a22;
  --lbl: #ffffff;
  --lbl-halo: rgba(14, 22, 30, .9);
  --lbl-font: var(--serif);
  --water-lbl: #cfe6ee;
  --pin-bg: rgba(14, 22, 30, .9);
  --pin-fg: #ffffff;
  --sun: #f0c66e;
  --fog: #cfd6df;
  --coast: #0e2c36;
  --road: rgba(70, 46, 16, .7);
  --bg: #0b2c39;
}
html[data-mode="chart"] {
  color-scheme: light;
  --glass: rgba(240, 231, 206, .92);
  --glass-line: rgba(60, 48, 30, .35);
  --fg: #2a2418;
  --muted: #6b5d45;
  --chip: rgba(60, 48, 30, .08);
  --chip-on: #2f3a4c;
  --chip-on-fg: #f3ead2;
  --lbl: #2b2419;
  --lbl-halo: rgba(236, 225, 196, .95);
  --lbl-font: var(--fell);
  --water-lbl: #2f5866;
  --pin-bg: #f6efd9;
  --pin-fg: #2a2418;
  --coast: #3b3022;
  --road: rgba(140, 48, 36, .75);
  --bg: #e6dbbd;
  --sun: #e0a93a;
  --fog: #8d97ab;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--fg); font-family: var(--ui); }
/* no double-tap zoom anywhere (quick taps on play or zoom must not zoom the page) */
body { overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
/* the floating chrome: a pinch or drag that starts on it does nothing, rather than zoom or scroll the page */
.seasonbar, .legend, .sheet, .zoom, .roundbtn { touch-action: none; }
button { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid #7fc4ff; outline-offset: 2px; }

#stage { position: fixed; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
#stage.dragging { cursor: grabbing; }
.map { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.map canvas, .map svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map svg { pointer-events: none; }
.labels { position: absolute; inset: 0; pointer-events: none; }

/* place labels */
.lbl { position: absolute; transform: translate(9px, -50%); white-space: nowrap; font-family: var(--lbl-font);
  font-style: italic; font-size: 15px; letter-spacing: .07em; text-transform: uppercase; color: var(--lbl);
  text-shadow: 0 0 4px var(--lbl-halo), 0 0 2px var(--lbl-halo), 0 0 1px var(--lbl-halo); }
.lbl.big { font-size: 20px; }
.lbl.r { transform: translate(calc(-100% - 9px), -50%); }
.dot { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%;
  background: var(--fog); box-shadow: 0 0 0 1.5px var(--lbl-halo); transition: background .3s; }
.dot.sun { background: var(--sun); }
html[data-mode="chart"] .lbl { font-style: normal; text-transform: none; letter-spacing: .02em; font-size: 16px; }
html[data-mode="chart"] .lbl.big { font-size: 21px; letter-spacing: .08em; text-transform: uppercase; }
.feat { display: none; position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font-family: var(--fell);
  font-style: italic; color: var(--water-lbl); text-shadow: 0 0 3px var(--lbl-halo); font-size: 16px; }
.feat.sea { font-size: 30px; letter-spacing: .32em; font-style: normal; }
.feat.cape, .feat.region { color: var(--lbl); }
.feat.region { font-size: 18px; letter-spacing: .25em; text-transform: uppercase; font-style: normal; opacity: .75; }
html[data-mode="chart"] .feat { display: block; }

/* NWS station pins */
.pin { position: absolute; transform: translate(-50%, calc(-100% - 8px)); display: flex; align-items: center; gap: 6px;
  padding: 4px 9px 4px 5px; border-radius: 999px; background: var(--pin-bg); color: var(--pin-fg);
  font: 600 12px/1.15 var(--ui); white-space: nowrap; box-shadow: 0 3px 10px rgba(0,0,0,.3); }
.pin::after { content: ""; position: absolute; left: 50%; bottom: -5px; margin-left: -5px; border: 5px solid transparent;
  border-top-color: var(--pin-bg); border-bottom: 0; }
.pin .ic { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; flex: none;
  background: var(--fog); color: #1b2530; }
.pin .ic.sun { background: var(--sun); }
.pin .tx { font-weight: 500; opacity: .78; }
.pin .vis { font-weight: 500; opacity: .78; }
html[data-mode="chart"] .pin { border: 1px solid rgba(60,48,30,.45); font-family: var(--fell); font-weight: 400; font-size: 13px; }
.pin[hidden] { display: none; }
.stn { position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; transform: rotate(45deg);
  background: var(--pin-bg); border: 1.5px solid var(--pin-fg); }

/* chrome */
/* legend, top left, drawn as a chart cartouche: the brand, the region (tap to switch), the fog the
   map shows, and the Art / Satellite view */
.legend { position: fixed; z-index: 10; left: calc(var(--sl) + 14px); top: calc(var(--top) + 12px); width: max-content; min-width: 250px; max-width: calc(100vw - 96px); padding: 10px 16px 12px;
  display: grid; justify-items: center; gap: 2px; text-align: center; font-family: var(--fell); color: #2f3a4c;
  background: #f1e7cb; border: 1.4px solid #2f3a4c; box-shadow: inset 0 0 0 5px #f1e7cb, inset 0 0 0 5.6px #2f3a4c; }
.legend p { margin: 0; }
.lg-brand { font-style: italic; font-size: 19px; line-height: 1; color: var(--muted); }
.lg-region { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 2px 8px 0 12px; margin-top: -2px; border: 0; border-radius: 6px;
  background: none; cursor: pointer; font: 400 24px/1 var(--fell); letter-spacing: 2.5px; color: inherit; white-space: nowrap; }
/* Touch targets: small controls keep their drawn size and get an invisible hit area of at least 44px */
.lg-region::after, .viewtoggle button::after, .ranges button::after, .play::after, .status .retry::after, .sb-fog::after {
  content: ""; position: absolute; z-index: 1; }
.lg-region::after { inset: -4px 0; }
.viewtoggle button, .ranges button, .play, .status .retry { position: relative; }
.viewtoggle button::after, .ranges button::after { inset: -9px 0; }
/* the pills' outer buttons reach out sideways too, so "2H" and "Art" are 44px wide to the touch */
.viewtoggle button:first-child::after { left: -4px; }
.ranges button:first-child::after { left: -10px; }
.ranges button:last-child::after { right: -6px; }
.play::after { inset: -8px; border-radius: 50%; }
.status .retry::after { inset: -10px -4px; }
.legend.long .lg-region { font-size: 19px; letter-spacing: 2px; }
.lg-region svg { flex: none; width: 14px; height: 14px; margin-bottom: 3px; opacity: .8; }
.lg-region:hover { background: var(--chip); }
.lg-region[aria-expanded="true"] svg { transform: rotate(180deg); }
.lg-sub { font-style: italic; font-size: 14.5px; line-height: 1.2; }
.legend .lg-key { display: flex; align-items: center; gap: 7px; margin-top: 3px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.lg-swatch { width: 22px; height: 11px; border-radius: 6px; background: rgba(108, 120, 149, .7); box-shadow: inset 0 0 0 1px rgba(47, 58, 76, .35); }
/* region tabs: always visible, one tap to switch */
.regions { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); margin-right: auto; }
.regions a { display: grid; place-items: center; padding: 8px 14px; min-height: 36px; border-radius: 999px; font-size: 13px; font-weight: 500;
  color: var(--muted); text-decoration: none; white-space: nowrap; }
.regions a:hover { color: var(--fg); background: var(--chip); }
.regions a[aria-current="page"] { background: var(--chip-on); color: var(--chip-on-fg); }
.regions .short { display: none; }

.roundbtn { position: fixed; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--glass-line); background: var(--glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: grid; place-items: center; cursor: pointer; color: var(--fg); }
.recenter { right: calc(var(--sr) + 16px); top: calc(var(--top) + 12px); }
.zoom { position: fixed; right: calc(var(--sr) + 16px); top: calc(var(--top) + 70px); display: grid; gap: 8px; }
.zoom .roundbtn { position: static; width: 44px; height: 44px; }
/* Art / Satellite toggle, at the foot of the legend */
.viewtoggle { margin-top: 8px; padding-top: 9px; border-top: .6px solid rgba(47, 58, 76, .45); width: 100%; display: flex; justify-content: center; }
.viewtoggle .seg, .ranges { display: flex; padding: 2px; gap: 2px; border-radius: 999px; background: var(--chip); border: 1px solid var(--glass-line); }
.viewtoggle button, .ranges button { border: 0; background: none; padding: 5px 12px; min-height: 28px; border-radius: 999px; font: 600 12px/1 var(--ui);
  color: var(--muted); cursor: pointer; }
.viewtoggle button[aria-pressed="true"], .ranges button[aria-checked="true"] { background: var(--chip-on); color: var(--chip-on-fg); }
.legend .satcap { margin-top: 5px; font: 11.5px/1.2 var(--ui); color: var(--muted); }

/* After dark: a note across the middle of the map, centred between the top chrome and the sheet, on a soft
   patch of the fog colour (fog.js FOG_RGB) rather than a card, in light text. Three z's drift up above it.
   It never takes a tap or a drag from the map. */
.sleep { position: fixed; z-index: 5; left: 50%; top: calc((var(--top) + 100dvh - var(--sleep-sheet-h, var(--sheet-h, 110px)) - 10px) / 2);
  transform: translate(-50%, -50%); width: min(560px, calc(100vw - 8px)); padding: 60px 76px 66px; text-align: center;
  pointer-events: none; --sl-fg: #fbf6e8; --sl-muted: rgba(251, 246, 232, .82); color: var(--sl-fg); text-shadow: 0 1px 3px rgba(38, 46, 66, .35);
  background: radial-gradient(closest-side, rgba(108, 120, 149, .94) 62%, rgba(108, 120, 149, .6) 82%, transparent); animation: sleep-in .8s ease-out both; }
.sleep[hidden] { display: none; }
.sl-head { margin: 0; font: italic 27px/1.15 var(--fell); }
.sl-body { margin: 8px auto 0; max-width: 320px; font: italic 16px/1.35 var(--fell); color: var(--sl-muted); text-wrap: balance; }
.sl-hours { margin: 12px 0 0; font: 12.5px/1.5 var(--ui); color: var(--sl-muted); font-variant-numeric: tabular-nums; }
.sl-hours:empty { display: none; }
.sl-hours b { color: var(--sl-fg); font-weight: 600; }
.zzz { position: relative; width: 90px; height: 80px; margin: 0 auto 2px; }
.zzz i { position: absolute; left: 34px; bottom: 0; font: italic 30px/1 var(--fell); color: var(--sl-fg); opacity: 0;
  animation: zfloat 4.2s ease-in-out infinite; }
.zzz i:nth-child(2) { animation-delay: 1.4s; }
.zzz i:nth-child(3) { animation-delay: 2.8s; }
/* each z rises on an S, growing and tilting side to side as it goes, and fades out at the top */
@keyframes zfloat {
  0% { opacity: 0; transform: translate(0, 0) scale(.45) rotate(-10deg); }
  15% { opacity: .95; }
  35% { transform: translate(16px, -24px) scale(.7) rotate(8deg); }
  65% { transform: translate(-6px, -50px) scale(.95) rotate(-8deg); }
  80% { opacity: .8; }
  100% { opacity: 0; transform: translate(20px, -78px) scale(1.2) rotate(10deg); }
}
@keyframes sleep-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .sleep { animation: none; }
  .zzz i { animation: none; opacity: .85; }
  .zzz i:nth-child(1) { transform: translate(-14px, -4px) scale(.55); }
  .zzz i:nth-child(2) { transform: translate(4px, -26px) scale(.8); }
  .zzz i:nth-child(3) { transform: translate(20px, -52px) scale(1.05); }
}
@media (max-width: 520px) {
  .sleep { padding: 46px 40px 50px; }
  .sl-head { font-size: 23px; }
  .sl-body { font-size: 15px; }
}

/* conditions sheet: one line of conditions, one row of controls, one line of credits */
.sheet { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  width: min(500px, calc(100% - 24px)); padding: 9px 14px 8px; border-radius: 18px; background: var(--glass);
  border: 1px solid var(--glass-line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.status { margin: 0; font-size: 13.5px; line-height: 1.3; font-weight: 500; text-wrap: balance; }
.status b { font-weight: 700; }
.status .retry { margin-left: 4px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--glass-line); background: var(--chip);
  font-size: 13px; font-weight: 600; cursor: pointer; }
.meta .badge { display: inline-block; margin-left: 6px; padding: 1px 7px 2px; border-radius: 999px; background: #8a5a2b; color: #fbf3df;
  font-size: 9.5px; letter-spacing: .14em; vertical-align: 1px; }
.notice { margin: -2px 0 0; font-size: 12px; color: var(--muted); }
.ctl { display: flex; align-items: center; gap: 10px; }
.clock { flex: none; display: grid; gap: 2px; }
.meta { font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.time { font-family: var(--serif); font-style: italic; font-size: 21px; line-height: 1; font-variant-numeric: tabular-nums; }
html[data-mode="chart"] .time { font-family: var(--fell); }
.ranges { flex: none; }
.ranges button { padding: 5px 9px; }
.play:disabled { opacity: .4; cursor: default; }
.play { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--glass-line); background: var(--chip); display: grid;
  place-items: center; cursor: pointer; flex: none; }
/* drawn 22px tall, touched 44px tall (the negative margin keeps the row's height) */
#scrub { flex: 1; width: 0; min-width: 0; accent-color: var(--chip-on); height: 44px; margin: -11px 0; }
.attrib { margin: 0; font-size: 9.5px; line-height: 1.3; color: var(--muted); }

@media (max-width: 760px) {
  .regions .full { display: none; }
  .regions .short { display: inline; }
}
@media (max-width: 520px) {
  .pin .tx { display: none; }
  .lbl.minor { display: none; }
}
/* live map labels (app.js): one curated label set per region, decluttered in labels.js.
   A paper-coloured knockout stroke behind every glyph keeps text legible on fog and on clear ground. */
:root { --icon-bg: rgba(246, 239, 217, .96); --marine: #3f6474; --knock: rgba(240, 231, 206, .96); }
.mk { transition: opacity .18s; }
html:not(.based) .mk { opacity: 0 !important; } /* until the base map is in under them (revealLabels, app.js); MapLibre sets an inline opacity */
.mk.off { opacity: 0; visibility: hidden; }
.mk .lbl, .mk .feat, .apt .code { -webkit-text-stroke: 4px var(--knock); paint-order: stroke fill;
  text-shadow: 0 0 6px var(--knock), 0 0 3px var(--knock); }
html[data-mode="chart"] .mk.town .lbl { transform: translate(14px, -50%); font-size: 16px; letter-spacing: .02em; }
html[data-mode="chart"] .mk.town .lbl.big { font-size: 19px; }
html[data-mode="chart"] .mk.town .lbl.r { transform: translate(calc(-100% - 14px), -50%); }
.mk .cond { position: absolute; left: 0; top: 0; width: 20px; height: 20px; margin: -10px 0 0 -10px;
  filter: drop-shadow(0 1px 1.5px rgba(40, 30, 15, .35)); }
.mk .cond svg { display: block; width: 100%; height: 100%; }
.mk .feat.marine { font-family: var(--fell); font-style: italic; color: var(--marine); font-size: 16px; letter-spacing: .03em; }
.mk .feat.marine.big { font-size: 24px; letter-spacing: .3em; }
.mk .feat.geographic { font-family: "IM Fell English SC", var(--fell); font-style: normal; color: var(--lbl);
  font-size: 15px; letter-spacing: .16em; opacity: 1; text-transform: none; }
.mk .feat.geographic.big { font-size: 18px; letter-spacing: .3em; }
@media (prefers-reduced-motion: reduce) { .dot, .mk { transition: none; } }

/* season bar, "Typical fog season": twelve months across the top, the fog season in the fog colour over a
   summer-yellow year, a plain line at today, sunrise and sunset on the right */
.seasonbar { position: fixed; z-index: 11; left: 0; right: 0; top: 0; padding: calc(env(safe-area-inset-top, 0px) + 7px) calc(var(--sr) + 16px) 7px calc(var(--sl) + 16px);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px 14px;
  background: var(--glass); border-bottom: 1px solid var(--glass-line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.sb-head { margin: 0; font: 600 10.5px/1 var(--ui); letter-spacing: .18em; text-transform: uppercase; color: var(--fg); white-space: nowrap; }
.sb-track { position: relative; height: 22px; border-radius: 5px; background: #e6c573; box-shadow: inset 0 0 0 1px rgba(60, 48, 30, .22); }
.sb-fog { position: absolute; top: 0; bottom: 0; background: #7d88a1; cursor: help; }
.sb-fog.l { border-top-left-radius: 5px; border-bottom-left-radius: 5px; }
.sb-fog.r { border-top-right-radius: 5px; border-bottom-right-radius: 5px; }
.sb-fog:focus-visible { outline: 2px solid #2f3a4c; outline-offset: 1px; }
.sb-fog::after { inset: -11px 0; }
.sb-month { position: absolute; top: 0; bottom: 0; display: grid; place-items: center; pointer-events: none;
  font: 600 10.5px/1 var(--ui); color: #6b5426; border-left: 1px solid rgba(255, 252, 240, .5); }
.sb-month:first-child, .sb-fog + .sb-month { border-left: 0; } /* January: the fog bands come first in the track */
.sb-month.fog { color: #f6f1e2; }
.sb-mark { position: absolute; top: -11px; bottom: -11px; width: 44px; margin-left: -22px; padding: 0; border: 0; background: none; cursor: pointer; z-index: 2; }
.sb-mark::before { content: ""; position: absolute; left: 21px; top: 7px; bottom: 7px; width: 2px; border-radius: 1px; background: var(--fg); }
.sb-tip { position: absolute; top: 28px; transform: translateX(-50%); padding: 4px 9px; border-radius: 6px; background: var(--chip-on); color: var(--chip-on-fg);
  font: 600 11.5px/1.2 var(--ui); white-space: nowrap; z-index: 3; pointer-events: none; box-shadow: 0 4px 14px rgba(40, 30, 15, .2); }
.sb-sun { font-size: 11.5px; line-height: 1.25; color: var(--fg); white-space: nowrap; }
.sb-sun .muted { color: var(--muted); }
@media (max-width: 700px) {
  .seasonbar { grid-template-columns: auto minmax(0, 1fr); }
  .sb-sun { text-align: right; overflow: hidden; text-overflow: ellipsis; }
  .sb-track { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 440px) { .sb-sun .muted { display: none; } }

/* region picker: dropdown under the legend's region name on desktop, bottom sheet on phones */
.pk-scrim { position: fixed; inset: 0; z-index: 19; background: rgba(30, 24, 14, .18); }
.picker { position: fixed; z-index: 20; left: calc(var(--sl) + 16px); top: var(--pk-top, calc(var(--top) + 64px)); width: min(400px, calc(100vw - 32px)); max-height: calc(100vh - var(--top) - 90px);
  max-height: calc(100dvh - var(--top) - 90px); overflow: auto; overscroll-behavior: contain; touch-action: pan-y; padding: 14px 16px 12px; border-radius: 20px; background: rgba(244, 237, 216, .98);
  border: 1px solid var(--glass-line); box-shadow: 0 18px 50px rgba(40, 30, 15, .28); color: var(--fg); }
.pk-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.pk-head b { font-family: var(--fell); font-weight: 400; font-size: 20px; }
.pk-close { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--glass-line); background: var(--chip); font-size: 20px; line-height: 1; cursor: pointer; }
.pk-locate { width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid var(--glass-line); background: var(--chip-on); color: var(--chip-on-fg);
  font-weight: 600; font-size: 13.5px; cursor: pointer; }
.pk-msg { margin: 8px 2px 0; font-size: 12.5px; color: var(--muted); }
.picker section { margin-top: 12px; }
.picker h3 { margin: 0 0 4px; font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.picker ul { list-style: none; margin: 0; padding: 0; }
.pk-row { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 8px 10px; border-radius: 10px; border: 0; background: none; text-align: left;
  color: inherit; text-decoration: none; font: inherit; cursor: pointer; }
.pk-row:hover, .pk-row:focus-visible { background: var(--chip); }
.pk-row.current { background: var(--chip); box-shadow: inset 3px 0 0 var(--chip-on); }
.pk-name { font-size: 15px; font-weight: 600; }
.pk-meta { font-size: 12px; color: var(--muted); }
.pk-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px #8d97ab; vertical-align: 1px; }
.pk-dot.on { background: #5f6b85; box-shadow: none; }
.picker[hidden], .pk-scrim[hidden] { display: none; }
.pk-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--glass-line); }
.pk-default { min-height: 44px; padding: 6px 4px; border: 0; background: none; font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--fg); }
@media (max-width: 600px) {
  .picker { left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: 82vh; max-height: 82dvh; border-radius: 22px 22px 0 0;
    padding: 14px calc(var(--sr) + 16px) calc(env(safe-area-inset-bottom, 0px) + 14px) calc(var(--sl) + 16px); }
}

/* Phones (upright or sideways): the chrome shrinks to what is read at a glance, so the map gets the screen.
   The legend is one line, the brand and the region to switch to; the fog key goes, and Art / Satellite moves
   to a round button under the zoom. The conditions sheet keeps its sentence and its controls; the credits
   fold behind an (i) button in its corner. */
.viewbtn, .infobtn { display: none; }
.viewbtn { right: calc(var(--sr) + 16px); top: calc(var(--top) + 178px); width: 44px; height: 44px; font: 600 11px/1 var(--ui); letter-spacing: .06em; }
.viewbtn[aria-pressed="true"] { background: var(--chip-on); color: var(--chip-on-fg); border-color: var(--chip-on); }
.infobtn { position: absolute; top: 7px; right: 8px; width: 22px; height: 22px; padding: 0; place-items: center; border-radius: 50%;
  border: 1px solid var(--glass-line); background: var(--chip); color: var(--muted); font: italic 600 13px/1 var(--fell); cursor: pointer; }
.infobtn::after { content: ""; position: absolute; inset: -12px; z-index: 2; }
.infobtn[aria-expanded="true"] { background: var(--chip-on); color: var(--chip-on-fg); }
.attrib a { color: inherit; }
.mapcredit { display: none; }
@media (max-width: 520px), (max-height: 500px) and (orientation: landscape) {
  .legend { left: calc(var(--sl) + 10px); min-width: 0; padding: 6px 12px 6px 14px; grid-template-columns: auto auto; align-items: center;
    column-gap: 6px; box-shadow: inset 0 0 0 3px #f1e7cb, inset 0 0 0 3.6px #2f3a4c; }
  .lg-brand { font-size: 15px; }
  .lg-region { font-size: 17px; letter-spacing: 1.5px; min-height: 34px; padding: 1px 2px 0 4px; margin: 0; }
  .lg-region::after { inset: -5px -4px; }
  .legend.long .lg-region { font-size: 14px; letter-spacing: 1px; }
  .lg-sub, .legend .lg-key, .viewtoggle { display: none; }
  .legend .satcap { grid-column: 1 / -1; margin: 0 0 2px; }
  .viewbtn, .infobtn { display: grid; }
  .sheet { padding: 7px 12px 8px; gap: 5px; }
  .status { padding-right: 24px; font-size: 13px; }
  .sheet:not(.credits-open) .attrib { display: none; }
  /* one (i): the map's own credit joins the sheet's credits */
  .mapcredit { display: inline; }
  .maplibregl-map .maplibregl-ctrl-bottom-right { display: none; }
  /* a long "60 min ago Delayed" wraps rather than squeeze the scrubber away */
  .meta { white-space: normal; max-width: 112px; }
  #scrub { min-width: 56px; }
}
/* Phones held sideways: too short to stack the legend over the conditions sheet, so the sheet moves to the
   bottom-right corner, clear of the legend */
@media (max-height: 500px) and (orientation: landscape) {
  .sheet { left: auto; right: calc(var(--sr) + 12px); transform: none; width: min(440px, calc(100% - var(--sl) - var(--sr) - 300px)); }
}
