/* Navbar Visibility Control */
.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

/* Prevent body scroll when mobile menu is open - mobile only */
@media (max-width: 768px) {
    body.menu-open {
        overflow: hidden !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 100vh !important;
    }
}

@media (max-width: 1024px) {
    .desktop-only {
        display: none;
    }
    
    .mobile-only {
        display: block;
    }
}

/* Mobile Navigation Bar - restored to original structure */
.navbar-mobile {
    font-family: var(--global-primary-font-family), sans-serif;
    overflow: visible;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 20;
    background-image: linear-gradient(to bottom, rgba(1,1,1,0.47), rgba(1,1,1,0.17), rgba(1,1,1,0));
    height: 90px;
    display: flex;
    justify-content: space-between;
    transition: all .2s linear;
    padding-top: 2rem;
}

.navbar-mobile .total-container {
    max-width: 1500px;
    width: 90%;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    margin-left: 5%;
    height: fit-content;
}

.navbar-mobile .logo-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding-left: 2%;
    min-height: 90px;
    max-width: 98%;
}

.navbar-mobile .logo-container a {
    height: 100%;
}

.navbar-mobile .logo-spacer {
    flex-grow: 0;
    flex-shrink: 0;
}

.navbar-mobile .logo-image {
    top: 1%;
    height: 80%;
    left: 2%;
    max-width: 100%;
    z-index: 21;
    padding-left: 0%;
    pointer-events: none;
    align-self: center;
    position: relative;
}

.navbar-mobile .navbar-item-menu {
    display: flex;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255,0.2);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.navbar-mobile .navbar-item-menu img {
    width: 50%;
    height: 50%;
    opacity: 0.6;
    filter: invert(1);
}

/* Full Screen Mobile Menu Modal */
.mobile-menu-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    /* Use dynamic viewport height for iOS Safari compatibility */
    height: 100dvh;
    background: #2a2a2a;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
}

.mobile-menu-modal.active {
    transform: translateX(0);
}

/* Fixed header background for logo and close button */
.mobile-menu-modal::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: #2a2a2a;
    z-index: 2000;
}

/* Logo in top left of modal */
.mobile-menu-logo {
    position: absolute;
    top: 40px;
    left: 40px;
    z-index: 2001;
}

.mobile-menu-logo img {
    height: 40px;
    max-width: 120px;
}

/* Close button */
.mobile-menu-close {
    position: absolute;
    top: 40px;
    right: 40px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2001;
}

.mobile-menu-close img {
    width: 20px;
    height: 20px;
    /* Using green SVG directly - no filter needed */
}

/* Menu items */
.mobile-menu-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 120px 40px 65px;
    overflow-y: auto;
    min-height: 0;
    position: relative;
}

/* Fade gradient overlay near social icons */
.mobile-menu-items::after {
    content: '';
    position: fixed;
    bottom: 65px;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, transparent, #2a2a2a);
    pointer-events: none;
    z-index: 2000;
}

.mobile-menu-item {
    display: block;
    text-decoration: none;
    color: #b0b0b0; /* Light gray instead of pure white */
}

.mobile-menu-item span {
    font-size: 24px;
    font-weight: 300;
    display: block;
    padding: 10px 0;
}

/* Expandable menu item with caret */
.mobile-menu-item-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.mobile-menu-caret {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
    position: relative;
}

.mobile-menu-caret::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid white;
}

/* Expanded menu styling - simplified */
.mobile-menu-expandable.expanded .mobile-menu-caret {
    transform: rotate(180deg);
}

/* Black background for ANY expanded section from line to line */
.mobile-menu-section-expandable.expanded {
    position: relative;
    z-index: 10; /* Ensure this is above the lines */
}

.mobile-menu-section-expandable.expanded::before {
    content: '';
    position: absolute;
    top: -15px; /* Extend to cover the line above */
    left: 50%;
    transform: translateX(-50%);
    width: 100vw; /* Full viewport width */
    bottom: -15px; /* Extend to cover the line below */
    background-color: black;
    z-index: 1; /* Overlay the lines */
}

/* Ensure menu content stays above the background for ALL expandable sections */
.mobile-menu-section-expandable.expanded .mobile-menu-item {
    position: relative;
    z-index: 2;
    color: white; /* White text on black background */
}

.mobile-menu-section-expandable.expanded .mobile-menu-subitems {
    position: relative;
    z-index: 2;
    color: white; /* White text for subitems too */
}

/* Ensure all text elements are white when expanded */
.mobile-menu-section-expandable.expanded .mobile-menu-item span,
.mobile-menu-section-expandable.expanded .mobile-menu-subitem span {
    color: white;
}

/* Make sure links inherit the white color */
.mobile-menu-section-expandable.expanded .mobile-menu-subitem {
    color: white;
}

/* Subitems */
.mobile-menu-subitems {
    max-height: 0;
    padding-top: 10px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-menu-expandable.expanded .mobile-menu-subitems {
    max-height: 200px;
}

.mobile-menu-subitem {
    text-decoration: none;
    color: inherit;
}

.mobile-menu-subitem:visited,
.mobile-menu-subitem:hover,
.mobile-menu-subitem:focus,
.mobile-menu-subitem:active {
    text-decoration: none;
    color: inherit;
}

.mobile-menu-subitem span {
    font-size: 20px;
    font-weight: 300;
    padding: 4px 0; /* Reduced from 2px to 1px */
    opacity: 0.8;
}

.mobile-menu-line {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
    margin: 10px 0;
}

.mobile-menu-item-last span {
    padding: 10px 0;
}

/* Social icons at bottom */
.mobile-menu-socials {
    position: fixed;
    bottom: 0;
    /* Add safe area inset for iOS devices with home indicator */
    bottom: env(safe-area-inset-bottom, 0);
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 15px 20px;
    /* Add extra padding for safe area */
    padding-bottom: calc(15px + env(safe-area-inset-bottom, 0));
    background: #2a2a2a;
    z-index: 2001;
}

.mobile-menu-socials a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.mobile-menu-socials img {
    width: 18px;
    height: 18px;
}

/* Clean separation between mobile and desktop navigation */

/* Hide desktop navbar below 1025px - mobile nav owns everything below 1025px */
@media (max-width: 1024px) {
    .navbar:not(.navbar-mobile) {
        display: none !important;
    }
}

/* Hide mobile navigation at 1025px and above - desktop nav takes over */
@media (min-width: 1025px) {
    .navbar-mobile,
    .mobile-menu-modal,
    #mobile-menu-modal,
    .mobile-menu-socials {
        display: none !important;
    }
}
