/**
 * Search Panel & Home Screen Styles
 */

/* === Home View === */
.view--home {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow-y: auto;
  width: 100%;
  position: relative;
  scroll-behavior: smooth;
  background: #2A0E18; /* match home-dark-flow — prevents body gray bleeding through */
}

/* Body color for the dark-flow wrapper (fallback + footer strip) */
.home-dark-flow {
  background: #2A0E18;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── Hero Section ── */
.home-hero {
  position: relative;
  flex: 1;
  min-height: calc(100dvh - var(--topbar-height));
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(160deg, #8B4560 0%, #703748 30%, #4A2030 65%, #2A0E18 100%);
}


.home-hero > * {
  position: relative;
  z-index: 1;
}

/* Wind field animated background */
.wind-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.wind-field canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Hero inner: two-column grid */
.home-hero__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 56px 64px 48px;
  box-sizing: border-box;
}

/* Left column */
.home-hero__left {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.home-hero__overline {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.home-hero__heading {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 3.75rem);
  font-weight: 500;
  color: #fff;
  line-height: 1.05;
  letter-spacing: -0.02em;
  transform: skewX(-3deg);
  margin: 0;
}

.home-hero__subtitle {
  font-family: var(--font-primary);
  font-size: 1.0625rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.6;
  max-width: 460px;
  margin: 0;
}

/* Trust bar */
.home-hero__trust {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.trust-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.68);
  letter-spacing: 0.01em;
}

.trust-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  flex-shrink: 0;
}

.trust-dot--live {
  background: var(--qualify-green);
  animation: trustPulse 2.5s ease-in-out infinite;
}

@keyframes trustPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(26,127,75,0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 4px rgba(26,127,75,0); }
}

@media (prefers-reduced-motion: reduce) {
  .trust-dot--live { animation: none; }
}
.reduce-motion .trust-dot--live { animation: none; }

.trust-sep {
  width: 1px;
  height: 12px;
  background: rgba(255,255,255,0.15);
}

/* Last-search shortcut pill */
.home-last-search {
  display: inline-flex;
  align-items: stretch;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius-pill);
  overflow: hidden;
  align-self: flex-start;
  max-width: 100%;
}

.home-last-search__params {
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
}

.home-last-search__divider {
  width: 1px;
  background: rgba(255, 255, 255, 0.13);
  flex-shrink: 0;
}

.home-last-search__btn {
  background: none;
  border: none;
  padding: 6px 14px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 150ms, background 150ms;
  font-family: var(--font-primary);
}

.home-last-search__btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.home-last-search__btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.5);
  outline-offset: -2px;
  border-radius: var(--radius-pill);
}

/* Right column: glass search card */
.home-hero__right {
  display: flex;
  align-items: flex-start;
}

.home-search-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 28px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
  width: 100%;
}

/* Form styles inside glass card */
.home-search-card .form-label {
  color: rgba(255, 255, 255, 0.85);
}

.home-search-card .form-input,
.home-search-card .autocomplete-input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
}

.home-search-card .form-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.home-search-card .form-input:focus,
.home-search-card .autocomplete-input:focus {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 2px rgba(139, 69, 96, 0.55);
  border-color: rgba(255,255,255,0.25);
}

.home-search-card .input-with-unit .unit {
  color: rgba(255, 255, 255, 0.5);
}

.home-search-card .range-separator {
  color: rgba(255, 255, 255, 0.45);
}

.home-search-card .search-mode-toggle {
  background: rgba(255, 255, 255, 0.08);
}

.home-search-card .search-mode-btn {
  color: rgba(255, 255, 255, 0.5);
  background: transparent;
}

.home-search-card .search-mode-btn:hover {
  color: rgba(255, 255, 255, 0.7);
}

