/* =============================================================
   N13 Balance — сайт-вариант №3 «Монохром, максимум»
   Построен на дизайн-системе Monochrome UI:
   tokens.css (переменные) + components.css (n13-классы).
   Здесь — раскладка, sticky-витрина и живые моки.
   ============================================================= */

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

html {
    scroll-behavior: smooth;
    /* Без резинового отскока: при листании до упора ничего
       не съезжает под фиксированную капсулу навигации. */
    overscroll-behavior-y: none;
}
body {
    margin: 0;
    position: relative;
    overflow-x: clip;
}
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: var(--radius-xs);
}

main { position: relative; z-index: 1; }

.wrap {
    max-width: 1180px;
    margin-inline: auto;
    padding-inline: var(--space-10);
}

section { scroll-margin-top: 96px; }

/* ---------- Прогресс чтения ---------- */
.progress {
    position: fixed;
    inset: 0 0 auto 0;
    height: 2px;
    z-index: 60;
    background: transparent;
}
.progress i {
    display: block;
    height: 100%;
    width: 0;
    background: var(--accent);
    opacity: 0.85;
}

/* ---------- Появление при скролле ---------- */
.rv {
    opacity: 0;
    transform: translateY(26px) scale(0.97);
    transition:
        opacity var(--dur-appear) var(--ease-spring),
        transform var(--dur-appear) var(--ease-spring-bounce);
    transition-delay: calc(var(--d, 0) * 70ms);
}
.rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    .rv { opacity: 1; transform: none; }
}

/* =============================================================
   Навигация-капсула
   ============================================================= */
.nav {
    position: fixed;
    top: var(--space-4);
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    justify-content: center;
    padding-inline: var(--space-6);
    pointer-events: none;
}
.nav__pill {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: var(--space-8);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-pill);
    /* Тёмная подложка поверх стекла: иначе blur белого луча под капсулой
       превращает её в мутную серую плашку и ссылки пропадают. */
    background: color-mix(in srgb, var(--bg) 72%, transparent);
    transition: box-shadow var(--dur-base) var(--ease-standard),
                background var(--dur-base) var(--ease-standard);
}
.nav.scrolled .nav__pill { box-shadow: var(--shadow-chip); }

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    font-weight: var(--weight-bold);
    padding-left: var(--space-2);
}
.brand__mark {
    display: grid;
    place-items: center;
    padding: var(--space-2xs) var(--space-3);
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--on-accent);
    font-family: var(--font-rounded);
    font-size: var(--text-caption);
    font-weight: var(--weight-heavy);
}
.brand__name { font-size: var(--text-callout); }

.nav__links {
    display: flex;
    gap: var(--space-7);
}
.nav__links a {
    font-size: var(--text-subheadline);
    font-weight: var(--weight-semibold);
    color: var(--text-secondary);
    transition: color var(--dur-fast) var(--ease-standard);
}
.nav__links a:hover { color: var(--text-primary); }

.nav__actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.theme-toggle { width: 36px; height: 36px; }
.nav__cta {
    font-size: var(--text-subheadline);
    padding: var(--space-2) var(--space-6);
    border-radius: var(--radius-pill);
}

.theme-toggle .ico-sun { display: none; }
:root[data-theme="light"] .theme-toggle .ico-moon { display: none; }
:root[data-theme="light"] .theme-toggle .ico-sun { display: block; }

/* =============================================================
   Hero — текст слева, телефон справа
   ============================================================= */
.hero { padding-top: clamp(96px, 13vh, 132px); }

.hero__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    align-items: center;
    gap: var(--space-16);
}

.hero__title {
    font-family: var(--font-rounded);
    font-size: clamp(var(--text-display), 6.6vw, 78px);
    font-weight: var(--weight-heavy);
    letter-spacing: -0.025em;
    line-height: var(--leading-tight);
    margin-top: var(--space-6);
}
.hero__sub {
    max-width: 46ch;
    margin-top: var(--space-8);
    font-size: var(--text-title3);
    line-height: 1.45;
    color: var(--text-secondary);
}
.hero__cta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-6);
    margin-top: var(--space-10);
}
.hero__chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-10);
}
.hero__chips .n13-chip { cursor: default; }

