/* плавающая шапка-капсула */

:root {
    --header-peach: #ffe8d6;
    --header-ink: #1f2937;
}

body {
    background:
        radial-gradient(900px 420px at 90% -10%, rgba(255, 170, 120, 0.18), transparent 55%),
        linear-gradient(180deg, #fff5ec 0%, #fff8f2 42%, #f7f4f1 100%);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 1200;
    padding: 14px 16px 8px;
    pointer-events: none;
    animation: header-drop 0.55s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.site-header__bar,
.site-header__drawer,
.site-header__backdrop {
    pointer-events: auto;
}

.site-header__bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 10px 14px 10px 12px;
    border-radius: 28px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow:
        0 10px 28px rgba(120, 70, 30, 0.10),
        0 2px 8px rgba(15, 23, 42, 0.04);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.site-header__bar:hover {
    box-shadow:
        0 14px 34px rgba(120, 70, 30, 0.14),
        0 4px 12px rgba(15, 23, 42, 0.05);
}

.site-header__logo {
    grid-column: 1;
    justify-self: start;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    text-decoration: none;
    transition: transform 0.25s ease;
}

.site-header__logo:hover {
    transform: scale(1.06) rotate(-4deg);
}

.site-header__logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.site-header__links {
    display: none;
    grid-column: 2;
    justify-self: center;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 2.8vw, 34px);
    min-width: 0;
    width: max-content;
}

.site-header__link {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border-radius: 14px;
    text-decoration: none !important;
    color: var(--header-ink) !important;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.15;
    white-space: nowrap;
    transition: transform 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.site-header__link svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    transition: transform 0.25s ease;
}

.site-header__link:hover {
    color: #ff6b00 !important;
    background: rgba(255, 107, 0, 0.08);
    transform: translateY(-2px);
    text-decoration: none !important;
}

.site-header__link:hover svg {
    transform: translateY(-2px) scale(1.08);
}

.site-header__right {
    grid-column: 3;
    justify-self: end;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 118px;
    flex: 0 0 auto;
}

.site-header__avatar {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.site-header__avatar--pad {
    border-radius: 14px;
    background: var(--header-peach);
    box-shadow: inset 0 0 0 1px rgba(255, 140, 80, 0.18);
    animation: avatar-pop 0.45s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.site-header__avatar img {
    width: 78%;
    height: 78%;
    object-fit: contain;
    display: block;
    transition: transform 0.25s ease;
}

.site-header__mascot-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.site-header__mascot-wrap img,
.site-header__mascot-wrap svg {
    width: 82%;
    height: 82%;
    object-fit: contain;
    display: block;
    transition: transform 0.25s ease;
}

.site-header__avatar:hover {
    transform: translateY(-2px) scale(1.04);
}

.site-header__avatar:hover img,
.site-header__avatar:hover .site-header__mascot-wrap img,
.site-header__avatar:hover .site-header__mascot-wrap svg {
    transform: scale(1.08);
}

.site-header__profile,
.site-header__login {
    position: relative;
}

.site-header__profile-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 168px;
    padding: 10px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 20;
    animation: menu-rise 0.22s ease both;
}

.site-header__profile-menu[hidden],
.site-header__login-menu[hidden] {
    display: none !important;
}

.site-header__profile-name {
    margin: 0 0 4px;
    padding: 6px 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--header-ink);
}

.site-header__profile-menu a {
    display: block;
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--header-ink) !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.18s ease, color 0.18s ease;
}

.site-header__profile-menu a:hover {
    background: #fff3ea;
    color: #ff6b00 !important;
}

/* десктоп: оранжевая кнопка Войти */
.site-header__login-btn {
    height: 44px;
    padding: 0 18px 0 14px;
    border: 0;
    border-radius: 999px;
    background: #ff5722;
    color: #fff;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 18px rgba(255, 87, 34, 0.28);
    transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.site-header__login-btn svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

.site-header__login-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow: 0 12px 22px rgba(255, 87, 34, 0.34);
    color: #fff;
}

.site-header__login-btn[aria-expanded="true"] {
    filter: brightness(0.96);
}

/* выпадающая плюшка как на макете */
.site-header__login-menu {
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    width: 252px;
    display: grid;
    gap: 10px;
    z-index: 30;
    animation: menu-rise 0.22s ease both;
    filter: drop-shadow(0 16px 30px rgba(15, 23, 42, 0.16));
}

.site-header__login-hello,
.site-header__login-actions {
    background: #fff;
    border-radius: 24px;
}

.site-header__login-hello {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 28px 18px 16px;
}

.site-header__login-hello::before {
    content: "";
    position: absolute;
    top: -7px;
    right: 28px;
    left: auto;
    width: 14px;
    height: 14px;
    background: #fff;
    transform: rotate(45deg);
    border-radius: 2px;
}

.site-header__login-hello img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
    flex: 0 0 auto;
}

.site-header__login-hello-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.site-header__login-hello-text strong {
    font-size: 1.08rem;
    font-weight: 800;
    color: #2f3540;
    line-height: 1.15;
}

.site-header__login-hello-text span {
    font-size: 0.92rem;
    font-weight: 600;
    color: #9aa0a8;
    line-height: 1.2;
}

.site-header__login-next {
    position: absolute;
    right: 16px;
    bottom: 8px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 7px solid #c4c8ce;
    animation: login-next-bob 1.15s ease-in-out infinite;
}

