html {
    scroll-padding-top: 5rem;
}

@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

.site-home { scroll-padding-top: 6rem; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #020617;
    border-bottom: 1px solid #ffffff1a;
}

.site-home .site-header {
    position: fixed;
    inset-inline: 0;
    background: rgba(2, 6, 23, .9);
    backdrop-filter: blur(20px);
}

.site-home .site-nav { min-height: 5.25rem; }

.site-nav {
    max-width: 96rem;
    min-height: 4rem;
    margin-inline: auto;
    padding-inline: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    font-size: .875rem;
    font-weight: 600;
}

@media (min-width: 768px) {
    .site-nav { padding-inline: 2.5rem; }
}

.site-nav a, .site-nav summary, .site-back-top {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    text-decoration: none;
}

.site-brand {
    gap: .75rem;
    color: #fff;
    font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -.05em;
    line-height: 1.1;
    white-space: nowrap;
}

.site-brand img {
    flex: none;
    width: 44px;
    height: 44px;
}

.site-brand strong {
    color: #34d399;
    font-weight: inherit;
}

.site-nav-links, .site-actions {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 2.1vw, 2rem);
}

.site-nav a:not(.site-trial):hover, .site-nav summary:hover,
.site-nav a[aria-current="page"] { color: #6ee7b7; }

.site-nav :focus-visible, .site-back-top:focus-visible {
    outline: 2px solid #6ee7b7;
    outline-offset: 3px;
}

.site-menu { position: relative; }

.site-menu summary {
    gap: .45rem;
    cursor: pointer;
    list-style: none;
}

.site-menu summary::-webkit-details-marker { display: none; }

.site-menu summary::after {
    content: "";
    width: .4rem;
    height: .4rem;
    margin-top: -.2rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
}

.site-menu[open] summary::after {
    margin-top: .15rem;
    transform: rotate(225deg);
}

.site-menu-panel {
    position: absolute;
    top: calc(100% + .5rem);
    right: 0;
    min-width: 13rem;
    padding: .5rem;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 1rem;
    box-shadow: 0 .75rem 2rem #0006;
}

.site-menu-panel a {
    display: flex;
    padding: .5rem .75rem;
    border-radius: .5rem;
}

.site-menu-panel a:hover { background: #ffffff0d; }
.site-nav .site-mobile-link, .site-menu-label { display: none; }

.site-trial {
    justify-content: center;
    padding-inline: 1rem;
    border-radius: .75rem;
    background: #34d399;
    color: #022c22;
}

.site-trial:hover { background: #6ee7b7; }

.site-back-top {
    position: fixed;
    z-index: 20;
    right: max(.75rem, env(safe-area-inset-right));
    bottom: max(.75rem, env(safe-area-inset-bottom));
    gap: .4rem;
    padding-inline: .9rem;
    border-radius: .75rem;
    background: #0f172a;
    border: 1px solid #475569;
    color: #f1f5f9;
    font-size: .875rem;
    font-weight: 600;
    box-shadow: 0 .25rem 1rem #0005;
}

.site-back-top:hover { background: #1e293b; }
.site-back-top[hidden] { display: none; }

@media (max-width: 899px) {
    .site-nav { gap: .65rem; }
    .site-brand { gap: .5rem; font-size: 1.125rem; }
    .site-brand img { width: 40px; height: 40px; }
    .site-nav .site-desktop-link, .site-more-label { display: none; }
    .site-nav .site-mobile-link { display: flex; }
    .site-menu-label { display: inline; }
    .site-nav-links { margin-inline-start: auto; }

    .site-menu { position: static; }

    .site-menu-panel {
        top: calc(100% + .25rem);
        right: .75rem;
        left: .75rem;
        max-width: 24rem;
        max-height: calc(100vh - 5rem);
        max-height: calc(100dvh - 5rem);
        margin-inline-start: auto;
        overflow-y: auto;
    }
}

@media (max-width: 400px) {
    .site-nav { gap: .25rem; }
    .site-brand { gap: .375rem; font-size: .9375rem; }
    .site-brand img { width: 36px; height: 36px; }
    .site-menu summary { font-size: .8125rem; }
    .site-trial { padding-inline: .375rem; font-size: .75rem; }
}

/* Client's name instead of «Войти» (cookie from the cabinet) */
.site-nav .site-account-link { display: inline-flex; align-items: center; gap: .5rem; max-width: 16rem; }
.site-account-icon { flex: none; width: 1.25rem; height: 1.25rem; fill: none; stroke: #34d399; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.site-account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-nav .site-trial[hidden] { display: none; }

@media (max-width: 899px) {
    /* Signed in: the account link takes the place of «Попробовать» on phones */
    .site-nav .site-account-link { display: inline-flex; max-width: 9rem; }
}

/* Telegram-blue button («Или через Telegram-бот») */
.btn-telegram { border-color: rgba(42, 171, 238, .5); color: #2AABEE; }
.btn-telegram:hover { background-color: rgba(42, 171, 238, .12); border-color: #2AABEE; }
