/**
 * RUNWY — Main Stylesheet
 * Imports design system, base styles, and component styles.
 */

@import url('./variables.css');

/* === Reset / Normalize === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--gray-900);
  background: var(--cloud-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  touch-action: manipulation;
  height: 100vh;
  height: 100dvh;
  width: 100%;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--horizon-teal-hover); text-decoration: none; }
a:hover { color: var(--horizon-teal); text-decoration: underline; }
a:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
ul, ol { list-style: none; }

/* === Focus Visible === */
:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* === Screen Reader Only === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* === Typography Tokens === */
.display-xl { font-size: 2rem; font-weight: 700; line-height: 1.2; }
.display-lg { font-size: 1.5rem; font-weight: 700; line-height: 1.25; }
.heading-md { font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
.heading-sm { font-size: 1rem; font-weight: 600; line-height: 1.4; }
.body-lg { font-size: 1rem; font-weight: 400; line-height: 1.6; }
.body-md { font-size: 0.875rem; font-weight: 400; line-height: 1.6; }
.body-sm { font-size: 0.8125rem; font-weight: 400; line-height: 1.5; }
.body-xs { font-size: 0.6875rem; font-weight: 400; line-height: 1.5; }
.data-xl { font-size: 1.75rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.data-lg { font-size: 1.25rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.data-md { font-size: 1rem; font-weight: 500; line-height: 1.3; font-variant-numeric: tabular-nums; }
.caption { font-size: 0.75rem; font-weight: 400; line-height: 1.5; }
.mono-md { font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 400; line-height: 1.7; }


.font-mono { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.05em; }

/* === App Layout === */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

/* === Top Bar === */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: var(--topbar-height);
  padding: 0 var(--space-6);
  background: #131F2E;
  color: #fff;
  flex-shrink: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: relative;
}

.topbar__logo {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-family: 'Pathway Extreme', 'Arial Narrow', sans-serif;
  transform: skewX(-5deg);
  color: #0F172A;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
}

.topbar__logo svg {
  transform: skewX(5deg);
}
.topbar__logo:hover {
  text-decoration: none;
}

.topbar__logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  align-self: center;
}

/* Hide logo image on home page — topbar is transparent over dark hero */
body:has(.view--home:not([hidden])) .topbar__logo-img {
  display: none;
}

.logo-preflt {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: #FFFFFF;
}

.logo-xwind {
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: #96C7E8;
  margin-left: 5px;
}

.topbar__spacer { flex: 1; }

/* === Topbar Nav (desktop) === */
.topbar__nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.topbar__nav-item {
  position: relative;
}

.topbar__nav-link {
  background: none;
  border: none;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: var(--space-2) var(--space-3);
  display: flex;
  align-items: center;
  gap: 5px;
  border-radius: var(--radius-md);
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.topbar__nav-link:hover,
.topbar__nav-link[aria-expanded="true"] {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.topbar__nav-chevron {
  transition: transform 0.18s ease;
  flex-shrink: 0;
}
.topbar__nav-link[aria-expanded="true"] .topbar__nav-chevron {
  transform: rotate(180deg);
}

.topbar__nav-divider {
  width: 1px;
  height: 16px;
  background: rgba(255,255,255,0.2);
  margin: 0 var(--space-1);
}

/* === Resources Dropdown === */
.topbar__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: auto;
  min-width: 280px;
  background: #1a1a22;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 2000;
  overflow: hidden;
}

/* PREFLT mega menu — 2-column layout */
#resources-content-preflt {
  display: flex;
}
.resources-preflt__col {
  min-width: 240px;
  flex: 1;
}
.resources-preflt__col:not(:last-child) {
  border-right: 1px solid rgba(255,255,255,0.07);
}

.topbar__dropdown-section {
  padding: var(--space-2) 0;
}

.topbar__dropdown-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(150,199,232,0.6);
  padding: var(--space-1) var(--space-4);
  margin-bottom: 2px;
}

.topbar__dropdown-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2) var(--space-4);
  color: rgba(255,255,255,0.8);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  line-height: 1.3;
}
.topbar__dropdown-item:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
  text-decoration: none;
}

.topbar__dropdown-desc {
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.4);
  font-weight: 400;
}

.topbar__dropdown-divider {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 0;
}

