/**
 * Mobile Menu Styles
 * Subtle, minimal, and classy mobile navigation
 */

/* Desktop - Hide mobile elements */
@media (min-width: 769px) {
    .menu-toggle,
    .mobile-menu-overlay,
    .mobile-menu-container,
    .menu-close,
    .close-icon {
        display: none !important;
    }
    
    /* Show desktop navigation */
    .main-navigation #primary-menu,
    .main-navigation .mobile-menu-list {
        display: flex !important;
        position: static !important;
        background: transparent !important;
        box-shadow: none !important;
        flex-direction: row !important;
        margin: 0 !important;
    }
    
    /* Reset mobile styles for desktop */
    .main-navigation li {
        border: none !important;
    }
    
    .main-navigation a {
        padding: 15px 20px !important;
    }
}

/* Mobile Menu Button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    align-items: center;
    gap: 8px;
    transition: opacity 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.menu-toggle:hover {
    opacity: 0.7;
}

.menu-toggle:focus {
    outline: 2px solid rgba(0, 0, 0, 0.1);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Minimalist hamburger icon */
.menu-icon {
    width: 20px;
    height: 14px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.menu-icon .bar {
    display: block;
    width: 100%;
    height: 1.5px;
    background: #2d3436;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform-origin: center;
}

/* Animated hamburger to X */
.menu-open .menu-icon .bar:first-child {
    transform: translateY(6px) rotate(45deg);
}

.menu-open .menu-icon .bar:last-child {
    transform: translateY(-6px) rotate(-45deg);
}

/* Menu text - subtle */
.menu-text {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: #2d3436;
    text-transform: uppercase;
}

/* Mobile menu overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile menu container */
.mobile-menu-container {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    display: none; /* Hidden by default */
    flex-direction: column;
}

/* Only show on mobile */
@media (max-width: 768px) {
    .mobile-menu-container {
        display: flex;
    }
}

.mobile-menu-container.active {
    transform: translateX(-280px);
}

/* Close button */
.menu-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.menu-close:hover {
    transform: rotate(90deg);
}

.close-icon {
    font-size: 24px;
    line-height: 1;
    color: #636e72;
    font-weight: 300;
}

/* Mobile menu list */
.mobile-menu-list {
    list-style: none;
    margin: 80px 0 40px 0;
    padding: 0;
}

.mobile-menu-list li {
    margin: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.mobile-menu-list li:last-child {
    border-bottom: none;
}

.mobile-menu-list a {
    display: block;
    padding: 18px 30px;
    color: #2d3436;
    text-decoration: none;
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
    position: relative;
}

.mobile-menu-list a:hover,
.mobile-menu-list a:focus {
    background: rgba(0, 0, 0, 0.02);
    padding-left: 35px;
    color: #000;
}

/* Subtle active indicator */
.mobile-menu-list .current-menu-item > a,
.mobile-menu-list .current_page_item > a {
    color: #000;
    font-weight: 500;
}

.mobile-menu-list .current-menu-item > a::before,
.mobile-menu-list .current_page_item > a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: #2d3436;
}

/* Submenu styling */
.mobile-menu-list .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.02);
}

.mobile-menu-list .sub-menu li {
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.mobile-menu-list .sub-menu a {
    padding-left: 50px;
    font-size: 14px;
}

/* Mobile specific styles */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }
    
    .main-navigation ul {
        display: none;
    }
    
    /* Adjust header for mobile */
    .site-header {
        padding: 15px 0;
    }
    
    .header-inner {
        min-height: 60px;
    }
    
    .site-branding {
        flex: 1;
    }
    
    .site-logo,
    .custom-logo {
        font-size: 20px;
        max-height: 40px;
    }
}

/* Slide-in animation classes */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-280px);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.mobile-menu-container.animating {
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.mobile-menu-overlay.animating {
    animation: fadeIn 0.3s ease forwards;
}

/* Prevent body scroll when menu is open */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Accessibility focus styles */
.mobile-menu-list a:focus {
    outline: 2px solid rgba(0, 0, 0, 0.1);
    outline-offset: -2px;
}

.menu-close:focus {
    outline: 2px solid rgba(0, 0, 0, 0.1);
    outline-offset: 2px;
    border-radius: 50%;
}

/* Small phone adjustments */
@media (max-width: 375px) {
    .mobile-menu-container {
        width: 260px;
        right: -260px;
    }
    
    .mobile-menu-container.active {
        transform: translateX(-260px);
    }
    
    .mobile-menu-list a {
        padding: 16px 25px;
        font-size: 14px;
    }
}

/* Landscape orientation adjustment */
@media (max-height: 500px) and (orientation: landscape) {
    .mobile-menu-list {
        margin-top: 60px;
    }
    
    .mobile-menu-list a {
        padding: 14px 25px;
    }
}

/* Dark mode support (if system preference) */
@media (prefers-color-scheme: dark) {
    .mobile-menu-container {
        background: #1a1a1a;
    }
    
    .menu-icon .bar,
    .menu-text {
        background: #ffffff;
        color: #ffffff;
    }
    
    .mobile-menu-list a {
        color: #e0e0e0;
    }
    
    .mobile-menu-list a:hover {
        background: rgba(255, 255, 255, 0.05);
        color: #ffffff;
    }
    
    .mobile-menu-list li {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    .close-icon {
        color: #b0b0b0;
    }
}