/* =====================================================
   НОЧНАЯ СМЕНА — лендинг /chat-bot-dlya-avtoservisa/
   Поверх токенов темы minimal (style.css, html.dark).
   Единственный акцент: #28c76f — действия ИИ и деньги.
   ===================================================== */

:root {
    --ns-accent: #28c76f;
    --ns-ease: cubic-bezier(0.16, 1, 0.3, 1); /* ease-out-expo */
}

html.ns {
    overflow-x: clip;
    scroll-behavior: smooth;
}
body.ns-page {
    background: var(--bg);
    color: var(--ink);
    margin: 0;
}

.ns-wrap {
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

/* === HEADER ============================================== */
.ns-header {
    position: absolute;
    inset: 0 0 auto 0;
    z-index: 10;
    padding-block: var(--s-3);
}
.ns-header .ns-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-2);
}
.ns-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 500;
    letter-spacing: -0.01em;
}
.ns-logo svg { fill: currentColor; }
.ns-header__phone {
    font-family: var(--font-mono);
    font-size: var(--t-sm);
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition-fast);
}
.ns-header__phone:hover { border-color: var(--ink); }

/* === HERO ================================================ */
.ns-hero {
    position: relative;
    min-height: 100svh;
    display: flex;
    align-items: center;
    padding-block: clamp(120px, 16vh, 180px) var(--s-5);
    overflow: clip;
}
.ns-hero__inner { position: relative; z-index: 2; max-width: 720px; }
.ns-hero__kicker {
    display: flex;
    align-items: baseline;
    gap: var(--s-2);
    flex-wrap: wrap;
    font-family: var(--font-mono);
    font-size: var(--t-xs);
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 var(--s-3);
}
.ns-clock {
    font-family: var(--font-mono);
    font-size: var(--t-md);
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.ns-clock__label { color: var(--muted-2); }
.ns-hero__title {
    margin: 0 0 var(--s-3);
    font-size: clamp(var(--t-2xl), 6.4vw, var(--t-5xl));
    line-height: 1.02;
    letter-spacing: -0.03em;
    font-weight: 700;
    text-wrap: balance;
}
.ns-hero__title em {
    font-style: normal;
    color: var(--muted);
}
.ns-hero__intro { max-width: 560px; }
.ns-hero__intro p {
    margin: 0 0 var(--s-3);
    font-size: var(--t-md);
    line-height: 1.55;
    color: var(--ink-3);
}
.ns-hero__cta {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    flex-wrap: wrap;
    margin-top: var(--s-4);
}
.ns-hero__cta .btn { text-decoration: none; }
.ns-hero__hint {
    width: 100%;
    margin: var(--s-2) 0 0;
    font-family: var(--font-mono);
    font-size: var(--t-xs);
    letter-spacing: 0.06em;
    color: var(--muted-2);
}

/* dot-matrix car */
.ns-hero__car {
    position: absolute;
    z-index: 1;
    right: max(calc((100vw - var(--container)) / 2), var(--gutter));
    bottom: clamp(96px, 18vh, 200px);
    width: clamp(340px, 38vw, 620px);
    color: var(--ink);
    opacity: 0.45;
    pointer-events: none;
}
.ns-car { width: 100%; height: auto; display: block; }
.ns-car__g--1 { animation: ns-drift 7s ease-in-out infinite alternate; }
.ns-car__g--2 { animation: ns-drift 9s ease-in-out -3s infinite alternate-reverse; }
.ns-car__g--3 { animation: ns-drift 11s ease-in-out -6s infinite alternate; }
@keyframes ns-drift {
    from { transform: translate(0, 0); }
    to   { transform: translate(1.6px, -1.2px); }
}
@media (max-width: 640px) {
    .ns-hero__intro p { font-size: var(--t-base); }
}

@media (max-width: 900px) {
    .ns-hero { padding-top: 112px; align-items: flex-start; }
    .ns-hero__car {
        position: static;
        width: min(92vw, 460px);
        margin: var(--s-4) auto 0;
        opacity: 0.42;
    }
    .ns-hero { display: block; }
}

/* === ОБЩЕЕ ДЛЯ СЕКЦИЙ ==================================== */
.ns-section { padding-block: var(--section-pad-block); }
.ns-section--line { border-top: 1px solid var(--line); }
.ns-eyebrow {
    font-family: var(--font-mono);
    font-size: var(--t-xs);
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 var(--s-3);
}
.ns-eyebrow b {
    color: var(--ink);
    font-weight: 500;
    margin-right: var(--s-2);
}
.ns-content h2 {
    margin: 0 0 var(--s-4);
    font-size: clamp(var(--t-xl), 3.6vw, var(--t-3xl));
    line-height: 1.08;
    letter-spacing: -0.025em;
    font-weight: 700;
    max-width: 720px;
    text-wrap: balance;
}
.ns-content a:not(.btn) {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--muted-2);
    transition: text-decoration-color var(--transition-fast);
}
.ns-content a:not(.btn):hover { text-decoration-color: var(--ink); }

