/* ==========================================================================
   HERO NAV COMPONENT - LoveForm-Style Collapsible Navigation
   K12 Landing Page (/k12) - Morphing navbar that collapses on scroll

   Two states:
   1. EXPANDED (default at scroll=0): Full hero with headline, subtitle, search bar
   2. COLLAPSED (on scroll): Compact search button bar

   Brand gradient background with white logo/hamburger
   ========================================================================== */

/* CSS Custom Properties for Hero Nav */
:root {
  /* Brand gradient - uses existing brand colors */
  --hero-nav-gradient: linear-gradient(135deg, #2ac8c8 0%, #289a96 100%);
  --hero-nav-gradient-dark: linear-gradient(135deg, #289a96 0%, #1f7a76 100%);

  /* Animation timing - LoveForm's spring-like easing */
  --hero-nav-transition: 350ms cubic-bezier(0.32, 0.72, 0, 1);
  --hero-nav-transition-fast: 200ms cubic-bezier(0.32, 0.72, 0, 1);

  /* Dimensions */
  --hero-nav-height-expanded: auto;
  --hero-nav-height-collapsed: 80px;
  --hero-search-bar-height: 66px;
  --hero-search-bar-radius: 40px;

  /* Z-index layer - must be above backdrop (999) for dropdowns to appear correctly */
  --hero-nav-z-index: 1000;
}

/* ==========================================================================
   BASE CONTAINER
   ========================================================================== */
.hero-nav {
  position: sticky;
  top: 0;
  z-index: var(--hero-nav-z-index);
  width: 100%;
}

/* ==========================================================================
   EXPANDED STATE - Full Hero with Gradient Background
   ========================================================================== */
.hero-nav-expanded {
  background: var(--hero-nav-gradient);
  padding: 0 0 20px 0; /* No top padding - header has its own height */
  /* No min-height - content-driven like LoveForm */
  transform-origin: top center;
  transition:
    opacity var(--hero-nav-transition),
    transform var(--hero-nav-transition);
}

/* Header Row: Logo + Title + Hamburger (all on same row) */
/* Matches K12 navbar spacing exactly */
.hero-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: var(--k12-header-row-height, 80px);
  width: 100%;
  margin: 0;
  padding-left: 16px;
  padding-right: 16px;
}

/* Logo - matches navbar .navbar-brand margin */
.hero-nav-header .hero-nav-logo {
  margin-left: 16px;
}

/* Hamburger - 32px from right viewport edge */
.hero-nav-header .hero-nav-menu-btn {
  margin-right: 16px;
}

/* Title in header - takes center space */
.hero-nav-header .hero-nav-title {
  flex: 1;
  text-align: center;
  margin: 0;
  padding: 0 16px;
}

/* ==========================================================================
   LANDING: CONTINUE SEARCHING CARD (Airbnb-style)
   ========================================================================== */
.k12-landing-page .k12-continue-section {
  padding: 12px 0 12px 0;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
}

.k12-landing-page .k12-continue-section .container-fluid {
  max-width: 1760px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

@media (max-width: 767px) {
  /* Mobile needs breathing room below the hero title */
  .k12-landing-page .k12-continue-section {
    padding-top: 12px;
    padding-bottom: 12px;
    border-bottom: none;
    border-top-color: #f3f4f6; /* Fainter divider under mobile hero */
  }

  /* Match landing carousel gutters on mobile */
  .k12-landing-page .k12-continue-section .container-fluid {
    padding-left: 22px;
    padding-right: 22px;
  }
}

.k12-landing-page .k12-continue-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 14px;
  box-sizing: border-box;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  text-decoration: none;
  color: #111827;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.k12-landing-page .k12-continue-card:active {
  transform: translateY(1px);
}

.k12-landing-page .k12-continue-card__body {
  min-width: 0;
}

.k12-landing-page .k12-continue-card__title {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.25;
  color: #111827;
  margin-bottom: 6px;
}

.k12-landing-page .k12-continue-card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #6b7280;
  font-weight: 600;
}

.k12-landing-page .k12-continue-chevron {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  flex-shrink: 0;
}

.k12-landing-page .k12-continue-card__thumbs {
  position: relative;
  width: 88px;
  height: 56px;
  flex-shrink: 0;
}

.k12-landing-page .k12-continue-thumb {
  position: absolute;
  top: 0;
  right: 0;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(42, 200, 200, 0.18), rgba(40, 154, 150, 0.18));
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  background-size: cover;
  background-position: center;
}

.k12-landing-page .k12-continue-thumb__img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  object-fit: cover;
}

.k12-landing-page .k12-continue-thumb--2 {
  right: 12px;
  z-index: 3;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.16), rgba(42, 200, 200, 0.16));
  transform: scale(0.98);
}

.k12-landing-page .k12-continue-thumb--3 {
  right: 14px;
  z-index: 1;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(42, 200, 200, 0.16));
  transform: rotate(-6deg) scale(0.96);
}

.k12-landing-page .k12-continue-thumb--1 {
  z-index: 2;
  right: 10px;
  transform: rotate(6deg);
}

