/* ==========================================================================
   1. ПЕРЕМЕННЫЕ И БАЗА (Mobile-first)
   ========================================================================== */

:root {
    --bg-dark: #0F172A;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-border: rgba(255, 255, 255, 0.1);
    --bg-overlay: rgba(15, 23, 42, 0.78);

    --primary: #38BDF8;
    --primary-hover: #0EA5E9;
    --accent: #818CF8;

    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --danger: #F87171;

    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-code: 'JetBrains Mono', monospace;

    --gradient-hero: linear-gradient(135deg, #38BDF8 0%, #818CF8 100%);
    --blur-glass: blur(12px);

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 20px;

    --shadow-glow: 0 10px 20px rgba(56, 189, 248, 0.25);
    --shadow-drawer: -10px 0 30px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 16px 40px rgba(0, 0, 0, 0.35);

    --header-bg: rgba(15, 23, 42, 0.8);
    --input-bg: rgba(15, 23, 42, 0.6);
    --tag-bg: rgba(255, 255, 255, 0.03);
    --glass-fill: rgba(255, 255, 255, 0.05);
    --glass-fill-hover: rgba(255, 255, 255, 0.1);
    --code-text: #E2E8F0;

    --focus-ring: 2px solid var(--primary);
    color-scheme: dark;
}

html[data-theme="light"] {
    --bg-dark: #F8FAFC;
    --bg-card: rgba(255, 255, 255, 0.86);
    --bg-card-border: rgba(15, 23, 42, 0.12);
    --bg-overlay: rgba(248, 250, 252, 0.9);

    --text-main: #0F172A;
    --text-muted: #475569;

    --shadow-drawer: -10px 0 30px rgba(15, 23, 42, 0.12);
    --shadow-card: 0 16px 40px rgba(15, 23, 42, 0.1);

    --header-bg: rgba(248, 250, 252, 0.9);
    --input-bg: #FFFFFF;
    --tag-bg: rgba(15, 23, 42, 0.04);
    --glass-fill: rgba(15, 23, 42, 0.04);
    --glass-fill-hover: rgba(15, 23, 42, 0.08);
    --code-text: #1E293B;

    color-scheme: light;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

body.no-scroll {
    overflow: hidden;
}

img {
    max-width: 100%;
    height: auto;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 3px;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3 {
    line-height: 1.2;
    font-weight: 700;
}

.section-title {
    font-size: 1.75rem;
    margin-bottom: 24px;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: left;
}

.glass {
    background: var(--bg-card);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    font-family: var(--font-main);
    text-decoration: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    cursor: pointer;
    border: none;
    min-height: 48px;
    will-change: transform;
}

.btn--primary {
    background: var(--gradient-hero);
    color: #0F172A;
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn--glass {
    background: var(--glass-fill);
    color: var(--text-main);
    border: 1px solid var(--bg-card-border);
}

.btn--glass:hover {
    background: var(--glass-fill-hover);
}

.btn--outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn--outline:hover {
    background: rgba(56, 189, 248, 0.1);
}

/* ==========================================================================
   2. ШАПКА
   ========================================================================== */

.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 16px 0;
    background: var(--header-bg);
    backdrop-filter: var(--blur-glass);
    border-bottom: 1px solid var(--bg-card-border);
}

.header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.25rem;
}

.logo__icon {
    color: var(--primary);
    font-family: var(--font-code);
}

.header__btn {
    display: none;
}

.nav {
    display: flex;
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 340px;
    height: 100vh;
    background: var(--bg-dark);
    border-left: 1px solid var(--bg-card-border);
    padding: 90px 24px 32px;
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-drawer);
    z-index: 1000;
}

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

.nav__list {
    display: flex;
    flex-direction: column;
    gap: 24px;
    list-style: none;
}

.nav__link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.15rem;
    font-weight: 600;
    display: block;
    padding: 8px 0;
    transition: color 0.2s ease;
}

.nav__link:hover {
    color: var(--primary);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--bg-card-border);
    background: var(--glass-fill);
    color: var(--text-main);
    cursor: pointer;
}

.theme-toggle__icon::before {
    content: "☀";
    font-size: 1.15rem;
    line-height: 1;
}

html[data-theme="light"] .theme-toggle__icon::before {
    content: "☾";
}

.burger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.burger span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--text-main);
    transition: transform 0.3s ease, opacity 0.3s ease;
    will-change: transform;
}

.burger--active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.burger--active span:nth-child(2) {
    opacity: 0;
}

.burger--active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* ==========================================================================
   3. HERO
   ========================================================================== */

.hero {
    padding: 112px 0 48px;
}

.hero__container {
    display: grid;
    gap: 32px;
}

.badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(56, 189, 248, 0.1);
    color: var(--primary);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.hero__title {
    font-size: 2.1rem;
    margin-bottom: 16px;
}

.hero__subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 24px;
}

.hero__actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hero__actions .btn {
    width: 100%;
}

.hero__banner {
    margin: 0;
}

.hero__banner img {
    display: block;
    width: 100%;
    border-radius: var(--radius-lg);
    border: 1px solid var(--bg-card-border);
    box-shadow: var(--shadow-card);
    animation: float 5s ease-in-out infinite;
    will-change: transform;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

@media (prefers-reduced-motion: reduce) {
    .hero__banner img {
        animation: none;
    }
}

/* ==========================================================================
   4. СТЕК, УСЛУГИ, КЕЙСЫ
   ========================================================================== */

.stack {
    padding: 32px 0;
    border-top: 1px solid var(--bg-card-border);
    border-bottom: 1px solid var(--bg-card-border);
}

.stack__grid {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
}

.stack__title {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 600;
}

.stack__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    list-style: none;
}

.tag {
    padding: 8px 16px;
    background: var(--tag-bg);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
}