/* === СКРОЛЛ-ИСТОРИЯ ====================================== */
.ns-story {
    position: relative;
    height: 460vh;
    border-top: 1px solid var(--line);
}
.ns-story__pin {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    overflow: clip;
    display: grid;
    grid-template-columns: minmax(200px, 280px) minmax(0, 640px);
    justify-content: center;
    align-content: center;
    gap: clamp(var(--s-3), 4vw, var(--s-6));
    padding-inline: var(--gutter);
    box-sizing: border-box;
}
.ns-story__rail {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    align-self: center;
    position: relative;
    padding-left: var(--s-3);
}
.ns-story__line {
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 1px;
    background: var(--line);
}
.ns-story__line-fill {
    position: absolute;
    inset: 0;
    background: var(--ink);
    transform-origin: top;
    transform: scaleY(0);
}
.ns-story__eyebrow {
    font-family: var(--font-mono);
    font-size: var(--t-2xs);
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-2);
    margin: 0;
}
.ns-story__clock {
    font-family: var(--font-mono);
    font-size: clamp(28px, 3vw, 40px);
    font-weight: 500;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    margin: 0;
    line-height: 1;
}
.ns-story__beats {
    list-style: none;
    margin: var(--s-2) 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--s-1);
}
.ns-story__beat {
    font-family: var(--font-mono);
    font-size: var(--t-xs);
    letter-spacing: 0.04em;
    color: var(--muted-2);
    transition: color 0.3s var(--ns-ease);
}
.ns-story__beat b {
    font-weight: 500;
    margin-right: 10px;
    font-variant-numeric: tabular-nums;
}
.ns-story__beat.is-on { color: var(--ink); }

.ns-story__stage { position: relative; align-self: center; min-height: min(560px, 72svh); }
.ns-frame {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    opacity: 0;
    transform: translateY(28px);
    pointer-events: none;
}
.ns-frame__in { width: 100%; }
.ns-frame__caption {
    margin: var(--s-2) 0 0;
    font-family: var(--font-mono);
    font-size: var(--t-xs);
    letter-spacing: 0.05em;
    color: var(--muted);
}

/* чат-окно (Авито-подобное) */
.ns-chat {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--bg-alt);
    overflow: hidden;
}
.ns-chat__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    font-size: var(--t-sm);
}
.ns-chat__ava {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    flex: none;
}
.ns-chat__title { font-weight: 500; }
.ns-chat__meta {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: var(--t-2xs);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-2);
}
.ns-chat__meta--on { color: var(--ns-accent); }
.ns-chat__body {
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ns-msg {
    max-width: 86%;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: var(--t-sm);
    line-height: 1.45;
}
.ns-msg--client {
    align-self: flex-start;
    background: var(--bg);
    border: 1px solid var(--line);
    border-bottom-left-radius: 4px;
}
.ns-msg--ai {
    align-self: flex-end;
    background: var(--bg);
    border: 1px solid var(--line);
    border-left: 2px solid var(--ns-accent);
    border-bottom-right-radius: 4px;
}
.ns-msg__tag {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--t-2xs);
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-2);
    margin-bottom: 4px;
}
.ns-msg--ai .ns-msg__tag { color: var(--ns-accent); }
.ns-msg__text { margin: 0; }
.ns-msg--photo .ns-msg__photo {
    display: grid;
    grid-template-columns: repeat(8, 6px);
    gap: 4px;
    padding: 6px 0 2px;
}
.ns-msg--photo .ns-msg__photo i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--muted-2);
    opacity: 0.6;
}
.ns-msg--photo .ns-msg__photo i:nth-child(3n) { opacity: 0.3; }
.ns-msg--photo .ns-msg__photo i:nth-child(5n) { opacity: 0.9; }

