/* Header, navigation and preloader */

#preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: #f8f8fb;
    transition: opacity 500ms ease, visibility 500ms ease;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-content {
    text-align: center;
}

.logo-preloader {
    width: min(270px, 68vw);
    margin: 0 auto 2rem;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    margin: 0 auto 1.25rem;
    border: 2px solid var(--line);
    border-top-color: var(--brand-magenta);
    border-radius: 50%;
    animation: spin 800ms linear infinite;
}

.preloader-content p {
    color: var(--ink-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 1000;
    border-bottom: 1px solid rgb(200 204 216 / 72%);
    background: rgb(250 250 252 / 88%);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    transition: background var(--ease), box-shadow var(--ease);
}

#header.sticky {
    background: rgb(255 255 255 / 94%);
    box-shadow: 0 10px 36px rgb(18 24 39 / 6%);
}

#header nav {
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.logo {
    z-index: 1001;
    padding: 0.55rem 0;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    text-decoration: none;
    transition: transform var(--ease);
}

.logo:hover {
    transform: translateY(-1px);
}

.logo-img {
    width: 174px;
    max-height: 46px;
    object-fit: contain;
}

.nav-links {
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    list-style: none;
}

.nav-links a {
    position: relative;
    display: block;
    padding: 0.65rem 0.85rem;
    color: #454d5e;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 650;
    text-decoration: none;
    transition: color var(--ease), background var(--ease);
}

.nav-links a::after {
    content: '';
    position: absolute;
    left: 0.85rem;
    bottom: 0.35rem;
    width: 18px;
    height: 2px;
    background: var(--brand-gradient);
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left;
    transition: opacity var(--ease), transform var(--ease);
}

.nav-links a:hover {
    color: var(--ink);
    background: rgb(116 91 199 / 6%);
}

.nav-links a:hover::after {
    opacity: 1;
    transform: scaleX(1);
}

.nav-links li:last-child a {
    margin-left: 0.55rem;
    padding-inline: 1rem;
    color: #fff;
    background: var(--ink);
}

.nav-links li:last-child a:hover {
    background: var(--brand-violet);
}

.nav-links li:last-child a::after {
    display: none;
}

.mobile-menu {
    z-index: 1001;
    width: 44px;
    height: 44px;
    padding: 0;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
    transition: color var(--ease), border-color var(--ease), background var(--ease), transform var(--ease);
}

.mobile-menu svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.mobile-menu:hover {
    color: #fff;
    border-color: var(--ink);
    background: var(--ink);
}

.mobile-menu:active {
    transform: scale(0.96);
}

@media (max-width: 1024px) {
    .nav-links { gap: 0; }
    .nav-links a { padding-inline: 0.65rem; font-size: 0.82rem; }
    .nav-links li:last-child a { margin-left: 0.25rem; }
}

@media (max-width: 768px) {
    #header nav { min-height: var(--header-height); }
    .logo-img { width: 145px; max-height: 40px; }
    .mobile-menu { display: flex; }

    .nav-links {
        position: fixed;
        top: var(--header-height);
        right: -100%;
        width: min(92vw, 390px);
        height: calc(100vh - var(--header-height));
        padding: 1.25rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.2rem;
        overflow-y: auto;
        border-left: 1px solid var(--line);
        background: rgb(255 255 255 / 98%);
        box-shadow: -24px 0 60px rgb(18 24 39 / 10%);
        transition: right 280ms ease;
    }

    .nav-links.active { right: 0; }

    .nav-links li {
        width: 100%;
        border-bottom: 1px solid var(--line);
    }

    .nav-links a {
        padding: 1rem 0.6rem;
        color: var(--ink);
        font-size: 1rem;
    }

    .nav-links a::after { display: none; }

    .nav-links li:last-child {
        border-bottom: 0;
    }

    .nav-links li:last-child a {
        margin: 0.8rem 0 0;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .logo-img { width: 137px; }
    .mobile-menu { width: 42px; height: 42px; }
}