/* === Preferences gear button + popover === */
.topbar__prefs-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  padding: var(--space-2);
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: color 0.15s, background 0.15s;
  margin-left: var(--space-2);
  position: relative;
}
.topbar__prefs-btn:hover,
.topbar__prefs-btn[aria-expanded="true"] {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.topbar__prefs-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: var(--space-4);
  background: #1a1a22;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 2000;
  padding: var(--space-3) var(--space-4);
  min-width: 220px;
}

.prefs-popover__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.prefs-popover__label {
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.75);
  font-weight: 500;
  cursor: pointer;
}

/* Toggle switch */
.prefs-switch {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.prefs-switch__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.prefs-switch__track {
  width: 36px;
  height: 20px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
  display: flex;
  align-items: center;
}
.prefs-switch__input:checked + .prefs-switch__track {
  background: #96C7E8;
}
.prefs-switch__thumb {
  position: absolute;
  left: 3px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.prefs-switch__input:checked + .prefs-switch__track .prefs-switch__thumb {
  transform: translateX(16px);
}
.prefs-switch__input:focus-visible + .prefs-switch__track {
  outline: 2px solid #96C7E8;
  outline-offset: 2px;
}

/* === Mobile hamburger === */
.topbar__hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  min-width: 40px;
  min-height: 40px;
  border-radius: var(--radius-md);
  margin-left: var(--space-1);
}
.topbar__hamburger:hover { background: rgba(255,255,255,0.1); }

.topbar__hamburger-bar {
  display: block;
  width: 18px;
  height: 1.5px;
  background: rgba(255,255,255,0.8);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* v10 home view: full dark page */
body:has(.view--home:not([hidden])) { background: #0D1929; }

body:has(.view--home:not([hidden])) .topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #0D1929;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  z-index: 1000;
  color: #fff;
}

body:has(.view--home:not([hidden])) .topbar__logo { color: #fff; }

body:has(.view--home:not([hidden])) .logo-xwind       { display: none; }
body:has(.view--home:not([hidden])) .topbar__logo-img { display: none; }
body:has(.view--home:not([hidden])) .topbar::after    { display: none; }

body:has(.view--home:not([hidden])) .main-content {
  padding-top: var(--topbar-height);
}

body:has(.view--home:not([hidden])) .app > .disclaimer-bar,
body:has(.view--map:not([hidden])) .app > .disclaimer-bar {
  display: none;
}

/* === View Transitions === */
::view-transition-old(root) {
  animation: view-out 350ms ease-out both;
}
::view-transition-new(root) {
  animation: view-in 400ms ease-out 300ms both;
}
@keyframes view-out {
  to { opacity: 0; }
}
@keyframes view-in {
  from { opacity: 0; }
}
::view-transition-group(root) {
  background: #001220;
}

/* === Main Content Area === */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Home view: let body be the scroll container so iOS tap-to-top works natively.
   The map view needs overflow:hidden, so we toggle this class in showView(). */
body.home-scroll {
  overflow-y: auto;
  height: auto;
  min-height: 100dvh;
}
body.home-scroll .app {
  overflow: visible;
  height: auto;
}
body.home-scroll .main-content {
  overflow: visible;
  height: auto;
}
body.home-scroll .view--home:not([hidden]) {
  overflow-y: visible;
  height: auto;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  width: 100%;
}

/* === Footer === */
.disclaimer-bar {
  background: #27272A;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: var(--space-2) var(--space-6);
  padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.55);
  text-align: center;
  line-height: 1.4;
  flex-shrink: 0;
  z-index: 100;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
}

.footer-tagline {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 400;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.03em;
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  justify-content: center;
}

.footer-links {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.footer-sep {
  color: rgba(255,255,255,0.15);
  user-select: none;
}

.disclaimer-bar a {
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  transition: color 150ms var(--ease-out);
}

.disclaimer-bar a:hover {
  color: #96C7E8;
  text-decoration: underline;
}

/* Home page inline footer — transparent, single row, sits on hero background */
.disclaimer-bar--inline {
  background: transparent;
  border-top: none;
  padding: var(--space-2) var(--space-6);
  padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
  color: rgba(255,255,255,0.45);
  flex-direction: row;
  gap: var(--space-3);
}
.disclaimer-bar--inline .footer-tagline {
  color: rgba(255,255,255,0.55);
  font-size: 0.6875rem;
}
.disclaimer-bar--inline .footer-sep { color: rgba(255,255,255,0.4); }
.disclaimer-bar--inline a { color: rgba(255,255,255,0.65); }
.disclaimer-bar--inline a:hover { color: rgba(255,255,255,0.85); }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms var(--ease-out), box-shadow 150ms var(--ease-out), transform 150ms var(--ease-out), color 150ms var(--ease-out);
  min-height: 40px;
  padding: var(--space-2) var(--space-6);
  font-size: 0.9375rem;
  line-height: 1.4;
}

.btn--primary {
  background: #00293f;
  color: #fff;
}
.btn--primary:hover { background: #004a6e; box-shadow: 0 2px 12px rgba(0,41,63,0.3); }
.btn--primary:active { background: #001220; transform: scale(0.98); }
.btn--primary:disabled { background: var(--gray-300); color: var(--gray-500); cursor: not-allowed; }

.btn--brand {
  background: #00293f;
  color: #fff;
}
.btn--brand:hover { background: #004a6e; box-shadow: 0 2px 12px rgba(0,41,63,0.3); }
.btn--brand:active { background: #001220; transform: scale(0.98); }

.btn--cta { background: var(--horizon-teal); color: #fff; }
.btn--cta:hover { background: var(--horizon-teal-active); box-shadow: 0 2px 12px rgba(0,147,215,0.3); }
.btn--cta:active { background: var(--horizon-teal-active); transform: scale(0.98); }
.btn--cta:disabled { background: var(--gray-300); color: var(--gray-500); cursor: not-allowed; box-shadow: none; transform: none; }

.btn:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(0,147,215,0.3);
}

.btn--secondary {
  background: transparent;
  border: 2px solid var(--horizon-teal);
  color: var(--horizon-teal);
}
.btn--secondary:hover { background: rgba(0,147,215,0.08); }

.btn--destructive {
  background: transparent;
  border: 2px solid var(--exceed-red);
  color: var(--exceed-red);
}
.btn--destructive:hover { background: var(--exceed-red-light); }

.btn--small {
  min-height: 36px;
  padding: var(--space-2) 14px;
  font-size: 0.875rem;
}

.btn--full { width: 100%; }

.btn .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

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

/* === Form Inputs === */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

[hidden] {
  display: none !important;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--deep-navy);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-label .required {
  color: var(--exceed-red);
}

.form-input {
  background: var(--gray-100);
  border: none;
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  font-size: 0.875rem;
  color: var(--gray-900);
  transition: background 150ms, box-shadow 150ms;
  width: 100%;
}
.form-input::placeholder { color: var(--gray-400); }
.form-input:focus {
  background: var(--gray-50);
  box-shadow: 0 0 0 2px rgba(0,147,215,0.3);
  outline: none;
}
.form-input:focus-visible {
  box-shadow: 0 0 0 2px rgba(0,147,215,0.3);
  outline: none;
}
.form-input--error {
  border-color: var(--exceed-red);
}

.form-error {
  font-size: 0.75rem;
  color: var(--exceed-red);
}

.form-helper {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.input-with-unit {
  position: relative;
}
.input-with-unit .form-input { padding-right: 48px; }
.input-with-unit .unit {
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-500);
  font-size: 0.875rem;
  pointer-events: none;
}

/* === Cards === */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 16px 20px;
}

/* === Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border-radius: var(--radius-pill);
  padding: var(--space-1) var(--space-3);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge--qualify { background: var(--qualify-green-light); color: var(--qualify-green); }
.badge--marginal { background: var(--marginal-amber-light); color: var(--marginal-amber); }
.badge--exceed { background: var(--exceed-red-light); color: var(--exceed-red); }
.badge--vrb { background: #EDE9FE; color: var(--vrb-purple); }
.badge--unknown { background: var(--surface-card); color: var(--gray-400); }
.badge--calm { background: var(--qualify-green-light); color: var(--qualify-green); }
.badge--home { background: #DBEAFE; color: #1D4ED8; }

/* Source badges */
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.source-badge--metar { background: #EFF6FF; color: var(--source-metar); }
.source-badge--taf { background: #F3E8FF; color: var(--source-taf); }
.source-badge--taf-nearby { background: #F3E8FF; color: var(--source-taf); }
.source-badge--nws { background: #FFF7ED; color: var(--source-nws); }
.source-badge--openmeteo { background: #FFF7ED; color: var(--source-openmeteo); }
.source-badge--stale { background: var(--marginal-amber-light); color: var(--marginal-amber); }

/* === Hide number input spinners (Safari) === */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* === Range Slider === */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: transparent;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background:
    linear-gradient(to right, transparent var(--slider-pct, 50%), var(--gray-200) var(--slider-pct, 50%)),
    linear-gradient(to right, var(--horizon-teal) 0%, var(--horizon-teal) 40%, var(--marginal-amber) 65%, var(--exceed-red) 100%);
}
input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background:
    linear-gradient(to right, transparent var(--slider-pct, 50%), var(--gray-200) var(--slider-pct, 50%)),
    linear-gradient(to right, var(--horizon-teal) 0%, var(--horizon-teal) 40%, var(--marginal-amber) 65%, var(--exceed-red) 100%);
}
input[type="range"]:focus-visible {
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--horizon-teal);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--horizon-teal);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  cursor: pointer;
}
input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 5px rgba(0, 147, 215, 0.35);
}

/* === Search Mode Toggle (Segmented Buttons) === */
.search-mode-toggle {
  display: flex;
  gap: 2px;
  background: var(--gray-100);
  border-radius: var(--radius-md);
  padding: 2px;
}
.search-mode-btn {
  flex: 1;
  padding: var(--space-1) var(--space-2);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-500);
  background: transparent;
  cursor: pointer;
  transition: all 100ms;
}
.search-mode-btn:hover { color: var(--gray-700); }
.search-mode-btn--active {
  background: #fff;
  color: var(--gray-900);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
/* Legacy plane switch label styles (kept for reference) */
.search-mode-toggle__label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-400);
  transition: color 200ms, font-weight 200ms;
  min-width: 70px;
}
.search-mode-toggle__label--left { text-align: right; }
.search-mode-toggle__label--right { text-align: left; }
.search-mode-toggle__label--active {
  color: var(--gray-900);
  font-weight: 600;
}

/* Plane Switch — adapted from Uiverse.io by Nawsome */
.plane-switch {
  --dot: #fff;
  --street: var(--gray-500);
  --street-line: var(--gray-400);
  --street-line-mid: var(--gray-300);
  --sky-1: #0093d7;
  --sky-2: #007ab8;
  --light-1: rgba(255, 233, 0, 1);
  --light-2: rgba(255, 233, 0, .3);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.plane-switch input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); pointer-events: none; }
.plane-switch input + div {
  -webkit-mask-image: radial-gradient(white, black);
  mask-image: radial-gradient(white, black);
  position: relative;
  overflow: hidden;
  width: 66px;
  height: 33px;
  padding: 1px;
  border-radius: 17px;
  background: linear-gradient(90deg, var(--street) 0%, var(--street) 25%, var(--sky-1) 75%, var(--sky-2) 100%) left var(--p, 0%) top 0;
  background-position-x: var(--p, 0%);
  background-size: 400% auto;
  transition: background-position 0.6s;
}
.plane-switch input + div:before,
.plane-switch input + div:after {
  content: "";
  display: block;
  position: absolute;
  transform: translateX(var(--s, 0));
  transition: transform 0.3s;
}
.plane-switch input + div:before {
  width: 56px;
  right: 3px;
  top: 5px;
  height: 1px;
  background: var(--street-line);
  box-shadow: 0 22px 0 0 var(--street-line);
}
.plane-switch input + div:after {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  left: 30px;
  top: 1px;
  animation: planeSwitchLights 2s linear infinite;
  box-shadow: inset 0 0 0 2px var(--light-1), 0 28px 0 var(--light-1), 10px 0 0 var(--light-2), 10px 28px 0 var(--light-2), 20px 0 0 var(--light-2), 20px 28px 0 var(--light-2);
}
.plane-switch input + div span { display: block; position: absolute; }
.plane-switch input + div span.street-middle {
  top: 16px;
  left: 28px;
  width: 4px;
  height: 1px;
  transform: translateX(var(--s, 0));
  background: var(--street-line-mid);
  box-shadow: 7px 0 0 var(--street-line-mid), 14px 0 0 var(--street-line-mid), 21px 0 0 var(--street-line-mid), 28px 0 0 var(--street-line-mid), 35px 0 0 var(--street-line-mid);
  transition: transform 0.3s;
}
.plane-switch input + div span.cloud {
  width: 16px;
  height: 5px;
  border-radius: 2px;
  background: #fff;
  position: absolute;
  top: var(--ct, 10px);
  left: 100%;
  opacity: var(--co, 0);
  transition: opacity 0.3s;
  animation: planeSwitchClouds 2s linear infinite var(--cd, 0s);
}
.plane-switch input + div span.cloud:before,
.plane-switch input + div span.cloud:after {
  content: "";
  position: absolute;
  transform: translateX(var(--cx, 0));
  border-radius: 50%;
  width: var(--cs, 5px);
  height: var(--cs, 5px);
  background: #fff;
  bottom: 1px;
  left: 1px;
}
.plane-switch input + div span.cloud:after {
  --cs: 6px;
  --cx: 4px;
}
.plane-switch input + div span.cloud.two {
  --ct: 26px;
  --cd: 1s;
  opacity: var(--co-2, 0);
}
.plane-switch input + div div {
  display: table;
  position: relative;
  z-index: 1;
  padding: 7px;
  border-radius: 50%;
  background: var(--dot);
  transform: translateX(var(--x, 0));
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.35, 1.2);
}
.plane-switch input + div div svg {
  width: 17px;
  height: 17px;
  display: block;
  color: var(--c, var(--street));
  transition: color 0.6s;
}
.plane-switch input:checked + div {
  --p: 100%;
  --x: 33px;
  --s: -66px;
  --c: var(--sky-2);
  --co: .8;
  --co-2: .6;
}
.plane-switch:focus-within {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 17px;
}

@keyframes planeSwitchLights {
  20%, 30% {
    box-shadow: inset 0 0 0 2px var(--light-2), 0 28px 0 var(--light-2), 10px 0 0 var(--light-1), 10px 28px 0 var(--light-1), 20px 0 0 var(--light-2), 20px 28px 0 var(--light-2);
  }
  55%, 65% {
    box-shadow: inset 0 0 0 2px var(--light-2), 0 28px 0 var(--light-2), 10px 0 0 var(--light-2), 10px 28px 0 var(--light-2), 20px 0 0 var(--light-1), 20px 28px 0 var(--light-1);
  }
  90%, 100% {
    box-shadow: inset 0 0 0 2px var(--light-1), 0 28px 0 var(--light-1), 10px 0 0 var(--light-2), 10px 28px 0 var(--light-2), 20px 0 0 var(--light-2), 20px 28px 0 var(--light-2);
  }
}
@keyframes planeSwitchClouds {
  97% { transform: translateX(-90px); visibility: visible; }
  98%, 100% { visibility: hidden; }
  99% { transform: translateX(-90px); }
  100% { transform: translateX(0); }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .plane-switch input + div,
  .plane-switch input + div:before,
  .plane-switch input + div:after,
  .plane-switch input + div span,
  .plane-switch input + div div,
  .plane-switch input + div div svg {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* === Modal === */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms var(--ease-out);
}
.modal-backdrop.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 480px;
  width: 90%;
  transform: scale(0.95);
  transition: transform 180ms var(--ease-out);
}
.modal-backdrop.active .modal { transform: scale(1); }

.modal__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-6);
}
.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
}
.modal__header .modal__title { margin-bottom: 0; }