/* Mobile: slightly rounder + more compact, with larger thumbnail (Airbnb-like) */
@media (max-width: 767px) {
  .k12-landing-page .k12-continue-card {
    padding: 10px 10px;
    border-radius: 20px;
  }

  .k12-landing-page .k12-continue-card__title {
    margin-bottom: 4px;
  }

  .k12-landing-page .k12-continue-card__thumbs {
    width: 112px;
    height: 72px;
  }

  .k12-landing-page .k12-continue-thumb {
    width: 72px;
    height: 72px;
    border-radius: 16px;
  }

  .k12-landing-page .k12-continue-thumb--2 {
    right: 2px;
  }

  .k12-landing-page .k12-continue-thumb--3 {
    right: 4px;
  }

  .k12-landing-page .k12-continue-thumb--1 {
    right: 0;
  }
}

/* Airbnb parity: desktop continue row uses horizontal separators + compact layout */
@media (min-width: 992px) {
  .k12-landing-page .k12-continue-section {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .k12-landing-page .k12-continue-card {
    max-width: 557px;
    margin-left: auto;
    margin-right: auto;
    padding: 8px 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  .k12-landing-page .k12-continue-card:active {
    transform: none;
  }

  .k12-landing-page .k12-continue-card__body {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .k12-landing-page .k12-continue-card__title {
    margin-bottom: 0;
    font-size: 14px;
    line-height: 1.25;
  }

  .k12-landing-page .k12-continue-card__meta {
    font-size: 14px;
    line-height: 1.25;
  }

  .k12-landing-page .k12-continue-chevron {
    width: 12px;
    height: 12px;
    stroke-width: 2;
  }
}

/* White Logo on gradient background - matches K12/S navbar logo size */
.hero-nav-logo img {
  height: 42px;
  filter: brightness(0) invert(1); /* Make logo white */
  transition: filter var(--hero-nav-transition-fast);
}

.hero-nav-logo__full {
  display: block;
}

.hero-nav-logo__mark {
  display: none;
}

/* Hamburger Menu Button - White on gradient */
.hero-nav-menu-btn {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--hero-nav-transition-fast);
}

.hero-nav-menu-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.hero-nav-menu-btn svg {
  width: 18px;
  height: 18px;
  stroke: #ffffff;
  stroke-width: 2;
}

/* Content Area - Centered */
.hero-nav-content {
  max-width: 834px; /* 🔧 BUG-100 (Airbnb Match): Reduced to 834px - accounts for button overlap (280×3 sections + 2px dividers - 56px overlap + 48px button) */
  margin: 0 auto;
  text-align: center;
}

/* ==========================================================================
   HEADLINE & SUBTITLE (Landing Page Mode)
   ========================================================================== */
.hero-nav-title {
  font-size: 32px; /* Smaller for inline header layout */
  font-weight: 700;
  color: #222222; /* Black text on gradient */
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.hero-nav-subtitle {
  font-size: 18px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.95);
  margin: -10px 0 16px 0; /* Negative top margin pulls closer to title */
  line-height: 1.4;
  white-space: nowrap; /* Keep on single line */
  text-align: center;
}

@media (min-width: 768px) {
  body.k12-landing-page .hero-nav[data-mode="landing"][data-edit-surface="compact"] .hero-nav-expanded {
    background: #ffffff;
    padding-bottom: 18px;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
  }

  body.k12-landing-page .hero-nav[data-mode="landing"][data-edit-surface="compact"] .hero-nav-logo img {
    filter: none;
  }

  body.k12-landing-page .hero-nav[data-mode="landing"][data-edit-surface="compact"] .hero-nav-menu-btn {
    background: rgba(15, 23, 42, 0.05);
  }

  body.k12-landing-page .hero-nav[data-mode="landing"][data-edit-surface="compact"] .hero-nav-menu-btn:hover {
    background: rgba(15, 23, 42, 0.09);
  }

  body.k12-landing-page .hero-nav[data-mode="landing"][data-edit-surface="compact"] .hero-nav-menu-btn svg {
    stroke: #222222;
  }

  body.k12-landing-page .hero-nav[data-mode="landing"][data-edit-surface="compact"] .hero-nav-title,
  body.k12-landing-page .hero-nav[data-mode="landing"][data-edit-surface="compact"] .hero-nav-subtitle {
    display: none !important;
  }

  body.k12-landing-page .hero-nav[data-mode="landing"][data-edit-surface="compact"] .hero-nav-content {
    max-width: 920px;
    padding-top: 4px;
  }

  body.k12-landing-page .hero-nav[data-mode="landing"][data-edit-surface="compact"] .hero-search-bar {
    margin-top: 0;
  }
}

/* ==========================================================================
   AIRBNB SEARCH BAR (Pill Shape) - White on Gradient
   ========================================================================== */
.hero-search-bar {
  display: flex;
  align-items: center;
  background: #ffffff;
  border-radius: var(--hero-search-bar-radius);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  max-width: 834px; /* 🔧 BUG-100 (Airbnb Match): Reduced to 834px - button overlaps WHO section (280×3 + 2px dividers - 56px overlap + 48px button) */
  margin: 0 auto;
  position: relative;
  z-index: 1001; /* BUG-179 FIX: Ensure search bar and X buttons are ABOVE backdrop (z-index: 999) */
  --hero-who-overlap: 56px;
  --hero-who-overlap-padding: 64px;
}

/* 🔧 BUG-191: Airbnb-style "dim bar" when any section is active (desktop parity) */
.hero-search-bar:has(.hero-search-section.active),
.hero-search-bar.has-active-section {
  background-color: #ebebeb;
}

/* 🔧 BUG-100 (Airbnb Match): Removed search button expansion - Airbnb keeps button at fixed 48px size */
/* Expand WHO overlap when search button is expanded (desktop layout) */
/* @media (min-width: 769px) {
  .hero-search-bar:has(.who-section.active) {
    --hero-who-overlap: 144px;
    --hero-who-overlap-padding: 152px;
  }
} */

/* Search Section - Each clickable area */
.hero-search-section {
  flex: 0 0 280px; /* 🔧 BUG-100 (Airbnb Match): Fixed width to match wrapper and prevent WHO section expansion */
  display: flex;
  flex-direction: column;
  padding: 14px 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  border-radius: var(--hero-search-bar-radius);
  transition: background var(--hero-nav-transition-fast);
  min-height: var(--hero-search-bar-height);
  justify-content: center;
}

.hero-search-section:hover {
  background: #f0f0f0; /* 🔧 BUG-100: Darkened from #f7f7f7 to #f0f0f0 (one shade darker for better visibility) */
}

.hero-search-section.active {
  background: #ffffff;
  box-shadow:
    inset 0 0 0 2px #222222,
    0 2px 16px rgba(0, 0, 0, 0.12);
  border-radius: 32px;
  z-index: 2;
  position: relative;
}

/* 🔧 BUG-092: WHO section drops to z-index 1 when active so ring appears behind search button (BUG-113 requirement) */
.hero-search-section.who-section.active {
  z-index: 1;
}

/* Section Label (small uppercase) */
.hero-section-label {
  font-size: 12px;
  font-weight: 600;
  color: #222222;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

/* Section Value (user selection or placeholder) */
.hero-section-value {
  font-size: 14px;
  color: #717171;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-section-value.has-value {
  color: #222222;
  font-weight: 500;
}

/* ==========================================================================
   CLEAR BUTTONS (X) - LoveForm Pattern
   Shows X button when section has a value, allows clearing without triggering open
   ========================================================================== */

/* Wrapper - positions section and clear button */
.hero-search-section-wrapper {
  position: relative;
  /* Allow slight shrink so the active WHO ring never “pushes” past the pill edge (no right-edge expansion). */
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
}

/* WHO section wrapper - needs to extend to search button edge */
/* BUG-113 FIX: When WHO is active, ring should extend behind search button */
.hero-search-section-wrapper:has(.who-section) {
  flex: 1 1 0;
  /* 🔧 BUG-100: Removed padding-right to match WHERE/WHEN wrappers for equal flex distribution */
  /* padding-right: var(--hero-who-overlap); */ /* Caused WHO to be 56px wider - negative margin extends behind button without needing wrapper padding */
  /* 🔧 BUG-100: Removed margin-right - the WHO SECTION (child) has negative margin for ring effect, wrapper doesn't need it */
  /* margin-right: calc(var(--hero-who-overlap) * -1); */ /* Compound negative margin with section's -56px caused wrapper to extend unnecessarily */
}

/* Section inside wrapper takes full width */
.hero-search-section-wrapper .hero-search-section {
  flex: 1;
  padding-right: 48px; /* Make room for clear button */
}

/* Clear button (X) - LoveForm pattern: gray circle with visible × */
.hero-clear-btn {
  display: none;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: #dddddd;
  border-radius: 50%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s,
    transform 0.15s;
  z-index: 1000; /* BUG-179 FIX: Must be >= backdrop z-index (999) to be clickable */
}

.hero-clear-btn:hover {
  background: #c8c8c8;
  transform: translateY(-50%) scale(1.05);
}

.hero-clear-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.hero-clear-btn svg {
  width: 12px;
  height: 12px;
  stroke: #222222;
  stroke-width: 2.5;
}

/* Show clear button only when section is ACTIVE (modal open) AND has a value */
/* X buttons appear when you click into a section, not when just viewing the bar */
/* Note: .active is on .hero-search-section, .has-value is on .hero-section-value */
.hero-search-section-wrapper:has(.hero-search-section.active):has(
    .hero-section-value.has-value
  )
  .hero-clear-btn {
  display: flex;
}

/* BUG-147 FIX: WHO clear button should sit BEFORE the expanded search button (LoveForm pattern)
   Regression note: base positioning can place #heroClearWho AFTER the expanded Search pill due to WHO overlap styles. */
#heroWhoSection.active + #heroClearWho {
  right: 118px; /* 9px (button right) + 98px (button width) + ~11px gap (prevents touching) */
}

/* Divider between sections */
.hero-search-divider {
  width: 1px;
  height: 32px;
  background: #dddddd;
  flex-shrink: 0;
}

/* Who section */
/* Note: Avoid negative margins here (can cause a subtle right-edge "expansion" when WHO is active). */
.hero-search-section.who-section {
  position: relative;
  z-index: 2; /* 🔧 BUG-101: Reduced from 4 to keep hover below search button (z-index: 3), matches Airbnb pattern */
}

/* Search Button - Brand Teal Circle */
/* BUG-113: Position relative with z-index to appear above WHO section ring */
/* BUG-092: Allow WHO section clicks through the margin overlap area */
.hero-search-btn {
  width: 48px;
  height: 48px;
  background: linear-gradient(to right, #2ac8c8, #289a96);
  border: none;
  border-radius: 50%;
  position: absolute; /* 🔧 BUG-100 (Airbnb Match): Absolute position to anchor right edge */
  right: 9px;
  top: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    transform 0.2s,
    box-shadow 0.2s,
    width 0.2s;
  z-index: 1002; /* Keep Search CTA above the hero backdrop (999) during staged WHERE->WHEN flows */
  pointer-events: auto; /* 🔧 BUG-092: Button itself is clickable */
}

.hero-search-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgba(42, 200, 200, 0.4);
}

.hero-search-btn svg {
  width: 15px; /* 🔧 BUG-100: Slightly smaller for more compact look */
  height: 15px;
  stroke: #ffffff;
  stroke-width: 3;
  fill: none;
}

/* Search button text - hidden by default (LoveForm pattern) */
.hero-search-btn-text {
  display: none;
  font-size: 14px; /* 🔧 BUG-100: Reduced from 16px to match Airbnb's compact text size */
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
}

/* 🔧 BUG-100 (Airbnb Match): Button moves left when ANY section is active, search bar stays fixed */
/* LoveForm pattern: Button shifts left to show "Search" text when modal is open, doesn't expand search bar */
.hero-search-bar:has(.hero-search-section.active) .hero-search-btn,
.hero-search-bar.has-active-section .hero-search-btn {
  width: 98px; /* Compact width similar to Airbnb */
  max-width: 98px;
  padding: 0 14px 0 10px; /* Tighter padding for compact look */
  border-radius: 24px;
  gap: 4px; /* Reduced gap between icon and text */
  right: 9px; /* Keep button anchored; avoid subtle right-edge shifts */
}

.hero-search-bar:has(.hero-search-section.active) .hero-search-btn-text,
.hero-search-bar.has-active-section .hero-search-btn-text {
  display: inline;
}

/* ==========================================================================
   COLLAPSED STATE - Compact Search Button Bar
   ========================================================================== */
.hero-nav-collapsed {
  display: none;
  background: #ffffff;
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.04);
  --k12-header-row-height: 60px;
  padding: 10px 0 16px;
}

.k12-search-page .hero-nav-collapsed {
  --k12-header-row-height: 60px;
  padding: 10px 0 16px;
}

.hero-nav-collapsed .hero-nav-header {
  /* Use grid so the (search+filter) group can be centered or left-aligned
     without pushing the filter pill away from the condensed search button. */
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  margin-bottom: 0;
  gap: 14px;
  justify-content: initial;
}

.k12-search-page .hero-nav-collapsed .hero-nav-header {
  gap: 12px;
}

/* Search + filter group stays adjacent (single layout unit). */
.hero-nav-collapsed__search-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  flex-wrap: nowrap;
  justify-self: center;
}

