/* ============================================
   LOTUS THEME — HEADER
   Sticky header, navigation, mobile nav
   ============================================ */

/* --- Scroll Progress Indicator --- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 1001;
  background: linear-gradient(90deg, var(--color-saffron), var(--color-saffron-light));
  transform-origin: left center;
  transform: scaleX(0);
  pointer-events: none;
}

.admin-bar .scroll-progress {
  top: 32px;
}


/* iOS dynamic-island / notch cover.
   A top-level fixed element (direct child of <body>) — NOT nested inside the
   fixed header, because iOS Safari does not reliably paint a fixed element's
   background into its own padding-top: env(safe-area-inset-top) region. This
   bar sits at the true top of the screen and covers exactly the inset strip.
   Default white (inner pages); transparent on the homepage dark video hero. */
.safe-area-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: env(safe-area-inset-top, 0px);
  z-index: 1002; /* above header (1000) and scroll-progress (1001) */
  pointer-events: none;
  /* Default (inner pages, not scrolled): solid white, matching the header. */
  background-color: #fff;
  transition: background-color var(--duration-base) var(--ease-out);
}

/* Homepage, not scrolled: transparent so the dark video hero reaches the top,
   matching the transparent header. */
.home .safe-area-bar {
  background-color: transparent;
}

/* Scrolled (any page): replicate the frosted header exactly — 95% white +
   12px blur — so the strip and the header read as one continuous surface.
   .is-scrolled (set by JS on <body>) is the primary hook; the :has() variant
   is a CSS-only backstop for the same state. */
body.is-scrolled .safe-area-bar,
body:has(.site-header--scrolled) .safe-area-bar {
  background-color: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* --- Site Header --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-height);
  padding-top: env(safe-area-inset-top, 0px);
  box-sizing: border-box;
  transition: all var(--duration-base) var(--ease-out);
  /* White background covers the ENTIRE header including the safe-area
     padding zone — so nothing scrolls through behind the dynamic island.
     Homepage overrides this to transparent (dark video hero). */
  background-color: #fff;
}

/* WordPress admin bar offset */
.admin-bar .site-header {
  top: 32px;
}

@media screen and (max-width: 782px) {
  .admin-bar .site-header {
    top: 46px;
  }
}

/* Scrolled state */
.site-header--scrolled {
  height: var(--header-height-scrolled);
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(12, 24, 41, 0.06);
}

/* When on dark hero (homepage) — transparent bg + light text until scrolled,
   so the video hero extends naturally behind the dynamic island. */
.home .site-header:not(.site-header--scrolled) {
  background-color: transparent;
  color: var(--color-white);
}

.home .site-header--scrolled {
  color: var(--color-text);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding-inline: var(--space-8);
  max-width: var(--container-wide);
  margin-inline: auto;
}


/* --- Logo --- */
.site-header__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  z-index: 10;
}

.site-header__logo-img {
  height: 56px;
  width: auto;
  transition: height var(--duration-base) var(--ease-out);
}

.site-header--scrolled .site-header__logo-img {
  height: 46px;
}

/* Show/hide logo variants based on header state */
.site-header__logo-img--light {
  display: none;
}

.home .site-header:not(.site-header--scrolled) .site-header__logo-img--dark {
  display: none;
}

.home .site-header:not(.site-header--scrolled) .site-header__logo-img--light {
  display: block;
}


/* --- Primary Nav --- */
.site-nav {
  display: flex;
  align-items: center;
}

.site-nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.site-nav__item {
  position: relative;
}

.site-nav__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}

.site-nav__link:hover {
  color: var(--color-saffron);
}

.site-header--scrolled .site-nav__link:hover {
  color: var(--color-saffron);
}

.site-nav__chevron {
  transition: transform var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}

.site-nav__item--has-children:hover .site-nav__chevron,
.site-nav__item--has-children .site-nav__link[aria-expanded="true"] .site-nav__chevron {
  transform: rotate(180deg);
}


/* --- Dropdown --- */
.site-nav__dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  min-width: 320px;
  width: max-content;
  max-width: 420px;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-base) var(--ease-out);
  pointer-events: none;
  border: 1px solid var(--color-gray-100);
}

.site-nav__dropdown-list li a {
  white-space: nowrap;
}

.site-nav__item--has-children:hover .site-nav__dropdown,
.site-nav__item--has-children .site-nav__link[aria-expanded="true"] + .site-nav__dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.site-nav__dropdown-list li a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-gray-800);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
}