.home-search-card .search-mode-btn--active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.home-search-card .advanced-toggle {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.home-search-card .advanced-toggle__label,
.home-search-card .advanced-toggle__chevron {
  color: rgba(255, 255, 255, 0.5);
}

.home-search-card .advanced-toggle:hover .advanced-toggle__label,
.home-search-card .advanced-toggle:hover .advanced-toggle__chevron {
  color: rgba(255, 255, 255, 0.7);
}

.home-search-card .form-section-divider {
  color: rgba(255, 255, 255, 0.4);
}

.home-search-card .form-section-divider::before,
.home-search-card .form-section-divider::after {
  background: rgba(255, 255, 255, 0.08);
}

/* Demo hint base styles */
.demo-hint {
  text-align: center;
  margin-top: var(--space-3);
  font-size: 0.75rem;
  color: var(--gray-400);
}

.demo-link {
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  padding: 0;
}

.demo-link:hover {
  color: var(--horizon-teal);
}

.demo-link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Dark card overrides */
.home-search-card .demo-hint,
.home-search-card .demo-link {
  color: rgba(255, 255, 255, 0.4);
}

.home-search-card .demo-link:hover {
  color: rgba(255, 255, 255, 0.75);
}

.form-hint-below-cta {
  text-align: center;
  font-size: 0.6875rem;
  color: var(--gray-400);
  margin-top: var(--space-2);
  padding: 0 var(--space-4);
}

.home-search-card .form-hint-below-cta {
  color: rgba(255, 255, 255, 0.4);
}

.home-search-card .form-group {
  margin-bottom: var(--space-3);
}

.home-search-card .form-group:last-of-type {
  margin-bottom: var(--space-3);
}

/* ── Below-fold teaser ── */
.home-teaser {
  padding: var(--space-16) var(--space-8) var(--space-12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  background: linear-gradient(to bottom, #2A0E18, #1A070F);
}

.home-teaser__cards {
  display: flex;
  gap: var(--space-4);
  width: 100%;
  max-width: 720px;
  justify-content: center;
}

.home-teaser__card {
  flex: 1;
  max-width: 200px;
  height: 120px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  filter: blur(1px);
  opacity: 0.45;
}

.home-teaser__text {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.02em;
  text-align: center;
}

/* ── Scroll Reveal ── */
.scroll-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out);
}

.scroll-reveal--visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .scroll-reveal { opacity: 1; transform: none; transition: none; }
}
.reduce-motion .scroll-reveal { opacity: 1; transform: none; transition: none; }

/* ── Mobile: single column ── */
@media (max-width: 900px) {
  .home-hero__inner {
    grid-template-columns: 1fr;
    gap: var(--space-6);
    padding: calc(var(--topbar-height) + var(--space-6)) var(--space-5) var(--space-8);
  }

  .home-hero__heading {
    font-size: clamp(2rem, 8vw, 2.5rem);
  }

  .home-hero__subtitle {
    max-width: 100%;
  }

  .home-teaser {
    padding: var(--space-10) var(--space-5) var(--space-8);
  }

  .home-teaser__card {
    height: 80px;
  }
}


/* === Search Card === */
.search-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255, 255, 255, 0.04);
  padding: var(--space-5) var(--space-5) var(--space-4);
  margin-bottom: var(--space-4);
  border: 1px solid var(--gray-200);
}


/* === Advanced Search Toggle (home view) === */
.advanced-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 6px 0;
  margin: var(--space-1) 0;
  border-top: 1px solid var(--gray-200);
  gap: var(--space-1);
}

.advanced-toggle__label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  user-select: none;
}

.advanced-toggle:hover .advanced-toggle__label {
  color: var(--gray-600);
}

.advanced-toggle__chevron {
  width: 16px;
  height: 12px;
  color: var(--gray-500);
  transition: transform 250ms var(--ease-out);
  flex-shrink: 0;
}

.advanced-toggle:hover .advanced-toggle__chevron {
  color: var(--gray-600);
}

.advanced-toggle.expanded .advanced-toggle__chevron {
  transform: rotate(180deg);
}

.advanced-fields {
  max-height: 0;
  overflow: hidden;
  transition: max-height 250ms var(--ease-out);
}

