/* ============================================================
   STUDIO THEME - BASE
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
ul, ol { list-style: none; }

h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter Tight', 'Inter', sans-serif;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--c-text);
}
h1 { font-size: clamp(2rem, 5vw, 3.75rem); }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.75rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.75rem); }

p { color: var(--c-text-muted); }

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--c-primary);
    color: #fff;
    padding: 12px 20px;
    z-index: 9999;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: var(--radius-btn, 10px);
    font-weight: 600;
    font-size: 15px;
    line-height: 1;
    text-decoration: none;
    transition: all .3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    white-space: nowrap;
    font-family: inherit;
}
.btn-sm { padding: 10px 20px; font-size: 14px; }
.btn-lg { padding: 18px 36px; font-size: 16px; }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover {
    background: var(--c-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(var(--c-primary-rgb), .25);
}
.btn-outline {
    background: transparent;
    color: var(--c-text);
    border-color: rgba(15, 23, 42, .15);
}
.btn-outline:hover { border-color: var(--c-primary); color: var(--c-primary); }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, .9);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid rgba(15, 23, 42, .06);
}

body.nav-open .site-header,
.site-header:has(.main-nav.open) {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    height: 72px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Inter Tight', sans-serif;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -0.02em;
    color: var(--c-text);
    flex-shrink: 0;
    min-width: 0;
}
.logo img { width: 36px; height: 36px; flex-shrink: 0; }
.logo span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Десктопное меню ---------- */
.main-nav {
    display: flex;
    align-items: center;
    gap: 28px;
    margin-left: auto;
}
.main-nav > a {
    font-size: 15px;
    font-weight: 500;
    color: var(--c-text-muted);
    transition: color .2s;
    padding: 6px 0;
    white-space: nowrap;
}
.main-nav > a:hover { color: var(--c-primary); }

.nav-close { display: none; }
.nav-mobile-cta { display: none; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}
.header-phone {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 15px;
    color: var(--c-text);
    white-space: nowrap;
}
.header-phone:hover { color: var(--c-primary); }

.burger {
    display: none;
    width: 42px;
    height: 42px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    border-radius: 10px;
}
.burger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--c-text);
    border-radius: 2px;
    transition: transform .3s, opacity .2s;
}
.burger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.active span:nth-child(2) { opacity: 0; }
.burger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s, visibility .3s;
    z-index: 98;
}
.nav-overlay.open { opacity: 1; visibility: visible; }
body.nav-open { overflow: hidden; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    background: #0F172A;
    color: #94A3B8;
    padding: 72px 0 32px;
    margin-top: 96px;
}
.site-footer p { color: #94A3B8; }
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
    margin-bottom: 56px;
}
.footer-logo {
    font-family: 'Inter Tight', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}
.footer-col h4 {
    color: #fff;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 16px;
}
.footer-col ul { display: flex; flex-direction: column; gap: 10px; }
.footer-col a { color: #94A3B8; font-size: 15px; }
.footer-col a:hover { color: #fff; }
.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 32px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    font-size: 14px;
}
.footer-legal a { color: #94A3B8; }
.footer-legal a:hover { color: #fff; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
[data-anim] { opacity: 0; transition: opacity .3s ease, transform .3s ease; }
[data-anim="up"] { transform: translateY(24px); }
[data-anim="fade"] { transform: none; }
[data-anim].visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    [data-anim] { opacity: 1; transform: none; transition: none; }
}

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 900px) {
    .header-inner { height: 64px; gap: 12px; }
    .burger { display: flex; }
    .header-cta, .header-phone { display: none; }

    /* Полноэкранное меню */
    .main-nav {
        position: fixed;
        inset: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;

        background: #FFFFFF;
        display: none;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
        margin: 0;
        padding: 20px;
        z-index: 200;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: none;
    }
    .main-nav.open { display: flex; }

    .nav-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        align-self: flex-end;
        border-radius: 12px;
        background: rgba(15, 23, 42, .06);
        color: #0F172A;
        font-size: 18px;
        margin-bottom: 20px;
        flex-shrink: 0;
    }
    .nav-close:hover { background: rgba(15, 23, 42, .12); }

    /* Ссылки — прямые дети .main-nav */
    .main-nav > a {
        display: block;
        width: 100%;
        padding: 16px 4px;
        font-size: 17px;
        font-weight: 500;
        line-height: 1.4;
        color: #0F172A;
        border-bottom: 1px solid rgba(15, 23, 42, .08);
        white-space: normal;
    }
    .main-nav > a:last-of-type { border-bottom: none; }
    .main-nav > a:active { color: var(--c-primary); }

    .nav-mobile-cta {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-top: 20px;
        padding-top: 20px;
        border-top: 1px solid rgba(15, 23, 42, .08);
    }
    .nav-mobile-cta .btn { width: 100%; }

    .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
    .footer-brand { grid-column: 1 / -1; }
    .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
}

