/**
 * Stacking order: mobile nav, ticket shell notches, Kadence wrapper.
 *
 * Kadence DOM: body > .cfd-site-shell (z 2) > #wrapper (z 1) > header + #inner-wrap.
 * A body::after backdrop at 99998 sat above the shell and dimmed the menu; backdrop
 * belongs on #wrapper::after inside the same stacking context as the header.
 */

:root {
  --cfd-z-wrapper: 1;
  --cfd-z-shell: 2;
  --cfd-z-shell-ring: 60;
  --cfd-z-header: 20;
  --cfd-z-nav-backdrop: 99998;
  --cfd-z-nav-panel: 99999;
  --cfd-z-nav-toggle: 100000;
  --cfd-z-nav-close: 100001;
}

/* Kadence #wrapper stacks above preceding header without explicit z-index */
body.cfd-custom-header-active #wrapper {
  position: relative;
  z-index: var(--cfd-z-wrapper);
}

body.cfd-custom-header-active .cfd-site-shell {
  position: relative;
  z-index: var(--cfd-z-shell);
}

body.cfd-custom-header-active .cfd-site-shell::after {
  z-index: var(--cfd-z-shell-ring);
}

body.cfd-custom-header-active #cfd-classic-header,
body.cfd-custom-header-active #cfd-departure-header {
  position: relative;
  z-index: var(--cfd-z-header);
}

/* Seamless classic ticket: shell sits flush under header; keep notches visible */
body.cfd-classic-header-active .cfd-site-shell {
  margin-top: 0;
}

/* Close control is mobile-only; hidden on all viewports until menu opens ≤768px */
.cfd-mobile-nav__close {
  display: none;
}

@media (min-width: 769px) {
  .cfd-mobile-nav__close {
    display: none !important;
  }

  body.cfd-menu-open.cfd-custom-header-active {
    overflow: visible;
  }

  body.cfd-menu-open.cfd-custom-header-active #wrapper::after {
    content: none !important;
    display: none !important;
  }

  body.cfd-menu-open.cfd-custom-header-active #cfd-classic-header,
  body.cfd-menu-open.cfd-custom-header-active #cfd-departure-header {
    z-index: var(--cfd-z-header) !important;
  }

  body.cfd-menu-open .ticket-nav-wrap,
  body.cfd-menu-open .cfd-departure-header__icons {
    position: static !important;
    inset: auto !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    text-align: inherit !important;
    z-index: auto !important;
    box-shadow: none;
  }

  body.cfd-menu-open .cfd-departure-header__icons .cfd-icon-nav,
  body.cfd-menu-open .ticket-nav-wrap .ticket-nav,
  body.cfd-menu-open .cfd-classic-header .ticket-nav {
    width: auto;
    padding-top: 0;
  }

  body.cfd-menu-open .cfd-icon-nav__link,
  body.cfd-menu-open .ticket-nav-wrap .ticket-nav__link,
  body.cfd-menu-open .cfd-classic-header .ticket-nav__link {
    display: flex;
    grid-template-columns: none;
    justify-content: center;
    justify-items: center;
    text-align: center;
    padding-left: 10px;
    padding-right: 10px;
  }

  body.cfd-menu-open .cfd-icon-nav__text {
    align-items: center;
    text-align: center;
  }

  body.cfd-menu-open .cfd-departure-header__board {
    isolation: isolate;
  }

  body.cfd-menu-open .ticket-header__menu-btn,
  body.cfd-menu-open .cfd-departure-header__menu-toggle {
    z-index: auto;
    position: static;
  }
}