.k12-search-page .hero-nav-collapsed__search-group {
  gap: 12px;
  justify-self: start;
}

.hero-nav-collapsed .hero-menu-wrapper--collapsed {
  justify-self: end;
}

/* Logo returns to normal color when collapsed */
.hero-nav-collapsed .hero-nav-logo img {
  filter: none;
}

/* Hamburger returns to normal color */
.hero-nav-collapsed .hero-nav-menu-btn {
  background: transparent;
  border: 1px solid #dddddd;
}

.hero-nav-collapsed .hero-nav-menu-btn svg {
  stroke: #222222;
}

.hero-nav-collapsed .hero-nav-menu-btn:hover {
  background: #f7f7f7;
}

/* Mobile landing headline slot (moved under search pill) */
.hero-nav-mobile-title {
  display: none;
}

/* Condensed Search Button - Pill shape in center */
.hero-nav {
  --k12-condensed-pill-height: 48px;
  --k12-condensed-pill-radius: 40px;
  --k12-condensed-pill-padding: 0 8px 0 12px;
  --k12-condensed-pill-text-size: 14px;
  --k12-condensed-pill-text-weight: 600;
  --k12-condensed-school-icon-size: 32px;
  --k12-condensed-search-icon-size: 32px;
  --k12-condensed-search-icon-margin: 4px 0 4px 4px;
}

