/* Navbar – layout, spacing, and mobile */

/* Logo and brand (navbar context) */
.navbar-area .logo {
    opacity: 1;
    mix-blend-mode: normal;
    width: auto;
    height: 33px;
    max-width: 140px;
    margin: 0;
    display: block;
    overflow: clip;
    object-fit: contain;
}

.navbar-area .brand {
    display: flex;
    align-items: center;
    line-height: 0;
}

.brand-logo,
.logo-wrap {
    display: flex;
    align-items: center;
}

.header-section {
    z-index: 19;
    background-color: transparent;
    width: 100%;
    padding-left: 15px;
    padding-right: 15px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding-top: 16px;
}

.header-container {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    width: 100%;
    max-width: 1164px;
    margin-left: auto;
    margin-right: auto;
    padding: 20px;
    transition: all 0.4s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
}

.header-container.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.navbar-area {
    background-color: transparent;
    position: relative;
    z-index: 20;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* Spacing fix: use gap instead of space-between for even spacing between logo, links, and buttons */
.nav-bar-wrapper {
    color: var(--color-brand--secondary);
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.brand-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.nav-menu-items {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex: 1;
    justify-content: center;
}

.navbar-dropdown {
    color: var(--color-brand--secondary);
    font-size: 16px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    transition: color 0.3s;
    display: inline-flex;
    align-items: center;
    padding: 0;
}

.navbar-dropdown:hover {
    color: var(--color-brand--primary);
}

.navbar-button-wrapper {
    color: var(--color-brand--secondary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    margin-left: auto;
}

/* Hamburger – hidden on desktop */
.menu-button {
    display: none;
}

/* Mobile menu – hidden on desktop */
.mobile-menu {
    display: none;
}

.mobile-menu-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mobile-menu-item {
    color: var(--color-brand--secondary);
    font-weight: 500;
    line-height: 1.33em;
    text-decoration: none;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: color 0.3s;
}

.mobile-menu-item:hover {
    color: var(--color-brand--primary);
}

.mobile-menu-item:last-of-type {
    border-bottom: none;
}

.mobile-menu-button {
    margin-top: 8px;
    text-align: center;
    width: 100%;
    justify-content: center;
}

/* Tablet and down – show hamburger, hide nav links */
@media screen and (max-width: 991px) {
    .nav-bar-wrapper {
        gap: 1rem;
    }

    .header-container {
        padding: 16px;
    }

    .nav-menu-items {
        display: none;
    }

    .menu-button {
        display: flex;
        background-color: transparent;
        border: none;
        cursor: pointer;
        text-align: center;
        border-radius: 8px;
        justify-content: center;
        align-items: center;
        width: 50px;
        height: 50px;
        padding: 0;
        flex-direction: column;
        gap: 5px;
        position: relative;
        z-index: 1001;
        transition: background-color 0.3s;
        pointer-events: auto;
        -webkit-tap-highlight-color: rgba(103, 80, 164, 0.1);
    }

    .menu-button:hover {
        background-color: rgba(103, 80, 164, 0.1);
    }

    .menu-button[aria-expanded="true"] {
        background-color: rgba(103, 80, 164, 0.1);
    }

    .menu-icon {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 24px;
        height: 18px;
        position: relative;
        gap: 5px;
    }

    .menu-icon span {
        display: block;
        width: 24px;
        height: 2px;
        background-color: var(--color-brand--secondary);
        border-radius: 2px;
        transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        transform-origin: center;
    }

    .menu-button[aria-expanded="true"] .menu-icon span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .menu-button[aria-expanded="true"] .menu-icon span:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }

    .menu-button[aria-expanded="true"] .menu-icon span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .navbar-button-wrapper {
        gap: 0.75rem;
        margin-left: auto;
    }

    .mobile-menu {
        display: block;
        width: 100%;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, visibility 0.3s ease;
        background-color: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-radius: 12px;
        margin-top: 0;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        position: relative;
        z-index: 1000;
    }

    .mobile-menu.active {
        max-height: 600px;
        opacity: 1;
        visibility: visible;
        margin-top: 16px;
    }
}

@media screen and (max-width: 767px) {
    .nav-bar-wrapper {
        gap: 0.75rem;
    }

    .header-container {
        padding: 14px;
    }

    .header-button:not(:last-child) {
        display: none;
    }

    .menu-button {
        display: flex;
    }
}

@media screen and (max-width: 479px) {
    .navbar-area {
        width: 100%;
    }

    .header-container {
        padding: 12px;
    }

    .header-section {
        padding-top: 12px;
    }

    .nav-bar-wrapper {
        gap: 0.75rem;
    }
}

/* Wider screens – allow logo to grow */
@media screen and (min-width: 1280px) {
    .navbar-area .logo {
        max-width: 100%;
    }
}
