.header-nav {
    display: flex;
    margin-left: 32px;
    flex-wrap: wrap;
    align-items: center;
}

.header-nav__close {
    display: none;
}

.header-burger {
    display: none;
    width: 40px;
    height: 40px;
    margin-left: 12px;
    border: 1px solid rgba(29, 53, 87, 0.25);
    border-radius: 12px;
    background: transparent;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.header-burger span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: #1d3557;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.header-burger span + span {
    margin-top: 5px;
}

.header-burger.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.header-burger.is-active span:nth-child(2) {
    opacity: 0;
}

.header-burger.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.header-burger:hover {
    border-color: #457b9d;
    box-shadow: 0 0 0 4px rgba(69, 123, 157, 0.12);
}

.header-nav__link {
    position: relative;
    color: #1d3557;
    font-weight: 600;
    text-decoration: none;
    padding: 10px 12px;
    transition: color 0.2s ease;
}

.header-nav__link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 2px;
    width: 100%;
    height: 2px;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.2s ease;
    background: #e63946;
}

.header-nav__link:hover {
    color: #e63946;
}

.header-nav__link:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

.header-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid rgba(29, 53, 87, 0.25);
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.header-toggle__icon {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    position: relative;
    background: linear-gradient(135deg, #f1faee, #ffd166);
    box-shadow: 0 0 8px rgba(255, 209, 102, 0.6);
}

.header-toggle__icon::after {
    content: "";
    position: absolute;
    top: 2px;
    right: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.75);
}

.header-toggle:hover {
    border-color: #457b9d;
    box-shadow: 0 0 0 4px rgba(69, 123, 157, 0.12);
}

.header-nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(19, 37, 63, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 98;
}

.header-nav-backdrop.is-active {
    opacity: 1;
    pointer-events: auto;
}

.header-nav__link {
    position: relative;
    color: #1d3557;
    font-weight: 600;
    text-decoration: none;
    padding: 10px 12px;
    transition: color 0.2s ease;
}

.header-nav__link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 2px;
    width: 100%;
    height: 2px;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.2s ease;
    background: #e63946;
}

.header-nav__link:hover {
    color: #e63946;
}

.header-nav__link:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

.header-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid rgba(29, 53, 87, 0.25);
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.header-toggle__icon {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    position: relative;
    background: linear-gradient(135deg, #f1faee, #ffd166);
    box-shadow: 0 0 8px rgba(255, 209, 102, 0.6);
}

.header-toggle__icon::after {
    content: "";
    position: absolute;
    top: 2px;
    right: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.75);
}

.header-toggle:hover {
    border-color: #457b9d;
    box-shadow: 0 0 0 4px rgba(69, 123, 157, 0.12);
}

.theme-dark .header {
    background: #13253f;
    color: #f1faee;
}

.theme-dark .header-nav__link {
    color: #f1faee;
}

.theme-dark .header-nav__link::after {
    background: #a8dadc;
}

.theme-dark .auth-btn__item {
    color: #f1faee;
}

.theme-dark .header-toggle {
    border-color: rgba(241, 250, 238, 0.4);
}