.modal__close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  color: var(--gray-500);
  transition: color 150ms var(--ease-out), background 150ms var(--ease-out);
}
.modal__close-btn:hover {
  color: var(--gray-900);
  background: var(--gray-100);
}
.modal__close-btn:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.modal__body {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--gray-700);
}

.disclaimer-modal { max-width: 560px; }

.modal__footer {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-6);
}

/* === Toast Notifications === */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3) var(--space-4);
  font-size: 0.875rem;
  max-width: 400px;
  animation: toastIn 200ms var(--ease-out);
}
.toast--warning { border-left: 4px solid var(--stale-yellow); }
.toast--error { border-left: 4px solid var(--exceed-red); }
.toast--success { border-left: 4px solid var(--qualify-green); }
.toast .dismiss {
  background: none;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  padding: var(--space-1);
  margin-left: auto;
  font-size: 1.125rem;
}

.toast__icon {
  flex-shrink: 0;
  font-size: 1rem;
}
.toast__message {
  flex: 1;
}
.toast__close {
  background: none;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  padding: var(--space-1);
  margin-left: auto;
  font-size: 1.125rem;
  min-width: 28px;
  min-height: 28px;
}
.toast__close:hover { color: var(--gray-900); }
.toast--info { border-left: 4px solid var(--horizon-teal); }
.toast--exit {
  animation: toastOut 200ms var(--ease-out) forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(8px); }
}

