/* Air Quality Index map — apparentlogic.com/aqi/map/. Tokens are the Air Quality page's (aqi/style.css). */

:root {
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    system-ui, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --card: #ffffff;
  --ink: #1d1d1f;
  --ink-2: #58585c;
  --ink-3: #86868b;
  --line: rgba(0, 0, 0, 0.11);
  --line-soft: rgba(0, 0, 0, 0.06);
  --accent: #14803a;
  --accent-fill: #27bd4a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05), 0 6px 20px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.08), 0 10px 30px rgba(0, 0, 0, 0.12);
  --nav-bg: rgba(255, 255, 255, 0.78);
  --glass: rgba(255, 255, 255, 0.86);

  /* 60 px inside the bar's 1 px bottom border gives Apple's 40 px badge its ¼-height (10 px) clear
     space above and below; phones use 57 px (8 px), which Apple allows for very limited layouts
     (1/10 of the height). */
  --topbar-h: 61px;
  --edge: 12px;
  --timeline-h: 76px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* The map's bottom padding is the timeline plus 24 px (map.mjs); MapKit draws its Apple Maps logo
     and Legal link just above it. Nothing of the page's may cover that band. */
  --mapkit-clear: calc(var(--timeline-h) + 24px + 40px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-alt: #0b0b0d;
    --card: #141416;
    --ink: #f5f5f7;
    --ink-2: #a8a8ad;
    --ink-3: #86868b;
    --line: rgba(255, 255, 255, 0.14);
    --line-soft: rgba(255, 255, 255, 0.08);
    --accent: #67e95a;
    --accent-fill: #34c759;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.5);
    --nav-bg: rgba(12, 12, 14, 0.72);
    --glass: rgba(22, 22, 24, 0.86);
  }
}

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

html,
body {
  height: 100%;
  margin: 0;
}

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

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.4;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent-fill);
  outline-offset: 2px;
  border-radius: 6px;
}

[hidden] {
  display: none !important;
}

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

/* ---------- Top bar ---------- */

.topbar {
  position: relative;
  z-index: 30;
  flex: 0 0 auto;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}

.brand-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-page {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 1 auto;
  min-width: 0;
}

.tb-button {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
}

.tb-button:hover,
.tb-button[aria-expanded="true"] {
  border-color: var(--ink-3);
}

.tb-button {
  white-space: nowrap;
  flex: 0 0 auto;
}

.tb-narrow {
  display: none;
}

.tb-icon {
  appearance: none;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.tb-icon svg,
.search-go svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.tb-icon[aria-expanded="true"] {
  border-color: var(--ink-3);
}

/* Apple's badge, unaltered, at its 40 px onscreen minimum; the bar's padding keeps its clear space. */
.tb-badge {
  flex: 0 0 auto;
  display: block;
  line-height: 0;
  border-radius: 8px;
}

.tb-badge img {
  display: block;
  width: 120px;
  height: 40px;
}

/* ---------- Place search ---------- */

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 260px;
  min-width: 160px;
}

.search-input {
  width: 100%;
  height: 34px;
  padding: 0 38px 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  -webkit-appearance: none;
  appearance: none;
}

.search-input::placeholder {
  color: var(--ink-3);
}

.search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-input:focus-visible {
  outline: 2px solid var(--accent-fill);
  outline-offset: 0;
}

.search-go {
  appearance: none;
  position: absolute;
  right: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}

.search-go:hover {
  color: var(--ink);
}

.search[aria-busy="true"] .search-go {
  opacity: 0.5;
}