.store-badge img { height: 56px; width: auto; }
.store-badge {
    display: inline-block;
    border-radius: 10px;
    transition: transform var(--dur-fast) var(--ease-spring-bounce), opacity var(--dur-fast);
}
.store-badge:hover { opacity: 0.85; }
.store-badge:active { transform: scale(var(--press-scale)); }
.store-badge--lg img { height: 64px; }

/* ---------- iPhone в рамке ----------
   Окно экрана в PNG-рамке (по альфа-каналу): 1206×2622 в 1350×2760
   → left 5.3333%, top 2.5%, 89.3333% × 95%. */
.phone {
    position: relative;
    aspect-ratio: 1350 / 2760;
    -webkit-user-select: none;
    user-select: none;
}
.phone__screen {
    position: absolute;
    left: 5.3333%;
    top: 2.5%;
    width: 89.3333%;
    height: 95%;
    object-fit: cover;
    border-radius: 13.7% / 6.3%;
    background: var(--bg-elevated);
    opacity: 0;
    transition: opacity var(--dur-base) var(--ease-standard);
}
.phone__screen.is-front { opacity: 1; }
.phone__frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    filter: drop-shadow(0 24px 48px rgba(0, 0, 0, 0.45));
}
:root[data-theme="light"] .phone__frame {
    filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.22));
}

.hero__device {
    position: relative;
    display: flex;
    justify-content: center;
    padding-block: var(--space-8);
}
.phone--hero {
    /* Ширина ограничена и вьюпортом по высоте (аспект 1350/2760 ≈ 0.489):
       телефон целиком помещается под навигацией, hero не раздувается. */
    width: min(340px, 36vw, calc((100vh - 230px) * 0.46));
    will-change: transform;
}

/* Плавающие glass-чипы с параллаксом */
.float-chip {
    position: absolute;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-pill);
    font-size: var(--text-footnote);
    color: var(--text-secondary);
    box-shadow: var(--shadow-chip);
    animation: floaty 6s ease-in-out infinite alternate;
    will-change: transform;
}
.float-chip b { color: var(--text-primary); }
.float-chip__ico {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    background: var(--surface-selected);
    border: var(--hairline) solid var(--border-strong);
    color: var(--text-primary);
    font-size: var(--text-caption);
}
.float-chip--a { top: 11%; left: -10%; animation-delay: 0s; }
.float-chip--b { top: 46%; right: -3%; animation-delay: -2s; }
.float-chip--c { bottom: 12%; left: -3%; animation-delay: -4s; }

@keyframes floaty {
    from { transform: translateY(calc(var(--par, 0px) - 7px)); }
    to   { transform: translateY(calc(var(--par, 0px) + 7px)); }
}
@media (prefers-reduced-motion: reduce) {
    .float-chip { animation: none; }
}

/* =============================================================
   Лента курсов
   ============================================================= */
.ticker {
    margin-top: var(--space-10);
    border-block: var(--hairline) solid var(--border);
    overflow: hidden;
    position: relative;
    z-index: 2;
    background: var(--bg);
    -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
            mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
}
.ticker__track {
    display: flex;
    width: max-content;
    animation: ticker 36s linear infinite;
}
.ticker:hover .ticker__track { animation-play-state: paused; }
.ticker__group {
    display: flex;
    align-items: center;
    padding-block: var(--space-5);
    font-size: var(--text-footnote);
    color: var(--text-muted);
    white-space: nowrap;
}
.ticker__group b {
    color: var(--text-primary);
    font-weight: var(--weight-semibold);
}
.ticker__group i {
    font-style: normal;
    margin-inline: var(--space-7);
    color: var(--text-tertiary);
}
.ticker__note { color: var(--text-tertiary); }
@keyframes ticker { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
    .ticker__track { animation: none; }
}

/* =============================================================
   Секции
   ============================================================= */
.section { padding-top: 120px; }
.section--last { padding-bottom: 120px; }