/* === Skeleton Loaders === */
.skeleton {
  background: var(--gray-200);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--gray-100), transparent);
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.skeleton--text { height: 16px; width: 80%; margin-bottom: var(--space-2); }
.skeleton--text-sm { height: 14px; width: 60%; margin-bottom: var(--space-2); }
.skeleton--heading { height: 24px; width: 60%; margin-bottom: var(--space-3); }
.skeleton--rect { height: 200px; width: 100%; }
.skeleton--circle { width: 60px; height: 60px; border-radius: 50%; }

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* === Responsive === */
@media (max-width: 639px) {
  .topbar {
    height: var(--topbar-height-mobile);
    padding: 0 var(--space-4);
    gap: var(--space-2);
  }
  .logo-preflt { font-size: 1.375rem; }
  .logo-xwind  { font-size: 0.9375rem; }
  .topbar__logo-img { width: 28px; height: 28px; }
  .disclaimer-bar { padding: var(--space-2) var(--space-3); gap: var(--space-1); flex-wrap: wrap; }
  .footer-meta { gap: var(--space-1); flex-wrap: wrap; }
  .hide-mobile { display: none !important; }

  /* Nav hidden on mobile by default; hamburger triggers .topbar__nav--open */
  .topbar__nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1a22;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: var(--space-2) 0;
    flex-direction: column;
    align-items: stretch;
    z-index: 1999;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  }
  .topbar__nav.topbar__nav--open {
    display: flex;
  }
  .topbar__nav-divider { display: none; }
  .topbar__nav-item { width: 100%; }
  .topbar__nav-link {
    width: 100%;
    padding: var(--space-3) var(--space-5);
    font-size: 0.9375rem;
    justify-content: space-between;
  }
  /* Mobile: dropdown appears inline below the button */
  .topbar__dropdown {
    position: static;
    width: 100%;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: rgba(255,255,255,0.04);
  }
  .topbar__dropdown-item { padding: var(--space-2) var(--space-8); }
  /* PREFLT content collapses to single scrollable column on mobile */
  #resources-content-preflt {
    flex-direction: column;
    max-height: 50dvh;
    overflow-y: auto;
  }
  .resources-preflt__col:not(:last-child) {
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.07);
  }
  .topbar__hamburger { display: flex; }
  .topbar__prefs-popover {
    right: var(--space-2);
  }

  /* Prevent iOS auto-zoom on input focus (requires >= 16px) */
  .form-input,
  .autocomplete-input {
    font-size: 16px;
  }
}

