/* Header Styles */
.site-header {
    background: rgba(0, 0, 0, 0.2);
    /* Subtle black tint always */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: none;
    position: fixed;
    transition: background 0.3s ease, backdrop-filter 0.3s ease, box-shadow 0.3s ease;
    top: 0;
    left: 0;
    z-index: 1000;
    width: 100%;
}

.site-header.scrolled,
.site-header.lang-open,
.site-header.menu-open {
    background: rgba(0, 0, 0, 0.8);
    /* Pure black semi-transparent */
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.header-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    /* Flexbox for main layout */
    justify-content: space-between;
    align-items: center;
    padding: 8px 32px;
    box-sizing: border-box;
    position: relative;
    /* Anchor for absolute elements */
    height: 60px;
    /* Enforce height for vertical centering reference */
}

/* Logo */
.site-branding {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--color-text-primary);
    justify-self: start;
    z-index: 20;
    /* Ensure clickable */
    position: relative;
}

/* ... existing styles ... */

/* Header Content Wrapper (Desktop) */
.header-menu-content {
    display: flex;
    align-items: center;
    position: static;
    /* Let children position relative to container */
}

.main-navigation {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    /* Perfect Center X/Y */
    width: max-content;
    z-index: 10;
    /* Lower than actions but high enough */
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 32px;
    z-index: 20;
    /* Ensure clickable */
    position: relative;
    /* Keep in flow */
}

.site-logo {
    width: 120px;
    height: auto;
    object-fit: contain;
}


/* Navigation */
.main-navigation ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 32px;
    align-items: center;
}

.main-navigation a {
    text-decoration: none;
    color: var(--color-text-primary);
    /* White by default */
    font-family: var(--font-family-base);
    position: relative;
    padding-bottom: 8px;
    transition: color 0.3s ease;
}

.main-navigation a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    height: 2px;
    background-color: var(--color-text-primary);
    /* Always white underline */
    transform: scaleX(0);
    transform-origin: right;
    /* Shrinks to the right when mouse leaves */
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.main-navigation a:hover {
    color: var(--color-text-primary);
    /* White on hover */
    opacity: 1;
}

.main-navigation a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
    /* Grows from the left when mouse enters */
}

/* Header Actions (Button/Cart) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 32px;
    /* Increased gap based on image visual spacing */
}

.header-lang {
    /* Typography via .text-desktop-button */
    letter-spacing: -0.005em;
    color: var(--color-text-primary);
    text-decoration: none;
    font-weight: 500;
    text-transform: none;
    transition: color 0.3s ease;
    cursor: pointer;
    padding: 8px 0;
}

.header-lang:hover {
    color: var(--color-text-primary);
}

/* Language Trigger (Icon) */
.lang-trigger {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-primary);
    /* White */
    padding: 0 0 4px 0;
    /* Space for underline */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    position: relative;
}

.lang-trigger::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--color-text-primary);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.lang-trigger:hover::after,
.site-header.lang-open .lang-trigger::after {
    transform: scaleX(1);
    transform-origin: left;
}

.lang-trigger:hover,
.site-header.lang-open .lang-trigger {
    color: var(--color-text-primary);
}

.current-lang-text {
    font-size: 15px;
    /* Typography via .text-desktop-button in HTML */
    letter-spacing: -0.005em;
    font-weight: 500;
    text-transform: none;
}




/* Mega Menu Container */
.lang-mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #161617;
    /* Solid Dark Background */
    border-top: 1px solid var(--color-border-white-10);
    padding: 0;

    /* Animation State: Hidden */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px) scale(0.98);
    /* Slight slide up and scale down */

    transition:
        opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0.4s step-end;
    /* Wait for opacity to finish before hiding */

    box-shadow: 0 50px 100px rgba(0, 0, 0, 0.5);
    z-index: 900;
}

/* Open State */
.site-header.lang-open .lang-mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);

    transition:
        opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0s step-start;
    /* Show immediately */

    border-bottom: 1px solid var(--color-border-white-10);
}

/* Content Grid */
.mega-menu-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 64px 32px 80px;
    /* Spacious padding */
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* 4 Columns */
    gap: 40px;
}

/* Titles */
.region-title {
    color: var(--color-text-tertiary);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0.05em;
    margin-bottom: 24px;
}

/* Lists */
.menu-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.menu-column a {
    text-decoration: none;
    display: block;
    color: var(--color-text-tertiary);
    /* Inactive: Grey */
    transition: opacity 0.2s ease, color 0.2s ease;
}

.menu-column a:hover {
    color: var(--color-text-primary);
    opacity: 1;
}

.menu-column a.active {
    opacity: 1;
    color: var(--color-text-primary);
    /* Active: White */
}

.menu-column a strong {
    display: block;
    margin-bottom: 2px;
}

.menu-column a span {
    display: block;
    color: inherit;
    /* Inherit white/grey from parent */
    opacity: 0.6;
    /* Keep slightly dimmer than title via opacity */
}

.menu-column a.active span,
.menu-column a:hover span {
    opacity: 1;
    /* Full white when active or hovered */
}

/* Responsive Grid */
@media (max-width: 1024px) {
    .mega-menu-content {
        grid-template-columns: repeat(2, 1fr);
        padding: 40px 32px;
    }
}

@media (max-width: 768px) {
    .mega-menu-content {
        grid-template-columns: 1fr;
    }
}

/* Language Switcher Wrapper */
.lang-switcher {
    display: flex;
    align-items: center;
    height: 100%;
}