@media (max-width: 540px) {
    .container { padding: 0 16px; }
    .logo { font-size: 17px; gap: 8px; }
    .logo img { width: 30px; height: 30px; }
    .logo span { max-width: 180px; }
    .main-nav { padding: 16px; }
    .btn { padding: 12px 22px; font-size: 14px; }
    .site-footer { padding: 56px 0 24px; }
    .footer-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   SCROLL TO TOP
   ============================================================ */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: var(--c-primary);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 999999;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .3s ease, transform .3s ease;
    box-shadow: 0 10px 30px rgba(var(--c-primary-rgb), .4);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    pointer-events: none;
}
.scroll-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.scroll-top:hover { transform: translateY(-5px) scale(1.08); }
.scroll-top:active { transform: translateY(-2px) scale(1.02); }

@media (max-width: 900px) {
    .scroll-top { bottom: 20px; right: 20px; width: 46px; height: 46px; font-size: 1.1rem; }
}

@media (max-width: 540px) {
    .scroll-top { bottom: 16px; right: 16px; width: 44px; height: 44px; font-size: 1rem; }
}

/* ========== STICKY FOOTER ========== */
html { height: 100%; }
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
main, main#main, .site-main {
    flex: 1 0 auto;
}
.site-footer {
    flex-shrink: 0;
    margin-top: auto;
}

/* ========== ERROR PAGE ========== */
.error-page {
    padding: 80px 0 60px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}
.error-box {
    text-align: center;
    max-width: 640px;
    margin: 0 auto;
    --err-color: var(--c-primary);
    --err-rgb: var(--c-primary-rgb);
}
.error-box.error-color-warning { --err-color: #F59E0B; --err-rgb: 245, 158, 11; }
.error-box.error-color-primary { --err-color: var(--c-primary); --err-rgb: var(--c-primary-rgb); }
.error-box.error-color-danger  { --err-color: #EF4444; --err-rgb: 239, 68, 68; }
.error-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 88px;
    margin: 0 auto 28px;
    border-radius: 50%;
    background: rgba(var(--err-rgb), 0.08);
    border: 1px solid rgba(var(--err-rgb), 0.25);
    color: var(--err-color);
    font-size: 40px;
}
.error-code {
    font-family: 'Inter Tight', sans-serif;
    font-size: clamp(80px, 14vw, 160px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.06em;
    color: var(--err-color);
    margin-bottom: 16px;
}
.error-title {
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
    color: var(--c-text);
}
.error-text {
    font-size: 16px;
    color: var(--c-text-muted);
    line-height: 1.65;
    margin-bottom: 36px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}
.error-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}
.error-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 26px;
    border-radius: var(--radius-btn, 10px);
    font-size: 15px;
    font-weight: 600;
    transition: all 0.15s;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
}
.error-btn-primary {
    background: var(--c-primary);
    color: #fff;
}
.error-btn-primary:hover {
    background: var(--c-primary-dark);
    box-shadow: 0 8px 24px rgba(var(--c-primary-rgb), 0.35);
    color: #fff;
}
.error-btn-secondary {
    border-color: rgba(15, 23, 42, 0.12);
    color: var(--c-text);
}
.error-btn-secondary:hover {
    border-color: var(--c-primary);
    color: var(--c-primary);
}

@media (max-width: 560px) {
    .error-page { padding: 60px 0 40px; }
    .error-icon-wrap { width: 72px; height: 72px; font-size: 32px; margin-bottom: 20px; }
    .error-btn { padding: 12px 20px; font-size: 14px; }
}


/* ========== POWERED BY ========== */
.footer-powered {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    color: #94A3B8;
    font-size: 13px;
    text-decoration: none;
    transition: all .25s ease;
}
.footer-powered:hover {
    background: rgba(217, 119, 6, .12);
    border-color: rgba(217, 119, 6, .5);
    color: #F59E0B;
    transform: translateY(-1px);
}
.footer-powered i {
    font-size: 13px;
    color: #D97706;
    transition: color .25s ease;
}
.footer-powered:hover i {
    color: #F59E0B;
}
.footer-powered b {
    font-weight: 700;
    color: #E2E8F0;
    transition: color .25s ease;
}
.footer-powered:hover b {
    color: #F59E0B;
}


/* ==== COLOR OVERRIDES v2 ==== */
/* Перебивает жёсткие цвета на переменные для работы пресетов */

/* Хедер */
.site-header {
    background: rgba(var(--c-bg-rgb, 255,255,255), .92) !important;
}

/* Мобильное меню */
.main-nav {
    background: var(--c-bg) !important;
}
.main-nav > a {
    color: var(--c-text) !important;
    border-bottom-color: var(--c-card-border) !important;
}
.nav-close {
    background: rgba(var(--c-text-rgb, 15,23,42), .08) !important;
    color: var(--c-text) !important;
}

/* Кнопки */
.btn-outline {
    background: var(--c-card-bg) !important;
    border-color: var(--c-card-border) !important;
    color: var(--c-text) !important;
}
.btn-outline:hover {
    border-color: var(--c-primary) !important;
    color: var(--c-primary) !important;
}