.section__title {
    font-family: var(--font-rounded);
    font-size: clamp(var(--text-display-sm), 4.6vw, 52px);
    font-weight: var(--weight-heavy);
    letter-spacing: -0.02em;
    line-height: var(--leading-tight);
    margin-top: var(--space-4);
}

/* =============================================================
   Sticky-витрина
   ============================================================= */
.show { padding-top: 120px; }

/* Внимание: без align-items:start — колонка телефона обязана растягиваться
   на всю высоту ряда, иначе sticky-диапазон схлопнется до высоты телефона. */
.show__grid {
    display: grid;
    grid-template-columns: minmax(0, 6fr) minmax(0, 6fr);
    gap: var(--space-16);
    margin-top: var(--space-16);
}

.show__side { min-width: 0; }
.show__sticky {
    position: sticky;
    top: 96px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: var(--space-8);
    padding-bottom: var(--space-8);
}
.phone--show { width: min(360px, 40vw); }

/* Прогресс-точки */
.show__dots {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-top: var(--space-16);
}
.show__dot {
    width: 10px;
    height: 10px;
    padding: 0;
    border-radius: var(--radius-full);
    border: var(--hairline) solid var(--border-selected);
    background: var(--surface);
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease-spring-bounce),
                background var(--dur-fast) var(--ease-standard),
                height var(--dur-base) var(--ease-spring);
}
.show__dot:hover { background: var(--surface-selected); transform: scale(1.2); }
.show__dot.is-active {
    background: var(--accent);
    border-color: transparent;
    height: 26px;
    border-radius: var(--radius-pill);
}

/* Блоки справа */
.show__blocks { min-width: 0; }
.show__block {
    min-height: 72vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-6);
    opacity: 0.35;
    transform: translateY(6px) scale(0.99);
    transition: opacity var(--dur-slow) var(--ease-standard),
                transform var(--dur-slow) var(--ease-spring);
}
.show__block.is-current { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    .show__block { opacity: 1; transform: none; }
}

.show__h {
    font-family: var(--font-rounded);
    font-size: clamp(var(--text-title), 3vw, var(--text-display-sm));
    font-weight: var(--weight-heavy);
    letter-spacing: -0.015em;
    line-height: var(--leading-tight);
}
.show__p {
    max-width: 46ch;
    font-size: var(--text-callout);
    line-height: 1.55;
    color: var(--text-secondary);
}
.show__chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.show__chips .n13-chip { cursor: default; }

/* Телефоны-слайды и подсказка — только для мобильной карусели */
.phone--slide { display: none; }
.show__hint {
    display: none;
    margin-top: var(--space-4);
    text-align: center;
    font-size: var(--text-caption);
    letter-spacing: var(--tracking-wide);
    color: var(--text-tertiary);
}

/* =============================================================
   Bento «Возможности»
   ============================================================= */
.bento {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-6);
    margin-top: var(--space-16);
}

.n13-card.feature {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
    padding: var(--space-10);
    transition: background var(--dur-base) var(--ease-standard),
                border-color var(--dur-base) var(--ease-standard),
                transform var(--dur-base) var(--ease-spring);
}
.n13-card.feature:hover {
    background: var(--surface-hover);
    border-color: var(--border-selected);
    transform: translateY(-3px);
}

.feature__title {
    font-family: var(--font-rounded);
    font-size: var(--text-title);
    font-weight: var(--weight-bold);
    letter-spacing: -0.01em;
}
.feature__desc {
    margin-top: var(--space-3);
    max-width: 52ch;
    font-size: var(--text-callout);
    line-height: 1.5;
    color: var(--text-secondary);
}