.site-nav__dropdown-list li a:hover {
  background-color: var(--color-gray-50);
  color: var(--color-saffron);
  box-shadow: inset 0 0 0 1px var(--color-saffron);
}

.site-nav__dropdown-icon {
  flex-shrink: 0;
  color: var(--color-gray-500);
  transition: color var(--duration-fast) var(--ease-out);
}

.site-nav__dropdown-list li a:hover .site-nav__dropdown-icon,
.site-nav__dropdown-list li a.is-active .site-nav__dropdown-icon {
  color: var(--color-saffron);
}

.site-nav__dropdown-list li a.is-active {
  background-color: var(--color-gray-50);
  color: var(--color-saffron);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--color-saffron);
}

/* Active state on top-level nav items (button or direct link) */
.site-nav__link.is-active {
  color: var(--color-saffron);
}


/* --- Header Actions --- */
.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

.site-header__phone {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: inherit;
  transition: color var(--duration-fast) var(--ease-out);
}

.site-header__phone:hover {
  color: var(--color-saffron);
}

.site-header__cta {
  /* Styling from btn--primary btn--sm */
}

/* Scrolled state for CTA */
.home .site-header:not(.site-header--scrolled) .site-header__cta {
  background-color: var(--color-saffron);
  border-color: var(--color-saffron);
  color: var(--color-white);
}


/* --- Hamburger Toggle --- */
.site-header__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 10;
  padding: 8px;
}

.site-header__toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background-color: currentColor;
  border-radius: 2px;
  transition: all var(--duration-base) var(--ease-out);
  transform-origin: center;
}

/* Active state (X) */
.site-header__toggle--active .site-header__toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.site-header__toggle--active .site-header__toggle-bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.site-header__toggle--active .site-header__toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* When mobile nav is open — force header above nav with dark bg */
.site-header:has(.site-header__toggle--active) {
  z-index: 1002;
  background-color: var(--color-navy) !important;
  color: var(--color-white) !important;
}

.site-header:has(.site-header__toggle--active) .site-header__logo-img--dark {
  display: none !important;
}

.site-header:has(.site-header__toggle--active) .site-header__logo-img--light {
  display: block !important;
}


/* --- Mobile Navigation Overlay --- */
.mobile-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-navy);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  overflow-y: auto;
  transition: all var(--duration-slow) var(--ease-out);
}

.admin-bar .mobile-nav {
  top: 32px;
}

.mobile-nav--open {
  opacity: 1;
  visibility: visible;
}

.mobile-nav__inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  min-height: 100dvh;
  padding: var(--header-height) var(--space-8) calc(var(--space-8) + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

.mobile-nav__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.mobile-nav__item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-nav__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-3) 0;
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-white);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.mobile-nav__sub {
  display: none;
  padding-bottom: var(--space-4);
}

.mobile-nav__item--has-children .mobile-nav__link[aria-expanded="true"] + .mobile-nav__sub {
  display: block;
}

.mobile-nav__sub li a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-lg);
  color: var(--color-text-on-dark);
  opacity: 0.8;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.mobile-nav__sub li a:hover {
  opacity: 1;
  color: var(--color-saffron-light);
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px var(--color-saffron-light);
}

.mobile-nav__icon {
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.mobile-nav__sub li a:hover .mobile-nav__icon,
.mobile-nav__sub li a.is-active .mobile-nav__icon {
  opacity: 1;
}

.mobile-nav__sub li a.is-active {
  opacity: 1;
  color: var(--color-saffron-light);
  font-weight: 600;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px var(--color-saffron-light);
}

.mobile-nav__link.is-active {
  opacity: 1;
  color: var(--color-saffron-light);
  font-weight: 600;
}

.mobile-nav__footer {
  margin-top: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.mobile-nav__phone {
  font-size: var(--text-xl);
  color: var(--color-saffron-light);
  font-weight: 600;
}

.mobile-nav__cta {
  text-align: center;
}


/* --- Responsive --- */
@media (max-width: 1024px) {
  .site-nav {
    display: none;
  }

  .site-header__phone span {
    display: none;
  }

  .site-header__toggle {
    display: flex;
  }
}

@media (max-width: 640px) {
  .site-header__phone {
    display: none;
  }

  .site-header__cta {
    display: none;
  }
}