.advanced-fields.expanded {
  max-height: 300px;
}

/* === Range Inputs === */
.range-inputs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.range-inputs .input-with-unit { flex: 1; }

.range-separator {
  font-size: 0.875rem;
  color: var(--gray-500);
  flex-shrink: 0;
}

/* === Time Range Inputs === */
.time-range-inputs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.time-input-group {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.time-label {
  font-size: 0.875rem;
  color: var(--gray-500);
}

.form-input--small {
  width: 60px;
  text-align: center;
}

/* === Autocomplete === */
.autocomplete-wrapper {
  position: relative;
}

.autocomplete-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.autocomplete-input {
  padding-right: 40px !important;
}

.autocomplete-clear {
  position: absolute;
  right: var(--space-2);
  background: none;
  border: none;
  color: var(--gray-500);
  font-size: 1.25rem;
  cursor: pointer;
  padding: var(--space-2);
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  z-index: 1;
}
.autocomplete-clear:hover { color: var(--gray-700); background: var(--gray-100); }

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
}

.autocomplete-dropdown li {
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  min-height: 40px;
  transition: background 100ms;
}

.autocomplete-dropdown li:hover,
.autocomplete-dropdown li.highlighted {
  background: var(--gray-50);
}

.autocomplete-dropdown li[aria-selected="true"] {
  background: #EFF6FF;
  border-left: 3px solid var(--horizon-teal);
}

.autocomplete-dropdown .ac-identifier {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--gray-900);
  flex-shrink: 0;
  min-width: 48px;
}

.autocomplete-dropdown .ac-name {
  font-size: 0.8125rem;
  color: var(--gray-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.autocomplete-dropdown .ac-empty {
  padding: var(--space-4);
  text-align: center;
  color: var(--gray-500);
  font-size: 0.875rem;
}

/* === Crosswind slider sync === */
#max-crosswind-slider {
  margin-bottom: var(--space-1);
}

/* === Profiles section === */
.profiles-section {
  margin-top: var(--space-1);
}

.profiles-section summary {
  cursor: pointer;
  list-style: none;
}

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

/* === Filter Sidebar (map view) === */
.filter-sidebar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 1000;
  width: var(--sidebar-width);
  background: #27272A;
  border-radius: 0;
  box-shadow: 4px 0 16px rgba(0,0,0,0.2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 300ms var(--ease-out);
}

.filter-sidebar__content {
  padding: var(--space-5);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.filter-sidebar__results {
  flex-shrink: 0;
  color: rgba(255,255,255,0.55);
  font-size: 0.8125rem;
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: var(--space-1);
}

/* Results hero: large count + label */
.results-hero {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 7px;
}

.results-hero__num {
  font-family: var(--font-mono);
  font-size: 1.375rem;
  font-weight: 500;
  color: #96C7E8;
  line-height: 1;
}

.results-hero__word {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.01em;
}

.results-rule {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin-bottom: 7px;
}

/* Results nav: 4-chip section jump row */
.results-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.results-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 5px;
  cursor: pointer;
  transition: background 120ms;
  min-width: 0;
  gap: 2px;
}
.results-chip:hover {
  background: rgba(255, 255, 255, 0.09);
}
.results-chip:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.results-chip__num {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1;
}

.results-chip__label {
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.55;
  line-height: 1;
}

.results-chip--qualify   .results-chip__num { color: var(--fc-vfr); }
.results-chip--marginal  .results-chip__num { color: var(--marginal-amber); }
.results-chip--exceed    .results-chip__num { color: var(--exceed-red); }
.results-chip--nodata    .results-chip__num { color: rgba(255, 255, 255, 0.3); }

.results-truncation-notice {
  margin: 6px 0 0;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.3);
  font-style: italic;
}

/* .input-with-unit--compact used by modal crosswind slider */
.input-with-unit--compact {
  flex-shrink: 0;
  width: 72px;
}

.input-with-unit--compact .form-input {
  padding: var(--space-1) var(--space-2);
  font-size: 0.8125rem;
}

