/**
 * SecureClimate global + mobile navigation.
 *
 * Phase 49F scope: desktop navigation, keyboard-accessible dropdowns, the
 * mobile menu toggle, and the off-canvas mobile navigation drawer. No
 * search, no sticky/scroll behavior, no footer.
 *
 * Nav-visibility breakpoint note: Phase 49E's logo/header-height switch
 * happens at 767px and is left untouched here. For navigation
 * specifically, the desktop inline menu is only shown at >=1280px (raised
 * from 1024px in the design-polish phase: seven top-level items plus the
 * logo and search overflowed at 1024px); below that the toggle + drawer
 * are used, since
 * no real menu items exist yet to confirm an inline menu would fit
 * safely at tablet widths. This is a deliberately conservative choice to
 * avoid horizontal overflow once real menu content is added - the
 * breakpoint can be widened later if measured content allows it.
 *
 * @package HelloElementorChild
 */

/* ==========================================================================
   Desktop navigation (>=1280px - the header switches to the drawer below
   1280px so a full top-level menu never overflows the small-desktop tier)
   ========================================================================== */

.sc-nav__menu {
  display: none;
  align-items: center;
  gap: var(--sc-space-6); /* 32px between primary items, per Phase 49B */
  margin: 0;
  padding: 0;
  list-style: none;
	justify-content:center;
}

.sc-nav__menu .menu-item {
  position: relative;
  display: flex;
  align-items: center;
}

.sc-nav__menu > .menu-item > a {
  display: inline-flex;
  align-items: center;
  gap: var(--sc-space-1);
  font-family: var(--sc-font-body);
  font-weight: var(--sc-font-weight-semibold);
  font-size: var(--sc-text-nav-size);
  line-height: var(--sc-text-nav-line-height);
  color: var(--sc-color-deep-ink);
  text-decoration: none;
  padding: var(--sc-space-2) 0;
}

.sc-nav__menu > .menu-item > a:hover {
  color: var(--sc-color-action-green);
  text-decoration: underline;
}

.sc-nav__menu > .menu-item > a:focus-visible {
  outline: var(--sc-focus-width) solid var(--sc-focus-color);
  outline-offset: var(--sc-focus-offset);
}

/* Current page: Deep Ink text + 2px Horizon Green underline - never color
   alone. WordPress adds .current-menu-item / .current-menu-ancestor and,
   in modern core, aria-current="page" automatically. */
.sc-nav__menu > .current-menu-item > a,
.sc-nav__menu > .current-menu-ancestor > a {
  color: var(--sc-color-deep-ink);
  text-decoration: none;
  box-shadow: inset 0 -2px 0 0 var(--sc-color-horizon-green);
}

/* ---- Submenu toggle (injected by JS as a sibling of the parent link) --- */

.sc-nav__submenu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex-shrink: 0;
  width: var(--sc-control-height);
  height: var(--sc-control-height);
  padding: 0;
  border: none;
  background: transparent;
  color: var(--sc-color-deep-ink);
  cursor: pointer;
}

.sc-nav__submenu-toggle:focus-visible {
  outline: var(--sc-focus-width) solid var(--sc-focus-color);
  outline-offset: var(--sc-focus-offset);
}

.sc-nav__chevron {
  width: 12px;
  height: 12px;
  transition: transform 0.15s ease;
}

.menu-item.is-open > .sc-nav__submenu-toggle .sc-nav__chevron {
  transform: rotate(180deg);
}

/* ---- Dropdown panel ---- */

.sc-nav__menu .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10;
  min-width: 220px;
  margin: 0;
  padding: var(--sc-space-2) 0;
  list-style: none;
  background-color: var(--sc-color-white);
  border: 1px solid var(--sc-color-soft-border);
  border-radius: var(--sc-radius-sm);
}

.menu-item.is-open > .sub-menu,
.sc-nav__menu:not(.sc-nav--js) .menu-item:focus-within > .sub-menu { /* no-JS fallback only */
  display: block;
}

.sc-nav__menu .sub-menu .menu-item a {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: var(--sc-space-2) var(--sc-space-4);
  font-family: var(--sc-font-body);
  font-weight: var(--sc-font-weight-regular);
  font-size: var(--sc-text-body-size);
  line-height: var(--sc-text-body-line-height);
  color: var(--sc-color-deep-ink);
  text-decoration: none;
  white-space: nowrap;
}

