/**
 * Internal section navigation
 *
 * Shared appearance for secondary navigation on internal pages.
 * The scroll area is contained by the component so a long list does not make
 * the complete document wider than the viewport.
 */
body:not(.home):not(.front-page) .sup-nav {
  --jci-secondary-nav-list-gap: 30px;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

/* The legacy list scrolls in the nav itself. Modern menus use the component's
 * viewport, keeping the arrows and optional CTA outside the scrollable area. */
body:not(.home):not(.front-page) .sup-nav:not(.jci-horizontal-menu),
body:not(.home):not(.front-page) .jci-secondary-nav-bar .jci-horizontal-menu.sup-nav {
  min-height: 0;
  padding: 0;
  border-block: 1px solid #0d0d0d;
}

body:not(.home):not(.front-page) .sup-nav:not(.jci-horizontal-menu) > :is(.sup-nav__list, .sup-nav-mini__list),
body:not(.home):not(.front-page) .jci-secondary-nav-bar .jci-horizontal-menu.sup-nav .sup-nav__list {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: var(--jci-secondary-nav-list-gap);
  width: max-content;
  min-width: 100%;
  margin: 0;
  padding: 12px 0;
  border: 0;
  list-style: none;
}

body:not(.home):not(.front-page) .sup-nav :is(.sup-nav__list, .sup-nav-mini__list) > li {
  flex: 0 0 auto;
  min-width: 0;
  border-bottom-color: transparent;
}

body:not(.home):not(.front-page) .sup-nav :is(.sup-nav__list, .sup-nav-mini__list) > li > a {
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

body:not(.home):not(.front-page) .sup-nav:not(.jci-horizontal-menu) :is(.sup-nav__list, .sup-nav-mini__list) > li > a {
  display: flex;
  align-items: center;
  min-height: 24px;
}

body:not(.home):not(.front-page) .jci-secondary-nav-bar .jci-horizontal-menu.sup-nav .jci-horizontal-menu__link {
  min-height: 0;
  padding-block: 0;
}

body:not(.home):not(.front-page) .jci-people-local-nav {
  --jci-secondary-nav-text-color: #767474;
}

body:not(.home):not(.front-page) :is(.sup-nav :is(.sup-nav__list, .sup-nav-mini__list) > li > a, .jci-people-local-nav__link) {
  color: var(--jci-secondary-nav-text-color, #767474);
  font-size: var(--jci-secondary-nav-font-size, 14px);
  font-weight: 500;
  text-decoration: none;
  text-transform: uppercase;
}

body:not(.home):not(.front-page) .sup-nav [data-jci-horizontal-menu-disclosure-label] {
  text-transform: uppercase;
}

/* A stroke emphasises the active label without changing its width on the rail. */
body:not(.home):not(.front-page) .sup-nav :is(.sup-nav__list, .sup-nav-mini__list) > li:is(.active, .is-active) > a,
body:not(.home):not(.front-page) :is(.sup-nav .sup-nav__list > li > a, .jci-people-local-nav__link):is(.is-active, [aria-current]) {
  color: var(--color-brand-blue, #487cff);
  font-weight: 500;
  -webkit-text-stroke: 0.2px currentColor;
}

body:not(.home):not(.front-page) :is(.sup-nav :is(.sup-nav__list, .sup-nav-mini__list) > li > a, .jci-people-local-nav__link):is(:hover, :focus-visible) {
  color: var(--color-brand-blue, #487cff);
}

body:not(.home):not(.front-page) .sup-nav :is(.sup-nav__list, .sup-nav-mini__list) > li > a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}

body:not(.home):not(.front-page) .jci-secondary-nav-bar {
  --jci-secondary-nav-sticky-gap: 30px;
  --jci-secondary-nav-mobile-divider: rgba(4, 28, 64, 0.14);
}

@media (min-width: 769px) and (max-width: 1024px) {
  body:not(.home):not(.front-page) :is(.sup-nav, .jci-people-local-nav) {
    --jci-secondary-nav-list-gap: 18px;
    --jci-secondary-nav-font-size: 13px;
  }
}

@media (min-width: 769px) {
  /* Shared secondary navigation placement used by Long Programs and Program
   * types. Keeping the positioning here makes both menus follow the same normal
   * flow and sticky threshold without duplicating page-specific declarations.
   */
  body:not(.home):not(.front-page) > .site-wrapper .site-main .jci-program-type-menu-bar.jci-secondary-nav-bar {
    position: sticky;
    top: calc(
      var(
        --jci-viewport-top-offset,
        var(--jci-header-visual-offset, var(--jci-header-offset, 120px))
      ) + var(--jci-secondary-nav-preceding-offset, 0px) + var(--jci-secondary-nav-sticky-gap, 30px)
    );
    margin-top: var(--jci-secondary-nav-flow-gap, var(--jci-secondary-nav-sticky-gap, 30px));
    border-top: 0;
    border-bottom: 0;
    z-index: var(--jci-layer-page-sticky, 30);
  }

  /* Keep the 30px gap above the sticky menu opaque, matching the Long Program
   * navigation and preventing page content from showing through below header.
   */
  body:not(.home):not(.front-page) > .site-wrapper .site-main .jci-program-type-menu-bar.jci-secondary-nav-bar::before {
    content: "";
    position: absolute;
    right: 0;
    bottom: 100%;
    left: 0;
    height: var(--jci-secondary-nav-sticky-gap, 30px);
    background: inherit;
    pointer-events: none;
  }

  /* Program type archives and Courses keep 60px of breathing space in normal
   * flow. The sticky state engages once that gap has reduced to 30px, so the
   * navigation remains visually separated from the header without staying too low.
   */
  body:not(.home):not(.front-page) > .site-wrapper .site-main .jci-program-type-menu-bar.jci-secondary-nav-bar.jci-program-type-menu-bar--archive {
    top: calc(
      var(
        --jci-viewport-top-offset,
        var(--jci-header-visual-offset, var(--jci-header-offset, 120px))
      ) + var(--jci-secondary-nav-sticky-gap, 30px)
    );
    margin-top: 60px;
  }

  body:not(.home):not(.front-page) > .site-wrapper .site-main .jci-program-type-menu-bar.jci-secondary-nav-bar.jci-program-type-menu-bar--archive::before {
    height: var(--jci-secondary-nav-sticky-gap, 30px);
  }

}

/* Courses uses two consecutive navigation levels from tablet upward. Program
 * types remains sticky only while the Course hero is in view, then yields to
 * Subject areas through native sticky containment. The visual 30px header gap
 * belongs to the Subject-area sticky box itself, rather than to a pseudo-element
 * above it. That makes the gap part of the real sticky geometry, so the
 * Program-type menu starts leaving before Subject areas arrives and the two
 * menus never paint over each other. JavaScript only observes this CSS-native
 * state. Mobile keeps the existing disclosure/pin primitive.
 */
@media (min-width: 769px) {
  body.jci-courses-page .jci-program-listing-hero__features--courses {
    margin-bottom: 0;
  }

  body:not(.home):not(.front-page) > .site-wrapper .site-main .jci-courses-subject-menu-bar {
    --jci-courses-subject-transition-space: 40px;
    position: sticky;
    top: var(
      --jci-viewport-top-offset,
      var(--jci-header-visual-offset, var(--jci-header-offset, 120px))
    );
    z-index: var(--jci-layer-page-sticky, 30);
    width: 100%;
    max-width: none;
    margin-top: max(
      0px,
      calc(
        var(--jci-courses-subject-transition-space)
        - var(--jci-secondary-nav-sticky-gap, 30px)
      )
    );
    margin-bottom: 0;
    padding-top: var(--jci-secondary-nav-sticky-gap, 30px);
    box-sizing: border-box;
    background: #fff;
  }

  /* The results section owns the visual breathing room below Subject areas.
   * Keep that spacing on the destination itself so filtering can align the
   * section edge directly below the sticky bar without duplicating a pixel
   * offset in JavaScript. The stable Courses body class also covers WPML route
   * shapes served through the canonical Courses template. */
  body.jci-courses-page #courses-results[data-jci-courses-listing] {
    --jci-courses-results-gap: 40px;
    padding-top: var(--jci-courses-results-gap);
  }
}

/*
 * The legacy stylesheet highlighted the first item when no active class was
 * available. This later component owns the nav state without !important.
 */
body.page-template-template-program-type .sup-nav__list > li:not(.active),
body.page-template-template-program-type .sup-nav__list > li:first-child:not(.active) {
  border-bottom-color: transparent;
}

body.page-template-template-program-type .sup-nav__list > li:not(.active)::after,
body.page-template-template-program-type .sup-nav__list > li:first-child:not(.active)::after {
  display: none;
  content: none;
}

body.page-template-template-program-type .sup-nav__list > li:not(.active) > a,
body.page-template-template-program-type .sup-nav__list > li:first-child:not(.active) > a {
  border-bottom-color: transparent;
  text-decoration: none;
}

body.page-template-template-program-type .sup-nav__list > li.active,
body.page-template-template-program-type .sup-nav__list > li.active > a {
  border-bottom-color: transparent;
}

@media (max-width: 768px) {
  body:not(.home):not(.front-page) .sup-nav:not(.jci-horizontal-menu) > :is(.sup-nav__list, .sup-nav-mini__list) {
    gap: 26px;
    padding-block: 0;
  }

  body:not(.home):not(.front-page) .sup-nav:not(.jci-horizontal-menu) :is(.sup-nav__list, .sup-nav-mini__list) > li > a {
    min-height: 44px;
  }

  /* Listing Program types remain directly visible on mobile. Reuse the shared
   * horizontal-menu scroll viewport instead of collapsing these primary
   * discovery links into a disclosure. The active term is kept in view by the
   * component's existing initialization logic, while the native scroll area and
   * overflow arrows make adjacent program types immediately discoverable. */
  body:not(.home):not(.front-page) > .site-wrapper .site-main .jci-program-type-menu-bar--horizontal-scroll {
    --jci-secondary-nav-anchor-height: 58px;
    position: sticky;
    top: var(--jci-viewport-top-offset, var(--jci-header-visual-offset, 76px));
    z-index: var(--jci-layer-page-sticky, 30);
    width: 100%;
    max-width: none;
    margin: 0;
    border: 0;
    background: #fff;
    box-shadow: inset 0 -1px var(--jci-secondary-nav-mobile-divider);
    overflow: visible;
  }

  /* Keep the sticky element itself as the only painted layer. A transformed
   * viewport-wide pseudo element can trigger compositor jitter in iOS/WebKit. */
  body:not(.home):not(.front-page) > .site-wrapper .site-main .jci-program-type-menu-bar--horizontal-scroll::before {
    display: none;
    content: none;
  }

  body:not(.home):not(.front-page) .jci-program-type-menu-bar--horizontal-scroll .jci-horizontal-menu.jci-program-type-nav.sup-nav {
    position: relative;
    z-index: 1;
    min-height: var(--jci-secondary-nav-anchor-height);
    padding: 0;
    border: 0;
    background: transparent;
  }

  body:not(.home):not(.front-page) .jci-program-type-menu-bar--horizontal-scroll .jci-program-type-nav__viewport {
    scroll-padding-inline: 0;
    scroll-snap-type: none;
  }

  body:not(.home):not(.front-page) .jci-program-type-menu-bar--horizontal-scroll .jci-horizontal-menu.jci-program-type-nav.sup-nav .jci-horizontal-menu__list.jci-program-type-nav__list.sup-nav__list {
    gap: 26px;
    padding-block: 0;
  }

  body:not(.home):not(.front-page) .jci-program-type-menu-bar--horizontal-scroll .jci-horizontal-menu__item {
    position: relative;
    scroll-snap-align: none;
    border: 0;
  }

  body:not(.home):not(.front-page) .jci-program-type-menu-bar--horizontal-scroll .jci-horizontal-menu.sup-nav .jci-horizontal-menu__link {
    min-height: var(--jci-secondary-nav-anchor-height);
    padding: 0;
    border-bottom: 0;
    line-height: 1.2;
  }

  body:not(.home):not(.front-page) .jci-program-type-menu-bar--horizontal-scroll .jci-horizontal-menu__arrow {
    flex-basis: 28px;
    width: 28px;
    height: 28px;
    border-color: rgba(4, 28, 64, 0.12);
    background: #fff;
  }

  /* Horizontal-scroll secondary menus use the shared measured pin controller
   * instead of a long-lived sticky layer (program types and Business Solutions).
   * The wrapper preserves the 58px normal-flow placeholder while pinned. */
  body:not(.home):not(.front-page) > .site-wrapper .site-main .jci-program-type-menu-bar--horizontal-scroll[data-jci-mobile-fixed-secondary-nav] {
    position: relative;
    top: auto;
    min-height: var(--jci-secondary-nav-anchor-height);
  }

  body:not(.home):not(.front-page) > .site-wrapper .site-main .jci-program-type-menu-bar--horizontal-scroll[data-jci-mobile-fixed-secondary-nav].is-mobile-pinned .jci-horizontal-menu.jci-program-type-nav.sup-nav {
    position: fixed;
    top: var(--jci-viewport-top-offset, var(--jci-header-visual-offset, 76px));
    right: 0;
    left: 0;
    z-index: var(--jci-layer-secondary-fixed, 1100);
    width: 100% !important;
    max-width: none !important;
    margin-inline: 0 !important;
    padding-inline: var(--jci-container-local-gutter, var(--jci-container-gutter-mobile, 16px));
    box-shadow: inset 0 -1px var(--jci-secondary-nav-mobile-divider);
    background: #fff;
    box-sizing: border-box;
  }

  /* Unlike the contained in-flow rail, the pinned nav spans the viewport.
   * Absolutely positioned arrows ignore padding, so give them the same inset
   * as the canonical secondary-nav container (including narrow tablets). */
  body:not(.home):not(.front-page) .jci-program-type-menu-bar--horizontal-scroll.is-mobile-pinned .jci-horizontal-menu__arrow--prev {
    left: var(--jci-container-local-gutter, var(--jci-container-gutter-mobile, 16px));
  }

  body:not(.home):not(.front-page) .jci-program-type-menu-bar--horizontal-scroll.is-mobile-pinned .jci-horizontal-menu__arrow--next {
    right: var(--jci-container-local-gutter, var(--jci-container-gutter-mobile, 16px));
  }
}

@media (max-width: 768px) {
  /* Pages with a persistent secondary disclosure use the same viewport-layer
   * architecture as Long Program. Long Program and Course subject-area bars
   * opt into this shared primitive rather than owning separate sticky systems.
   * A normal-flow 56px bar remains the geometry placeholder; the existing
   * horizontal-menu component is fixed only after the shared JS pin controller
   * reaches the canonical in-flow sticky header. */
  /* Header positioning is owned by the site shell. Internal pages use the
   * canonical in-flow sticky header, so secondary navigation must not convert
   * it back to fixed or add a second layout offset. This keeps the first Program
   * heading fully below the header and avoids duplicate compensation on iOS. */

  body:not(.home):not(.front-page) > .site-wrapper .site-main .jci-secondary-nav-bar--mobile-disclosure {
    --jci-secondary-nav-gutter: var(--jci-container-gutter-mobile, 16px);
    --jci-secondary-nav-anchor-height: 56px;
    position: relative;
    top: auto;
    z-index: var(--jci-layer-page-sticky, 30);
    min-height: var(--jci-secondary-nav-anchor-height);
    border: 0;
    background: var(--jci-secondary-nav-slot-background, #fff);
    box-shadow: none;
  }

  body:not(.home):not(.front-page) > .site-wrapper .site-main .jci-secondary-nav-bar--mobile-disclosure::before {
    display: none;
    content: none;
  }

  /* Prepare opt-in reveal-on-pin geometry before first paint. The shared head
   * bootstrap restores the ordinary navigation if its controller fails; without
   * JS these links remain visible. The ready attribute also supports menus
   * initialized after the initial document lifecycle. */
  html.jci-horizontal-menu-js body:not(.home):not(.front-page) > .site-wrapper .site-main [data-jci-mobile-fixed-secondary-nav][data-jci-mobile-reveal-on-pin],
  body:not(.home):not(.front-page) > .site-wrapper .site-main [data-jci-mobile-fixed-secondary-nav][data-jci-mobile-reveal-on-pin][data-jci-mobile-pin-ready="true"] {
    min-height: 0;
  }

  html.jci-horizontal-menu-js body:not(.home):not(.front-page) > .site-wrapper .site-main [data-jci-mobile-fixed-secondary-nav][data-jci-mobile-reveal-on-pin]:not(.is-mobile-pinned) > .jci-horizontal-menu,
  body:not(.home):not(.front-page) > .site-wrapper .site-main [data-jci-mobile-fixed-secondary-nav][data-jci-mobile-reveal-on-pin][data-jci-mobile-pin-ready="true"]:not(.is-mobile-pinned) > .jci-horizontal-menu {
    display: none;
  }

  body:not(.home):not(.front-page) .jci-secondary-nav-bar--mobile-disclosure .jci-horizontal-menu.sup-nav {
    width: 100% !important;
    max-width: none !important;
    min-height: var(--jci-secondary-nav-anchor-height, 56px);
    margin: 0 !important;
    padding: 0;
    border: 0;
    background: #fff;
    box-shadow: inset 0 -1px var(--jci-secondary-nav-mobile-divider);
  }

  body:not(.home):not(.front-page) .jci-secondary-nav-bar--mobile-disclosure .jci-horizontal-menu[data-jci-horizontal-menu-ready] .jci-horizontal-menu__disclosure {
    min-height: var(--jci-secondary-nav-anchor-height, 56px);
    padding-inline: var(--jci-secondary-nav-gutter);
    color: var(--color-brand-navy, #041c40);
    font-size: 14px;
    font-weight: 600;
  }

  /* Section tracking changes the label during scroll. Keep it on one line so
   * the trigger cannot grow beyond the height reserved by the in-flow slot. */
  body:not(.home):not(.front-page) .jci-secondary-nav-bar--mobile-disclosure .jci-horizontal-menu__disclosure-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body:not(.home):not(.front-page) > .site-wrapper .site-main .jci-secondary-nav-bar--mobile-disclosure.is-mobile-pinned .jci-horizontal-menu.sup-nav {
    position: fixed;
    top: calc(var(--jci-viewport-top-offset, var(--jci-header-visual-offset, 76px)) + var(--jci-secondary-nav-preceding-offset, 0px));
    right: 0;
    left: 0;
    z-index: var(--jci-layer-secondary-fixed, 1100);
  }

  body:not(.home):not(.front-page) .jci-secondary-nav-bar--mobile-disclosure .jci-horizontal-menu[data-jci-horizontal-menu-ready] > .jci-horizontal-menu__viewport {
    right: 0;
    left: 0;
    width: auto;
    min-width: 0;
    max-width: none;
    box-shadow: 0 10px 24px rgba(4, 28, 64, 0.1);
  }

  body:not(.home):not(.front-page) .jci-secondary-nav-bar--mobile-disclosure .jci-horizontal-menu[data-jci-horizontal-menu-ready] .jci-horizontal-menu__list.sup-nav__list {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
    gap: 0;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0 var(--jci-secondary-nav-gutter);
    border: 0;
    background: #fff;
    white-space: normal;
  }

  body:not(.home):not(.front-page) .jci-secondary-nav-bar--mobile-disclosure .jci-horizontal-menu[data-jci-horizontal-menu-ready] .jci-horizontal-menu__item {
    width: 100%;
    border-top: 1px solid rgba(4, 28, 64, 0.12);
    white-space: normal;
  }

  /* Active-label disclosures can keep the current destination in the index. */
  body:not(.home):not(.front-page) .jci-secondary-nav-bar--mobile-disclosure .jci-horizontal-menu[data-jci-horizontal-menu-ready]:not([data-jci-horizontal-menu-disclosure-track-active="false"]) .jci-horizontal-menu__item.is-active,
  body:not(.home):not(.front-page) .jci-secondary-nav-bar--mobile-disclosure .jci-horizontal-menu[data-jci-horizontal-menu-ready]:not([data-jci-horizontal-menu-disclosure-track-active="false"]) .jci-horizontal-menu__item.active {
    display: var(--jci-secondary-nav-disclosure-current-display, none);
  }

  body:not(.home):not(.front-page) .jci-secondary-nav-bar--mobile-disclosure .jci-horizontal-menu[data-jci-horizontal-menu-ready] .jci-horizontal-menu__link {
    width: 100%;
    min-height: var(--jci-secondary-nav-disclosure-link-height, 48px);
    padding: 12px var(--jci-secondary-nav-disclosure-link-end, 0px) 12px 0;
    white-space: normal;
    font-size: 14px;
    line-height: 1.3;
  }

  body.page-template-template-program-type .aaccordion .aaccordion-header {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    text-align: left;
  }

  body.page-template-template-program-type .aaccordion .aaccordion-header > .container-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  body.page-template-template-program-type .aaccordion .aaccordion-header > .container-inner > span {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    float: none;
    text-align: left;
    overflow-wrap: anywhere;
  }

  body.page-template-template-program-type .aaccordion .aaccordion-header > .container-inner > img {
    flex: 0 0 auto;
    margin-left: auto;
  }
}

/* Keep swipe/trackpad navigation without showing a page-like scrollbar. */
body:not(.home):not(.front-page) .sup-nav {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body:not(.home):not(.front-page) .sup-nav::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
