.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(135deg, rgba(15, 70, 85, 0.97) 0%, rgba(11, 85, 85, 0.97) 50%, rgba(20, 65, 75, 0.97) 100%);
    backdrop-filter: saturate(1.8) blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

#menu-toggle {
    display: block;
    background-color: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

#menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#menu-toggle:active {
    transform: scale(0.95);
}

#menu-toggle svg {
    width: 2rem;
    height: 2rem;
    display: block;
}

#menu-toggle path {
    stroke: var(--text-primary-light);
    stroke-width: 2px;
    transition: stroke 0.2s ease;
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo-container img {
    width: 7rem;
    transition: transform 0.3s ease;
}

.logo-container img:hover {
    transform: scale(1.05);
}

.nav-list {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-direction: column;
    width: calc(100% - 2rem);
    max-width: 400px;
    /* Hidden state: do not overlay the logo or capture taps */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-1rem);

    position: absolute;
    top: calc(100% + 0.5rem);
    right: 1rem;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: saturate(1.8) blur(20px);
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
    overflow: hidden;
}

.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0s;
}

.nav-list-item {
    list-style: none;
    font-size: 1rem;
    width: 100%;
    text-align: center;
    font-weight: 600;
}

.nav-list-item:not(:last-child) {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.nav-list-item_link {
    display: block;
    text-decoration: none;
    color: #1a1a1a;
    width: 100%;
    padding: 1.25rem 1.5rem;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    position: relative;
}

.nav-list-item_link:hover {
    background-color: rgba(11, 85, 85, 0.1);
    color: var(--bg-primary-1);
    transform: translateX(0.25rem);
}

.nav-list-item_link:active {
    background-color: rgba(11, 85, 85, 0.15);
    color: var(--bg-primary-1);
}

.button-group {
    display: flex;
    justify-content: center;
    align-items: center;
}

#lang-button {
    border-right: none;
}

@media screen and (min-width: 1080px) {
    .container {
        position: relative;
    }

    .navbar {
        height: 7rem;
        padding: 1rem 5rem;
    }

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

    .logo-container img {
        width: 9rem;
    }

    .nav-items-container {
        display: block;
        /* width: min-content; */
    }

    .nav-list {
        all: unset;
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: stretch;
        gap: 2rem;
        position: unset;
        background-color: unset;
        flex-grow: 1;
    }

    .nav-list-item {
        display: flex;
        justify-content: center;
        align-items: center;
        height: auto;
        width: auto;
        border: none;
    }

    .nav-list-item_link,
    .list-item-link {
        display: inline-block;
        text-align: center;
        cursor: pointer;
        padding: 0.75rem 1.25rem;
        color: var(--text-primary-light);
        font-weight: 600;
        text-decoration: none;
        border-radius: 0.5rem;
        transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
        position: relative;
    }

    .nav-list-item_link:hover,
    .list-item-link:hover {
        background-color: rgba(255, 255, 255, 0.15);
        color: var(--text-primary-light);
        transform: translateY(-1px);
    }

    .nav-list-item_link:active,
    .list-item-link:active {
        transform: translateY(0);
        background-color: rgba(255, 255, 255, 0.1);
    }

    #menu-toggle {
        display: none;
    }

    .link-image {
        max-width: 100%;
        max-height: 100%;
    }
}
/** Mobile-friendly tweaks for navbar button group **/
.button-group {
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Ensure consistent clickable area for mixed markup inside button-group */
.button-group .button,
.button-group button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px; /* accessible tap target */
    padding: 0.5rem 0.9rem;
    white-space: nowrap;
}
.button-group .button a {
    display: inline-block;
    color: inherit;
    /* Mirror padding when <a> is nested inside a .button wrapper */
    padding: 0.5rem 0.9rem;
}

@media screen and (max-width: 600px) {
    .navbar {
        flex-wrap: wrap;
        row-gap: 0.5rem;
    }
    .button-group {
        width: 100%;
        justify-content: center;
        margin-top: 0.25rem;
    }
    .logo-container img {
        width: 6.5rem;
    }
    #menu-toggle svg {
        width: 2.1rem;
    }
}

@media screen and (max-width: 360px) {
    .button-group {
        justify-content: space-between;
    }
}


/* Modernized navbar button-group look and accessibility (scoped to navbar) */
.button-group .button,
.button-group button {
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: saturate(1.2) blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    font-weight: 600;
    color: var(--text-primary-light);
}

/* Ensure nested link fills the hit area and inherits styles */
.button-group .button a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Hover/active/focus-visible states (accessible) */
.button-group .button:hover,
.button-group button:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.button-group .button:active,
.button-group button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.button-group .button:focus-visible,
.button-group button:focus-visible {
    outline: 2px solid var(--text-primary-light);
    outline-offset: 2px;
}

/* Compact grid behavior on small screens: two columns, then full-width */
@media screen and (max-width: 480px) {
    .button-group {
        row-gap: .5rem;
    }
    .button-group .button,
    .button-group button {
        flex: 1 1 45%;
    }
}

@media screen and (max-width: 340px) {
    .button-group .button,
    .button-group button {
        flex: 1 1 100%;
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .button-group .button,
    .button-group button {
        transition: none;
    }
}


/* Ensure logo always sits above any accidental overlays */
.logo-container {
    position: relative;
    z-index: 2;
}