.sc-nav__menu .sub-menu .menu-item a:hover {
  color: var(--sc-color-action-green);
  text-decoration: underline;
}

.sc-nav__menu .sub-menu .menu-item a:focus-visible {
  outline: var(--sc-focus-width) solid var(--sc-focus-color);
  outline-offset: var(--sc-focus-offset);
}

@media (min-width: 1280px) {
  .sc-nav__menu {
    display: flex;
  }
}

/* ==========================================================================
   Mobile menu toggle (Phase 49E structural button, now functional)
   ========================================================================== */

.sc-header__menu-toggle {
  display: inline-flex; /* shown below 1280px; hidden when the inline menu shows */
}

@media (min-width: 1280px) {
  .sc-header__menu-toggle {
    display: none;
  }
}

/* ==========================================================================
   Mobile / tablet off-canvas navigation drawer (<1280px)
   ========================================================================== */

.sc-mobile-nav__overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background-color: var(--sc-color-deep-ink);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
}

.sc-mobile-nav__overlay.is-visible {
  opacity: 0.4;
  visibility: visible;
}

.sc-mobile-nav {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  box-sizing: border-box;
  width: 320px;
  max-width: 85vw;
  background-color: var(--sc-color-white);
  transform: translateX(100%);
  transition: transform 0.2s ease;
  overflow-y: auto;
}

.sc-mobile-nav.is-open {
  transform: translateX(0);
}

/* Closed drawer: hidden from assistive tech and the tab order even where
   the inert attribute (set by JS) is unsupported. Visibility flips after
   the slide-out so the animation still plays. */
.sc-mobile-nav:not(.is-open) {
  visibility: hidden;
  transition: transform 0.2s ease, visibility 0s linear 0.2s;
}

.sc-mobile-nav__inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.sc-mobile-nav__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sc-space-4);
  border-bottom: 1px solid var(--sc-color-soft-border);
}

.sc-mobile-nav__title {
  font-family: var(--sc-font-heading);
  font-weight: var(--sc-font-weight-semibold);
  font-size: var(--sc-text-h4-size-mobile);
  color: var(--sc-color-deep-ink);
}

.sc-mobile-nav__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--sc-control-height);
  height: var(--sc-control-height);
  padding: 0;
  border: none;
  background: transparent;
  color: var(--sc-color-deep-ink);
  cursor: pointer;
}

.sc-mobile-nav__close:focus-visible {
  outline: var(--sc-focus-width) solid var(--sc-focus-color);
  outline-offset: var(--sc-focus-offset);
}

.sc-mobile-nav__close-icon {
  width: 18px;
  height: 18px;
}

.sc-mobile-nav__nav {
  padding: var(--sc-space-2) 0;
}

.sc-mobile-nav__menu {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sc-mobile-nav__menu .menu-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  border-bottom: 1px solid var(--sc-color-soft-border);
}

.sc-mobile-nav__menu > .menu-item > a {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-height: 44px;
  padding: var(--sc-space-3) var(--sc-space-4);
  font-family: var(--sc-font-body);
  font-weight: var(--sc-font-weight-semibold);
  font-size: var(--sc-text-body-lg-size);
  color: var(--sc-color-deep-ink);
  text-decoration: none;
}

.sc-mobile-nav__menu > .menu-item > a:focus-visible {
  outline: var(--sc-focus-width) solid var(--sc-focus-color);
  outline-offset: calc(-1 * var(--sc-focus-width));
}

.sc-mobile-nav__menu .current-menu-item > a,
.sc-mobile-nav__menu .current-menu-ancestor > a {
  box-shadow: inset 3px 0 0 0 var(--sc-color-horizon-green);
}

.sc-mobile-nav__menu .sub-menu {
  display: none;
  flex-basis: 100%; /* forces the sub-menu onto its own row below the
    link + toggle row, since .menu-item is now a flex container */
  margin: 0;
  padding: 0 0 var(--sc-space-2) var(--sc-space-4);
  list-style: none;
}

.sc-mobile-nav__menu .menu-item.is-open > .sub-menu {
  display: block;
}

