/* ===========================
   БАЗОВЫЕ СТИЛИ И КОМПОНЕНТЫ
   =========================== */

/* ── Reset & Base ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition-theme);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

img, video { max-width: 100%; display: block; }

a { color: var(--accent-primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

ul, ol { list-style: none; }

address { font-style: normal; }

/* ── Типографика ── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.5rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.75rem); }
h4 { font-size: 1.25rem; }

p { color: var(--text-secondary); line-height: 1.7; }

code, pre {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    background: var(--bg-code);
    border-radius: 4px;
}

code { padding: 2px 6px; font-size: 0.875em; color: var(--accent-primary); }

/* ── Контейнер ── */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Кнопки ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.25s ease;
    text-align: center;
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-accent);
    color: var(--text-inverse);
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    color: var(--text-inverse);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    filter: brightness(1.1);
}

.btn-outline {
    background: transparent;
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.btn-outline:hover {
    background: var(--accent-primary);
    color: var(--text-inverse);
    transform: translateY(-2px);
}

.btn-ghost {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-ghost:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-sm { padding: 0.45rem 1.1rem; font-size: 0.875rem; }
.btn-lg { padding: 1rem 2.25rem; font-size: 1.05rem; }

/* ── Хедер / Навбар ── */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-theme), box-shadow 0.3s, backdrop-filter 0.3s;
}

.site-header.scrolled {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-md);
}

.navbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-icon {
    width: 40px;
    height: 40px;
    color: var(--accent-primary);
}

.logo-icon svg { width: 100%; height: 100%; }
.logo-bg { fill: var(--accent-primary); }

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.logo-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo-tagline {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

.nav-link {
    padding: 0.5rem 0.9rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
    position: relative;
}

.nav-link:hover, .nav-link.active {
    color: var(--accent-primary);
    background: var(--accent-glow);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-primary);
}

.nav-cta { margin-left: 0.5rem; }

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: var(--accent-glow);
}

.theme-toggle svg { width: 18px; height: 18px; }
.theme-icon { display: flex; }

[data-theme="light"] .theme-icon--moon { display: flex; }
[data-theme="light"] .theme-icon--sun  { display: none; }
[data-theme="dark"]  .theme-icon--sun  { display: flex; }
[data-theme="dark"]  .theme-icon--moon { display: none; }

.burger {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 36px;
    height: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    margin-left: auto;
    padding: 2px;
}

.burger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s;
}

.burger.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
    backdrop-filter: blur(4px);
}

.overlay.active { display: block; }

/* ── Секции ── */
.section {
    padding: 6rem 0;
}

.section-sm { padding: 4rem 0; }

.section-header {
    text-align: center;
    margin-bottom: 3.5rem;
}

.section-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.9rem;
    border-radius: 20px;
    background: var(--accent-light);
    color: var(--accent-primary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1rem;
}

.section-title {
    margin-bottom: 1rem;
}

.section-subtitle {
    max-width: 600px;
    margin: 0 auto;
    color: var(--text-secondary);
    font-size: 1.05rem;
}

/* ── Карточки ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
    background: var(--bg-card-hover);
}

/* ── Теги / Бейджи ── */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--accent-light);
    color: var(--accent-primary);
    border: 1px solid var(--border-color);
}

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ── Иконка-блок ── */
.icon-box {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent-primary);
}

.icon-box svg { width: 28px; height: 28px; }
.icon-box-lg { width: 72px; height: 72px; border-radius: 18px; }
.icon-box-lg svg { width: 36px; height: 36px; }

/* ── Grid-системы ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }

/* ── Формы ── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-control {
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s;
    width: 100%;
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control.error { border-color: var(--status-error); }
.form-error { font-size: 0.8rem; color: var(--status-error); margin-top: 0.25rem; display: none; }
.form-control.error + .form-error { display: block; }

textarea.form-control { resize: vertical; min-height: 120px; }

/* ── Алерты ── */
.alert {
    padding: 0.875rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    display: none;
    align-items: center;
    gap: 0.5rem;
}

.alert.show { display: flex; }
.alert-success { background: rgba(22, 163, 74, 0.1); color: var(--status-success); border: 1px solid rgba(22, 163, 74, 0.2); }
.alert-error   { background: rgba(220, 38, 38, 0.1); color: var(--status-error);   border: 1px solid rgba(220, 38, 38, 0.2); }

/* ── Счётчики ── */
.counters-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.counter-item {
    text-align: center;
    padding: 2rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

.counter-value {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    color: var(--accent-primary);
    line-height: 1;
    margin-bottom: 0.5rem;
    font-variant-numeric: tabular-nums;
}

.counter-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ── Статус-индикатор ── */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--status-success);
    display: inline-block;
    animation: pulse-dot 2s infinite;
}

/* ── Подвал ── */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 4rem 0 2rem;
    margin-top: auto;
    transition: var(--transition-theme);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--border-color);
}

.footer-logo { margin-bottom: 1rem; }

.footer-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.footer-heading {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.footer-links li { margin-bottom: 0.6rem; }
.footer-links a { color: var(--text-secondary); font-size: 0.9rem; transition: color 0.2s; }
.footer-links a:hover { color: var(--accent-primary); }

.footer-address p {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.footer-address svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--accent-primary); }
.footer-address a { color: var(--text-secondary); }
.footer-address a:hover { color: var(--accent-primary); }

.footer-social { display: flex; gap: 0.75rem; }

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.social-link:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: var(--accent-glow);
}

.social-link svg { width: 18px; height: 18px; }

.footer-bottom {
    padding-top: 2rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-bottom > *:last-child { margin-left: auto; }
.footer-privacy-link { color: var(--text-muted); }
.footer-privacy-link:hover { color: var(--accent-primary); }

/* ── Страница-заголовок ── */
.page-hero {
    padding: 8rem 0 4rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.page-hero-title { margin-bottom: 1rem; }
.page-hero-subtitle { max-width: 600px; font-size: 1.1rem; color: var(--text-secondary); }

/* ── Разделитель ── */
.divider {
    height: 1px;
    background: var(--border-color);
    margin: 2rem 0;
}

/* ── Spinner ── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}

.btn.loading .spinner { display: inline-block; }
.btn.loading .btn-text { opacity: 0.7; }

/* ── Адаптивность ── */
@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
    .counters-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .section { padding: 4rem 0; }
    .section-sm { padding: 2.5rem 0; }

    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: 1fr; }
    .counters-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
    .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
    .footer-bottom { flex-direction: column; align-items: flex-start; }
    .footer-bottom > *:last-child { margin-left: 0; }

    .burger { display: flex; }
    .theme-toggle { order: 3; }

    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--bg-overlay);
        flex-direction: column;
        align-items: stretch;
        padding: 1rem 1.5rem 2rem;
        border-bottom: 1px solid var(--border-color);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 999;
        gap: 0.25rem;
    }

    .nav-menu.open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .nav-link { padding: 0.75rem 1rem; border-radius: 8px; }
    .nav-link.active::after { display: none; }
    .nav-cta { margin-left: 0; margin-top: 0.5rem; }

    .page-hero { padding: 6rem 0 3rem; }
}

@media (max-width: 480px) {
    .counters-grid { grid-template-columns: 1fr; }
    .container { padding: 0 1rem; }
}