/* === Mobile Navigation Bar === */
.mobile-nav-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  min-height: 54px;
  background: #fff;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: stretch;
  z-index: 500;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

.mobile-nav-seg {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-primary);
  gap: 2px;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-seg::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 6px;
  right: 6px;
  height: 3px;
  border-radius: 2px 2px 0 0;
  opacity: 0;
  transition: opacity 150ms;
}
.mobile-nav-seg--green::after { background: var(--fc-vfr); }
.mobile-nav-seg--amber::after { background: var(--marginal-amber); }
.mobile-nav-seg--red::after   { background: var(--exceed-red); }
.mobile-nav-seg--gray::after  { background: var(--gray-400); }
.mobile-nav-seg--active::after { opacity: 1; }

/* Tinted background on active segment — makes toggle state legible */
.mobile-nav-seg--green.mobile-nav-seg--active { background: rgba(69, 240, 208, 0.08); }
.mobile-nav-seg--amber.mobile-nav-seg--active { background: rgba(146, 112, 0, 0.08); }
.mobile-nav-seg--red.mobile-nav-seg--active   { background: rgba(185, 28, 28, 0.08); }
.mobile-nav-seg--gray.mobile-nav-seg--active  { background: rgba(100, 116, 139, 0.08); }

/* Zero-count segments — muted but not disabled */
.mobile-nav-seg--zero { opacity: 0.4; }

.mobile-nav-seg__num {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}
.mobile-nav-seg--green .mobile-nav-seg__num { color: var(--fc-vfr); }
.mobile-nav-seg--amber .mobile-nav-seg__num { color: var(--marginal-amber); }
.mobile-nav-seg--red   .mobile-nav-seg__num { color: var(--exceed-red); }
.mobile-nav-seg--gray  .mobile-nav-seg__num { color: var(--gray-500); }

.mobile-nav-seg__label {
  font-size: 0.5625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
}

.mobile-nav-divider {
  width: 1px;
  background: var(--gray-200);
  margin: 10px 0;
  flex-shrink: 0;
}

/* === Mobile Bottom Sheet (filter panel) === */
.mobile-filter-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
  z-index: 1500;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 300ms var(--ease-out);
  padding: var(--space-4) var(--space-6) var(--space-8);
}

.mobile-filter-sheet.open {
  transform: translateY(0);
}

.mobile-filter-sheet__handle {
  width: 40px;
  height: 4px;
  background: var(--gray-300);
  border-radius: 2px;
  margin: 0 auto var(--space-4);
}

@media (max-width: 639px) {
  .filter-sidebar {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    z-index: 1100;
    background: #27272A;
    border-right: none;
    border-radius: 0;
    box-shadow: none;
  }

  .map-container {
    margin-left: 0;
  }

  .filter-sidebar.mobile-open {
    display: flex;
    animation: slideUp 300ms var(--ease-out);
  }

  @keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  /* Nav bar replaces sidebar header nav on mobile — hide the duplicate */
  .results-nav,
  .results-rule {
    display: none;
  }

  /* Drag handle strip — tap or swipe down to close */
  .sidebar-drag-handle {
    flex-shrink: 0;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    touch-action: none;
  }
  .sidebar-drag-handle::after {
    content: '';
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.25);
    transition: background 150ms;
  }
  .sidebar-drag-handle:active::after {
    background: rgba(255, 255, 255, 0.45);
  }

  .view--home {
    scroll-behavior: smooth;
  }

  /* Home view — mobile single column handled in @media (max-width: 900px) above */
  .home-search-card .form-label {
    font-size: 0.8125rem;
  }

  .home-teaser {
    padding: var(--space-8) var(--space-4) var(--space-8);
  }


  .range-inputs {
    flex-direction: column;
    gap: var(--space-2);
  }
  .range-inputs .input-with-unit {
    width: 100%;
  }
  .range-separator {
    align-self: center;
    font-size: 0.75rem;
  }
}

/* === Reduce Motion (user setting) === */
.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}