.sc-mobile-nav__menu .sub-menu .menu-item a {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-height: 44px;
  padding: var(--sc-space-2) var(--sc-space-4);
  font-family: var(--sc-font-body);
  font-weight: var(--sc-font-weight-regular);
  font-size: var(--sc-text-body-size);
  color: var(--sc-color-deep-ink);
  text-decoration: none;
}

.sc-mobile-nav__menu .sub-menu .menu-item a:focus-visible {
  outline: var(--sc-focus-width) solid var(--sc-focus-color);
  outline-offset: calc(-1 * var(--sc-focus-width));
}

/* Body scroll lock while the drawer is open (class applied by JS). */
.sc-nav-open {
  overflow: hidden;
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .sc-mobile-nav,
  .sc-mobile-nav__overlay,
  .sc-nav__chevron {
    transition: none;
  }
}

/* Top-level labels never wrap. Measured in the lab with the real Drupal
   main menu (6 items: What We Do, Where We Work, Projects, Resources
   Library, Blog, Events): the header content width is capped at 1152px from
   1280px up, so every desktop width has the same budget. At a 24px gap the
   row needed 1147 of 1152px (5px spare); a 16px gap leaves ~45px spare for
   label edits. Type size is unchanged. */
.sc-nav__menu > .menu-item > a {
  white-space: nowrap;
}

@media (min-width: 1280px) {
  .sc-nav__menu {
    gap: var(--sc-space-4);
  }
}

/* ==========================================================================
   Label-only menu parents (inc/navigation.php): a real <button> that
   toggles its submenu - looks like the other top-level items, never a link.
   ========================================================================== */

.sc-nav__parent {
  display: inline-flex;
  align-items: center;
  gap: var(--sc-space-2);
  min-height: var(--sc-control-height);
  padding: 0;
  font-family: var(--sc-font-body);
  font-weight: var(--sc-font-weight-semibold);
  font-size: var(--sc-text-nav-size);
  line-height: var(--sc-text-nav-line-height);
  white-space: nowrap;
  cursor: pointer;
}

.sc-nav__parent:hover .sc-nav__parent-label {
  color: var(--sc-color-action-green);
  text-decoration: underline;
}

.sc-nav__parent:focus-visible {
  outline: var(--sc-focus-width) solid var(--sc-focus-color);
  outline-offset: var(--sc-focus-offset);
}

.menu-item.is-open > .sc-nav__parent .sc-nav__chevron {
  transform: rotate(180deg);
}

.sc-nav__menu > .current-menu-ancestor > .sc-nav__parent {
  box-shadow: inset 0 -2px 0 0 var(--sc-color-horizon-green);
}

/* In the drawer: a full-width row like the other top-level items. */
.sc-mobile-nav__menu > .menu-item > .sc-nav__parent {
  flex: 1 1 auto;
  justify-content: space-between;
  width: 100%;
  padding: var(--sc-space-3) var(--sc-space-4);
  font-size: var(--sc-text-body-lg-size);
  text-align: left;
}

.sc-mobile-nav__menu > .menu-item > .sc-nav__parent:focus-visible {
  outline-offset: calc(-1 * var(--sc-focus-width));
}

.sc-mobile-nav__menu .current-menu-ancestor > .sc-nav__parent {
  box-shadow: inset 3px 0 0 0 var(--sc-color-horizon-green);
}

/* Drawer search row (the header search icon gives way to the 220px logo
   on the narrowest phones; see secureclimate-header.css). */
.sc-mobile-nav__search {
  display: flex;
  align-items: center;
  min-height: var(--sc-control-height);
  margin-top: var(--sc-space-2);
  padding: var(--sc-space-3) var(--sc-space-4);
  font-family: var(--sc-font-body);
  font-weight: var(--sc-font-weight-semibold);
  font-size: var(--sc-text-body-lg-size);
  color: var(--sc-color-action-green);
  text-decoration: underline;
}

.sc-mobile-nav__search:focus-visible {
  outline: var(--sc-focus-width) solid var(--sc-focus-color);
  outline-offset: calc(-1 * var(--sc-focus-width));
}

@media (prefers-reduced-motion: reduce) {
  .sc-nav__parent .sc-nav__chevron {
    transition: none;
  }
}
