/**
 * Mobile Navigation Styles
 * Hamburger animation + Offcanvas overrides
 */

/* ==========================================================================
   HAMBURGER BUTTON
   ========================================================================== */

.hamburger {
  display: none; /* Hidden on desktop */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px; /* Touch-friendly size */
  height: 44px;
  padding: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 10000;
}

.hamburger__line {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--dark, #1a1a1a);
  border-radius: 2px;
  transition:
    transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55),
    opacity 0.2s ease;
  transform-origin: center;
}

/* Show hamburger on mobile */
@media (max-width: 991px) {
  .hamburger {
    display: flex;
  }
}

/* ==========================================================================
   HAMBURGER -> X ANIMATION
   Uses body class added by Bricks when offcanvas is open
   ========================================================================== */

.brx-body-offcanvas-open .hamburger__line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.brx-body-offcanvas-open .hamburger__line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.brx-body-offcanvas-open .hamburger__line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ==========================================================================
   OFFCANVAS OVERRIDES
   ========================================================================== */

/* Ensure offcanvas is above header */
.brxe-offcanvas {
  z-index: 99999;
}

/* Smooth backdrop */
.brx-offcanvas-backdrop {
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ==========================================================================
   MOBILE NAV INSIDE OFFCANVAS
   ========================================================================== */

/* Ensure nav items stack vertically */
.offcanvas-nav .brxe-nav-nested {
  flex-direction: column;
  width: 100%;
}

.offcanvas-nav .brx-nav-nested-items {
  flex-direction: column;
  width: 100%;
  gap: var(--space-xs, 8px);
}

/* Nav links full width */
.offcanvas-nav .brxe-nav-nested .brx-nav-link {
  width: 100%;
  padding: var(--space-s, 12px) var(--space-m, 16px);
  font-size: var(--text-m, 1rem);
  border-bottom: 1px solid var(--bg-body-l-5, rgba(0,0,0,0.05));
}

/* Dropdown styling inside offcanvas */
.offcanvas-nav .brxe-dropdown .brx-dropdown-content {
  position: static !important; /* Critical for offcanvas dropdowns */
  width: 100%;
  box-shadow: none;
  background: transparent;
  padding-left: var(--space-m, 16px);
}

/* Dropdown toggle arrow rotation */
.offcanvas-nav .brxe-dropdown.brx-open .brx-dropdown-arrow {
  transform: rotate(180deg);
}

/* ==========================================================================
   CLOSE BUTTON INSIDE OFFCANVAS
   ========================================================================== */

.offcanvas-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 24px;
  color: var(--dark, #1a1a1a);
}

.offcanvas-close:hover {
  opacity: 0.7;
}

/* ==========================================================================
   ACCESSIBILITY & MOBILE FIXES
   ========================================================================== */

/* Remove default focus outline */
.hamburger:focus,
.offcanvas-close:focus {
  outline: none;
}

/* Subtle focus for keyboard users only */
.hamburger:focus-visible,
.offcanvas-close:focus-visible {
  outline: 2px solid var(--primary, #633368);
  outline-offset: 2px;
}

/* Remove iOS tap highlight (blue flash) */
.hamburger,
.offcanvas-close,
.brxe-toggle,
[data-bricks-offcanvas-toggle],
.mobile-toggle,
.mobile-toggle * {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

/* Remove focus outline on Bricks toggle and mobile elements */
.brxe-toggle:focus,
[data-bricks-offcanvas-toggle]:focus,
.mobile-toggle:focus,
.mobile-toggle *:focus {
  outline: none;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .hamburger__line {
    transition: none;
  }

  .brx-offcanvas-backdrop {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
