/* NeoHypo Swiss Public Transport Isochrone & Livability Explorer
 * Implements Modern Web Guidance patterns:
 *   - brand-consistent-forms (`color-scheme: light` + `accent-color`)
 *   - slider (separate WebKit / Firefox pseudo-element blocks + CSS `progress()` with `calc()` fallback)
 *   - forms (`min-height: 48px` touch targets, `1rem` font-size to prevent mobile zoom)
 *   - navigation-drawer (`<dialog class="Drawer">` with scroll-snap dismiss + `@supports` fallback)
 */

:root {
  color-scheme: light;
  --brand-primary: #ff5c33;
  --brand-primary-hover: #e84b24;
  --brand-primary-soft: rgba(255, 92, 51, 0.11);
  --surface-bg: #f8fafc;
  --surface-card: #ffffff;
  --surface-muted: #f1f5f9;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --radius-md: 12px;
  --radius-lg: 16px;
  --header-h: 56px;

  accent-color: var(--brand-primary);
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--surface-bg);
  color: var(--text-primary);
  overflow: hidden;
}

.material-symbols-rounded {
  font-size: 18px;
  line-height: 1;
  vertical-align: middle;
}

/* Header (`content-first-noise-reduction` + `form-factor-adaptation`:
 * compact single row < 12% viewport height, `min-block-size` instead of fixed height,
 * safe-area-inset padding, and 1 single auth-aware CTA on mobile)
 */
.IsoHeader {
  min-block-size: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding-block-start: env(safe-area-inset-top, 0px);
  padding-inline: max(0.85rem, env(safe-area-inset-left, 0px)) max(0.85rem, env(safe-area-inset-right, 0px));
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 30;
  position: relative;
}

.IsoHeader-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-inline-size: 0;
}

.IsoLogo {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-block-size: 44px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 800;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

.IsoHeader-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--brand-primary-soft);
  color: var(--brand-primary-hover);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.IsoHeader-nav {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

/* Touch-friendly Buttons (`form-factor-adaptation`: >= 44px on coarse pointer) */
.IsoBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-block-size: 40px;
  min-inline-size: 40px;
  padding: 0.45rem 0.85rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

@media (pointer: coarse) {
  .IsoBtn {
    min-block-size: 44px;
    min-inline-size: 44px;
  }
}

.IsoBtn[hidden] {
  display: none !important;
}

.IsoBtn--primary {
  background: var(--brand-primary);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(255, 92, 51, 0.25);
}

.IsoBtn--primary:hover {
  background: var(--brand-primary-hover);
}

.IsoBtn--authed {
  background: var(--text-primary);
  color: #ffffff;
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.16);
}

.IsoBtn--authed:hover {
  background: #1e293b;
}

.IsoBtn--authed .IsoAuthCta-icon {
  color: #34d399;
}

.IsoAuthCta {
  border-radius: 999px;
  padding-inline: 0.95rem;
}

.IsoBtn--secondary {
  background: var(--text-primary);
  color: #ffffff;
}