.condensed-search-btn {
  display: flex;
  align-items: center;
  gap: 0;
  padding: var(--k12-condensed-pill-padding);
  height: var(--k12-condensed-pill-height);
  background: #ffffff;
  border: 1px solid #dddddd;
  border-radius: var(--k12-condensed-pill-radius);
  cursor: pointer;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 4px 12px rgba(0, 0, 0, 0.05);
  transition: box-shadow var(--hero-nav-transition-fast);
  flex: 1 1 auto;
  min-width: 0;
  width: fit-content;
  max-width: 100%;
}

.k12-search-page .condensed-search-btn,
.hero-nav[data-mode="landing"] .hero-nav-collapsed .condensed-search-btn {
  flex: 0 0 430px;
  width: 430px;
  max-width: 430px;
}

.k12-search-page .condensed-search-btn {
  flex: 0 0 430px;
  width: 430px;
  max-width: 430px;
  height: var(--k12-condensed-pill-height);
  padding: var(--k12-condensed-pill-padding);
}

.hero-nav[data-mode="landing"] .hero-nav-collapsed .condensed-search-btn {
  height: var(--k12-condensed-pill-height);
  padding: var(--k12-condensed-pill-padding);
}

@media (min-width: 1024px) {
  .k12-search-page .condensed-search-btn,
  .hero-nav[data-mode="landing"] .hero-nav-collapsed .condensed-search-btn {
    flex-basis: 444px;
    width: 444px;
    max-width: 444px;
  }

  .k12-search-page .condensed-search-btn {
    flex-basis: 444px;
    width: 444px;
    max-width: 444px;
  }
}