/* печать по мере скролла */
.ns-type { position: relative; }
.ns-type__ghost { visibility: visible; }
.ns-type__live { display: none; }
html.js-typing .ns-type__ghost { visibility: hidden; }
html.js-typing .ns-type__live {
    display: block;
    position: absolute;
    inset: 0;
}
.ns-type__caret {
    display: none;
    width: 8px;
    height: 1.05em;
    background: var(--ink);
    vertical-align: text-bottom;
    animation: ns-caret 1s steps(1) infinite;
}
html.js-typing .ns-frame.is-typing .ns-type__caret { display: inline-block; }
@keyframes ns-caret { 50% { opacity: 0; } }

/* CRM-кадр */
.ns-crm {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--bg-alt);
    overflow: hidden;
}
.ns-crm__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: var(--t-xs);
    letter-spacing: 0.06em;
    color: var(--muted);
}
.ns-crm__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ns-accent);
    flex: none;
}
.ns-crm__body { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.ns-crm__row {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    color: var(--muted-2);
    font-size: var(--t-xs);
    font-family: var(--font-mono);
}
.ns-crm__row--card {
    border: 1px solid var(--ns-accent);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: var(--t-sm);
    background: color-mix(in srgb, var(--ns-accent) 7%, transparent);
}
.ns-crm__row--card b { font-weight: 600; }
.ns-crm__row--card .ns-crm__time {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: var(--t-xs);
    color: var(--ns-accent);
    white-space: nowrap;
}

@media (max-width: 640px) {
    .ns-crm__row--card { flex-wrap: wrap; }
    .ns-crm__row--card .ns-crm__time { margin-left: 0; width: 100%; }
}

@media (max-width: 900px) {
    .ns-story { height: 440vh; }
    .ns-story__pin {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        align-content: start;
        gap: var(--s-3);
        padding-top: var(--s-3);
    }
    .ns-story__rail {
        flex-direction: row;
        align-items: baseline;
        flex-wrap: wrap;
        gap: var(--s-2);
        padding-left: 0;
        padding-top: var(--s-2);
        align-self: start;
    }
    .ns-story__line { left: 0; right: 0; top: 0; bottom: auto; width: auto; height: 1px; }
    .ns-story__line-fill { transform-origin: left; transform: scaleX(0); }
    .ns-story__eyebrow { width: 100%; }
    .ns-story__clock { font-size: 26px; }
    .ns-story__beats { flex-direction: row; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 0 auto; }
    .ns-story__beat span { display: none; }
    .ns-story__stage { align-self: start; min-height: 62svh; }
    .ns-frame { align-items: flex-start; }
}

/* === ЧТО ВНУТРИ (mono-список) ============================ */
.ns-what ul {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: ns-item;
    border-top: 1px solid var(--line);
    max-width: 880px;
}
.ns-what li {
    counter-increment: ns-item;
    position: relative;
    padding: var(--s-3) 0 var(--s-3) 72px;
    border-bottom: 1px solid var(--line);
    font-size: var(--t-base);
    line-height: 1.55;
    color: var(--muted);
    max-width: 760px;
}
.ns-what li::before {
    content: "0" counter(ns-item);
    position: absolute;
    left: 0;
    top: calc(var(--s-3) + 6px);
    font-family: var(--font-mono);
    font-size: var(--t-sm);
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--muted-2);
}
.ns-what li strong {
    display: block;
    color: var(--ink);
    font-weight: 600;
    font-size: var(--t-md);
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}
@media (max-width: 640px) {
    .ns-what li { padding-left: 48px; }
}

