/* ═══════════════════════════════════════════
   SPLASH — экран загрузки (dev: без глитча)
   ═══════════════════════════════════════════ */

/* Пока не отработала загрузка (или не нажали «АССОРТИМЕНТ» на мобиле) —
   прячем обычный контент страницы и системные элементы шапки/футера. */
html.is-splash body::after {
    display: none;
}

html.is-splash .mob-bar,
html.is-splash .mob-nav,
html.is-splash .mob-overlay,
html.is-splash .page-bottom-bar {
    display: none !important;
}

html.is-splash .main-container {
    display: none;
}

/* Сплэш: убираем фон bg.svg и CSS-сетку — здесь собственный void */
html.is-splash {
    overflow: hidden;
    background-color: var(--bg);
}

html.is-splash body {
    background-color: var(--bg);
    background-image: none;
    height: 100vh;
    min-height: unset;
    overflow: hidden;
}
html.is-splash body::before {
    display: none;
}

/* Контент раскрыт — сам сплэш и его элементы больше не нужны */
html:not(.is-splash) .splash-bg,
html:not(.is-splash) .splash,
html:not(.is-splash) .loader-wrap,
html:not(.is-splash) .splash-mob {
    display: none !important;
}

.splash-bg {
    position: fixed;
    inset: 0;
    background: url('../assets/img/splash_bg1.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
    z-index: 0;
}

/* ─── Контейнер ─── */
.splash {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ─── Логотип ─── */
.splash-logo {
    position: relative;

    margin-bottom: 60px;
    user-select: none;

    img {
        max-width: 800px;
        height: auto;
        width: 50vw;
    }
}

.logo-glitch {
    position: relative;
    display: inline-block;
}

.logo-glitch img {
    display: block;
    width: clamp(300px, 46vw, 620px);
    height: auto;
}

/* ─── Формула ─── */
.formula {
    display: flex;
    align-items: center;
    gap: clamp(16px, 3.5vw, 48px);
    margin-bottom: 0;
}

.formula-img-wrap {
    width: 150px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.9s ease, transform 0.9s ease;
}

.formula-img-wrap:last-child {
    position: relative;
    left: 20px;
}

.formula-img-wrap.revealed {
    opacity: 1;
    transform: translateY(0);
}

.formula-frame {
    position: absolute;
    top: 25%;
    width: 150px;
    height: 150px;
    pointer-events: none;
    background:
        linear-gradient(var(--core), var(--core)) 0 0 / 20px 2px no-repeat,
        linear-gradient(var(--core), var(--core)) 0 0 / 2px 20px no-repeat,
        linear-gradient(var(--core), var(--core)) 100% 0 / 20px 2px no-repeat,
        linear-gradient(var(--core), var(--core)) 100% 0 / 2px 20px no-repeat,
        linear-gradient(var(--core), var(--core)) 0 100% / 20px 2px no-repeat,
        linear-gradient(var(--core), var(--core)) 0 100% / 2px 20px no-repeat,
        linear-gradient(var(--core), var(--core)) 100% 100% / 20px 2px no-repeat,
        linear-gradient(var(--core), var(--core)) 100% 100% / 2px 20px no-repeat;
    filter: drop-shadow(0 0 6px var(--core));
}

.formula-img {
    height: clamp(150px, 20vw, 240px);
    width: auto;
    object-fit: contain;
}

.formula-op {
    font-family: var(--font-display);
    font-size: clamp(24px, 3.5vw, 40px);
    color: var(--text);
    line-height: 1;
    position: relative;
    top: 16px;
}

/* ─── Полоса загрузки ─── */
.loader-wrap {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

.loader-scanline {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--ice) 50%, transparent);
    opacity: 0.4;
}

.loader-track {
    height: 36px;
}

.loader-bar {
    transition: clip-path 0.04s linear;
}

.loader-label {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-display);
    font-size: 9px;
    color: rgba(255, 238, 0, 0.75);
    letter-spacing: 0.18em;
    z-index: 1;
    white-space: nowrap;
}

