/* --- Navigation & Global Nav Container --- */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    padding: 24px 16px 0 16px;
    transition: all 0.3s ease;
}

@media (min-width: 1024px) {
    #main-nav {
        padding-left: 24px;
        padding-right: 24px;
    }
}

/* --- The Navbar Pill Shape & Glass Effect --- */
.nav-container {
    max-width: 80rem; 
    margin-left: auto;
    margin-right: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px; 
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    border-radius: 9999px; 
}

@media (min-width: 1024px) {
    .nav-container {
        padding-left: 40px;
        padding-right: 40px; 
    }
}

/* --- Logo & Branding --- */
.logo-container {
    display: flex;
    align-items: center;
    flex-shrink: 0; /* FIX: Prevents logo from shrinking when window narrows */
    z-index: 110;
}

.logo-img {
    height: 2rem; 
    width: auto;
    transition: height 0.3s ease;
}

@media (min-width: 1024px) {
    .logo-img {
        height: 2.5rem; 
    }
}

/* --- Desktop Menu --- */
.desktop-menu {
    display: none; 
    gap: 24px; 
    align-items: center;
}

@media (min-width: 1024px) {
    .desktop-menu {
        display: flex; 
    }
}

.desktop-menu .nav-link {
    position: relative;
    color: #1e293b;
    font-weight: 400;
    text-decoration: none;
    padding: 4px 0;
    transition: color 0.3s;
    white-space: nowrap; /* FIX: Prevents text links from wrapping */
}

.desktop-menu .nav-link::after {
    content: '';
    position: absolute;
    width: 0; 
    height: 2px;
    bottom: 0; 
    left: 0;
    background: #0d9488;
    transition: width 0.3s ease;
}

.desktop-menu .nav-link:hover { 
    color: #0d9488; 
}

.desktop-menu .nav-link:hover::after { 
    width: 100%; 
}

/* --- Mobile Toggle Button --- */
#menu-open {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    color: #1e293b;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.3s;
    flex-shrink: 0;
}

@media (min-width: 1024px) {
    #menu-open {
        display: none; 
    }
}

#menu-open:hover {
    color: #0d9488;
}

/* --- Mobile Menu & Overlay (FIXED STATES) --- */
#menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 115;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    width: 80%;
    max-width: 320px;
    background-color: #ffffff;
    z-index: 120;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 25px rgba(0,0,0,0.1);
    transform: translateX(100%); /* FIX: Starts off-screen to stop the flash */
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* THE MAGIC: These only apply when JS adds the class to the body */
body.mobile-menu-active #menu-overlay {
    opacity: 1;
    pointer-events: auto;
}

body.mobile-menu-active #mobile-menu {
    transform: translateX(0%);
}

body.mobile-menu-active {
    overflow: hidden; /* Stop page scrolling when menu is open */
}

/* --- Mobile Menu Styling --- */
.mobile-links {
    display: flex;
    flex-direction: column;
    padding: 16px 32px; 
    gap: 16px; 
    overflow-y: auto;
}

.mobile-nav-link {
    display: block;
    color: #1e293b;
    font-size: 1.1rem; 
    font-weight: 600;
    text-align: left;
    padding: 12px 0;
    text-decoration: none;
    width: 100%;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.3s ease;
}

.mobile-nav-link:hover {
    color: #0d9488;
    padding-left: 8px;
}

.mobile-close-container {
    display: flex;
    justify-content: flex-end;
    padding: 24px;
}

#menu-close {
    padding: 12px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#menu-close:hover {
    color: #ef4444; 
    background: #fee2e2;
}

/* --- WordPress Admin Bar Compatibility --- */
.admin-bar #main-nav { 
    top: 32px; 
}
@media screen and (max-width: 782px) {
    .admin-bar #main-nav { 
        top: 46px; 
    }
}