/* ============================================================
   CityScope — landing page, snapshot toolbar, sources/freshness,
   location map, comparison extras. Reads only tokens.css variables.
   ============================================================ */

/* ---- Landing hero ---- */
.landing-hero { padding-top: clamp(1.5rem, 9vh, 5rem); }
.landing-hero h1 {
  font-size: clamp(2.1rem, 6.2vw, 3.6rem);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.04;
  max-width: 16ch;
  text-wrap: balance;
}
.landing-hero .lede {
  font-size: clamp(1rem, 2.2vw, 1.12rem);
  line-height: 1.55;
  max-width: 52ch;
  margin: 1rem auto 1.9rem;
  text-wrap: pretty;
}
.landing-search { width: min(580px, 100%); text-align: left; }
.landing-search .search-box { width: 100%; padding: 0.45rem 0.45rem 0.45rem 1.15rem; }
.landing-search .search-box input { font-size: 1.05rem; }

.landing-ctas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: var(--space-5);
}
.landing-ctas .btn-secondary { text-decoration: none; }
.landing-note { margin-top: 0.6rem; font-size: 0.8rem; color: var(--muted); }
.landing-ctas .hero-location-btn { margin-top: 0; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 0.65rem 1.1rem;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}
.btn-ghost:hover { background: rgba(127, 127, 127, 0.12); }
.btn-small { padding: 0.4rem 0.9rem; font-size: 0.82rem; }

/* ---- Landing sections ---- */
.landing-section { margin-top: clamp(3rem, 10vh, 5.5rem); }
.section-title {
  font-size: clamp(1.35rem, 3.4vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  text-wrap: balance;
}
.section-lede {
  color: var(--muted);
  text-align: center;
  max-width: 56ch;
  margin: 0.6rem auto 0;
  line-height: 1.55;
}

.feature-grid {
  list-style: none;
  padding: 0;
  margin: var(--space-5) 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
}
.feature-card { padding: var(--space-5); animation: none; }
.feature-card h3 { font-size: 1rem; font-weight: 650; letter-spacing: -0.01em; margin-top: 0.85rem; }
.feature-card p { color: var(--muted); line-height: 1.55; margin-top: 0.4rem; font-size: 0.92rem; }
.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: var(--accent-text);
  background: color-mix(in srgb, var(--primary) 14%, transparent);
}

.source-table-wrap { margin-top: var(--space-5); padding: 0; overflow-x: auto; animation: none; }
.source-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 560px; }
.source-table th, .source-table td { text-align: left; padding: 0.85rem var(--space-4); vertical-align: top; line-height: 1.5; }
.source-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--hairline);
}
.source-table tbody th { font-weight: 650; white-space: nowrap; }
.source-table tbody td { color: var(--muted); }
.source-table tbody tr:not(:last-child) > * { border-bottom: 1px solid var(--hairline); }

/* ---- Snapshot ---- */
.loading-hint { color: var(--muted); font-size: 0.88rem; text-align: center; max-width: 36ch; }

.data-notice {
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  line-height: 1.5;
  background: color-mix(in srgb, var(--warning) 14%, var(--glass-bg-strong));
  border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
}

.hero-observed { color: var(--muted); margin-top: 0.5rem; font-size: 0.8rem; }

.snapshot-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text);
  border-radius: var(--radius-pill);
  padding: 0.55rem 1rem;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}
.action-btn:hover { background: var(--glass-bg-strong); }
.action-btn:active { transform: scale(0.97); }
.action-btn[aria-pressed="true"] { color: var(--warning); }
.action-btn[aria-pressed="true"] svg { fill: currentColor; }
.action-btn[aria-pressed="true"] span { color: var(--text); }

.card-source { margin-top: var(--space-4); font-size: 0.78rem; color: var(--muted); line-height: 1.45; }

.fact-list { margin: 0; }
.fact-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0.6rem 0;
  font-size: 0.9rem;
}
.fact-row:not(:last-child) { border-bottom: 1px solid var(--hairline); }
.fact-row dt { color: var(--muted); font-weight: 600; flex-shrink: 0; }
.fact-row dd { margin: 0; text-align: right; line-height: 1.45; }
.sources-list .fact-row dd { max-width: 70%; }

.mini-map {
  height: 190px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-3);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  z-index: 0;
}
.mini-map .leaflet-control-attribution { font-size: 9px; }

