/* Phase 3: app-like navigation layer for the existing Bootstrap header.
 * Keep the existing menu markup, links, collapse behavior and navigation JS.
 */

@media (max-width: 991.98px) {
  .ije-header .navbar-collapse {
    margin-top: .65rem;
    padding: .5rem;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 16px;
    background: #071827;
    box-shadow: 0 16px 36px rgba(0, 0, 0, .22);
  }

  .ije-header .ije-nav-link {
    display: flex;
    min-height: 48px;
    align-items: center;
    padding: .7rem .85rem;
    border-radius: 11px;
    color: rgba(255, 255, 255, .94);
    transition: color .16s ease, background-color .16s ease;
  }

  .ije-header .ije-nav-link:hover,
  .ije-header .ije-nav-link:focus-visible {
    color: #fed100;
    background: rgba(255, 255, 255, .08);
  }

  .ije-header .current-menu-item > .ije-nav-link,
  .ije-header .current_page_item > .ije-nav-link,
  .ije-header .ije-nav-link[aria-current="page"] {
    color: #fff;
    background: rgba(0, 153, 103, .2);
    box-shadow: inset 3px 0 #009967;
  }

  .ije-header .navbar-nav .dropdown-menu {
    margin: .25rem 0 .5rem;
    padding: .35rem;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 12px;
    background: rgba(255, 255, 255, .05);
  }

  .ije-header .navbar-nav .dropdown-item {
    min-height: 44px;
    display: flex;
    align-items: center;
    border-radius: 9px;
    color: rgba(255, 255, 255, .9);
  }

  .ije-header .navbar-nav .dropdown-item:hover,
  .ije-header .navbar-nav .dropdown-item:focus-visible {
    color: #fed100;
    background: rgba(255, 255, 255, .08);
  }
}