.theme-dark .header-toggle__icon {
    background: linear-gradient(135deg, #a8dadc, #1d3557);
    box-shadow: inset -4px -4px 6px rgba(13, 30, 50, 0.7);
}

.theme-dark .header-toggle:hover {
    border-color: #a8dadc;
    box-shadow: 0 0 0 4px rgba(168, 218, 220, 0.18);
}

.theme-dark .header-toggle__icon::after {
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #13253f;
    opacity: 0.9;
}

.theme-dark .logo-link .title {
    color: #f1faee;
}

.theme-dark .logo-link .title::before {
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 274 304' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M27.004 300.04c0-3.139 2.129-4.15 10.86-5.159 33.343-3.852 50.111-10.016 67.639-24.865 18.15-15.377 27.738-36.061 30.369-65.519 1.602-17.929 1.566-17.932-11.393-.829-15.556 20.529-36.02 30.606-62.035 30.546-18.688-.045-28.858-3.372-41.827-13.69C6.832 209.557 1.03 197.351.887 179.018c-.102-13.303.85-16.941 7.643-29.194 6.21-11.202 12.331-17.818 30.644-33.125 69.158-57.806 83.249-73.145 93.251-101.52l5.33-15.12 5.95 14.845c10.46 26.094 18.815 35.877 67.649 79.208 53.368 47.354 60.373 56.367 62.068 79.858.563 7.812-.147 18.016-1.578 22.676-3.698 12.041-15.327 24.348-29.745 31.481-10.281 5.085-14.981 6.145-27.438 6.184-8.267.025-18.904-1.132-23.638-2.573-13.02-3.965-29.658-16.591-40.226-30.527l-9.471-12.489v12.994c0 15.815 7.158 41.505 14.738 52.894 12.14 18.241 39.556 33.394 67.873 37.512 24.876 3.618 24.852 3.611 24.852 7.832 0 3.921-1.88 3.989-110.893 3.989-108.2 0-110.892-.095-110.892-3.903Z' fill='%23f1faee'/%3E%3C/svg%3E") no-repeat;
}

.theme-dark .header-burger {
    border-color: rgba(241, 250, 238, 0.35);
}

.theme-dark .header-burger span {
    background: #f1faee;
}

.theme-dark .header-burger:hover {
    border-color: #a8dadc;
    box-shadow: 0 0 0 4px rgba(168, 218, 220, 0.18);
}

.theme-dark .header-nav-backdrop {
    background: rgba(7, 17, 33, 0.55);
}

body.nav-open {
    overflow: hidden;
}

@media (max-width: 992px) {
    .header-nav {
        margin-left: 16px;
    }
}

@media (max-width: 768px) {
    .header-burger {
        display: inline-flex;
    }

    .header-nav {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(240px, 78vw);
        margin-left: 0;
        padding: 72px 22px 24px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        background: #f1faee;
        transform: translateX(100%);
        opacity: 0;
        pointer-events: none;
        box-shadow: -18px 0 40px rgba(13, 30, 50, 0.18);
        transition: transform 0.25s ease, opacity 0.25s ease;
        z-index: 99;
    }

    .header-nav.is-open {
        transform: translateX(0);
        opacity: 1;
        pointer-events: auto;
    }

    .header-nav__link {
        display: block;
        width: 100%;
        padding: 14px 0;
        font-size: 16px;
        border-bottom: 1px solid rgba(29, 53, 87, 0.12);
    }

    .header-nav__close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 18px;
        right: 16px;
        width: 32px;
        height: 32px;
        border-radius: 10px;
        border: 1px solid rgba(29, 53, 87, 0.2);
        background: rgba(241, 250, 238, 0.8);
        transition: border-color 0.2s ease, background 0.2s ease;
    }

    .header-nav__close span {
        position: absolute;
        width: 16px;
        height: 2px;
        background: #1d3557;
        border-radius: 999px;
    }

    .header-nav__close span:first-child {
        transform: rotate(45deg);
    }

    .header-nav__close span:last-child {
        transform: rotate(-45deg);
    }

    .header-nav__close:hover {
        border-color: #457b9d;
        background: rgba(168, 218, 220, 0.25);
    }

    .header-nav__link::after {
        display: none;
    }

    .header-nav__link:last-child {
        border-bottom: none;
    }

    .theme-dark .header-nav {
        background: #0b1d33;
        box-shadow: -18px 0 40px rgba(2, 8, 18, 0.45);
    }

    .theme-dark .header-nav__link {
        color: #f1faee;
        border-bottom: 1px solid rgba(168, 218, 220, 0.18);
    }

    .theme-dark .auth-btn__item {
        color: #f1faee;
    }

    .theme-dark .header-nav__close {
        border-color: rgba(168, 218, 220, 0.3);
        background: rgba(11, 29, 51, 0.85);
    }

    .theme-dark .header-nav__close span {
        background: #f1faee;
    }

    .theme-dark .header-nav__close:hover {
        border-color: rgba(168, 218, 220, 0.55);
        background: rgba(168, 218, 220, 0.2);
    }
}