.search-status:empty {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.search-status {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 1;
  margin: 0;
  padding: 8px 12px;
  font-size: 0.8125rem;
  color: var(--ink-2);
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

/* As the bar narrows, the name (then the page label) is hidden from sight only, so the link is
   still read as "Air Quality Index Map"; "What the app adds" shortens to "The app"; and below 720 px
   the search field moves behind a button and opens as a row under the bar. */
@media (max-width: 960px) {
  .brand-name {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .tb-wide {
    display: none;
  }

  .tb-narrow {
    display: inline;
  }
}

@media (max-width: 720px) {
  :root {
    --topbar-h: 57px;
  }

  .topbar-actions {
    gap: 8px;
  }

  .tb-icon {
    display: grid;
  }

  .search {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 8px max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
    background: var(--nav-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line-soft);
  }

  .search.is-open {
    display: flex;
  }

  .search-input {
    height: 38px;
    font-size: 1rem;
  }

  .search-go {
    right: max(15px, calc(env(safe-area-inset-right) + 3px));
  }

  .search-status {
    left: 12px;
    right: 12px;
  }

  .tb-button {
    padding: 6px 11px;
  }
}

@media (max-width: 420px) {
  .topbar {
    gap: 8px;
  }

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

@media (max-width: 400px) {
  .topbar {
    gap: 6px;
    padding: 0 max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
  }

  .topbar-actions {
    gap: 6px;
  }

  .tb-button {
    padding: 6px 10px;
  }
}

@media (max-width: 359px) {
  .brand {
    display: none;
  }

  .tb-button {
    padding: 6px 8px;
  }
}

/* ---------- Stage and map ---------- */

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--bg-alt);
}

.map {
  position: absolute;
  inset: 0;
}

.card {
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
}

.map-message,
.noscript {
  position: absolute;
  z-index: 25;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  max-width: min(420px, calc(100% - 2 * var(--edge)));
  padding: 16px 20px;
  text-align: center;
  font-size: 0.9375rem;
  background: var(--glass);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
}

.noscript p {
  margin: 0 0 8px;
}

.noscript p:last-child {
  margin: 0;
}

/* A short line above the band MapKit keeps for its logo: why the map opened on another layer. */
.map-note {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: calc(var(--mapkit-clear) + var(--safe-bottom) + 8px);
  transform: translateX(-50%);
  margin: 0;
  width: max-content;
  max-width: min(520px, calc(100% - 2 * var(--edge)));
  padding: 8px 14px;
  text-align: center;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--ink);
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

/* Empty, it stays in the page (a screen reader hears a line put into a region that was already
   there) but takes no room and shows nothing. */
.map-note:empty {
  padding: 0;
  border: 0;
  background: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
}

/* ---------- Timeline ---------- */

.timeline {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: calc(var(--edge) + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(760px, calc(100% - 2 * var(--edge)));
  min-height: var(--timeline-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px 10px;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

.timeline.is-single,
.timeline.is-empty {
  width: auto;
  max-width: calc(100% - 2 * var(--edge));
  min-height: 0;
  padding: 10px 16px;
}

.tl-play {
  appearance: none;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--accent-fill);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.tl-play svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.tl-play:hover {
  filter: brightness(1.08);
}

.tl-main {
  flex: 1 1 auto;
  min-width: 0;
}

.tl-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 20px;
}

.tl-label {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tl-status {
  color: var(--ink-2);
  font-size: 0.8125rem;
}

.tl-status:not(:empty)::before {
  content: "·";
  margin-right: 8px;
  color: var(--ink-3);
}

.tl-track {
  position: relative;
  padding-bottom: 12px;
}

.tl-range {
  display: block;
  width: 100%;
  margin: 4px 0 0;
  accent-color: var(--accent-fill);
  cursor: pointer;
}

.tl-now {
  position: absolute;
  bottom: 0;
  left: calc(8px + var(--now, 0) * (100% - 16px));
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  line-height: 1;
  pointer-events: none;
}

.tl-now::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 1px;
  height: 6px;
  background: var(--ink-3);
}

/* ---------- Legend ---------- */

/* Top left, under the top bar: the bottom left is MapKit's logo and Legal link. */
.legend {
  position: absolute;
  z-index: 10;
  left: calc(var(--edge) + env(safe-area-inset-left, 0px));
  top: var(--edge);
  width: min(300px, calc(100% - 2 * var(--edge)));
  max-height: calc(100% - var(--edge) - var(--mapkit-clear) - var(--safe-bottom));
  overflow: auto;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
}

.legend-toggle {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.legend-name {
  font-weight: 600;
  font-size: 0.875rem;
}

.legend-hint {
  margin-left: auto;
  color: var(--ink-3);
  font-size: 0.75rem;
}

.legend-body {
  padding: 0 14px 12px;
}

.lg-section + .lg-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.lg-title {
  margin: 0 0 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-2);
}

.lg-ramp {
  height: 10px;
  border-radius: 5px;
  box-shadow: inset 0 0 0 0.5px var(--line);
}

.lg-ramp-labels {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.6875rem;
  color: var(--ink-2);
}

.lg-unit {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.lg-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.lg-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}

.lg-row-range {
  margin-left: auto;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.lg-swatch {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 4px;
  box-shadow: inset 0 0 0 0.5px var(--line);
}

.lg-swatch--empty {
  box-shadow: inset 0 0 0 1px var(--ink-3);
}

.lg-symbol {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  background: var(--symbol);
}

.lg-symbol--circle {
  width: 10px;
  height: 10px;
  margin: 2px;
  border-radius: 50%;
}

.lg-symbol--triangle {
  clip-path: polygon(50% 8%, 96% 90%, 4% 90%);
}

.lg-note,
.lg-text {
  margin: 6px 0 0;
  font-size: 0.6875rem;
  color: var(--ink-3);
}

.lg-text {
  color: var(--ink-2);
  font-size: 0.75rem;
}

.lg-credit {
  margin: 12px 0 0;
  font-size: 0.6875rem;
  color: var(--ink-3);
}

/* ---------- Spot card ---------- */

.spot-pin {
  position: absolute;
  z-index: 14;
  left: -7px;
  top: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-fill);
  box-shadow: 0 0 0 2.5px #fff, 0 1px 6px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.spot {
  position: absolute;
  z-index: 15;
  left: 0;
  top: 0;
  width: min(300px, calc(100% - 2 * var(--edge)));
  padding: 12px 14px 12px;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  --arrow-x: 50%;
  --arrow-y: 50%;
}

.spot.is-offscreen {
  visibility: hidden;
}

.spot::after {
  content: "";
  position: absolute;
  left: calc(var(--arrow-x) - 7px);
  bottom: -7px;
  width: 14px;
  height: 14px;
  background: var(--glass);
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  transform: rotate(45deg);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
}

.spot.is-below::after {
  top: -7px;
  bottom: auto;
  transform: rotate(225deg);
}

.spot.is-right::after,
.spot.is-left::after {
  top: calc(var(--arrow-y) - 7px);
  bottom: auto;
}

.spot.is-right::after {
  left: -7px;
  transform: rotate(135deg);
}

.spot.is-left::after {
  left: auto;
  right: -7px;
  transform: rotate(-45deg);
}

.spot-close {
  appearance: none;
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}

.spot-close:hover {
  background: var(--line-soft);
  color: var(--ink);
}

.spot-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.spot-body > * {
  margin: 0;
}

.spot-kicker {
  padding-right: 28px;
  font-size: 0.75rem;
  color: var(--ink-2);
}

.spot-place {
  padding-right: 28px;
  font-weight: 600;
  margin-top: 2px;
}

.spot-reading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding-right: 28px;
}

.spot-headline {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.spot.is-loading .spot-headline {
  color: var(--ink-3);
  font-weight: 500;
}

.spot-swatch {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 4px;
  box-shadow: inset 0 0 0 0.5px var(--line);
}

.spot-detail {
  margin-top: 2px;
  font-size: 0.875rem;
}

.spot-lines {
  margin-top: 4px;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--ink-2);
}

.spot-note,
.spot-where {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--ink-2);
}

.spot-where {
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}

.spot-app {
  display: block;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  font-size: 0.875rem;
  font-weight: 500;
}

.spot-credit {
  margin: 6px 0 0;
  font-size: 0.6875rem;
  color: var(--ink-3);
}

/* ---------- Layer panel ---------- */

.layer-panel {
  position: absolute;
  z-index: 20;
  top: var(--edge);
  right: calc(var(--edge) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--mapkit-clear) + var(--safe-bottom));
  width: min(360px, calc(100% - 2 * var(--edge)));
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

/* On a phone the panel hangs from the top bar and stops above MapKit's logo and Legal link. */
@media (max-width: 640px) {
  .layer-panel {
    top: 0;
    left: 0;
    right: 0;
    bottom: calc(var(--mapkit-clear) + var(--safe-bottom));
    width: auto;
    border-radius: 0 0 16px 16px;
  }
}

.lp-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  padding: 12px 16px 8px;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.lp-heading {
  margin: 0;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}

.lp-close {
  appearance: none;
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  padding: 6px 4px;
  cursor: pointer;
}

.lp-sections {
  padding: 0 8px 12px;
}

.lp-section {
  margin: 0;
  padding: 8px 0 4px;
  border: 0;
  border-top: 1px solid var(--line-soft);
}

.lp-section:first-child {
  border-top: 0;
}

.lp-section-title {
  padding: 4px 8px 2px;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}

.lp-row,
.lp-summary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
}

.lp-row:hover,
.lp-summary:hover {
  background: var(--line-soft);
}

.lp-row input {
  margin: 3px 0 0;
  accent-color: var(--accent-fill);
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

.lp-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lp-name {
  font-weight: 500;
}

.lp-sub {
  font-size: 0.75rem;
  color: var(--ink-2);
}

.lp-row.is-unavailable {
  cursor: default;
}

.lp-row.is-unavailable .lp-name {
  color: var(--ink-3);
}

.lp-row.is-unavailable .lp-sub {
  color: var(--ink-3);
}

.lp-row.is-unavailable:hover {
  background: transparent;
}

.lp-summary {
  flex-direction: column;
  gap: 0;
  list-style-position: inside;
}

.lp-details > .lp-row {
  margin-left: 12px;
}

.lp-footer {
  margin: 2px 8px 6px;
  font-size: 0.6875rem;
  color: var(--ink-3);
}

/* ---------- What the app adds ---------- */

.app-panel {
  bottom: auto;
  max-height: calc(100% - var(--edge) - var(--mapkit-clear) - var(--safe-bottom));
}

@media (max-width: 640px) {
  .app-panel {
    bottom: auto;
  }
}

.ap-body {
  padding: 0 16px 16px;
}

.ap-lead {
  margin: 0 0 10px;
  color: var(--ink-2);
  font-size: 0.875rem;
}

.ap-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.ap-item {
  display: flex;
  flex-direction: column;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.ap-title {
  font-weight: 600;
  font-size: 0.875rem;
}

.ap-text {
  font-size: 0.875rem;
  color: var(--ink-2);
}

.ap-link {
  display: block;
  margin-top: 14px;
  font-weight: 600;
}

.ap-more {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.875rem;
}

.ap-legal {
  margin: 14px 0 0;
  font-size: 0.6875rem;
  color: var(--ink-3);
}

@media (max-width: 640px) {
  :root {
    --edge: 8px;
  }

  .legend {
    width: min(260px, calc(100% - 2 * var(--edge)));
  }
}

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

/* ---------- Questions or help? and Stay informed ---------- */

.fm-body {
  padding: 0 16px 16px;
}

.fm-lead {
  margin: 0 0 12px;
  color: var(--ink-2);
  font-size: 0.875rem;
}

.fm-form {
  display: grid;
  gap: 12px;
}

.fm-field {
  display: grid;
  gap: 4px;
}

.fm-label {
  font-size: 0.8125rem;
  font-weight: 600;
}

.fm-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

.fm-message {
  resize: vertical;
  min-height: 96px;
}

/* The spam trap: out of sight and out of the tab order, but not display:none, which bots skip. */
.fm-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.fm-consent {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--ink-2);
}

.fm-submit {
  appearance: none;
  justify-self: start;
  border: 0;
  border-radius: 999px;
  padding: 8px 20px;
  background: var(--accent-fill);
  color: #000;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}

.fm-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.fm-status {
  margin: 0;
  font-size: 0.875rem;
}

.fm-status.is-ok {
  color: var(--accent);
}

.fm-status.is-error {
  color: #c4261d;
}

@media (prefers-color-scheme: dark) {
  .fm-status.is-error {
    color: #ff8a80;
  }
}

.ap-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 16px;
}

.ap-action {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
}

@media (max-width: 720px) {
  #help-button,
  #signup-button {
    display: none;
  }
}

/* ---------- Embedded on the Air Quality page (?embed=1) ---------- */

/* The frame shows the map, its legend and its timeline. The bar's own controls shrink to two
   floating buttons; the brand, search and App Store badge belong to the page around the frame. */
.is-embed .topbar {
  position: absolute;
  z-index: 30;
  top: var(--edge);
  right: var(--edge);
  height: auto;
  padding: 0;
  background: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: 0;
}

.is-embed .brand,
.is-embed .search,
.is-embed .tb-icon,
.is-embed #app-button,
.is-embed #help-button,
.is-embed #signup-button,
.is-embed .tb-badge {
  display: none !important;
}

.is-embed .topbar-actions {
  gap: 8px;
}

.is-embed .tb-button {
  padding: 7px 14px;
  color: var(--ink);
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-color: var(--line-soft);
  box-shadow: var(--shadow-sm);
}

.is-embed a.tb-button:hover {
  text-decoration: none;
}

/* The layer panel hangs below the two buttons. */
.is-embed .layer-panel {
  top: calc(var(--edge) + 46px);
}

/* The legend's name leaves the corner to the buttons. */
.is-embed .legend {
  max-width: calc(100% - 2 * var(--edge) - 232px);
}

/* On a touch screen the framing page makes the whole map one link to the full map, so the frame
   offers no button it cannot honour: no Layers, no legend to open, no play. */
@media (hover: none), (pointer: coarse) {
  .is-embed #layers-button,
  .is-embed .legend-hint,
  .is-embed .tl-play,
  .is-embed .map-note {
    display: none !important;
  }
  .is-embed .legend {
    max-width: calc(100% - 2 * var(--edge) - 132px);
  }
}