.services,
.cases,
.interactive,
.workflow,
.contact {
    padding: 64px 0;
}

.features,
.interactive__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.card {
    padding: 24px;
    transition: transform 0.3s ease;
    will-change: transform;
}

.card:hover {
    transform: translateY(-5px);
}

.card__icon {
    display: block;
    width: 112px;
    height: auto;
    margin-bottom: 16px;
}

.card__title {
    font-size: 1.25rem;
    margin-bottom: 12px;
}

.card__desc {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.cases__grid,
.workflow__steps,
.contact__container {
    display: grid;
    gap: 20px;
}

.case-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.case-card__badge {
    font-size: 0.8rem;
    font-family: var(--font-code);
    color: var(--primary);
    margin-bottom: 12px;
}

.case-card__title {
    font-size: 1.3rem;
    margin-bottom: 12px;
}

.case-card__desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 20px;
    flex-grow: 1;
}

.case-card__metrics {
    display: flex;
    gap: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--bg-card-border);
}

.metric {
    display: flex;
    flex-direction: column-reverse;
}

.metric__val {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.metric__lbl {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.workflow__visual {
    margin: 0 0 24px;
}

.workflow__visual img {
    display: block;
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--bg-card-border);
}

.animate-on-scroll {
    will-change: transform, opacity;
}

/* ==========================================================================
   5. ИНТЕРАКТИВНЫЙ БЛОК
   ========================================================================== */

.interactive {
    position: relative;
    background-image: url("../images/interactive-bg.png");
    background-size: cover;
    background-position: center;
}

.interactive::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--bg-overlay);
}

.interactive .container {
    position: relative;
    z-index: 1;
}

.calc,
.code-card {
    padding: 24px;
}

.calc__lead,
.calc__result,
.contact__text {
    color: var(--text-muted);
}

.calc__lead {
    margin-bottom: 8px;
}

.calc__result {
    min-height: 4.5em;
    font-size: 1.05rem;
    color: var(--text-main);
}

.code-card {
    font-family: var(--font-code);
}

.code-card__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--bg-card-border);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.red { background: #EF4444; }
.dot.yellow { background: #F59E0B; }
.dot.green { background: #10B981; }

.code-card__title {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: 8px;
}

.code-card__body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: pre;
}

.code-card__body code {
    font-size: 0.85rem;
    color: var(--code-text);
    font-family: var(--font-code);
}

.keyword { color: #F472B6; }
.function { color: #38BDF8; }
.comment { color: #64748B; font-style: italic; }
.string { color: #34D399; }

/* ==========================================================================
   6. ЭТАПЫ, ФОРМА, ПОДВАЛ
   ========================================================================== */

.workflow__steps {
    list-style: none;
}

.step {
    padding: 24px;
}

.step__num {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: rgba(56, 189, 248, 0.2);
    margin-bottom: 12px;
    font-family: var(--font-code);
}

.step__title {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.step__desc {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.contact__text {
    margin-bottom: 24px;
    font-size: 1.05rem;
}

.contact__links {
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-style: normal;
}

.contact__link {
    color: var(--text-main);
    text-decoration: none;
    font-size: 1.1rem;
}

.contact__link span {
    color: var(--text-muted);
}

.form,
.calc {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form__group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form__label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form__input,
.form__textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 1rem;
}

.form__input:focus,
.form__textarea:focus {
    border-color: var(--primary);
}

.form__input.is-invalid,
.form__textarea.is-invalid {
    border-color: var(--danger);
}

.form__textarea {
    min-height: 120px;
    resize: vertical;
}

.form__error {
    min-height: 1.2em;
    color: var(--danger);
    font-size: 0.8rem;
}

.form__status {
    min-height: 1.2em;
    color: var(--primary);
    font-size: 0.9rem;
}

.footer {
    padding: 32px 0;
    border-top: 1px solid var(--bg-card-border);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer__container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
}

/* ==========================================================================
   7. ПЛАНШЕТ
   ========================================================================== */

@media (min-width: 768px) {
    .section-title {
        font-size: 2.2rem;
        margin-bottom: 32px;
    }

    .section-title.center {
        text-align: center;
    }

    .hero {
        padding: 128px 0 64px;
    }

    .hero__title {
        font-size: 2.6rem;
    }

    .hero__actions {
        flex-direction: row;
    }

    .hero__actions .btn {
        width: auto;
    }

    .stack__grid {
        flex-direction: row;
        align-items: center;
        gap: 32px;
    }

    .stack__title {
        white-space: nowrap;
    }

    .services,
    .cases,
    .interactive,
    .workflow,
    .contact {
        padding: 100px 0;
    }

    .cases__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .workflow__visual {
        margin-bottom: 32px;
    }

    .workflow__steps {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }

    .footer__container {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

/* ==========================================================================
   8. ДЕСКТОП
   ========================================================================== */

@media (min-width: 1024px) {
    .header__btn {
        display: inline-flex;
    }

    .burger {
        display: none;
    }

    .nav {
        position: static;
        right: auto;
        width: auto;
        max-width: none;
        height: auto;
        padding: 0;
        border: none;
        box-shadow: none;
        background: transparent;
    }

    .nav__list {
        flex-direction: row;
        gap: 24px;
    }

    .nav__link {
        font-size: 0.95rem;
        font-weight: 400;
        padding: 0;
    }

    .hero {
        min-height: 100vh;
        display: flex;
        align-items: center;
        padding: 120px 0 80px;
    }

    .hero__container {
        grid-template-columns: 1.1fr 0.9fr;
        gap: 40px;
        align-items: center;
    }

    .hero__title {
        font-size: 3rem;
    }

    .contact__container {
        grid-template-columns: 1fr 1fr;
        gap: 60px;
        align-items: center;
    }
}
