/*
 * Shared hamburger behavior for public surfaces.
 * The homepage gutter is the reference for the toggle, Home control, and drawer.
 */

:where(
  body.ph-home,
  body.toward-mission,
  body.aa-contact-page,
  body.aa-login-page,
  body.aa-service-page
) .aa-chrome-controls.header-controls {
  padding-left: max(var(--public-composition-gutter), env(safe-area-inset-left, 0px)) !important;
  padding-right: max(var(--public-composition-gutter), env(safe-area-inset-right, 0px)) !important;
}

:where(
  body.ph-home,
  body.toward-mission,
  body.aa-contact-page,
  body.aa-login-page,
  body.aa-service-page
) .aa-chrome-header .glass-bar.controls-bar {
  overflow: visible !important;
}

html:has(body.ph-home.aa-chrome-nav-open),
html:has(body.toward-mission.aa-chrome-nav-open),
html:has(body.aa-contact-page.aa-chrome-nav-open),
html:has(body.aa-login-page.aa-chrome-nav-open),
html:has(body.aa-service-page.aa-chrome-nav-open),
body.ph-home.aa-chrome-nav-open,
body.toward-mission.aa-chrome-nav-open,
body.aa-contact-page.aa-chrome-nav-open,
body.aa-login-page.aa-chrome-nav-open,
body.aa-service-page.aa-chrome-nav-open {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

:where(
  body.ph-home,
  body.toward-mission,
  body.aa-contact-page,
  body.aa-login-page,
  body.aa-service-page
) .aa-chrome-header {
  z-index: 140 !important;
}

:where(
  body.ph-home,
  body.toward-mission,
  body.aa-contact-page,
  body.aa-login-page,
  body.aa-service-page
) .aa-chrome-drawer {
  --public-drawer-top: calc(var(--aa-chrome-header-height, 150px) + env(safe-area-inset-top, 0px) + 6px);
  top: var(--public-drawer-top) !important;
  left: max(10px, env(safe-area-inset-left, 0px)) !important;
  width: min(22rem, calc(100vw - 28px)) !important;
  max-width: min(22rem, calc(100vw - 28px)) !important;
  max-height: calc(100dvh - var(--public-drawer-top) - 12px - env(safe-area-inset-bottom, 0px)) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  z-index: 130 !important;
  box-sizing: border-box;
}

:where(
  body.ph-home,
  body.toward-mission,
  body.aa-contact-page,
  body.aa-login-page,
  body.aa-service-page
) .aa-chrome-backdrop {
  z-index: 120 !important;
  background: rgba(3, 7, 12, 0.55) !important;
}

html[data-theme="light"] :where(
  body.ph-home,
  body.toward-mission,
  body.aa-contact-page,
  body.aa-login-page,
  body.aa-service-page
) .aa-chrome-backdrop {
  background: rgba(15, 18, 22, 0.28) !important;
}

:where(
  body.ph-home,
  body.toward-mission,
  body.aa-contact-page,
  body.aa-login-page,
  body.aa-service-page
) .aa-chrome-drawer__links .aa-chrome-nav-link.aa-chrome-text-control {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  max-width: 100%;
  overflow-wrap: anywhere;
  hyphens: auto;
}

html[data-theme="stellar"] body.ph-home.aa-chrome-page .aa-chrome-drawer,
html[data-theme="stellar"] body.toward-mission.aa-chrome-page .aa-chrome-drawer,
html[data-theme="stellar"] body.aa-contact-page.aa-chrome-page .aa-chrome-drawer,
html[data-theme="stellar"] body.aa-login-page.aa-chrome-page .aa-chrome-drawer,
html[data-theme="stellar"] body.aa-service-page.aa-chrome-page .aa-chrome-drawer {
  background-color: #03070c !important;
  background-image: none !important;
  border: 1px solid rgba(150, 180, 255, 0.22) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 18px 48px rgba(0, 0, 0, 0.45) !important;
}

html[data-theme="dark"] body.ph-home.aa-chrome-page .aa-chrome-drawer,
html[data-theme="dark"] body.toward-mission.aa-chrome-page .aa-chrome-drawer,
html[data-theme="dark"] body.aa-contact-page.aa-chrome-page .aa-chrome-drawer,
html[data-theme="dark"] body.aa-login-page.aa-chrome-page .aa-chrome-drawer,
html[data-theme="dark"] body.aa-service-page.aa-chrome-page .aa-chrome-drawer {
  background-color: #050b12 !important;
  background-image: none !important;
  border: 1px solid rgba(120, 150, 180, 0.28) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 18px 48px rgba(0, 0, 0, 0.5) !important;
}

html[data-theme="light"] body.ph-home.aa-chrome-page .aa-chrome-drawer,
html[data-theme="light"] body.toward-mission.aa-chrome-page .aa-chrome-drawer,
html[data-theme="light"] body.aa-contact-page.aa-chrome-page .aa-chrome-drawer,
html[data-theme="light"] body.aa-login-page.aa-chrome-page .aa-chrome-drawer,
html[data-theme="light"] body.aa-service-page.aa-chrome-page .aa-chrome-drawer {
  background-color: #f7fbff !important;
  background-image: none !important;
  border: 1px solid rgba(167, 199, 225, 0.55) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    0 18px 52px rgba(17, 42, 63, 0.16) !important;
}

/* Business Ops Correction 02: one shared rail and spacing rhythm. */
:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page {
  --public-chrome-gutter: clamp(22px, 2.8vw, 36px);
  --public-drawer-inner-x: clamp(20px, 2.3vw, 28px);
  --public-drawer-group-gap: 16px;
  --public-drawer-submenu-indent: 20px;
}

:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page .aa-chrome-header .aa-chrome-controls.header-controls {
  padding-left: calc(var(--public-chrome-gutter) + var(--aa-chrome-control-hit-pad, 6px) + env(safe-area-inset-left, 0px)) !important;
  padding-right: calc(var(--public-chrome-gutter) + env(safe-area-inset-right, 0px)) !important;
}

:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page .aa-chrome-drawer {
  left: calc(var(--public-chrome-gutter) + env(safe-area-inset-left, 0px)) !important;
  width: min(24rem, calc(100vw - 2 * var(--public-chrome-gutter) - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px))) !important;
  max-width: min(24rem, calc(100vw - 2 * var(--public-chrome-gutter) - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px))) !important;
  padding: 32px var(--public-drawer-inner-x) 30px !important;
  box-sizing: border-box !important;
}

:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page #aa-chrome-drawer-body { width: 100%; }

:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page .aa-chrome-drawer__links {
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page .aa-chrome-drawer__links li {
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page .aa-chrome-drawer__links .aa-chrome-nav-link {
  display: flex !important;
  align-items: center;
  min-height: 44px;
  box-sizing: border-box;
  padding: 8px 0 !important;
  margin: 0 !important;
  font-size: 0.875rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.075em !important;
  line-height: 1.3 !important;
  text-transform: uppercase !important;
}

:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page .aa-chrome-drawer__links:first-child { margin-bottom: 24px !important; }

:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page .aa-chrome-drawer__section-label {
  margin: 0 0 20px !important;
  padding: 0 !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.14em !important;
  line-height: 1.25 !important;
}

:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page .aa-chrome-drawer__section-label + .aa-chrome-drawer__links {
  gap: 0 !important;
  margin-bottom: var(--public-drawer-group-gap) !important;
}

:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page .aa-chrome-drawer__section-label + .aa-chrome-drawer__links .aa-chrome-nav-link {
  padding: 7px 0 7px var(--public-drawer-submenu-indent) !important;
  font-size: clamp(1rem, 1.65vw, 1.12rem) !important;
  font-weight: 620 !important;
  letter-spacing: -0.012em !important;
  text-transform: none !important;
}

:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page .aa-chrome-drawer__links:last-child {
  border-top: 1px solid rgba(147, 175, 194, 0.22) !important;
  padding-top: 16px !important;
}

html[data-theme="light"] :is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page .aa-chrome-drawer__links:last-child {
  border-top-color: rgba(58, 69, 84, 0.16) !important;
}

@media (max-width: 430px) {
  :is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page .aa-chrome-drawer { padding-top: 28px !important; padding-bottom: 26px !important; }
}

html[data-theme="light"] :is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page .aa-chrome-drawer__section-label { color: rgba(58, 69, 84, 0.72); }

/* Keep the shared rail inside the layout viewport when a page has a scrollbar. */
:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page .aa-chrome-header .header-bars {
  width: 100% !important;
  margin-left: 0 !important;
}
:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page:not(.aa-public-chrome) .aa-chrome-header .glass-bar {
  width: 100% !important;
}

/* Keep enlarged HOME and theme labels in separate columns without fixed label widths. */
:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page:not(.tm-controls-compact):not(.aa-chrome-controls-compact) .aa-chrome-header .aa-chrome-controls.header-controls {
  grid-template-columns: minmax(max-content, 1fr) max-content minmax(0, 1fr) !important;
}
:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page:not(.tm-controls-compact):not(.aa-chrome-controls-compact) .aa-chrome-controls-start {
  width: max-content !important;
  min-width: 0 !important;
  max-width: none !important;
  padding-right: 8px !important;
}
:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page:not(.tm-controls-compact):not(.aa-chrome-controls-compact) .aa-chrome-home-slot {
  margin-right: 0 !important;
}
:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page:not(.tm-controls-compact):not(.aa-chrome-controls-compact) .aa-chrome-header .public-theme-cluster {
  position: static !important;
  inset: auto !important;
  width: auto !important;
  transform: none !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page:not(.tm-controls-compact):not(.aa-chrome-controls-compact) .mode-rail--theme-only {
  position: static !important;
  inset: auto !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: var(--aa-chrome-theme-gap, clamp(8px, 1.2vw, 12px));
  width: auto !important;
  height: auto;
  margin: 0;
  padding: 0;
}
:is(body.ph-home, body.toward-mission, body.aa-contact-page, body.aa-login-page, body.aa-service-page).aa-chrome-page:not(.tm-controls-compact):not(.aa-chrome-controls-compact) .mode-rail--theme-only > .mode-option {
  width: auto !important;
  max-width: none !important;
  flex-shrink: 0 !important;
  position: static !important;
  left: auto !important;
  top: auto !important;
  transform: none !important;
  margin: 0 !important;
  pointer-events: auto;
}
