.app-header {
    position: fixed;
    top: 15px;
    left: 0;

    width: 100%;
    height: var(--header-height);

    margin-top: 0;

    z-index: 999;
}

.app-header-container {
    position: relative;

    height: 100%;
    width: var(--header-width);
    max-width: var(--header-max-width);
    min-width: var(--header-min-width);

    margin: auto;

    border-radius: var(--header-radius);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 18px;
    box-sizing: border-box;
}

.app-header-container-part {
    height: 100%;
    min-width: 0;
}

.app-header-container-part.right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;

    flex: 0 0 auto;
}

.app-header-container-part.right .title {
    color: #fff;

    font-weight: 700;
    font-size: 1.2rem;
    white-space: nowrap;

    display: flex;
    align-items: center;
}

.app-header-container-part.right .logo {
    width: 55px;
    height: 55px;

    flex: 0 0 auto;

    background-color: var(--color-site);

    -webkit-mask-image: url('/assets/logo.png');
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    -webkit-mask-position: center;

    mask-image: url('/assets/logo.png');
    mask-repeat: no-repeat;
    mask-size: contain;
    mask-position: center;
}

.app-header-container-part.middle {
    display: flex;
    align-items: center;
    justify-content: center;

    flex: 1 1 auto;
    min-width: 0;
}

.app-header-nav {
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--header-nav-gap);
}

.app-header-nav-item,
.app-header-mobile-nav-item {
    position: relative;

    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: center;
    gap: var(--header-nav-item-gap);

    color: var(--header-nav-item-color);
    text-decoration: none;

    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1;

    border: none;
    outline: none;
    background: transparent;
    box-shadow: none;

    cursor: pointer;

    transform: translateY(0);
    transition:
        color var(--header-nav-transition),
        transform var(--header-nav-transition);
}

.app-header-nav-item:hover,
.app-header-mobile-nav-item:hover {
    color: var(--color-site);
    transform: translateY(var(--header-nav-hover-translate));
}

.app-header-nav-item .nav-icon,
.app-header-mobile-nav-item .nav-icon {
    width: var(--header-nav-icon-size);
    height: var(--header-nav-icon-size);

    flex: 0 0 auto;

    background-color: currentColor;

    transition:
        background-color var(--header-nav-transition),
        transform var(--header-nav-transition);

    -webkit-mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    -webkit-mask-position: center;

    mask-repeat: no-repeat;
    mask-size: contain;
    mask-position: center;
}

.app-header-nav-item:hover .nav-icon,
.app-header-mobile-nav-item:hover .nav-icon {
    transform: scale(1.08);
}

.app-header-nav-item .nav-icon.home,
.app-header-mobile-nav-item .nav-icon.home {
    -webkit-mask-image: url('../assets/svg/home.svg');
    mask-image: url('../assets/svg/home.svg');
}

.app-header-nav-item .nav-icon.us,
.app-header-mobile-nav-item .nav-icon.us {
    -webkit-mask-image: url('../assets/img/us.png');
    mask-image: url('../assets/img/us.png');
}

.app-header-nav-item .nav-icon.blog,
.app-header-mobile-nav-item .nav-icon.blog {
    -webkit-mask-image: url('../assets/svg/blog.svg');
    mask-image: url('../assets/svg/blog.svg');
}

.app-header-nav-item .nav-icon.projects,
.app-header-mobile-nav-item .nav-icon.projects {
    -webkit-mask-image: url('../assets/svg/code.svg');
    mask-image: url('../assets/svg/code.svg');
}

.app-header-nav-item .nav-icon.about,
.app-header-mobile-nav-item .nav-icon.about {
    -webkit-mask-image: url('../assets/svg/user.svg');
    mask-image: url('../assets/svg/user.svg');
}

.app-header-nav-item .nav-icon.contact,
.app-header-mobile-nav-item .nav-icon.contact {
    -webkit-mask-image: url('../assets/svg/letter.svg');
    mask-image: url('../assets/svg/letter.svg');
}

.app-header-nav-item .nav-icon.gallery,
.app-header-mobile-nav-item .nav-icon.gallery {
    -webkit-mask-image: url('../assets/svg/gallery.svg');
    mask-image: url('../assets/svg/gallery.svg');
}

.app-header-nav-item .nav-icon.menu {
    -webkit-mask-image: url('../assets/svg/menu.svg');
    mask-image: url('../assets/svg/menu.svg');
}

.app-header-menu-button {
    display: none;
}

.app-header-container-part.left {
    display: flex;
    align-items: center;
    justify-content: center;

    height: 70%;
    margin: auto 0;
    border-radius: 100px;
    padding: 0 7px;

    flex: 0 0 auto;
}

.app-header-lang,
.app-header-settings {
    height: var(--header-action-size);

    border: none;
    outline: none;
    background: transparent;
    box-shadow: none;

    color: var(--header-action-color);

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
    font-family: inherit;

    transform: translateY(0);

    transition:
        color var(--header-left-transition),
        transform var(--header-left-transition);
}

.app-header-lang {
    min-width: 72px;
    gap: 7px;

    padding: 0 12px;

    font-size: 0.95rem;
    font-weight: 600;
}

.app-header-settings {
    width: var(--header-action-size);
    padding: 0;
}

.app-header-lang:hover,
.app-header-settings:hover {
    color: var(--color-site);
    transform: translateY(var(--header-left-hover-translate));
}