@media (min-width: 640px) {
  .hide-desktop { display: none !important; }
}

/* === About Modal === */
.about-modal {
  max-width: 560px;
  width: calc(100% - var(--space-8));
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.about-modal__body {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  flex: 1;
  min-height: 0;
}

.about-section__heading {
  font-family: 'Pathway Extreme', 'Arial Narrow', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--horizon-teal, #96C7E8);
  margin-bottom: var(--space-2);
}
.about-subheading {
  font-family: 'Pathway Extreme', 'Arial Narrow', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gray-400, #94A3B8);
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
}

.about-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.about-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--gray-600, #4B5563);
}

.about-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}
.about-swatch--green { background: var(--qualify-green, #22C55E); }
.about-swatch--amber { background: var(--marginal-amber, #F59E0B); }
.about-swatch--red   { background: var(--exceed-red, #EF4444); }
.about-swatch--gray  { background: var(--gray-400, #9CA3AF); }

.about-disclaimer {
  font-size: 0.8125rem;
  color: var(--gray-500, #6B7280);
  font-style: italic;
  margin-top: var(--space-2);
  line-height: 1.5;
}
.about-disclaimer__link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-style: italic;
  color: var(--horizon-teal, #96C7E8);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.about-footer {
  padding-top: var(--space-4);
  border-top: 1px solid var(--gray-200, #E5E7EB);
  font-size: 0.875rem;
  color: var(--gray-500, #6B7280);
}

/* === Annotated airport card demo === */
.about-card-demo {
  position: relative;
  background: #27272A;
  border-radius: var(--radius-md);
  padding: 20px 16px;
  margin-bottom: var(--space-3);
}

/* Numbered callout dot */
.ann-dot {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #E2E8F0;
  color: #1E293B;
  font-size: 0.5625rem;
  font-weight: 700;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  z-index: 1;
}

/* Numbered legend below the card */
.about-card-legend {
  list-style: none;
  counter-reset: legend-counter;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 22px auto 1fr;
  column-gap: var(--space-2);
  row-gap: var(--space-3);
  align-items: start;
}
.about-card-legend li {
  display: contents;
  font-size: 0.8125rem;
  line-height: 1.5;
}
.about-card-legend li > strong {
  color: var(--gray-800, #1E293B);
  font-size: 0.8125rem;
  line-height: 1.5;
}
.about-card-legend li > span {
  color: var(--gray-600, #4B5563);
  font-size: 0.8125rem;
  line-height: 1.5;
}
.about-card-legend li::before {
  counter-increment: legend-counter;
  content: counter(legend-counter);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #E2E8F0;
  color: #1E293B;
  font-size: 0.5625rem;
  font-weight: 700;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hide callout dots on very narrow screens where positioning breaks */
@media (max-width: 400px) {
  .ann-dot { display: none; }
}

/* === Tool badge (Live / Soon) in PREFLT About modal === */
.about-tools-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.about-tools-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}
.about-tool-badge {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: var(--radius-pill);
  margin-top: 2px;
  white-space: nowrap;
}
.about-tool-badge--live {
  background: rgba(69, 240, 208, 0.12);
  color: #45f0d0;
  border: 1px solid rgba(69, 240, 208, 0.3);
}
.about-tool-badge--soon {
  background: rgba(148, 163, 184, 0.08);
  color: var(--gray-400, #9CA3AF);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

/* ── FAQ modal ──────────────────────────────────── */
.faq-modal .modal__body { max-width: 680px; }

.faq-section {
  margin-bottom: var(--space-6);
}
.faq-section--last { margin-bottom: 0; }

.faq-section__heading {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-500, #64748B);
  margin: 0 0 var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--gray-200, #E2E8F0);
}

.faq-item {
  border-bottom: 1px solid var(--gray-100, #F1F5F9);
}
.faq-item:last-child { border-bottom: none; }

.faq-item summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-800, #1E293B);
  user-select: none;
  transition: color 150ms ease;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  flex-shrink: 0;
  font-size: 1rem;
  font-weight: 300;
  color: var(--gray-400, #94A3B8);
  transition: color 150ms ease;
}
.faq-item[open] summary::after {
  content: '−';
  color: #703748;
}
.faq-item summary:hover { color: #703748; }
.faq-item summary:hover::after { color: #703748; }

.faq-item__answer {
  padding: 0 0 var(--space-4);
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--gray-600, #475569);
}
.faq-item__answer p { margin: 0 0 var(--space-2); }
.faq-item__answer p:last-child { margin-bottom: 0; }
.faq-item__answer strong { color: var(--gray-800, #1E293B); }

.faq-formula {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8125rem;
  background: rgba(13, 148, 136, 0.05);
  border: 1px solid rgba(13, 148, 136, 0.15);
  border-left: 3px solid rgba(13, 148, 136, 0.5);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--space-2) var(--space-3);
  margin: var(--space-2) 0;
  color: #0f766e;
  line-height: 1.8;
}

.faq-list {
  margin: var(--space-2) 0 0 var(--space-4);
  padding: 0;
  list-style: disc;
}
.faq-list li { margin-bottom: var(--space-1); }

.faq-link {
  color: #703748;
  text-decoration: none;
}
.faq-link:hover { text-decoration: underline; }

/* === Beta Access Overlay === */
.beta-access-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 18, 30, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.beta-access-card {
  background: var(--surface-bg);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  max-width: 380px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.beta-access-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}

.beta-access-desc {
  font-size: 0.9375rem;
  color: var(--gray-600);
  margin: 0;
}

.beta-access-input {
  width: 100%;
  padding: 0.625rem var(--space-4);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-pill);
  font-size: 1rem;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  background: #fff;
  color: var(--gray-900);
  outline: none;
  transition: border-color 150ms;
  box-sizing: border-box;
}

.beta-access-input:focus {
  border-color: var(--sky-blue);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.15);
}

.beta-access-btn {
  width: 100%;
  margin-top: var(--space-1);
}

.beta-access-error {
  font-size: 0.875rem;
  color: var(--red-500, #ef4444);
  margin: 0;
  text-align: center;
}
