#header {
    --background-color: var(--header-background-color);
    --item-color: #ffffff;
    --shadow-color: rgba(130, 130, 130);
    --box-shadow: 0 0 10px 0 var(--shadow-color);

    --item-border: 1px solid rgba(130, 130, 130, 0.12);

    --mobile-active-item-color: #2b4670;
    --mobile-hover-item-color: #305b9b;

    position: sticky;
    top: 0;
    background-color: var(--background-color);
    box-shadow: var(--box-shadow);
    z-index: 1000;
    width: 100%;
    display: flex;
    align-items: center;
}

#header .container {
    max-width: var(--max-content-width);
    min-height: 100px;
    width: 100%;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

/* Schrink header height on scroll */
#header .container.shrink {
    min-height: 80px;
}

#header .logo {
    display: flex;
    justify-content: center;
    transition: opacity 0.3s ease;
    opacity: 0.9;
    text-decoration: none;
}

#header .logo:hover {
    opacity: 1;
}

#header .logo-text {
    color: var(--header-active-item-color);
    font-family: 'TeXGyreChorus';
    font-weight: 500;
    font-style: italic;
    letter-spacing: 0px;
    text-wrap: nowrap;
    transition: color 0.3s ease, font-size 0.3s ease;
    font-size: clamp(20px, (100vw - 134.5px) * 0.0928, 46px);
    margin-bottom: 10px;
}

#header .logo:hover .logo-text {
    color: #ffe77a;
}

#header .nav-link {
    color: var(--item-color);
    text-decoration: none;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.3s ease;
    font-size: 16px;
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
}

#header .nav-link:hover {
    color: var(--header-hover-item-color) !important;
}

#header .nav-link.active {
    color: var(--header-active-item-color);
}

#header .nav-container {
    width: inherit;
    display: flex;
    align-items: center;
    flex-direction: row;
    justify-content: end;
}

/* Desktop styles */
@media (min-width: 1200.5px) {
    #header .menu-toggle {
        display: none;
    }

    #header .nav {
        display: flex;
    }

    #header .nav-list {
        display: flex;
        gap: 1rem;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    #header .controls-mobile {
        display: none;
    }

    #header .nav-container .language-toggle {
        margin-left: 1.5rem;
    }
}

/* Language selector styles */
#header .language-selector {
    position: relative;
}

#header .language-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--item-color);
    box-sizing: content-box;
}

#header .current-language {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#header .flag-icon {
    width: 24px;
    height: 16px;
    object-fit: cover;
    border: 1px solid #223a5e;
}

#header .language-code {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 15px;
}

#header .language-dropdown {
    position: absolute;
    top: -200px;
    right: 0;
    background-color: var(--background-color);
    border-radius: 3px;
    box-shadow: var(--box-shadow);
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    display: block;
    opacity: 0;
    min-width: 85px;
    z-index: 1002;
    transition: opacity 0.3s ease;
}

#header .language-selector .language-dropdown.active {
    opacity: 1;
    top: 130%;
}

#header .language-option {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--item-color);
    text-align: left;
    transition: background-color 0.3s ease;
}

#header .language-option:hover {
    background-color: var(--item-color);
    color: var(--background-color);
}

#header .current-language .language-code {
    margin-top: 3px;
    transition: color 0.3s ease;
}

#header .current-language:hover .language-code {
    color: var(--header-hover-item-color);
}

#header .current-language .flag-icon {
    transition: opacity 0.3s ease;
}

#header .current-language:hover .flag-icon {
    opacity: 0.8;
}

@media (min-width: 1000px) {
    #header .nav-link {
        font-size: 20px;
    }
}

/* Mobile styles */
@media (max-width: 1200px) {
    #header .container {
        flex-direction: column;
        padding: 0;
        max-width: unset;
    }

    #header .logo-and-menu-toggle-container {
        padding: 0 30px;
        min-height: inherit;
        width: 100%;
        box-sizing: border-box;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    #header .controls-mobile {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    #header .nav-container .language-selector {
        display: none;
    }

    #header .menu-toggle {
        display: flex;
        justify-content: center;
        align-items: center;
        background: none;
        border: none;
        cursor: pointer;
        margin: 0.5rem;
        padding: 0.1rem;
        border-radius: 50%;
        z-index: 1001;
        position: relative;
        transition: background-color 0.1s ease, opacity 0.1s ease;
    }

    #header.menu-toggle:active {
        opacity: 1;
    }

    #header .menu-toggle:hover {
        opacity: 0.7;
    }

    #header .menu-icon {
        width: 24px;
        height: 24px;
        fill: var(--item-color);
        transition: fill 0.2s ease;
    }

    #header .menu-toggle:hover .menu-icon {
        fill: var(--header-hover-item-color);
    }

    #header .menu-toggle:active .menu-icon {
        fill: var(--header-active-item-color);
    }

    #header .nav {
        display: flex;
        z-index: 1000;
        /* Borders below the nav and below the menu */
        width: 100%;
        background-color: var(--background-color);
        height: 0px;
        width: 100%;
        overflow: hidden;
        transition: padding 0.3s ease, height 0.3s ease;
        box-shadow: none;
    }

    #header .nav.active {
        /* depand on the number of items in the nav number of items * item height (60px) */
        height: 360px;
        /* depend on the max height of the top nav (100px)*/
        max-height: calc(90vh - 100px);
    }

    #header .nav-list {
        display: flex;
        flex-direction: column;
        list-style: none;
        margin: 0;
        padding: 0;
        width: 100%;
    }

    #header .nav-list li {
        height: 60px;
        box-sizing: border-box;
    }

    #header .nav-list .nav-link {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        height: 100%;
        align-content: center;
        padding: 0 30px;
        margin: 0;
        box-sizing: border-box;
        transition: background-color 0.3s ease;
        border-bottom: var(--item-border);
    }

    #header .nav-list .nav-link:first-child {
        border-top: var(--item-border);
    }

    #header .nav-list .nav-link.active {
        color: var(--item-color);
        background-color: var(--mobile-active-item-color);
    }

    #header .nav-list .nav-link:hover {
        color: var(--item-color) !important;
        background-color: var(--mobile-hover-item-color);
    }
}