/* === КЕЙС ================================================ */
.ns-case h2 { max-width: 720px; }
.ns-case p {
    margin: 0 0 var(--s-3);
    color: var(--muted);
    line-height: 1.6;
    max-width: 760px;
}
.ns-case p:has(> strong:first-child) {
    border-left: 2px solid var(--ns-accent);
    padding: var(--s-2) 0 var(--s-2) var(--s-3);
    color: var(--ink);
    font-size: var(--t-md);
    line-height: 1.5;
    letter-spacing: -0.01em;
    margin-block: var(--s-4);
}
.ns-case p:has(> strong:first-child) strong { color: var(--ns-accent); font-weight: 600; }

/* === ДЕМО-ЗАГЛУШКА ======================================= */
.ns-demo__grid {
    display: grid;
    grid-template-columns: minmax(0, 420px) minmax(0, 560px);
    gap: clamp(var(--s-3), 4vw, var(--s-6));
    justify-content: space-between;
    align-items: start;
}
.ns-demo__note {
    color: var(--muted);
    line-height: 1.6;
    margin: 0 0 var(--s-3);
}
.demo-chat-placeholder .ns-chat__input {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid var(--line);
}
.demo-chat-placeholder .ns-chat__input input {
    flex: 1;
    min-width: 0;
    font: inherit;
    font-size: var(--t-sm);
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg);
    color: var(--ink);
}
.demo-chat-placeholder .ns-chat__input input::placeholder { color: var(--muted-2); }
.demo-chat-placeholder .ns-chat__input button {
    font: inherit;
    font-size: var(--t-sm);
    font-weight: 600;
    padding: 10px 18px;
    border: none;
    border-radius: 999px;
    background: var(--ink);
    color: var(--bg);
    opacity: 0.55;
    cursor: not-allowed;
}
.demo-chat-placeholder .ns-chat__soon {
    margin: 0;
    padding: 8px 16px 14px;
    font-family: var(--font-mono);
    font-size: var(--t-2xs);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-2);
}
.demo-chat-placeholder .ns-chat__soon b {
    color: var(--ns-accent);
    font-weight: 500;
}
@media (max-width: 900px) {
    .ns-demo__grid { grid-template-columns: 1fr; }
}

/* === ТАРИФЫ ============================================== */
.ns-price ul {
    list-style: none;
    margin: 0 0 var(--s-4);
    padding: 0;
    border-top: 1px solid var(--line);
    max-width: 880px;
}
.ns-price ul li {
    padding: var(--s-3) 0;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    line-height: 1.55;
}
.ns-price ul li strong {
    display: block;
    color: var(--ink);
    font-size: var(--t-md);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}
.ns-price p { max-width: 720px; color: var(--muted); line-height: 1.6; }
.ns-price .roi { margin-top: var(--s-4); }

/* === FAQ ================================================= */
.ns-faq h3 {
    margin: 0;
    padding: var(--s-3) 0 var(--s-1);
    border-top: 1px solid var(--line);
    font-size: var(--t-md);
    font-weight: 600;
    letter-spacing: -0.01em;
}
.ns-faq h3:first-of-type { border-top: 1px solid var(--line); }
.ns-faq p {
    margin: 0 0 var(--s-3);
    color: var(--muted);
    line-height: 1.6;
    max-width: 760px;
}

/* === ХВОСТ (смежные, форма, CTA) ========================= */
.ns-rest p, .ns-rest ul { color: var(--muted); line-height: 1.6; max-width: 760px; }
.ns-rest ul { padding-left: 1.2em; margin: 0 0 var(--s-3); }
.ns-rest ul li { margin-bottom: var(--s-1); }
.ns-rest hr { border: none; border-top: 1px solid var(--line); margin: var(--s-5) 0; }
.ns-rest p:has(> strong:only-child) { font-size: var(--t-md); }
.ns-rest .lf-embed { border-radius: 14px; background: var(--bg-alt); }

/* === FOOTER ============================================== */
.ns-footer {
    border-top: 1px solid var(--line);
    padding-block: var(--s-4);
    margin-top: var(--s-6);
}
.ns-footer .ns-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-1) var(--s-4);
    font-size: var(--t-xs);
    color: var(--muted-2);
}
.ns-footer a { color: inherit; }

/* =====================================================
   ДВИЖЕНИЕ
   1) CSS scroll-driven animations в @supports
   2) фолбэк: IntersectionObserver + классы (html.no-sda)
   3) prefers-reduced-motion: статичная раскадровка
   ===================================================== */