.IsoBtn--ghost {
  background: var(--surface-muted);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.IsoBtn--ghost:hover {
  background: #e2e8f0;
}

.IsoBtn--full {
  width: 100%;
  min-block-size: 48px;
}

/* Main Split Layout */
.IsoLayout {
  display: grid;
  grid-template-columns: 420px 1fr;
  height: calc(100dvh - var(--header-h) - env(safe-area-inset-top, 0px));
  width: 100%;
}

.IsoSidebar {
  background: var(--surface-card);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  overscroll-behavior: contain;
  height: 100%;
}

.IsoPanel {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Search Landmark & Autocomplete */
.IsoSearch {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.IsoSearch-form {
  position: relative;
}

.IsoFieldLabel {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.IsoSearch-inputWrap {
  position: relative;
  display: flex;
  align-items: center;
}

.IsoSearch-icon {
  position: absolute;
  left: 0.8rem;
  color: var(--brand-primary);
  pointer-events: none;
}

/* 1rem (16px) font-size & 48px min-height prevent iOS Safari auto-zoom */
.IsoInput {
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 2.8rem 0.65rem 2.35rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--surface-bg);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="number"].IsoInput {
  padding: 0.6rem 0.75rem;
}

.IsoInput:focus-visible {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(255, 92, 51, 0.18);
  background: #ffffff;
}

.IsoSearch-submit {
  position: absolute;
  right: 0.35rem;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 9px;
  background: var(--brand-primary);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.IsoAutocomplete {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.14);
  z-index: 50;
  max-height: 310px;
  overflow-y: auto;
}

.IsoAutocomplete-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 46px;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
}

.IsoAutocomplete-item:hover,
.IsoAutocomplete-item[aria-selected="true"] {
  background: var(--surface-muted);
}

.IsoAutocomplete-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.IsoAutocomplete-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.IsoAutocomplete-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.IsoAutocomplete-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* Quick Pick Chips */
.IsoQuickPicks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.IsoChip {
  min-height: 34px;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.IsoChip:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

/* Origin Card + Secondary Share Action */
.IsoOriginCard {
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
}

.IsoOriginCard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.IsoOriginCard-info {
  min-inline-size: 0;
}

.IsoOriginCard-title {
  font-size: 1rem;
  font-weight: 800;
}

.IsoOriginCard-sub {
  font-size: 0.78rem;
  color: #cbd5e1;
  margin-top: 0.2rem;
}

.IsoShareBtn {
  flex-shrink: 0;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  font-size: 0.76rem;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.IsoShareBtn:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Fieldsets & Segmented Radios */
.IsoControls {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.IsoFieldset {
  border: none;
  margin: 0;
  padding: 0;
}

.IsoSegmented {
  display: grid;
  gap: 0.35rem;
}

.IsoSegmented--2 {
  grid-template-columns: repeat(2, 1fr);
}

.IsoSegmented--4 {
  grid-template-columns: repeat(4, 1fr);
}

.IsoSegmented--5 {
  grid-template-columns: repeat(5, 1fr);
}

.IsoOverlayGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
}

.IsoRadioPill {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.35rem 0.4rem;
  border-radius: 10px;
  border: 1.5px solid var(--border-subtle);
  background: var(--surface-bg);
  font-size: 0.77rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.IsoRadioPill input[type="radio"] {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

.IsoRadioPill:has(input[type="radio"]:checked) {
  border-color: var(--brand-primary);
  background: var(--brand-primary-soft);
  color: var(--brand-primary-hover);
}

.IsoRadioPill:has(input[type="radio"]:focus-visible) {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

/* Customizable `<select>` (`forms` + `branded-select-styling`) */
.IsoSelectField {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.IsoSelect,
.IsoSelect::picker(select) {
  appearance: base-select;
}

.IsoSelect {
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  padding: 0.6rem 0.85rem;
  font: inherit;
  font-size: max(1rem, 1em);
  font-weight: 600;
  color: var(--text-primary);
  background-color: var(--surface-bg);
  border: 1.5px solid #64748b;
  border-radius: var(--radius-md);
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
}

.IsoSelect:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
  border-color: var(--brand-primary);
  background-color: #ffffff;
}

.IsoSelect::picker(select) {
  font: inherit;
  background-color: #ffffff;
  color: var(--text-primary);
  border: 1.5px solid #64748b;
  border-radius: var(--radius-md);
  padding: 0.35rem;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
}

.IsoSelect::picker-icon {
  color: var(--text-secondary);
}

.IsoSelect option {
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

.IsoSelect option:hover {
  background-color: var(--surface-muted);
}

.IsoSelect option::checkmark {
  color: var(--brand-primary);
}

/* =========================================================================
 * Accessible Range Slider (`modern-web-guidance`: `slider`)
 * Separate vendor pseudo-element selectors + `progress()` with `calc()` fallback
 * ========================================================================= */
.RangeField {
  display: grid;
  gap: 0.45rem;
}

.RangeField-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.RangeField-output {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--brand-primary);
  font-variant-numeric: tabular-nums;
}

.RangeField input[type="range"] {
  --thumb-size: 1.35rem;
  --track-height: 0.45rem;
  --track-bg: #e2e8f0;
  --track-fill: var(--brand-primary);
  --progress: progress(var(--control-value), var(--control-min), var(--control-max));

  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 44px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}

@supports not (opacity: progress(1, 0, 100)) {
  .RangeField input[type="range"] {
    --progress: calc(
      (var(--control-value) - var(--control-min)) /
      (var(--control-max) - var(--control-min))
    );
  }
}

.RangeField input[type="range"]:focus-visible {
  outline: none;
}

.RangeField input[type="range"]::-webkit-slider-runnable-track {
  height: var(--track-height);
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--track-fill) calc(var(--progress) * 100%),
    var(--track-bg) calc(var(--progress) * 100%)
  );
}

.RangeField input[type="range"]::-moz-range-track {
  height: var(--track-height);
  border-radius: 999px;
  background: var(--track-bg);
}

.RangeField input[type="range"]::-moz-range-progress {
  height: var(--track-height);
  border-radius: 999px;
  background: var(--track-fill);
}

.RangeField input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--thumb-size);
  height: var(--thumb-size);
  border-radius: 50%;
  background: var(--track-fill);
  border: 2.5px solid #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
  margin-top: calc((var(--track-height) - var(--thumb-size)) / 2);
}

.RangeField input[type="range"]::-moz-range-thumb {
  width: var(--thumb-size);
  height: var(--thumb-size);
  border-radius: 50%;
  background: var(--track-fill);
  border: 2.5px solid #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
}

.RangeField input[type="range"]:focus-visible::-webkit-slider-thumb {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.RangeField input[type="range"]:focus-visible::-moz-range-thumb {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.RangeField-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Collapsible Advanced Filters */
.IsoDetails {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-bg);
}

.IsoDetails-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 0.55rem 0.8rem;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.IsoDetails-summary::-webkit-details-marker {
  display: none;
}

.IsoDetails-body {
  padding: 0.75rem 0.8rem 0.85rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.IsoFilterRow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

/* KPI Strip */
.IsoKpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.IsoKpi {
  background: var(--surface-muted);
  border-radius: 10px;
  padding: 0.6rem 0.5rem;
  text-align: center;
}

.IsoKpi-val {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.IsoKpi-lbl {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Results Cards */
.IsoResults-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.IsoResults-header--spaced {
  margin-top: 1rem;
}

.IsoResults-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
}

.IsoResults-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--brand-primary-soft);
  color: var(--brand-primary-hover);
}

.IsoCardList {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.IsoCommuneCard {
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.IsoCommuneCard:hover {
  border-color: var(--brand-primary);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
}

.IsoCommuneCard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.IsoCommuneCard-name {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-primary);
}

.IsoCommuneCard-score {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 7px;
  background: #ecfdf5;
  color: #047857;
}

.IsoCommuneCard-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.IsoMiniBadge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.18rem 0.48rem;
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--text-secondary);
}

.IsoMiniBadge--tp {
  background: #eff6ff;
  color: #1d4ed8;
}

.IsoMiniBadge--cad {
  background: #ecfdf5;
  color: #047857;
}

.IsoUpgradeBox {
  margin-top: 0.75rem;
  padding: 0.9rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border: 1px solid #fdba74;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.IsoUpgradeBox-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: #7c2d12;
  line-height: 1.45;
}

/* Map Stage */
.IsoMapStage {
  position: relative;
  width: 100%;
  height: 100%;
  background: #e2e8f0;
}

.IsoMapCanvas {
  width: 100%;
  height: 100%;
}

/* Floating Mobile Filter & Origin Trigger (hidden on desktop >= 960px) */
.IsoMapFilterBtn {
  display: none;
}

.IsoLoadingPill {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
  z-index: 15;
  transition: opacity 0.2s ease;
}

.IsoLoadingPill[hidden] {
  display: none;
}

.IsoSpinner {
  width: 15px;
  height: 15px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: iso-spin 0.75s linear infinite;
}

@keyframes iso-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Floating Legend */
.IsoLegend {
  position: absolute;
  bottom: 1.5rem;
  right: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  z-index: 12;
  max-width: 340px;
}

.IsoLegend-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.45rem;
}

.IsoLegend-scale {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.IsoLegend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.IsoLegend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.IsoLegend-hint {
  margin-top: 0.45rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Map Popup DOM Content — always rendered in front of map pins with enlarged close button */
:where(.mapboxgl-canvas-container, .maplibregl-canvas-container) {
  z-index: 1;
}

:where(.mapboxgl-popup, .maplibregl-popup) {
  z-index: 80 !important;
}

:where(.mapboxgl-popup-content, .maplibregl-popup-content) {
  position: relative;
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.26), 0 4px 12px rgba(15, 23, 42, 0.12);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

:where(.mapboxgl-popup-close-button, .maplibregl-popup-close-button) {
  position: absolute;
  inset-block-start: 8px;
  inset-inline-end: 8px;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: 32px;
  min-block-size: 32px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  border: 1.5px solid rgba(15, 23, 42, 0.16);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.2);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

:where(.mapboxgl-popup-close-button, .maplibregl-popup-close-button):hover:not(:disabled) {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
  transform: scale(1.06);
}

:where(.mapboxgl-popup-close-button, .maplibregl-popup-close-button):focus-visible {
  outline: 3px solid var(--brand-primary, #ff5c33);
  outline-offset: 2px;
}

@media (pointer: coarse) {
  :where(.mapboxgl-popup-close-button, .maplibregl-popup-close-button) {
    min-inline-size: 38px;
    min-block-size: 38px;
    font-size: 24px;
  }
}

.IsoPopup {
  font-family: 'Plus Jakarta Sans', sans-serif;
  min-width: 210px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.IsoPopup-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-primary);
  padding-inline-end: 36px;
}

.IsoPopup-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.IsoPopup-btn {
  margin-top: 0.3rem;
  min-height: 36px;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  border: none;
  background: var(--brand-primary);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

/* =========================================================================
 * Responsive Mobile Drawer (`modern-web-guidance`: `navigation-drawer`)
 * ========================================================================= */
.Drawer {
  position: fixed;
  inset: 0;
  width: 100dvw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  overflow: hidden;
}

.Drawer::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.Drawer-track {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior: contain;
}

.Drawer-track::-webkit-scrollbar {
  display: none;
}

.Drawer-panel {
  flex: 0 0 min(88vw, 410px);
  height: 100%;
  background: var(--surface-card);
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-align: start;
  box-shadow: 12px 0 32px rgba(15, 23, 42, 0.22);
}

.Drawer-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-subtle);
}

.Drawer-title {
  font-size: 0.95rem;
  font-weight: 800;
}

.Drawer-dismiss {
  flex: 0 0 100vw;
  height: 100%;
  scroll-snap-align: start;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

p,
li {
  text-wrap: pretty;
}

@media (max-width: 959px) {
  :root {
    --header-h: 52px;
  }

  .IsoHeader {
    padding-inline: max(0.75rem, env(safe-area-inset-left, 0px)) max(0.75rem, env(safe-area-inset-right, 0px));
  }

  /* Enforce strictly ONE button (`#iso-auth-cta`) in the mobile header */
  .IsoDesktopOnly,
  .IsoHeader-badge {
    display: none !important;
  }

  .IsoAuthCta {
    font-size: 0.82rem;
    padding-inline: 0.82rem;
  }

  .IsoLayout {
    grid-template-columns: 1fr;
  }

  .IsoSidebar {
    display: none;
  }

  .IsoMapFilterBtn {
    position: absolute;
    inset-block-start: 0.75rem;
    inset-inline-start: max(0.75rem, env(safe-area-inset-left, 0px));
    max-inline-size: calc(100dvw - 1.5rem);
    min-block-size: 44px;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-strong);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.14);
    z-index: 16;
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.83rem;
    font-weight: 700;
    cursor: pointer;
  }

  .IsoMapFilterBtn-icon {
    color: var(--brand-primary);
    flex-shrink: 0;
  }

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

  .IsoLoadingPill {
    top: 4rem;
    left: max(0.75rem, env(safe-area-inset-left, 0px));
    transform: none;
    max-inline-size: calc(100dvw - 1.5rem);
  }

  .IsoLegend {
    left: 0.75rem;
    right: 0.75rem;
    bottom: max(0.9rem, env(safe-area-inset-bottom, 0px));
    max-width: none;
  }
}
