/**
 * APD 401 — Context + step visibility contract.
 * This is the only module that decides which cards are visible and their order.
 */
@media (max-width: 767px) {
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search > [data-search-field="location"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search > [data-search-panel="location"] { order: 10 !important; }

  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search > [data-search-field="dates"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search > [data-search-panel="dates"] { order: 20 !important; }

  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search > [data-search-field="guests"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search > [data-search-panel="guests"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search > [data-search-field="service"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search > [data-search-panel="service"] { order: 30 !important; }

  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search > [data-search-panel],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search > [data-search-field] {
    display: none !important;
  }

  /* Expanded panel for the active step. */
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search[data-active-panel="location"] > [data-search-panel="location"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search[data-active-panel="dates"] > [data-search-panel="dates"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search[data-active-panel="guests"] > [data-search-panel="guests"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search[data-active-panel="service"] > [data-search-panel="service"] {
    display: block !important;
  }

  /* Collapsed summaries around the active panel. */
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search[data-active-panel="location"] > [data-search-field="dates"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search.apd380-context-stays[data-active-panel="location"] > [data-search-field="guests"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search.apd380-context-experiences[data-active-panel="location"] > [data-search-field="guests"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search.apd380-context-services[data-active-panel="location"] > [data-search-field="service"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search[data-active-panel="dates"] > [data-search-field="location"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search[data-active-panel="guests"] > [data-search-field="location"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search[data-active-panel="guests"] > [data-search-field="dates"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search[data-active-panel="service"] > [data-search-field="location"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search[data-active-panel="service"] > [data-search-field="dates"] {
    display: block !important;
  }

  /* Context-specific exclusions. */
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search.apd380-context-services > [data-search-field="guests"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search.apd380-context-services > [data-search-panel="guests"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search.apd380-context-stays > [data-search-field="service"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search.apd380-context-stays > [data-search-panel="service"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search.apd380-context-experiences > [data-search-field="service"],
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search.apd380-context-experiences > [data-search-panel="service"] {
    display: none !important;
  }

  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search.apd380-context-experiences [data-guest-row="pets"] {
    display: none !important;
  }

  /* Approved compact Dónde heights. */
  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search.apd380-context-stays[data-active-panel="location"] > .apd5-location-panel {
    height: 414px !important;
    min-height: 414px !important;
    max-height: 414px !important;
  }

  html body.apd380-mobile-search-canonical.apd186-search-modal-open #apd5-search:is(.apd380-context-experiences,.apd380-context-services)[data-active-panel="location"] > .apd5-location-panel {
    height: 180px !important;
    min-height: 180px !important;
    max-height: 180px !important;
    padding: 24px 22px 34px !important;
  }

  /* Compact preview content by context. */
  html body.apd380-mobile-search-canonical.apd186-search-modal-open:not(.apd370-location-expanded)
  #apd5-search:is(.apd380-context-experiences,.apd380-context-services)[data-active-panel="location"] #apd26-recent-destinations,
  html body.apd380-mobile-search-canonical.apd186-search-modal-open:not(.apd370-location-expanded)
  #apd5-search:is(.apd380-context-experiences,.apd380-context-services)[data-active-panel="location"] .apd26-destination-section-title,
  html body.apd380-mobile-search-canonical.apd186-search-modal-open:not(.apd370-location-expanded)
  #apd5-search:is(.apd380-context-experiences,.apd380-context-services)[data-active-panel="location"] #apd5-destination-list > * {
    display: none !important;
  }

}

/* APD401: smart live results only while typing; native recents/suggestions own compact Dónde. */
@media (max-width: 767px) {
  html body.apd380-mobile-search-canonical.apd186-search-modal-open:not(.apd392-location-typing):not(.apd386-location-typing) #apd5-search .apd392-location-results { display:none !important; }
  html body.apd380-mobile-search-canonical.apd186-search-modal-open.apd392-location-typing #apd5-search .apd392-location-results,
  html body.apd380-mobile-search-canonical.apd186-search-modal-open.apd386-location-typing #apd5-search .apd392-location-results { display:block !important; }
}