/* -- появление секций -- */
@supports (animation-timeline: view()) {
    html.sda .ns-io {
        animation: ns-rise 1ms linear both;
        animation-timeline: view();
        animation-range: entry 5% entry 45%;
    }
}
@keyframes ns-rise {
    from { opacity: 0; transform: translateY(32px); }
    to   { opacity: 1; transform: none; }
}
html.no-sda .ns-io {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.9s var(--ns-ease), transform 0.9s var(--ns-ease);
}
html.no-sda .ns-io.is-in { opacity: 1; transform: none; }
html:not(.js) .ns-io { opacity: 1; transform: none; }

/* -- скролл-история: сцены -- */
@supports (animation-timeline: view()) {
    html.sda .ns-story { view-timeline: --ns-story block; }
    html.sda .ns-story__line-fill {
        animation: ns-fill 1ms linear both;
        animation-timeline: --ns-story;
        animation-range: contain 0% contain 100%;
    }
    html.sda .ns-frame {
        animation: ns-frame 1ms linear both;
        animation-timeline: --ns-story;
    }
    html.sda .ns-frame--1 { animation-name: ns-frame-first; animation-range: contain 0% contain 30%; }
    html.sda .ns-frame--2 { animation-range: contain 22% contain 55%; }
    html.sda .ns-frame--3 { animation-range: contain 47% contain 80%; }
    html.sda .ns-frame--4 { animation-name: ns-frame-last; animation-range: contain 72% contain 100%; }
}
@keyframes ns-fill { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@media (max-width: 900px) {
    @supports (animation-timeline: view()) {
        html.sda .ns-story__line-fill { animation-name: ns-fill-x; }
    }
}
@keyframes ns-fill-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes ns-frame {
    0%   { opacity: 0; transform: translateY(36px); }
    18%  { opacity: 1; transform: none; }
    82%  { opacity: 1; transform: none; }
    100% { opacity: 0; transform: translateY(-30px); }
}
@keyframes ns-frame-first {
    0%   { opacity: 1; transform: none; }
    82%  { opacity: 1; transform: none; }
    100% { opacity: 0; transform: translateY(-30px); }
}
@keyframes ns-frame-last {
    0%   { opacity: 0; transform: translateY(36px); }
    22%  { opacity: 1; transform: none; }
    100% { opacity: 1; transform: none; }
}

/* фолбэк: биты через классы от JS (IntersectionObserver/scroll) */
html.no-sda .ns-frame {
    transition: opacity 0.55s var(--ns-ease), transform 0.55s var(--ns-ease);
}
html.no-sda .ns-frame.is-live { opacity: 1; transform: none; }
html.no-sda .ns-frame.is-past { opacity: 0; transform: translateY(-30px); }
html.no-sda .ns-story__line-fill { transition: transform 0.2s linear; }

/* без JS вся история видна раскадровкой */
html:not(.js) .ns-story { height: auto; }
html:not(.js) .ns-story__pin { position: static; height: auto; align-content: start; padding-block: var(--s-5); }
html:not(.js) .ns-story__stage { min-height: 0; }
html:not(.js) .ns-frame {
    position: static;
    opacity: 1;
    transform: none;
    margin-bottom: var(--s-4);
}

/* -- reduced motion: статичная раскадровка, таймеры не тикают -- */
@media (prefers-reduced-motion: reduce) {
    html.ns * { animation: none !important; transition: none !important; }
    html.ns { scroll-behavior: auto; }
    .ns-story { height: auto !important; }
    .ns-story__pin {
        position: static;
        height: auto;
        align-content: start;
        padding-block: var(--s-5);
    }
    .ns-story__stage { min-height: 0; }
    .ns-frame {
        position: static;
        opacity: 1 !important;
        transform: none !important;
        margin-bottom: var(--s-4);
        pointer-events: auto;
    }
    .ns-story__line-fill { transform: none; }
    .ns-io { opacity: 1 !important; transform: none !important; }
    .ns-type__ghost { visibility: visible !important; }
    .ns-type__live, .ns-type__caret { display: none !important; }
}