.loader-status {
    padding: 4px 44px;
    display: flex;
    justify-content: space-between;
    font-family: var(--font-body);
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 0.07em;
}

/* ─── Выход ─── */
.splash.exit {
    animation: splash-exit 0.45s ease forwards;
}

@keyframes splash-exit {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* ─── Мобильный сплэш (скрыт на десктопе) ─── */
.splash-mob {
    display: none;
}

/* ═══════════════════════════════════════════
   МОБИЛЬ — ≤ 900px
   ═══════════════════════════════════════════ */
@media (max-width: 900px) {
    html.is-splash {
        overflow: auto;
    }

    html.is-splash body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Скрываем десктоп */
    .splash {
        display: none;
    }
    .loader-wrap {
        display: none;
    }

    .splash-bg {
        background: url('../assets/img/splash_bg1.png');
        background-size: cover;
        background-repeat: no-repeat;
        background-attachment: fixed;
    }

    /* Показываем мобильный сплэш */
    .splash-mob {
        display: flex;
        flex-direction: column;
        align-items: center;
        position: relative;
        z-index: 1;
        width: 100%;
        gap: 0;
    }

    /* ─── Логотип ─── */
    .splash-mob-logo {
        position: relative;
        margin-bottom: 32px;
    }

    .splash-mob-logo .logo-glitch img {
        width: clamp(220px, 72vw, 380px);
        height: auto;
        display: block;
    }

    /* ─── Визуал с анимацией ─── */
    .splash-mob-visual {
        position: relative;
        width: 100%;
        height: 280px;
        margin-bottom: 36px;
        flex-shrink: 0;
    }

    /* Угловые скобки */
    .splash-mob-frame {
        width: 250px;
        height: 250px;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        pointer-events: none;
        z-index: 2;
        background:
            linear-gradient(var(--core), var(--core)) 0 0 / 28px 2px no-repeat,
            linear-gradient(var(--core), var(--core)) 0 0 / 2px 28px no-repeat,
            linear-gradient(var(--core), var(--core)) 100% 0 / 28px 2px no-repeat,
            linear-gradient(var(--core), var(--core)) 100% 0 / 2px 28px no-repeat,
            linear-gradient(var(--core), var(--core)) 0 100% / 28px 2px no-repeat,
            linear-gradient(var(--core), var(--core)) 0 100% / 2px 28px no-repeat,
            linear-gradient(var(--core), var(--core)) 100% 100% / 28px 2px no-repeat,
            linear-gradient(var(--core), var(--core)) 100% 100% / 2px 28px no-repeat;
    }

    /* Контейнер шагов */
    .splash-mob-seq {
        position: absolute;
        inset: 0;
    }

    /* Каждый шаг — один из пяти */
    .splash-mob-step {
        position: absolute;
        inset: 0;
        opacity: 0;
        transition: opacity 0.3s ease-out;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .splash-mob-step.active {
        opacity: 1;
    }

    .splash-mob-img {
        width: 150px;
        height: auto;
        object-fit: contain;
        filter: drop-shadow(0 0 24px rgba(255, 238, 0, 0.45)) drop-shadow(0 6px 24px rgba(0, 0, 0, 0.7));
    }

    #smFlavor {
        width: 100%;
        max-width: 220px;
        transform: none;
    }

    #smStep4 img {
        width: 270px;
        max-width: 270px;
        object-fit: cover;
    }

    .splash-mob-op {
        font-family: var(--font-latin);
        font-size: 72px;
        font-weight: 700;
        color: var(--text);
        line-height: 1;
    }

    /* ─── Навигация ─── */
    .splash-mob-nav {
        margin-top: auto;
        display: flex;
        flex-direction: column;
        gap: 20px;
        width: 100%;
        max-width: 480px;
    }
}