@media (min-width: 992px) {
  .ije-header .navbar-collapse {
    margin-top: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .ije-header .ije-nav-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: .6rem .75rem;
    border-radius: 10px;
    transition: color .16s ease, background-color .16s ease;
  }

  .ije-header .ije-nav-link:hover,
  .ije-header .ije-nav-link:focus-visible {
    color: #fed100;
    background: rgba(255, 255, 255, .08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ije-header .ije-nav-link {
    transition: none;
  }
}

/* Keep the floating help prompt from covering filter controls on small screens. */
@media (max-width: 991.98px) {
  body:has(.offcanvas-backdrop) .ije-ask-invite {
    display: none !important;
  }

  /* Keep the Bootstrap drawer and its backdrop above fixed help controls. */
  .offcanvas-backdrop {
    z-index: 2147483646 !important;
  }

  .ije-filter-drawer {
    z-index: 2147483647 !important;
  }
}

/* Reduce the floating control's footprint over tour photography on touch/tablet layouts. */
@media (max-width: 991.98px) {
  .ije-floating-filter {
    width: 52px;
    height: 52px;
    justify-content: center;
    padding: 0 !important;
    gap: 0;
  }

  .ije-floating-filter > span:not(.ije-filter-count) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .ije-floating-filter .ije-filter-count:not([hidden]) {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 21px;
    min-height: 21px;
    display: grid;
    place-items: center;
    padding: 0 5px;
    border-radius: 999px;
    background: #fed100;
    color: #071827;
    font-size: 12px;
    line-height: 1;
  }
}

/* Shared app-shell interaction polish across WordPress and booking-engine pages. */
:where(a, button, input, select, textarea) {
  touch-action: manipulation;
}

:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid #009967;
  outline-offset: 3px;
}

@media (max-width: 767.98px) {
  :where(button, .btn, input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto !important;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Keep tour-detail utility actions out of the gallery at tablet widths. */
@media (min-width: 576px) and (max-width: 991.98px) {
  .ije-ota-page .ije-side-actions {
    position: relative !important;
    inset: auto !important;
    z-index: 5;
    display: flex;
    width: min(100% - 2rem, 1280px);
    margin: 0 auto;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    gap: .5rem;
  }

  .ije-ota-page .ije-side-actions > .btn {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 14px;
  }

  .ije-ota-page .ije-side-actions #ijeShareMenu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    padding: .65rem;
    border: 1px solid rgba(7, 24, 39, .12);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(7, 24, 39, .16);
  }
}

/* The location filter already provides a persistent Ask IJE action. Hide the
   separate floating help prompt on small screens so it cannot cover results. */
@media (max-width: 575.98px) {
  body:has(.ije-floating-filter) .ije-ask-fab {
    display: none !important;
  }
}

/* Homepage first-view rhythm: keep the full search and copy, with less vertical drag. */
@media (max-width: 575.98px) {
  body.home .ije-home-page .ije-home-hero {
    min-height: 0;
  }

  body.home .ije-home-page .ije-home-hero-content.container {
    padding-top: 2rem;
    padding-bottom: 1.75rem;
  }

  body.home .ije-home-page .ije-home-hero h1 {
    font-size: clamp(1.55rem, 6.5vw, 1.85rem);
    line-height: 1.08;
    margin-bottom: .75rem;
  }

  body.home .ije-home-page .ije-home-hero p {
    font-size: .95rem;
    line-height: 1.45;
  }

  body.home .ije-home-page .ije-home-gateway-wrap > .ije-hig {
    margin-top: 1rem;
  }

  /* Leave room before the next section so the fixed Ask IJE action cannot
     obscure its heading as the shorter hero ends. */
  body.home .ije-home-page .ije-home-intro {
    padding-top: 7rem;
  }
}
/* Tour detail first view: on small screens, show the existing gallery after
   the title and rating, then keep booking facts and summary directly below. */
@media (max-width: 767.98px) {
  body.single-product .ije-hero > .row > .col-lg-8 {
    display: flex;
    flex-direction: column;
  }

  body.single-product .ije-hero > .row > .col-lg-8 > .pe-lg-3 {
    display: contents;
  }

  body.single-product .ije-hero-title { order: 1; }
  body.single-product .ije-rating-row { order: 2; }
  body.single-product .ije-transfer-route-strip { order: 3; }
  body.single-product .ije-gallery-shell { order: 4; }
  body.single-product .ije-experience-bar { order: 5; }
  body.single-product .ije-summary { order: 6; }
  body.single-product .ije-main-content { order: 7; }
}

/* Keep the mobile listing filter beside the results heading instead of over discovery cards. */
@media (max-width: 991.98px) {
  body:has(#ijeCatalogueHeading) .ije-floating-filter {
    display: none !important;
  }

  body:has(#ijeCatalogueHeading) .ije-catalogue-heading {
    display: flex;
    flex-direction: column;
    align-items: stretch !important;
    gap: .75rem;
  }

  body:has(#ijeCatalogueHeading) .ije-mobile-catalogue-filter {
    align-self: flex-end;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 44px;
    padding: .6rem 1rem;
    border: 1px solid rgba(7, 24, 39, .14);
    border-radius: 14px;
    background: #fff;
    color: #082754;
    font: inherit;
    font-size: .9rem;
    font-weight: 750;
    box-shadow: 0 4px 14px rgba(7, 24, 39, .08);
  }

  body:has(#ijeCatalogueHeading) .ije-mobile-catalogue-filter:focus-visible {
    outline: 3px solid rgba(7, 95, 100, .35);
    outline-offset: 2px;
  }
}

/* Reduce the mobile lead-in before tour results while retaining the full discovery content. */
@media (max-width: 575.98px) {
  .ije-location-page .ije-editorial-feelings {
    padding-top: 20px !important;
  }

  .ije-location-page .ije-editorial-section-head {
    gap: 10px;
    margin-bottom: 16px;
  }

  .ije-location-page .ije-feeling-card {
    height: 138px;
  }
}