@media (max-width: 768px) {
  body.cfd-menu-open.cfd-custom-header-active {
    overflow: hidden;
  }

  /* Full-viewport dim inside #wrapper — above #inner-wrap, below header + nav panel */
  body.cfd-menu-open.cfd-custom-header-active #wrapper::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: var(--cfd-z-nav-backdrop);
    background: var(--cfd-mobile-menu-backdrop, rgba(0, 0, 0, 0.45));
    pointer-events: auto;
  }

  body.cfd-menu-open.cfd-custom-header-active #cfd-classic-header,
  body.cfd-menu-open.cfd-custom-header-active #cfd-departure-header {
    position: relative;
    z-index: var(--cfd-z-nav-panel);
  }

  /* Full-viewport mobile menu canvas */
  body.cfd-menu-open .ticket-nav-wrap,
  body.cfd-menu-open .cfd-departure-header__icons {
    position: fixed;
    inset: 0;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    height: 100dvh;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    align-items: stretch;
    text-align: left;
    z-index: var(--cfd-z-nav-panel) !important;
    box-shadow: none;
  }

  body.cfd-menu-open .cfd-departure-header__icons .cfd-icon-nav,
  body.cfd-menu-open .ticket-nav-wrap .ticket-nav,
  body.cfd-menu-open .cfd-classic-header .ticket-nav {
    width: 100%;
    align-items: stretch;
    text-align: left;
    padding-top: calc(44px + 2rem);
  }

  body.cfd-menu-open .cfd-mobile-nav__close {
    display: flex !important;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: var(--cfd-z-nav-close);
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--cfd-accent, #a8322d);
    border-radius: 0;
    background: var(--cfd-accent, #a8322d);
    color: #fff;
    font-family: inherit;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    pointer-events: auto;
  }

  body.cfd-menu-open .cfd-mobile-nav__close span {
    display: block;
    margin-top: -2px;
  }

  body.cfd-menu-open .cfd-mobile-nav__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
  }

  body.cfd-menu-open .cfd-icon-nav__link,
  body.cfd-menu-open .ticket-nav-wrap .ticket-nav__link,
  body.cfd-menu-open .cfd-classic-header .ticket-nav__link {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    justify-content: flex-start;
    justify-items: start;
    text-align: left;
    gap: 12px 16px;
    padding-left: var(--cfd-k-gutter, 16px);
    padding-right: var(--cfd-k-gutter, 16px);
  }

  body.cfd-menu-open .cfd-icon-nav__text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  body.cfd-menu-open .cfd-icon-nav__label,
  body.cfd-menu-open .cfd-icon-nav__sublabel,
  body.cfd-menu-open .cfd-classic-header .ticket-nav__label,
  body.cfd-menu-open .cfd-classic-header .ticket-nav__name,
  body.cfd-menu-open .ticket-nav-wrap .ticket-nav__label,
  body.cfd-menu-open .ticket-nav-wrap .ticket-nav__name {
    text-align: left;
  }

  body.cfd-menu-open .cfd-classic-header .ticket-nav > li,
  body.cfd-menu-open .cfd-classic-header .ticket-nav > .ticket-nav__item,
  body.cfd-menu-open .ticket-nav-wrap .ticket-nav > li,
  body.cfd-menu-open .ticket-nav-wrap .ticket-nav > .ticket-nav__item {
    text-align: left;
  }

  body.cfd-menu-open .cfd-classic-header .ticket-nav__label,
  body.cfd-menu-open .ticket-nav-wrap .ticket-nav__label {
    padding-left: var(--cfd-k-gutter, 16px);
    padding-right: var(--cfd-k-gutter, 16px);
  }

  body.cfd-menu-open .ticket-header__menu-btn,
  body.cfd-menu-open .cfd-departure-header__menu-toggle {
    position: relative;
    z-index: var(--cfd-z-nav-toggle);
  }

  /* Board isolation trapped nav below photo on split header tablets */
  body.cfd-menu-open .cfd-departure-header__board {
    isolation: auto;
  }
}

/* Future canvas markup: map to same stacking scale as ticket-nav / icon nav */
@media (max-width: 768px) {
  body.cfd-mobile-nav-open.cfd-custom-header-active {
    overflow: hidden;
  }

  body.cfd-mobile-nav-open.cfd-custom-header-active #wrapper::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: var(--cfd-z-nav-backdrop);
    background: var(--cfd-mobile-menu-backdrop, rgba(0, 0, 0, 0.45));
    pointer-events: auto;
  }
}