@keyframes login-next-bob {
    0%, 100% { transform: translateY(0); opacity: 0.85; }
    50% { transform: translateY(3px); opacity: 1; }
}

.site-header__login-actions {
    padding: 8px;
    display: grid;
    gap: 2px;
}

.site-header__login-actions a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    color: #3a404a !important;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 0.98rem;
    transition: background 0.18s ease, color 0.18s ease;
}

.site-header__login-actions a svg {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    color: #ff6a00;
}

.site-header__login-actions a:hover {
    background: #fff4ea;
    color: #ff6a00 !important;
}

.site-header__burger {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 14px;
    background: transparent;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.site-header__burger:hover {
    background: rgba(15, 23, 42, 0.04);
    transform: scale(1.04);
}

.site-header__burger span {
    display: block;
    width: 20px;
    height: 2.5px;
    border-radius: 99px;
    background: var(--header-ink);
    transition: transform 0.28s ease, opacity 0.2s ease, width 0.2s ease;
}

.site-header.is-open .site-header__burger span:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg);
}

.site-header.is-open .site-header__burger span:nth-child(2) {
    opacity: 0;
    width: 0;
}

.site-header.is-open .site-header__burger span:nth-child(3) {
    transform: translateY(-8.5px) rotate(-45deg);
}

.site-header__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(28, 20, 14, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
    z-index: 1190;
}

.site-header.is-open .site-header__backdrop {
    opacity: 1;
    pointer-events: auto;
}

.site-header__drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(340px, 90vw);
    height: 100vh;
    padding: 0 14px 18px;
    background: #fffaf6;
    border-left: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: -18px 0 40px rgba(15, 23, 42, 0.12);
    transform: translateX(100%);
    visibility: hidden;
    pointer-events: none;
    transition:
        transform 0.34s cubic-bezier(0.2, 0.9, 0.2, 1),
        visibility 0s linear 0.34s;
    z-index: 1210;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
}

.site-header.is-open .site-header__drawer {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    transition:
        transform 0.34s cubic-bezier(0.2, 0.9, 0.2, 1),
        visibility 0s linear 0s;
}

.site-drawer__header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: #fffaf6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 0 10px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    flex: 0 0 auto;
}

.site-drawer__brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--header-ink);
}

.site-drawer__brand img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.site-drawer__close {
    position: static;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 12px;
    background: #fff;
    color: var(--header-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.site-drawer__close:hover,
.site-drawer__close:active {
    background: #fff3ea;
    border-color: rgba(255, 107, 0, 0.25);
    color: #ff6b00;
    transform: scale(1.05);
}

.site-drawer__close svg {
    width: 19px;
    height: 19px;
}

.site-drawer__profile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    flex: 1;
    min-width: 0;
}

.site-drawer__profile .site-header__avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
}

.site-drawer__user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.site-drawer__nick {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--header-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.site-drawer__role {
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
    line-height: 1.2;
}

.site-drawer__auth {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
    flex: 0 0 auto;
}

.site-drawer__auth a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 6px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    color: var(--header-ink) !important;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 0.82rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.site-drawer__auth a img {
    width: 26px;
    height: 26px;
}

.site-drawer__auth a:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(255, 120, 40, 0.12);
}

.site-drawer__panel {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 6px;
    flex: 0 0 auto;
}

.site-drawer__panel:empty {
    display: none;
}

.site-drawer__panel h2 {
    margin: 0;
}

.site-drawer__panel a {
    display: block;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--header-ink) !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 0.86rem;
    transition: background 0.18s ease, color 0.18s ease;
}

.site-drawer__panel a:hover {
    background: #fff3ea;
    color: #ff6b00 !important;
}

.site-drawer__nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 6px;
    margin-bottom: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    flex: 0 0 auto;
}

.site-drawer__nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 10px;
    color: var(--header-ink) !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 0.85rem;
    background: #fff;
    border: 1px solid transparent;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.site-drawer__nav a svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.site-drawer__nav a:hover {
    background: #fff3ea;
    border-color: rgba(255, 107, 0, 0.18);
    color: #ff6b00 !important;
    transform: translateX(3px);
}

.site-drawer__footer {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    flex: 0 0 auto;
}

.site-drawer__logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #dc2626 !important;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 0.85rem;
    transition: background 0.18s ease, transform 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.site-drawer__logout-btn svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    flex: 0 0 auto;
}

.site-drawer__logout-btn:hover {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.28);
    color: #b91c1c !important;
    transform: translateY(-1px);
}

.navigation {
    display: none !important;
}

@keyframes header-drop {
    from {
        opacity: 0;
        transform: translateY(-18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes avatar-pop {
    from {
        opacity: 0;
        transform: scale(0.7);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes menu-rise {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 860px) {
    .site-header {
        padding: 18px 24px 10px;
    }

    .site-header__bar {
        padding: 12px 18px 12px 14px;
        border-radius: 32px;
    }

    .site-header__links {
        display: flex;
    }

    .site-header__logo {
        width: 56px;
        height: 56px;
    }

    /* бургер только для телефонов */
    .site-header__burger,
    .site-header__backdrop,
    .site-header__drawer {
        display: none !important;
    }
}

/* на телефонах: Войти в шапке прячем — вход через меню */
@media (max-width: 859px) {
    .site-header__login {
        display: none !important;
    }

    .site-header__links {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-header,
    .site-header__avatar--pad,
    .site-header__drawer,
    .site-header__backdrop,
    .site-header__burger span,
    .site-header__login-next {
        animation: none !important;
        transition: none !important;
    }
}