@media (min-width: 768px) and (max-width: 949px) {
  .k12-search-page .hero-nav-collapsed .hero-nav-logo__full {
    display: none;
  }

  .k12-search-page .hero-nav-collapsed .hero-nav-logo__mark {
    display: block;
  }
}

.condensed-search-btn:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
}

/* Filter Pill Button (Search Mode Only) - LoveForm Style */
.hero-filter-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  height: var(--k12-condensed-pill-height);
  background: #ffffff;
  border: 1px solid #dddddd;
  border-radius: var(--k12-condensed-pill-radius); /* Fully rounded pill to match search bar */
  cursor: pointer;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 4px 12px rgba(0, 0, 0, 0.05);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
  flex-shrink: 0;
  position: relative;
}

.k12-search-page .hero-filter-pill {
  height: var(--k12-condensed-pill-height);
  padding: 0 16px;
  gap: 8px;
}

.hero-filter-pill:hover {
  border-color: #222222;
  background: #f7f7f7;
}

.hero-filter-pill svg {
  width: 16px;
  height: 16px;
  color: #222222;
  flex-shrink: 0;
}

.hero-filter-pill .filter-text {
  font-size: var(--k12-condensed-pill-text-size);
  font-weight: var(--k12-condensed-pill-text-weight);
  color: #222222;
  white-space: nowrap;
}

.hero-filter-pill .filter-count-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-coral);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* School Icon - 3D style */
.condensed-school-icon {
  width: var(--k12-condensed-school-icon-size, 32px);
  height: var(--k12-condensed-school-icon-size, 32px);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
}

.condensed-school-icon img {
  width: var(--k12-condensed-school-icon-size, 32px);
  height: var(--k12-condensed-school-icon-size, 32px);
  object-fit: contain;
}

/* Condensed text items */
.condensed-location,
.condensed-dates,
.condensed-kids {
  font-size: var(--k12-condensed-pill-text-size);
  font-weight: var(--k12-condensed-pill-text-weight);
  color: #222222;
  padding: 0;
  white-space: nowrap;
}

.condensed-location {
  display: inline-block;
  flex: 0 1 auto;
  min-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 48%;
}