.chart-figure { margin: 0; min-width: 0; }
.chart-caption { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.chart-figure .glass-chart { margin-top: var(--space-2); }

.air-quality-card.is-unavailable .aqi-value,
#air-quality-card.is-unavailable .aqi-value { color: var(--muted); }

.search-suggestions .suggestion-pop { white-space: nowrap; }

/* ---- Compare ---- */
.view-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.compare-actions { justify-content: flex-end; }
#compare-quick-add { margin-top: var(--space-3); }
.empty-state h2 { font-size: 1.15rem; font-weight: 700; }
.empty-state svg { color: var(--muted); }
.empty-state .btn-secondary { margin-top: var(--space-2); text-decoration: none; }
.compare-hint { margin-top: var(--space-4); color: var(--muted); font-size: 0.9rem; }

.compare-table .cmp-corner { width: 1%; }
.compare-table thead th.cmp-col-head { min-width: 9.5rem; }
.cmp-swatch { display: block; width: 22px; height: 4px; border-radius: 2px; margin-bottom: 0.5rem; }
.cmp-head-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; }
.compare-table .cmp-head-actions .compare-remove { margin-top: 0; }
.cmp-open { font-size: 0.78rem; font-weight: 600; }
.cmp-cond { display: inline-flex; align-items: center; gap: 0.4rem; white-space: normal; font-weight: 500; }
.cmp-icon { display: inline-flex; width: 22px; height: 22px; flex-shrink: 0; }
.cmp-icon svg { width: 100%; height: 100%; }
.compare-table td.cmp-strong { font-size: 1.15rem; font-weight: 700; }
.cmp-sub { color: var(--muted); font-weight: 500; font-size: 0.78rem; }
.cmp-na { color: var(--muted); font-weight: 500; }
.compare-table td.cmp-state { vertical-align: top; white-space: normal; max-width: 14rem; }
.cmp-loading { color: var(--muted); font-weight: 500; }
.cmp-error { display: block; color: var(--danger); font-weight: 500; margin-bottom: 0.6rem; line-height: 1.4; }

.compare-charts { margin-top: var(--space-5); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin: -0.25rem 0 0.25rem; font-size: 0.82rem; font-weight: 600; }
.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend-swatch { width: 12px; height: 4px; border-radius: 2px; }
.chart-hover-wrap { position: relative; }
.chart-tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  min-width: 140px;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 0.45rem; }
.chart-tooltip .tt-row b { margin-left: auto; padding-left: 0.75rem; font-variant-numeric: tabular-nums; }
.chart-tooltip .tt-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.compare-source { margin-top: var(--space-4); }

/* ---- Toast variants ---- */
.toast.is-error { color: var(--danger); }

@media (max-width: 760px) {
  .view-header-row { align-items: flex-start; }
  .compare-actions { justify-content: flex-start; }
}

.daily-rain { white-space: nowrap; }

@media (max-width: 480px) {
  .converter { grid-template-columns: 1fr 1fr; }
  .converter .converter-field:first-child { grid-column: 1 / -1; }
  .converter button { grid-column: 1 / -1; }
  .landing-ctas { flex-direction: column; align-items: stretch; width: 100%; }
  .landing-ctas > * { justify-content: center; }
  .snapshot-actions .action-btn { flex: 1 1 calc(50% - 0.5rem); justify-content: center; }
  .fact-row { flex-direction: column; gap: 0.15rem; }
  .fact-row dd, .sources-list .fact-row dd { text-align: left; max-width: none; }
  .source-table { min-width: 0; }
  .source-table thead { display: none; }
  .source-table tr { display: block; padding: 0.75rem var(--space-4); }
  .source-table tbody tr:not(:last-child) { border-bottom: 1px solid var(--hairline); }
  .source-table tbody tr:not(:last-child) > * { border-bottom: none; }
  .source-table th, .source-table td { display: block; padding: 0.15rem 0; }
}

/* Only shown in print (see print.css). */
.print-header { display: none; }

/* Sticky nav gets a glass backing once content scrolls beneath it
   (full-bleed, behind the centred nav row). Toggled by main.js. */
.navbar::before {
  content: "";
  position: absolute;
  inset: 0 calc(50% - 50vw);
  z-index: -1;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  border-bottom: 1px solid var(--hairline);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.navbar.is-scrolled::before { opacity: 1; }

/* Keep the measure names visible while the city columns scroll sideways. */
.compare-table tbody th,
.compare-table thead th.cmp-corner {
  position: sticky;
  left: 0;
  z-index: 1;
  /* Opaque, or the scrolled values show through the glass. */
  background: var(--surface);
  box-shadow: 1px 0 0 var(--hairline);
}
@media (max-width: 480px) {
  .compare-table tbody th { white-space: normal; min-width: 6.5rem; max-width: 7.5rem; font-size: 0.8rem; }
  .compare-table th, .compare-table td { padding: var(--space-3); }
}
