header {
    position: fixed;
    width: 100%;
    z-index: 1000;
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.8s ease;
    background: black;
    padding-bottom: 50px;
}

/* Black overlay to hide content when scrolling up */
header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 90px;
    background: black;
    z-index: -1;
}

header.slide-in {
    transform: translateY(0);
    opacity: 1;
}

nav {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 15px;
    width: 100%;
}

.nav-container {
    border: 1px solid white;
    border-radius: 20px;
    backdrop-filter: blur(15px);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.desktop {
    display: flex;
    list-style: none;
    align-items: center;
    padding: 0;
    margin: 8px;
    justify-content: center;
    gap: 25px;
}

.desktop li.desktop-logo img {
    display: flex;
    width: 50px;
    height: 50px;
    cursor: pointer;
}

.desktop li.desktop-logo:hover img {
    transform: scale(1.05) translateY(-1px);
}

.desktop li a {
    text-decoration: none;
    color: white;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    cursor: pointer;
}

.desktop li a:hover {
    color: rgba(49, 209, 88, 0.95);
}

.desktop li a.active-tab {
    color: rgba(49, 209, 88, 0.95);
}

.desktop li a:hover::before {
    left: 100%;
}

.mobile {
    display: none;
}

@media (max-width: 768px) {

    header {
        padding-bottom: 4vw !important;
    }


    header::before {
        height: 90px;
    }

    .nav-container {
        background: none;
        display: flex;
        width: 100%;
        border: none;
    }

    .desktop {
        display: none;
    }

    .mobile {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        justify-self: center;
        padding: 0 4vw;
        width: 100%;
        gap: 5px;
        /* Small gap between grid items */
    }

    .mobile-logo {
        display: flex;
        align-items: center;
        justify-content: flex-start;
    }

    .mobile-logo img {
        width: 17vw;
        height: auto;
        transition: transform 0.3s ease;
    }

    .mobile-logo:active img {
        transform: scale(0.95);
    }

    .mobile-section-title {
        display: flex;
        align-items: center;
        justify-items: center;
        text-align: center;
        padding-left: 10px;
        padding-right: 10px;
        min-width: 0;
        /* Allow shrinking */
        flex-shrink: 1;
        /* Allow shrinking if needed */
    }

    .mobile-section-title h2 {
        font-size: 5.5vw;
        font-family: 'Montserrat', sans-serif;
        font-weight: 600;
        color: white;
        white-space: nowrap;
    }

    .mobile-title-part1 {
        font-family: 'Roboto', sans-serif;
        transition: all 0.3s ease;
        font-weight: 400;
        display: inline;
    }

    .mobile-title-part2 {
        font-family: 'Montserrat', sans-serif;
        color: rgba(49, 209, 88, 0.95);
        font-weight: 500;
        transition: all 0.3s ease;
        display: inline;
    }

    /* Mobile Navigation Arrows */
    .mobile-nav-arrows {
        position: relative;
        z-index: 1001;
        display: flex;
        justify-content: flex-end;
        gap: 0;
        width: auto;
        height: 60px;
        align-items: center;
    }

    .mobile-nav-arrow {
        position: relative;
        z-index: 1001;
        display: flex;
        cursor: pointer;
        transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.3s ease;
        opacity: 1;
        visibility: visible;
        align-items: center;
    }

    .mobile-nav-arrow.hidden {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        width: 0 !important;
        min-width: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden;
        transition: opacity 0.15s ease, visibility 0.15s ease, width 0.15s ease;
    }

    .mobile-nav-arrow {
        /* Minimal hardware acceleration only when needed */
        will-change: auto;
    }

    .mobile-nav-arrow i {
        color: white;
        font-size: 1.5rem;
        transition: color 0.15s ease-out, opacity 0.15s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        width: auto;
        height: auto;
        padding: 0;
        margin: 0;
        pointer-events: none;
        /* Only use hardware acceleration during transitions */
        will-change: color;
    }

    .mobile-nav-arrow:hover i {
        opacity: 1;
        color: white;
        /* Keep white on hover for mobile */
    }

    .mobile-nav-arrow:active i {
        color: rgba(49, 209, 88, 0.95) !important;
        transition: color 0.08s ease-out !important;
        /* Very fast transition to green when pressing */
    }

    /* Force immediate return to white on any non-active state */
    .mobile-nav-arrow:not(:active):not(.touching) i {
        color: white !important;
        transition: color 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    /* Immediate reset class for section changes */
    .mobile-nav-arrow.reset-color i,
    .mobile-nav-arrow.force-white i {
        color: white !important;
        transition: none !important;
    }

    /* Additional reset on touchend/touchcancel */
    .mobile-nav-arrow.touch-ended i {
        color: white !important;
        transition: color 0.2s ease-out !important;
    }

    /* Debug touch areas - can be removed in production */
    .mobile-nav-arrow.prev {
        flex-grow: 2;
        width: 100%;
        justify-content: flex-end;
        padding-left: 0;
    }

    .mobile-nav-arrow.next {
        width: 30%;
        justify-content: flex-end;
        padding-left: 0;
        padding-right: 4vw;
    }

    /* Expand button area when only one button exists */
    .mobile-nav-arrow:only-child {
        flex-grow: 1;
        width: 100%;
        justify-content: center;
        padding-left: 0;
    }

    /* Specific positioning for single buttons */
    .mobile-nav-arrow.next:only-child {
        justify-content: flex-end;
        padding-right: 4vw;
    }

    .mobile-nav-arrow.prev:only-child {
        justify-content: flex-start;
        padding-left: 4vw;
    }

    /* Expand button area when the other button is hidden (fallback) */
    .mobile-nav-arrows:has(.mobile-nav-arrow.prev.hidden) {
        justify-content: stretch;
    }

    .mobile-nav-arrows:has(.mobile-nav-arrow.prev.hidden) .mobile-nav-arrow.next {
        flex-grow: 1;
        width: 100%;
        justify-content: flex-end;
        padding-left: 0;
        padding-right: 4vw;
    }

    .mobile-nav-arrows:has(.mobile-nav-arrow.next.hidden) {
        justify-content: stretch;
    }

    .mobile-nav-arrows:has(.mobile-nav-arrow.next.hidden) .mobile-nav-arrow.prev {
        flex-grow: 1;
        width: 100%;
        justify-content: flex-end;
        padding-right: 4vw;
    }
}

/* Small screens - reduce button size to preserve title space, keep title font unchanged */
@media (max-width: 480px) {
    .mobile-nav-arrows {
        height: 50px;
        gap: 0;
    }

    .mobile-nav-arrow i {
        font-size: 1.3rem;
    }

    /* Single button handling for small screens */
    .mobile-nav-arrow.next:only-child {
        padding-right: 4vw;
    }

    .mobile-nav-arrow.prev:only-child {
        padding-left: 4vw;
    }

    /* Expand button area when the other button is hidden - small screens (fallback) */
    .mobile-nav-arrows:has(.mobile-nav-arrow.prev.hidden) .mobile-nav-arrow.next {
        flex-grow: 1;
        width: 100%;
        padding-right: 4vw;
    }

    .mobile-nav-arrows:has(.mobile-nav-arrow.next.hidden) .mobile-nav-arrow.prev {
        flex-grow: 1;
        width: 100%;
        padding-left: 4vw;
    }
}

/* Very small screens - further reduce button size, title stays same */
@media (max-width: 400px) {
    .mobile-nav-arrows {
        margin-right: 3vw;
        height: 45px;
        gap: 0;
    }

    .mobile-nav-arrow i {
        font-size: 1.1rem;
    }

    .mobile-nav-arrow.prev:only-child {
        padding-left: 3vw;
    }

    /* Expand button area when the other button is hidden - very small screens (fallback) */
    .mobile-nav-arrows:has(.mobile-nav-arrow.prev.hidden) .mobile-nav-arrow.next {
        flex-grow: 1;
        width: 100%;
        padding-right: 3vw;
    }

    .mobile-nav-arrows:has(.mobile-nav-arrow.next.hidden) .mobile-nav-arrow.prev {
        flex-grow: 1;
        width: 100%;
        padding-left: 3vw;
    }
}

/* Extra small screens - minimal button size, title unchanged */
@media (max-width: 360px) {
    .mobile-nav-arrows {
        margin-right: 2vw;
        height: 40px;
        gap: 0;
    }

    .mobile-nav-arrow i {
        font-size: 1rem;
    }

    /* Single button handling for extra small screens */
    .mobile-nav-arrow.next:only-child {
        padding-right: 2vw;
    }

    .mobile-nav-arrow.prev:only-child {
        padding-left: 2vw;
    }

    /* Expand button area when the other button is hidden - extra small screens (fallback) */
    .mobile-nav-arrows:has(.mobile-nav-arrow.prev.hidden) .mobile-nav-arrow.next {
        flex-grow: 1;
        width: 100%;
        padding-right: 2vw;
    }

    .mobile-nav-arrows:has(.mobile-nav-arrow.next.hidden) .mobile-nav-arrow.prev {
        flex-grow: 1;
        width: 100%;
        padding-left: 2vw;
    }
}