/* ---------- График ---------- */
.chart {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-4);
    align-items: end;
    height: 210px;
    margin-top: auto;
}
.chart__bar {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: var(--space-2);
    height: 100%;
}
.chart__bar i {
    display: block;
    height: var(--h);
    border-radius: var(--radius-sm);
    background: linear-gradient(to top, var(--surface-selected), var(--surface-hover));
    border: var(--hairline) solid var(--border-strong);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform var(--dur-appear) var(--ease-spring-bounce),
                background var(--dur-fast) var(--ease-standard);
}
.chart.in .chart__bar i { transform: scaleY(1); }
.chart.in .chart__bar:nth-child(1) i { transition-delay: 0ms; }
.chart.in .chart__bar:nth-child(2) i { transition-delay: 70ms; }
.chart.in .chart__bar:nth-child(3) i { transition-delay: 140ms; }
.chart.in .chart__bar:nth-child(4) i { transition-delay: 210ms; }
.chart.in .chart__bar:nth-child(5) i { transition-delay: 280ms; }
.chart.in .chart__bar:nth-child(6) i { transition-delay: 350ms; }
.chart__bar:hover i { background: var(--surface-selected); }
.chart__bar--hot i {
    background: var(--accent);
    border-color: transparent;
}
.chart__bar em {
    font-style: normal;
    text-align: center;
    font-size: var(--text-caption2);
    color: var(--text-muted);
}
@media (prefers-reduced-motion: reduce) {
    .chart__bar i { transform: scaleY(1); transition: none; }
}

/* ---------- Карточка счёта ---------- */
.acc {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    margin-top: auto;
}
.acc__card {
    border-radius: var(--radius-xl);
    border: var(--border-w-card) solid var(--border-selected);
    background: linear-gradient(145deg, var(--surface-hover), transparent 70%);
    padding: var(--space-8);
}
.acc__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.acc__top .n13-chip { cursor: default; }
.acc__name {
    margin-top: var(--space-16);
    font-size: var(--text-title3);
    font-weight: var(--weight-bold);
}
.acc__sum {
    font-family: var(--font-rounded);
    font-size: var(--text-display-sm);
    font-weight: var(--weight-heavy);
    letter-spacing: -0.01em;
}
.acc__row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.acc__row .n13-chip { cursor: default; }

/* ---------- Конвертер ---------- */
.conv {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-top: auto;
}
.conv__row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    background: var(--surface-elevated);
    border: var(--hairline) solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-5);
    cursor: text;
    transition: border-color var(--dur-fast) var(--ease-standard),
                background var(--dur-fast) var(--ease-standard);
}
.conv__row:focus-within {
    border-color: var(--border-selected);
    background: var(--surface-selected);
}
.conv__cur {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 92px;
    font-size: var(--text-subheadline);
    font-weight: var(--weight-bold);
}
.conv__ico {
    width: 34px;
    height: 34px;
    font-size: var(--text-callout);
    font-style: normal;
}
.conv__input {
    /* width:0 + flex:1 — иначе врождённая ширина input распирает карточку */
    flex: 1;
    width: 0;
    min-width: 0;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-rounded);
    font-size: var(--text-title2);
    font-weight: var(--weight-bold);
    text-align: right;
    padding: var(--space-2) 0;
}

/* ---------- Темы ---------- */
.themes {
    position: relative;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}
.themes__pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
}
.themes__pair img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    border: var(--hairline) solid var(--border-strong);
    transition: transform var(--dur-slow) var(--ease-spring);
}
.feature--themes:hover .themes__pair img:first-child { transform: translateY(-4px) rotate(-1deg); }
.feature--themes:hover .themes__pair img:last-child  { transform: translateY(-4px) rotate(1deg); }
.themes__btn { align-self: center; }

/* =============================================================
   Манифест
   ============================================================= */
.statement {
    padding-top: 140px;
    text-align: center;
}
.statement__text {
    font-size: clamp(var(--text-display-sm), 5.4vw, var(--text-display-xl));
    margin-top: var(--space-6);
}
.statement__sub {
    margin: var(--space-8) auto 0;
    max-width: 52ch;
    font-size: var(--text-callout);
    color: var(--text-muted);
    line-height: 1.5;
}

/* =============================================================
   Скачать
   ============================================================= */