.header-user {
    color: var(--color-text-primary);
    /* White */
    /* Grey default */
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.header-user:hover {
    color: var(--color-text-primary);
}

.header-user i {
    font-size: 24px;
}

.header-search {
    width: 20px;
    height: 20px;
    cursor: pointer;
    color: var(--color-text-primary);
}

/* Default Hidden Mobile Lang */
.mobile-lang-section {
    display: none;
}

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 6px;
    z-index: 1001;
    padding: 0;
}

.mobile-toggle .line {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--color-text-primary);
    transition: all 0.3s ease;
}

/* Header Content Wrapper (Desktop) */
.header-menu-content {
    display: flex;
    align-items: center;
    gap: 32px;
}

/* Global Reveal Animation */
@keyframes appleReveal {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes appleSlideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Language Menu Staggered Animation */
.site-header.lang-open .menu-column li {
    opacity: 0;
    transform: translateY(20px);
    animation: appleReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.site-header.lang-open .menu-column li:nth-child(1) {
    animation-delay: 0.05s;
}

.site-header.lang-open .menu-column li:nth-child(2) {
    animation-delay: 0.1s;
}

.site-header.lang-open .menu-column li:nth-child(3) {
    animation-delay: 0.15s;
}

.site-header.lang-open .menu-column li:nth-child(4) {
    animation-delay: 0.2s;
}

/* Mobile Responsive Styles */
@media (max-width: 1024px) {
    .header-container {
        padding: 24px 32px;
        display: flex;
        /* Reset to Flex for Mobile */
        justify-content: space-between;
        align-items: center;
    }

    .mobile-toggle {
        display: flex;
    }

    .desktop-only {
        display: none !important;
    }

    /* Start with menu hidden */
    .header-menu-content {
        display: flex;
        /* changed from none to flex to allow transition */
        visibility: hidden;
        pointer-events: none;
        position: absolute;
        top: 60px;
        /* Header height offset */
        left: 0;
        width: 100%;
        height: calc(100dvh - 60px);
        flex-direction: column;
        align-items: flex-start;
        padding: 32px;
        box-sizing: border-box;
        overflow-y: auto;
        /* Allow scrolling if content is tall */
        opacity: 0;
        transform: translateY(20px);
        /* Fast close */
    }

    /* Open State Container */
    .site-header.menu-open {
        height: 100dvh;
        /* Full screen height */
        background: #000000;
        transition: height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
        overflow: hidden;
        border-radius: 0;
        /* Remove radius for full screen */
    }

    .site-header.menu-open .header-menu-content {
        visibility: visible;
        pointer-events: auto;
        opacity: 1;
        transform: translateY(0);
        transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
        transition-delay: 0.1s;
    }

    .main-navigation li {
        width: 100%;
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .site-header.menu-open .main-navigation li {
        opacity: 0;
        transform: translateY(20px);
        animation: appleReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    .site-header.menu-open .main-navigation li:nth-child(1) {
        animation-delay: 0.1s;
    }

    .site-header.menu-open .main-navigation li:nth-child(2) {
        animation-delay: 0.15s;
    }

    .site-header.menu-open .main-navigation li:nth-child(3) {
        animation-delay: 0.2s;
    }

    .site-header.menu-open .main-navigation li:nth-child(4) {
        animation-delay: 0.25s;
    }

    .site-header.menu-open .main-navigation li:nth-child(5) {
        animation-delay: 0.3s;
    }

    .site-header.menu-open .header-actions {
        opacity: 0;
        transform: translateY(20px);
        animation: appleReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        animation-delay: 0.4s;
    }



    /* Open State Toggle Animation */
    .site-header.menu-open .mobile-toggle .line:nth-child(1) {
        transform: translateY(4px) rotate(45deg);
    }

    .site-header.menu-open .mobile-toggle .line:nth-child(2) {
        transform: translateY(-4px) rotate(-45deg);
    }

    /* Mobile Navigation Links */
    .site-header.menu-open .main-navigation {
        position: static;
        transform: none;
        width: 100%;
        display: block;
    }

    .site-header.menu-open .main-navigation ul {
        flex-direction: column;
        align-items: flex-start;
        gap: 24px;
        width: 100%;
    }

    .site-header.menu-open .main-navigation a {
        /* Override desktop styles with mobile title styles */
        color: var(--color-text-primary);
        padding-bottom: 0;
        display: block;
        width: 100%;
        /* Typography via .text-mobile-title (.text-desktop-subtitle) */
        letter-spacing: -0.02em;
    }

    .site-header.menu-open .main-navigation a::after {
        display: none;
        /* No underline animation on mobile */
    }

    /* Mobile Actions Positioned at Bottom */
    .site-header.menu-open .header-actions {
        margin-top: auto;
        /* Push to bottom */
        width: 100%;
        flex-direction: column;
        /* Stack lang and user */
        align-items: flex-start;
        justify-content: flex-start;
        padding-top: 24px;
        border-top: 1px solid var(--color-border-white-10);
        gap: 24px;
    }


    /* Mobile Language Section */
    .mobile-lang-section {
        display: block;
        width: 100%;
    }

    .mobile-lang-list {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .mobile-lang-list a {
        text-decoration: none;
        color: var(--color-text-tertiary);
        display: block;
        transition: color 0.2s;
    }

    .mobile-lang-list a.active {
        color: var(--color-text-primary);
        color: var(--color-primary-accent);
    }

    /* User Icon on Mobile */
    .site-header.menu-open .header-user {
        margin-top: 16px;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 24px 32px;
    }
}