.app-header-lang .lang-flag {
    width: var(--header-lang-flag-size);
    height: var(--header-lang-flag-size);

    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.app-header-settings .settings-icon {
    width: var(--header-settings-icon-size);
    height: var(--header-settings-icon-size);

    background-color: currentColor;

    transition:
        background-color var(--header-left-transition),
        transform var(--header-left-transition);

    -webkit-mask-image: url('../assets/svg/settings.svg');
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    -webkit-mask-position: center;

    mask-image: url('../assets/svg/settings.svg');
    mask-repeat: no-repeat;
    mask-size: contain;
    mask-position: center;
}

.app-header-settings:hover .settings-icon {
    transform: rotate(45deg);
}

.app-header-menu-modal {
    position: absolute;
    top: calc(var(--header-height) + var(--header-modal-top-gap));
    left: 50%;

    width: var(--header-width);
    max-width: var(--header-max-width);
    min-width: var(--header-min-width);

    transform: translateX(-50%) translateY(-12px) scale(0.98);
    transform-origin: top center;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    border-radius: var(--header-modal-radius);
    overflow: hidden;

    transition:
        opacity var(--header-modal-transition),
        visibility var(--header-modal-transition),
        transform var(--header-modal-transition);

    z-index: 998;
}

.app-header-menu-modal.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transform: translateX(-50%) translateY(0) scale(1);
}

.app-header-mobile-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;

    padding: 14px;

    direction: rtl;
}

.app-header-mobile-nav-item {
    min-height: 48px;

    border-radius: 18px;

    color: #ffffff;

    background: rgba(255, 255, 255, 0.06);

    font-size: 0.92rem;

    transition:
        color var(--header-nav-transition),
        background-color var(--header-nav-transition),
        transform var(--header-nav-transition);
}

.app-header-mobile-nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 1200px) {
    :root {
        --header-width: 86%;
        --header-nav-gap: 20px;
    }

    .app-header-container {
        padding: 0 14px;
    }

    .app-header-container-part.right .title {
        font-size: 1.08rem;
    }
}

@media (max-width: 992px) {
    :root {
        --header-width: 92%;
        --header-nav-gap: 14px;
        --header-nav-icon-size: 19px;
    }

    .app-header-nav-item {
        font-size: 0.88rem;
    }

    .app-header-container-part.right {
        gap: 10px;
    }

    .app-header-container-part.right .logo {
        width: 48px;
        height: 48px;
    }

    .app-header-lang {
        min-width: 62px;
        padding: 0 8px;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 64px;
        --header-width: var(--header-mobile-width);
        --header-min-width: 0;
        --header-action-size: 38px;
        --header-nav-icon-size: 20px;
    }

    .app-header {
        top: 12px;
        height: var(--header-height);
    }

    .app-header-container {
        width: var(--header-mobile-width);
        padding: 0 10px;
    }

    .app-header-nav {
        gap: 0;
    }

    .app-header-nav > .app-header-nav-item:not(.app-header-menu-button) {
        display: none;
    }

    .app-header-menu-button {
        display: flex;
        min-width: 76px;
        height: 42px;

        border-radius: 100px;
    }

    .app-header-menu-button.is-active {
        color: var(--color-site);
    }

    .app-header-container-part.middle {
        flex: 0 0 auto;
        order: 2;
    }

    .app-header-container-part.right {
        order: 3;
        gap: 8px;
    }

    .app-header-container-part.left {
        order: 1;
        height: 68%;
        padding: 0 5px;
    }

    .app-header-container-part.right .title {
        font-size: 0.98rem;
    }

    .app-header-container-part.right .logo {
        width: 42px;
        height: 42px;
    }

    .app-header-lang {
        min-width: 54px;
        gap: 5px;
        padding: 0 7px;
        font-size: 0.86rem;
    }

    .app-header-settings {
        width: var(--header-action-size);
    }

    .app-header-menu-modal {
        width: var(--header-mobile-width);
        max-width: none;
        min-width: 0;
    }

    .app-header-mobile-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 12px;
    }

    .app-header-mobile-nav-item {
        min-height: 50px;
        border-radius: 16px;
    }
}

@media (max-width: 480px) {
    :root {
        --header-mobile-width: calc(100% - 18px);
        --header-action-size: 36px;
        --header-lang-flag-size: 20px;
        --header-settings-icon-size: 20px;
    }

    .app-header {
        top: 9px;
    }

    .app-header-container {
        padding: 0 8px;
    }

    .app-header-container-part.right {
        gap: 6px;
    }

    .app-header-container-part.right .title {
        max-width: 82px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;

        font-size: 0.9rem;
    }

    .app-header-container-part.right .logo {
        width: 38px;
        height: 38px;
    }

    .app-header-lang {
        min-width: 48px;
        padding: 0 5px;
    }

    .app-header-lang span {
        display: none;
    }

    .app-header-menu-button {
        min-width: 66px;
        height: 40px;

        font-size: 0.86rem;
    }

    .app-header-mobile-nav {
        grid-template-columns: 1fr;
        gap: 7px;
        padding: 10px;
    }

    .app-header-mobile-nav-item {
        min-height: 46px;
        padding: 0 16px;
        box-sizing: border-box;
    }
}

@media (max-width: 360px) {
    .app-header-container-part.right .title {
        display: none;
    }

    .app-header-menu-button {
        min-width: 58px;
    }

    .app-header-lang {
        min-width: 40px;
    }
}
