/* 
   SCX Mobile Navigation Styles
   Safari-compatible mobile menu with enhanced accessibility
   This overrides all previous mobile navigation styles
*/

/* Base styles for all screen sizes */
.nav-toggle {
  display: none; /* Hidden by default on desktop */
}

/* Mobile styles (apply at 880px breakpoint) */
@media (max-width: 880px) {
  /* Container layout */
  .site-header .container.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
  }
  
  /* Logo positioning */
  .logo {
    position: relative;
    z-index: 5000;
    display: block;
    margin-left: 0;
  }
  
  .logo img {
    height: 42px;
  }
  
  /* Toggle button styling */
  .nav-toggle {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    position: absolute;
    top: 6px;
    right: 16px;
    z-index: 5000;
    cursor: pointer;
  }
  
  .nav-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
  
  .nav-toggle .bar {
    width: 22px;
    height: 2px;
    background-color: var(--black);
    transition: transform 0.3s, opacity 0.3s;
  }
  
  /* Hamburger to X animation */
  .nav-toggle[aria-expanded="true"] .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .nav-toggle[aria-expanded="true"] .bar:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle[aria-expanded="true"] .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
  
  /* Menu styling - Target both class and ID for compatibility */
  .nav-scroll-wrapper {
    position: relative;
  }
  
  .nav__menu, #primary-menu {
    position: fixed;
    top: 60px;
    right: 12px;
    left: 12px;
    display: none;
    flex-direction: column;
    background: #fff;
    padding: 1.25rem 1.25rem 1.5rem;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 14px;
    box-shadow: 0 14px 40px -5px rgba(0,0,0,0.25);
    max-height: 70vh;
    overflow: auto;
    z-index: 4500;
    will-change: opacity, transform;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Open state - Target both class and ID for compatibility */
  .nav__menu.is-open, #primary-menu.is-open {
    display: flex !important;
    animation: fadeSlide 0.28s ease;
  }
  
  @keyframes fadeSlide {
    0% {opacity: 0; transform: translateY(-8px);}
    100% {opacity: 1; transform: translateY(0);}
  }
  
  .nav__menu a, #primary-menu a {
    font-size: 1.05rem;
    padding: 0.4rem 0;
  }
  
  /* Prevent background scrolling when menu is open */
  body.menu-open {
    overflow: hidden;
    /* ensure page not jump: lock position */
  }
}