.download {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-6);
    padding: clamp(var(--space-16), 8vw, 96px) var(--space-10);
}
.download__ray {
    position: absolute;
    inset: 0;
    background: var(--light-ray);
    pointer-events: none;
}
.download__icon {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    border-radius: 18px;
    background: var(--accent);
    color: var(--on-accent);
    font-family: var(--font-rounded);
    font-weight: var(--weight-heavy);
    font-size: var(--text-title2);
    box-shadow: var(--shadow-card);
}
.download__title {
    font-family: var(--font-rounded);
    font-size: clamp(var(--text-display-sm), 4.6vw, 48px);
    font-weight: var(--weight-heavy);
    letter-spacing: -0.02em;
    line-height: var(--leading-tight);
}
.download__sub {
    max-width: 44ch;
    color: var(--text-secondary);
    font-size: var(--text-callout);
    line-height: 1.5;
}
.download__fine {
    font-size: var(--text-caption);
    color: var(--text-tertiary);
}

/* =============================================================
   Футер
   ============================================================= */
.footer {
    border-top: var(--hairline) solid var(--border);
    padding-block: var(--space-16);
    position: relative;
    z-index: 1;
}
.footer__inner {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    flex-wrap: wrap;
}
.footer__copy {
    color: var(--text-muted);
    font-size: var(--text-footnote);
    margin-inline: auto;
}
.footer__links { display: flex; gap: var(--space-6); }
.footer__links a {
    font-size: var(--text-footnote);
    color: var(--text-muted);
    transition: color var(--dur-fast) var(--ease-standard);
}
.footer__links a:hover { color: var(--text-primary); }

/* =============================================================
   Адаптив
   ============================================================= */
@media (max-width: 899px) {
    .hero { padding-top: 120px; }
    .hero__grid {
        grid-template-columns: 1fr;
        gap: var(--space-16);
        text-align: center;
    }
    .hero__sub { margin-inline: auto; font-size: var(--text-headline); }
    .hero__cta, .hero__chips { justify-content: center; }
    .hero__title { font-size: clamp(38px, 10.5vw, var(--text-display-xl)); }
    .phone--hero { width: min(320px, 74vw); }

    .float-chip--a { left: 2%; }
    .float-chip--b { right: 2%; }
    .float-chip--c { left: 3%; }


    .section, .show { padding-top: 88px; }
    .statement { padding-top: 100px; }

    /* Витрина на мобильном: горизонтальная карусель со снапом.
       Каждый слайд — карточка со своим телефоном. Нативный свайп,
       никакого sticky/vh — на iOS работает безотказно. */
    .show__grid { display: block; margin-top: var(--space-10); }
    .show__side { display: none; }
    .show__blocks {
        display: flex;
        gap: var(--space-4);
        margin-inline: calc(-1 * var(--space-10));
        padding-inline: var(--space-10);
        padding-block: var(--space-2) var(--space-4);
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding-inline: var(--space-10);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .show__blocks::-webkit-scrollbar { display: none; }
    .show__block {
        flex: 0 0 82%;
        max-width: 340px;
        scroll-snap-align: center;
        min-height: 0;
        justify-content: flex-start;
        gap: var(--space-4);
        opacity: 1;                 /* без затемнения — карточки равноправны */
        transform: none;
        background: var(--surface);
        border: var(--hairline) solid var(--border);
        border-radius: var(--radius-2xl);
        padding: var(--space-8) var(--space-6);
    }
    .phone--slide {
        display: block;
        width: min(200px, 58%);
        margin-inline: auto;
        margin-bottom: var(--space-2);
    }
    .phone--slide .phone__frame { filter: none; }   /* тень дорога на мобильном GPU */
    .show__h { font-size: var(--text-title2); }
    .show__p { font-size: var(--text-subheadline); }
    .show__hint { display: block; }

    .bento { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 759px) {
    .nav { top: var(--space-2); }
    .nav__links { display: none; }
    .nav__cta { display: none; }
    .nav__pill { gap: var(--space-4); }

    .store-badge img { height: 50px; }
    .n13-card.feature { padding: var(--space-8); }
    .chart { height: 160px; }
    .float-chip { display: none; }
    .conv__cur { min-width: 74px; }
    .conv__input { font-size: var(--text-title3); }
}