.condensed-dates {
  flex: 0 1 32%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.condensed-kids {
  flex: 0 0 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.condensed-text-stack {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  flex-direction: row;
  flex-wrap: nowrap;
  min-width: 0;
  overflow: hidden;
  gap: 0;
}

.condensed-dates,
.condensed-kids {
  color: #222222;
}

@media (min-width: 768px) {
  .k12-search-page .condensed-text-stack {
    align-items: center;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0;
  }

  .k12-search-page .condensed-location {
    flex: 0 1 auto;
    max-width: none;
  }

  .k12-search-page .condensed-dates {
    flex: 0 1 auto;
    white-space: nowrap;
  }

  .k12-search-page .condensed-kids {
    white-space: nowrap;
  }
}

/* Dividers in condensed bar */
.condensed-divider {
  height: 24px;
  width: 1px;
  background: #dddddd;
  flex-shrink: 0;
  margin: 0 8px;
}

/* Condensed search icon */
.condensed-search-icon {
  width: var(--k12-condensed-search-icon-size, 32px);
  height: var(--k12-condensed-search-icon-size, 32px);
  background: #2ac8c8;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: var(--k12-condensed-search-icon-margin, 4px 0 4px 4px);
  flex-shrink: 0;
}

.condensed-search-icon svg {
  width: 14px;
  height: 14px;
  stroke: #ffffff;
  stroke-width: 3;
  fill: none;
}

/* ==========================================================================
   STATE TRANSITIONS
   ========================================================================== */

/* Landing Page: Start expanded, collapse on scroll */
/* 🔧 BUG-180 FIX: Removed transform: scaleY(1) because ANY CSS transform (even identity)
   creates a new containing block for position:fixed children, causing dropdown backdrops
   to be constrained to the hero section (~200px) instead of the full viewport */
.hero-nav[data-state="expanded"] .hero-nav-expanded {
  display: block;
  opacity: 1;
}

.hero-nav[data-state="expanded"] .hero-nav-collapsed {
  display: none;
}

.hero-nav[data-state="collapsed"] .hero-nav-expanded {
  display: none;
  opacity: 0;
  transform: scaleY(0.95);
}

.hero-nav[data-state="collapsed"] .hero-nav-collapsed {
  display: flex;
}

/* Animation classes for smooth transitions */
.hero-nav.is-collapsing .hero-nav-expanded {
  opacity: 0;
  transform: scaleY(0.95);
}

/* 🔧 BUG-180 FIX: Removed transform: scaleY(1) - see expanded state comment above */
.hero-nav.is-expanding .hero-nav-expanded {
  opacity: 1;
}

/* ==========================================================================
   SEARCH DROPDOWN PANELS
   ========================================================================== */
.hero-search-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  background: #ffffff;
  border-radius: 32px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  padding: 24px;
  display: none;
  /* 🔧 BUG-180 FIX: Changed from z-index: 2 to 1001 so dropdowns appear ABOVE the
     backdrop (z-index: 999) and hero-nav (z-index: 1000). Without this, the backdrop
     covers the dropdown making it unclickable. */
  z-index: 1001;
  /* 🔧 BUG-100 (WHO Dropdown Fix): Removed left: 0; right: 0; to allow child dropdowns to respect their own max-width */
  /* Each dropdown (WHERE, WHEN, WHO) specifies its own positioning and max-width */
}

.hero-search-dropdown.active {
  display: block;
  opacity: 1; /* 🔧 BUG-091: Persist animation end state, prevent revert to 0 */
  animation: dropdownSlideIn 0.2s ease-out;
}

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

/* Where Panel - Location Search */
.hero-where-dropdown {
  max-width: 280px; /* 🔧 BUG-100 (Airbnb Match): Reduced from 500px to 280px - matches WHO dropdown width and aligns with search bar left edge */
  left: 0;
  right: auto;
}

.hero-location-input {
  width: 100%;
  padding: 16px;
  border: 1px solid #dddddd;
  border-radius: 12px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

.hero-location-input:focus {
  border-color: #222222;
}

.hero-nearby-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px;
  margin-top: 12px;
  background: #f7f7f7;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
  text-align: left;
}

.hero-nearby-btn:hover {
  background: #ebebeb;
}

.hero-nearby-icon {
  width: 40px;
  height: 40px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hero-nearby-text {
  font-size: 16px;
  font-weight: 500;
  color: #222222;
}

/* When Panel - Calendar/Date Selection */
.hero-when-dropdown {
  max-width: 834px; /* 🔧 BUG-100 (Airbnb Match): Full search bar width - WHEN calendar spans entire search bar like Airbnb */
  left: 0;
  right: auto;
}

/* Where Panel - Location Search (Airbnb-style dropdown) */
.hero-where-dropdown {
  width: 400px;
  max-width: calc(100vw - 16px);
  left: 0;
  right: auto;
  box-sizing: border-box;
  padding: 20px 0;
  display: none;
}

.hero-where-dropdown.show {
  display: block;
  animation: heroDropdownFadeIn 0.15s ease-out;
}

/* Hide static suggestions when autocomplete is showing */
.hero-where-dropdown.has-suggestions .static-suggestions {
  display: none;
}

/* Fixed-height scroll wrapper: panel stays locked at Nearby + 5 rows visible.
   header label (~30px) + Nearby row (72px) + 5 suggestion rows (5×72px=360px) = 462px.
   When recents are added or API returns 20 items, content scrolls inside this box. */
.hero-suggestions-scroll {
  max-height: 462px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

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

/* Who Panel - Kids Selection */
.hero-who-dropdown {
  width: 425px; /* 🔧 BUG-100 (WHO Dropdown FIX): Explicit width 425px to match Airbnb's Guests dropdown (measured: 425px) */
  max-width: calc(
    100vw - 16px
  ); /* 🔧 BUG-100 (Viewport Overflow Fix): Prevent clipping on smaller screens, leave 16px margin from viewport edge */
  right: -8px; /* 🔧 BUG-100 (Airbnb Match): Offset to align with WHO section's extended right edge (section extends 8px beyond search bar) */
  left: auto;
  box-sizing: border-box; /* Include padding in width calculation */
}

.hero-grade-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid #ebebeb;
  gap: 24px; /* BUG-125 FIX: Ensure space between label and counter */
}

.hero-grade-row:last-child {
  border-bottom: none;
}

/* BUG-125 FIX: Label container - flex: 1 prevents overflow into counter */
.hero-grade-row > div:first-child {
  flex: 1;
  min-width: 0; /* Allow text truncation if needed */
  text-align: left; /* LoveForm pattern: left-justified labels */
}

.hero-grade-label {
  font-size: 16px;
  font-weight: 500;
  color: #222222;
  text-align: left; /* BUG-125 FIX: Explicit left alignment (LoveForm pattern) */
}

.hero-grade-description {
  font-size: 14px;
  color: #717171;
  text-align: left; /* BUG-125 FIX: Explicit left alignment */
}

.hero-counter {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-counter-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #dddddd;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #717171;
  transition:
    border-color 0.2s,
    color 0.2s;
}

.hero-counter-btn:hover:not(:disabled) {
  border-color: #222222;
  color: #222222;
}

.hero-counter-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.hero-counter-value {
  font-size: 16px;
  font-weight: 500;
  min-width: 20px;
  text-align: center;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

/* Tablet */
@media (max-width: 767px) {
  .hero-nav-expanded {
    padding: 16px 16px 24px;
    min-height: auto;
  }

  .hero-nav-title {
    font-size: 32px;
  }

  .hero-nav-subtitle {
    font-size: 16px;
    margin-bottom: 20px;
  }

  /* Stack search bar vertically on mobile */
  .hero-search-bar {
    flex-direction: column;
    border-radius: 16px;
  }

  .hero-search-section {
    width: 100%;
    border-radius: 0;
    padding: 16px 20px;
    border-bottom: 1px solid #ebebeb;
  }

  .hero-search-section:last-of-type {
    border-bottom: none;
  }

  .hero-search-divider {
    display: none;
  }

  .hero-search-section.who-section {
    flex: 1;
    padding-right: 20px;
  }

  /* Clear buttons on mobile - adjust positioning */
  .hero-search-section-wrapper {
    flex-direction: row;
    width: 100%;
  }

  .hero-search-section-wrapper .hero-search-section {
    padding-right: 48px;
  }

  .hero-clear-btn {
    right: 16px;
  }

  .hero-search-btn {
    width: calc(100% - 32px);
    border-radius: 12px;
    margin: 16px;
    height: 48px;
  }

  /* Condensed bar adjustments */
  .hero-nav-collapsed {
    --k12-header-row-height: 56px;
    padding: 8px 0 12px;
  }

  .hero-nav-collapsed__search-group {
    justify-self: start;
  }

  .condensed-search-btn {
    min-width: 200px;
    flex: 1;
  }

  .condensed-location {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .condensed-dates,
  .condensed-kids {
    display: none;
  }

  .condensed-divider {
    display: none;
  }

  /* Mobile: icon-only filter (no border) */
  .hero-filter-pill {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    width: 44px;
    height: 44px;
  }

  .hero-filter-pill .filter-text {
    display: none;
  }

  .hero-filter-pill__icon-svg {
    display: block;
    width: 20px;
    height: 20px;
  }

  /* Mobile header: match Airbnb (search bar only).
     Hide top logo/back/menu since bottom nav includes branding/actions. */
  .hero-nav-collapsed .hero-nav-logo,
  .hero-nav-collapsed .hero-mobile-back-btn,
  .hero-nav-collapsed .hero-menu-wrapper--collapsed {
    display: none !important;
  }

  .hero-nav-collapsed .hero-nav-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 16px;
  }

  .hero-nav-collapsed__search-group {
    width: 100%;
    justify-self: stretch;
  }

  .condensed-search-btn {
    min-width: 0;
    width: 100%;
    flex: 1 1 auto;
    justify-content: space-between;
  }

  .condensed-location {
    max-width: 220px;
  }

  /* Mobile landing headline under the pill (uses the same animated DOM as desktop). */
  .hero-nav-mobile-title {
    display: block;
    padding: 10px 16px 0;
  }

  .hero-nav-mobile-title .hero-nav-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    white-space: normal;
    text-align: left;
  }

  /* Mobile landing: use the Airbnb-style search pill (collapsed state only).
     This avoids maintaining two separate mobile search UIs on /k12. */
  .hero-nav[data-mode="landing"] .hero-nav-expanded {
    display: none !important;
  }

  .hero-nav[data-mode="landing"] .hero-nav-collapsed {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    background: #ffffff !important;
    padding-left: 22px !important;
    padding-right: 22px !important;
    padding-bottom: 20px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
  }

  .hero-nav[data-mode="landing"] .hero-nav-collapsed .hero-nav-header {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    padding: 12px 0 4px !important;
    min-height: auto !important;
    gap: 0 !important;
  }

  .hero-nav[data-mode="landing"]
    .hero-nav-collapsed
    .hero-nav-collapsed__search-group {
    width: 100% !important;
    padding: 0 !important;
    justify-content: center !important;
  }

  .hero-nav[data-mode="landing"] .hero-nav-collapsed .condensed-search-btn {
    width: 100% !important;
    max-width: 400px !important;
    margin: 0 auto !important;
  }

  .hero-nav[data-mode="landing"] .hero-nav-collapsed .hero-nav-mobile-title {
    width: 100% !important;
    margin-top: 0 !important;
    padding: 8px 16px 0 !important;
    min-height: 56px !important; /* Match Airbnb icon-row vertical space */
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }

  .hero-nav[data-mode="landing"] .hero-nav-collapsed .hero-nav-title {
    font-size: 20px !important;
    text-align: center !important;
    color: #222222 !important;
    margin: 0 !important;
    white-space: nowrap !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.2 !important;
  }
}

/* Mobile */
@media (max-width: 576px) {
  .hero-nav-title {
    font-size: 28px;
  }

  .hero-nav-subtitle {
    font-size: 14px;
  }

  .hero-nav-header {
    padding: 0;
  }

  .condensed-search-btn {
    min-width: 150px;
  }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */
.hero-nav button:focus-visible {
  outline: 2px solid #2ac8c8;
  outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .hero-nav,
  .hero-nav-expanded,
  .hero-nav-collapsed,
  .hero-search-section,
  .hero-search-btn,
  .condensed-search-btn {
    transition: none;
  }
}

/* ==========================================================================
   ANIMATED TEXT - BLACK on Gradient (overrides hero-text-animation.css)
   ========================================================================== */
.hero-nav .hero-title {
  white-space: normal;
}

.hero-nav .hero-title #animatedText {
  white-space: nowrap;
}

/* Black text for animated words on gradient background */
.hero-nav .hero-title .static-word,
.hero-nav .hero-title .dynamic-word {
  color: #222222 !important;
}

.hero-nav .hero-title .dynamic-word span {
  color: inherit;
}

/* Typewriter cursor - black */
.hero-nav .dynamic-word::after {
  color: #222222;
}

/* ==========================================================================
   TRANSPORTATION CALENDAR OVERRIDES FOR K12 HERO
   LoveForm-style inline dropdown instead of full-screen modal
   ========================================================================== */

/* 🔧 BUG-096: When calendar is child of hero nav, use absolute positioning like WHERE/WHO */
.hero-nav > .transportation-calendar-modal[data-context="hero-nav"] {
  position: absolute !important; /* Override fallback rule - position relative to hero nav container */
  top: calc(
    100% - 8px
  ) !important; /* 12px gap from search bar bottom (hero nav extends 20px below search bar: 12-20=-8) */
  left: 0;
  right: 0;
  bottom: auto;
  z-index: 1001; /* Above dropdowns but below search button */
  align-items: flex-start;
  justify-content: center;
  padding-top: 0;
}

/* Fallback: When calendar is still at body level (during transition or other contexts) */
.transportation-calendar-modal[data-context="hero-nav"] {
  position: fixed; /* Keep fixed - uses JS-set --hero-calendar-top variable */
  z-index: 10000; /* Match base modal stacking so it stays visible */
  top: var(
    --hero-calendar-top,
    200px
  ); /* JS sets this to searchBar.bottom + 12px */
  left: 0;
  right: 0;
  bottom: auto;
  align-items: flex-start;
  justify-content: center;
  padding-top: 0;
}

/* LoveForm-style subtle backdrop for K12 - 25% opacity matches LoveForm exactly */
.transportation-calendar-modal[data-context="hero-nav"] .modal-backdrop {
  display: none !important; /* 🔧 BUG-095: Hide backdrop entirely - hero nav calendar is dropdown, not overlay modal */
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Make the modal container a clean dropdown panel - positioned below search bar */
.transportation-calendar-modal[data-context="hero-nav"] .modal-container {
  /* 🔧 BUG-096: No positioning needed - wrapper handles 12px gap */
  margin-top: 0;
  margin-bottom: 0;
  width: 834px; /* 🔧 BUG-100: Force exact search bar width */
  max-width: 834px; /* Backup constraint */
  border-radius: 24px;
  box-shadow: none !important; /* Remove modal shadow - search bar shadow provides depth */
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid #dddddd;
  max-height: min(720px, calc(100vh - 108px));
}

/* Remove the scale animation - use simple fade/slide */
.transportation-calendar-modal[data-context="hero-nav"]:not([data-modal-open="true"])
  .modal-container {
  transform: translateY(-10px);
  opacity: 0;
}

.transportation-calendar-modal[data-context="hero-nav"][data-modal-open="true"]
  .modal-container {
  transform: translateY(0);
  opacity: 1;
}

/* Lighter header for inline dropdown feel */
.transportation-calendar-modal[data-context="hero-nav"] .modal-header {
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid #ebebeb;
  padding: 16px 24px;
}

.transportation-calendar-modal[data-context="hero-nav"] .calendar-controls-row {
  margin-top: 0.9rem !important;
  padding: 0 1rem 0.4rem !important;
}

.transportation-calendar-modal[data-context="hero-nav"][data-max-week-rows="6"] .modal-header {
  padding: 14px 22px;
}

.transportation-calendar-modal[data-context="hero-nav"][data-max-week-rows="6"] .calendar-section {
  padding: 12px 24px;
}

.transportation-calendar-modal[data-context="hero-nav"][data-max-week-rows="6"] .dual-calendar-container {
  gap: 18px;
  margin-bottom: 10px;
}

.transportation-calendar-modal[data-context="hero-nav"][data-max-week-rows="6"] .calendar-header {
  margin-bottom: 10px;
}

.transportation-calendar-modal[data-context="hero-nav"][data-max-week-rows="6"] .calendar-month {
  font-size: 18px;
}

.transportation-calendar-modal[data-context="hero-nav"][data-max-week-rows="6"] .apple-calendar-grid {
  gap: 4px;
  padding: 12px;
}

.transportation-calendar-modal[data-context="hero-nav"][data-max-week-rows="6"] .calendar-day {
  font-size: 14px;
}

.transportation-calendar-modal[data-context="hero-nav"][data-max-week-rows="6"] .calendar-controls-row {
  margin-top: 0.35rem !important;
  padding: 0 1rem 0.25rem !important;
}

/* iPad Mini/Air: reduce hero WHEN dropdown shell width slightly (Airbnb-like)
   without shrinking the internal calendar UI elements. */
@media (min-width: 768px) and (max-width: 1100px) {
  .transportation-calendar-modal[data-context="hero-nav"] .modal-container {
    width: min(744px, calc(100vw - 24px)) !important;
    max-width: min(744px, calc(100vw - 24px)) !important;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Mobile: Full screen modal is OK on mobile */
@media (max-width: 767px) {
  .transportation-calendar-modal[data-context="hero-nav"] {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    padding-top: 0;
    align-items: center;
  }

  .transportation-calendar-modal[data-context="hero-nav"] .modal-backdrop {
    display: block !important;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .transportation-calendar-modal[data-context="hero-nav"] .modal-container {
    margin: 16px;
    max-height: 90vh;
  }
}
