/**
 * Mobile Header Improvements
 * 
 * Fixes mobile header layout with hamburger menu and proper spacing
 * 
 * @package GaganaSamoa
 */

/* ============================================
   HAMBURGER MENU STYLES
   ============================================ */

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    padding: 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.menu-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

.menu-toggle:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    width: 24px;
    height: 18px;
    justify-content: space-between;
}

.hamburger-line {
    display: block;
    height: 3px;
    width: 100%;
    background-color: var(--color-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Animated hamburger when menu is open */
.main-navigation.toggled .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.main-navigation.toggled .hamburger-line:nth-child(2) {
    opacity: 0;
}

.main-navigation.toggled .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ============================================
   MOBILE HEADER LAYOUT FIXES
   ============================================ */

@media (max-width: 767px) {
    /* Fix header layout - logo left, hamburger right */
    .header-inner {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 20px !important;
        padding: 15px 0;
        min-height: 60px; /* Ensure consistent header height */
    }
    
    .site-branding {
        flex: 0 0 auto;
        max-width: none;
        text-align: left;
    }
    
    .main-navigation {
        flex: 0 0 auto;
        justify-content: flex-end;
    }
    
    .menu-toggle {
        display: block;
        margin: 0; /* Remove centering */
        position: relative;
        z-index: 10;
    }
    
    /* Improve mobile menu dropdown */
    .main-navigation ul {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 9999;
        background: white;
        border: 1px solid #e1e5e9;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        margin-top: 10px;
        padding: 10px 0;
    }
    
    .main-navigation li {
        border-bottom: 1px solid #f0f0f0;
    }
    
    .main-navigation li:last-child {
        border-bottom: none;
    }
    
    .main-navigation a {
        padding: 12px 20px;
        color: var(--color-text);
        border-radius: 0;
    }
    
    .main-navigation a:hover {
        background: var(--color-bg-light);
        color: var(--color-primary);
    }
}

/* ============================================
   MOBILE FRONT PAGE HEADER FIXES
   ============================================ */

@media (max-width: 767px) {
    /* Reduce header padding to give hero more space */
    body.home .site-header {
        padding-top: 12px !important;
        padding-bottom: 12px !important;
    }
    
    /* Adjust hero section top spacing - increase to prevent header overlap */
    .hero-inner {
        padding-top: 110px !important; /* More space from header */
    }
}

@media (max-width: 480px) {
    /* Even tighter spacing on small phones */
    body.home .site-header {
        padding-top: 12px !important;
        padding-bottom: 12px !important;
    }
    
    .header-inner {
        padding: 12px 0 !important;
    }
    
    /* Give hero more breathing room - increase padding to prevent overlap */
    .hero-inner {
        padding-top: 120px !important;
        min-height: calc(100vh - 80px) !important;
    }
    
    /* Smaller logo on tiny screens */
    .custom-logo {
        max-height: 40px !important;
    }
    
    /* Smaller hamburger on tiny screens */
    .hamburger-icon {
        width: 20px;
        height: 15px;
    }
    
    .hamburger-line {
        height: 2px;
    }
}

/* ============================================
   MOBILE TARO IMAGE POSITIONING
   ============================================ */

@media (max-width: 767px) {
    /* Show taro image on mobile below hero buttons */
    .hero-taro-mobile {
        display: block !important;
        margin: 40px auto 30px;
        max-width: 200px;
        opacity: 0.8;
    }
    
    /* Hide desktop taro positioning on mobile */
    .hero-section .hero-taro {
        display: none !important;
    }
}

@media (min-width: 768px) {
    /* Hide mobile taro on desktop */
    .hero-taro-mobile {
        display: none !important;
    }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

.screen-reader-text {
    position: absolute !important;
    clip: rect(1px, 1px, 1px, 1px);
    width: 1px !important;
    height: 1px !important;
    overflow: hidden;
}

/* Focus states for hamburger */
.menu-toggle:focus .hamburger-line {
    background-color: var(--color-secondary);
}

/* Ensure menu is accessible with keyboard */
.main-navigation.toggled ul {
    display: flex !important;
}

/* Better touch targets on mobile */
@media (max-width: 767px) {
    .menu-toggle {
        min-width: 44px;
        min-height: 44px;
    }
    
    .main-navigation a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}