/* Общие детали демо-конфигураторов: подсказка-капля (goo-tip.js) и меню «поделиться» (share.js) */
.cfgtip {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    filter: url(#cfg-goo-tip) drop-shadow(0 6px 12px rgba(0, 0, 0, .25));
}

.cfgtip i {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    background: var(--color-alt, #97bf74);
    will-change: transform;
}

.cfgtip__text {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 6;
    box-sizing: border-box;
    width: max-content;
    max-width: 280px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    color: #1d1f1d;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s ease;
}

.cfgtip__text.is-on {
    opacity: 1;
    transition: opacity .25s ease;
}

.cfgshare {
    position: absolute;
    z-index: 7;
    display: flex;
    flex-direction: column;
    min-width: 200px;
    padding: 6px;
    border-radius: 18px;
    background: #262325;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .35);
    animation: cfgshare-pop .2s ease-out;
}

.cfgshare[hidden] {
    display: none;
}

.cfgshare a,
.cfgshare button {
    display: block;
    padding: 9px 14px;
    border: 0;
    border-radius: 12px;
    background: none;
    color: #fff;
    font: inherit;
    font-size: 14px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.cfgshare a:hover,
.cfgshare button:hover {
    background: var(--color-alt, #97bf74);
    color: #1d1f1d;
}

.cfgshare button {
    margin-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, .1);
    border-radius: 0 0 12px 12px;
    color: var(--color-alt, #97bf74);
}

@keyframes cfgshare-pop {
    from { opacity: 0; transform: translateY(6px); }
}

/* Полоса конфигуратора: светло-серая подложка во всю ширину экрана; заголовок с призывом лежит в левой колонке
   над сценой (передаётся внутрь блока) и вместе с ней прилипает к верху, панель параметров прокручивается рядом.
   Фон шире контейнера рисуем border-image с выносом на 100vw — он не создаёт горизонтальной прокрутки, в отличие от
   отрицательных полей (50vw включает полосу прокрутки) */
.cfg-band {
    --cfg-gray: #ecedea;
    --cfg-top: 0px;
}

.cfg-band__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 16px;
    color: #1d1f1d; /* сам конфигуратор — светлым текстом на тёмном */
}

.cfg-band__head .sol-demo-title {
    margin: 0;
}

.cfg-band__offer {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

/* В полноэкранном режиме — только конфигуратор */
.deskcfg.is-full .cfg-band__head,
.cfg.is-full .cfg-band__head {
    display: none;
}

@media (min-width: 601px) {
    .cfg-band {
        padding: 24px 0 32px;
        background: var(--cfg-gray);
        border-image: linear-gradient(var(--cfg-gray), var(--cfg-gray)) fill 0 / 0 / 0 100vw;
    }
}

/* Компьютер: колонка «заголовок + сцена» прилипает под шапкой сайта; шапка от 1367px прячется при прокрутке вниз
   (js/header-scroll.js), ниже — закреплена всегда */
@media (min-width: 1025px) {
    body:has(.header:not(.header--hidden)) .cfg-band {
        --cfg-top: 66px;
    }

    .cfg-band .deskcfg__view,
    .cfg-band .cfg-view {
        top: calc(var(--cfg-top) + 16px);
        transition: top .3s;
    }

    /* Призыв уже у заголовка — в итоге под кнопкой не повторяем */
    .cfg-band .deskcfg__offer p,
    .cfg-band .cfg-offer p {
        display: none;
    }
}

@media (min-width: 1025px) and (max-width: 1366px) {
    .cfg-band,
    body:has(.header:not(.header--hidden)) .cfg-band {
        --cfg-top: var(--mh-height, 60px);
    }
}

/* Сцена — чтобы шапка сайта, заголовок, сцена и поля вошли в экран */
@container (min-width: 900px) {
    .cfg-band .deskcfg__stage,
    .cfg-band .cfg-stage {
        height: min(680px, calc(100vh - 66px - 80px - 40px));
    }
}

/* Планшет: подложку даёт полоса — у колонки со сценой своей серой карточки нет */
@media (min-width: 601px) and (max-width: 1024px) {
    .cfg-band .deskcfg__view,
    .cfg-band .cfg-view {
        padding: 0;
        border-radius: 0;
        background: none;
    }
}

@media (max-width: 1024px) {
    .cfg-band__offer {
        display: none;
    }
}

/* Телефон: заголовок и конфигуратор — на серой полосе от края до края экрана, без скруглений.
   Полоса выходит за поля контейнера (контейнер по центру, поэтому 50% − 50vw = −поле) */
@media (max-width: 600px) {
    .cfg-band {
        margin-inline: calc(50% - 50vw);
        padding: 16px calc(50vw - 50%) 0;
        background: var(--cfg-gray);
    }

    .cfg-band__head {
        margin-bottom: 12px;
    }
}

/* ===== Каркас конфигуратора (терраса, забор; разметка — kit.php, поведение — shell.js) =====
   Повторяет стол (desk.css): слева липкая колонка «заголовок + сцена + итог», справа панель параметров;
   на широкой сцене плашка итога лежит поверх её низа, на узкой — под ней; телефон — всё в один экран, параметры в окне */
.cfg {
    display: grid;
    gap: 24px;
    align-items: start;
}

.cfg-view {
    position: sticky;
    top: 100px;
    container-type: inline-size;
}

.cfg-stage {
    position: relative;
    height: min(680px, calc(100vh - 120px));
    min-height: 480px;
}

.cfg-icon-collapse,
.cfg-full.is-active .cfg-icon-expand {
    display: none;
}

.cfg-full.is-active .cfg-icon-collapse {
    display: block;
}

/* Плашка итога: серая капсула с ценой и выгрузками, призыв и кнопка заявки */
.cfg-deal {
    position: relative;
    z-index: 3;
    display: flex;
    gap: 6px;
    margin-top: 12px;
    padding: 6px;
    border-radius: 28px;
    background: #fff;
    color: #262325;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}

.cfg-total {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px 14px;
    border-radius: 22px;
    background: #e8eae6;
}

/* Цена в «эникеях»: монетка крутится и цифры подсвечиваются, пока идёт пересчёт */
.cfg-price {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.cfg-price b {
    font-size: 48px;
    font-weight: 500;
    line-height: .9;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
    transition: color .3s;
}

.cfg-price-note {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
    line-height: 1.1;
}

.cfg-price-note small {
    font-size: 13px;
    color: #8a8d89;
}

.cfg-price-note > span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cfg-price-note em {
    font-style: normal;
}

.cfg-coin {
    width: 20px;
    height: 20px;
    flex: none;
    background: url("img/coin.svg") center / contain no-repeat;
}

.cfg-price.is-counting .cfg-coin {
    animation: cfg-coin .7s ease-out;
}

.cfg-price.is-up b {
    color: #5f8f36;
}

.cfg-price.is-down b {
    color: #c98a1c;
}

@keyframes cfg-coin {
    to { transform: rotateY(720deg); }
}

.cfg-exports {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cfg-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: #262325;
    color: var(--color-alt, #97bf74);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .2s, color .2s, transform .2s;
}

.cfg-export:hover,
.cfg-export[aria-expanded="true"] {
    background: var(--color-alt, #97bf74);
    color: #1d1f1d;
}

.cfg-export:active {
    transform: scale(.95);
}

/* «Поделиться» — всегда круглая иконка, подпись — в подсказке */
.cfg-export--round {
    width: 34px;
    padding: 0;
    justify-content: center;
}

.cfg-export--round span {
    display: none;
}

.cfg-export.is-flash {
    animation: cfg-flash .5s ease-out;
}

@keyframes cfg-flash {
    30% { transform: scale(.88); background: #fff; color: #1d1f1d; }
}

/* Пока готовится файл — иконка пульсирует */
.cfg-export.is-busy {
    pointer-events: none;
}

.cfg-export.is-busy svg {
    animation: cfg-busy .8s ease-in-out infinite alternate;
}

@keyframes cfg-busy {
    to { opacity: .2; transform: scale(.7); }
}

.cfg-offer {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    min-width: 250px;
    padding: 10px 10px 10px 14px;
}

.cfg-offer p {
    margin: 0;
    font-size: 14px;
    line-height: 1.35;
}

.cfg-offer .btn {
    align-self: stretch;
}

@container (min-width: 900px) {
    /* Плашка поверх сцены — одна строка по низу сцены: цена, выгрузки, «Хочу такой конфигуратор!» */
    .cfg-deal {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        align-items: center;
        margin: 0;
        gap: 12px;
        padding: 0 8px 8px;
        background: none;
        box-shadow: none;
    }

    .cfg-total {
        flex: 1;
        flex-direction: row;
        align-items: center;
        gap: 14px;
        padding: 6px 6px 6px 16px;
        border-radius: 999px;
    }

    .cfg-total .cfg-exports {
        margin-left: auto;
    }

    .cfg-price b {
        font-size: 40px;
    }

    .cfg-exports {
        flex-wrap: nowrap;
    }

    .cfg-offer {
        position: relative;
        flex: none;
        min-width: 0;
        padding: 0;
    }

    .cfg-offer p {
        position: absolute;
        top: calc(100% + 6px);
        right: -10px;
        width: max-content;
        padding: 6px 18px 14px;
        border-radius: 16px 0 20px 20px;
        background: #fff;
        font-size: 13px;
        box-shadow: 0 14px 24px rgba(0, 0, 0, .18);
        clip-path: inset(0 -30px -30px -30px);
    }
}

@container (max-width: 899px) {
    /* Итог под сценой лежит прямо на серой подложке, без своей карточки */
    .cfg-view .cfg-deal {
        background: none;
        border: 0;
        box-shadow: none;
    }

    .cfg-view .cfg-total {
        background: none;
    }

    .cfg-stage {
        height: min(560px, calc(100vh - 290px));
        min-height: 360px;
    }
}

@container (max-width: 640px) {
    .cfg-deal {
        flex-direction: column;
    }

    .cfg-offer {
        min-width: 0;
    }
}

@media (max-width: 1024px) {
    /* Сцена, разделы и итог — на общей светло-серой подложке */
    .cfg-view {
        position: relative;
        top: 0;
        padding: 8px;
        border-radius: 28px;
        background: #ecedea;
    }

    .cfg-stage {
        height: 460px;
        min-height: 0;
    }
}

/* Вкладки разделов, крестик окна, «смета» у цены и имя цвета в подписи — только на телефоне */
.cfg-tabs,
.cfg-close,
.cfg-price-note .cfg-price-more,
.cfg-swname-inline {
    display: none;
}

.cfg-panel [data-cfg-section][hidden] {
    display: none !important;
}

/* Телефон: сцена — квадрат, под ней кнопки разделов и итог; параметры раздела — окном поверх кнопок */
@media (max-width: 600px) {
    /* Два класса — чтобы перебить базовые стили сцены и панели конфигуратора (они подключаются после kit.css) */
    .cfg .cfg-stage {
        height: auto;
        min-height: 0;
        aspect-ratio: 1;
        border-radius: 20px;
    }

    .cfg-view {
        padding: 0;
        border-radius: 0;
        background: none;
    }

    /* Окно параметров — поверх блока кнопок разделов и в его размер (--sheet-top, --sheet-h задаёт скрипт);
       если раздел не помещается — вытягивается вниз до конца блока, дальше своя прокрутка */
    .cfg .cfg-panel {
        position: absolute;
        top: var(--sheet-top, 0px);
        left: 0;
        right: 0;
        min-height: var(--sheet-h, 0px);
        max-height: calc(100% - var(--sheet-top, 0px));
        z-index: 4;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: none;
        gap: 14px;
        padding: 16px 16px 18px;
        border: 0;
        border-radius: 20px;
        background: #1d1f1d;
        box-shadow: 0 -6px 20px rgba(0, 0, 0, .18);
        opacity: 0;
        transform: translateY(16px);
        visibility: hidden;
        transition: opacity .25s, transform .35s cubic-bezier(.22, 1, .36, 1), visibility 0s .35s;
    }

    .cfg .cfg-panel.is-open {
        opacity: 1;
        transform: none;
        visibility: visible;
        transition: opacity .25s, transform .35s cubic-bezier(.22, 1, .36, 1);
    }

    /* Первый заголовок окна — левее крестика */
    .cfg-panel [data-cfg-title] {
        padding-right: 44px;
    }

    .cfg-close {
        position: absolute;
        top: calc(var(--sheet-top, 0px) + 10px);
        right: 10px;
        z-index: 5;
        display: grid;
        place-items: center;
        width: 36px;
        height: 36px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: #3a3d3a;
        color: #fff;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
        opacity: 0;
        visibility: hidden;
        transform: translateY(16px);
        transition: opacity .2s, transform .35s cubic-bezier(.22, 1, .36, 1), visibility 0s .35s;
    }

    .cfg-view.has-sheet .cfg-close {
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: opacity .2s .1s, transform .35s cubic-bezier(.22, 1, .36, 1);
    }

    /* Ряды вариантов в окне — от края до края, листаются свайпом */
    .cfg-panel [data-cfg-swipe] {
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        margin-inline: -16px;
        padding-inline: 16px;
        scroll-padding-inline: 16px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
    }

    .cfg-panel [data-cfg-swipe]::-webkit-scrollbar {
        display: none;
    }

    .cfg-panel [data-cfg-swipe] > * {
        flex: none;
        scroll-snap-align: start;
    }

    /* Название выбранного цвета под кружками */
    .cfg-panel [data-cfg-swname] {
        display: block;
        margin-top: 10px;
        font-size: 13px;
        line-height: 1.3;
        color: rgba(255, 255, 255, .8);
    }

    /* …или прямо в строке подписи ряда, справа: «ЦВЕТ ........ Тик» — экономит строку в окне */
    .cfg-panel [data-cfg-swname].cfg-swname-inline {
        display: inline;
        float: right;
        margin: 0;
        font-size: 13px;
        font-weight: 400;
        letter-spacing: normal;
        text-transform: none;
        color: rgba(255, 255, 255, .6);
    }

    /* Цена открывает смету — подсказка «смета» под валютой */
    .cfg-price[data-cfg-price-section] {
        cursor: pointer;
    }

    .cfg-price-note .cfg-price-more {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-size: 11px;
        font-weight: 500;
        color: #5f8f36;
    }

    .cfg-price-more::after {
        content: "";
        width: 5px;
        height: 5px;
        border-right: 1.5px solid currentColor;
        border-bottom: 1.5px solid currentColor;
        transform: rotate(-45deg);
    }

    /* Кнопки разделов: две широкие пополам, три плитками */
    .cfg-tabs {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 6px;
        margin-top: 6px;
        padding: 6px;
        border-radius: 20px;
        background: #1d1f1d;
    }

    .cfg-tab {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        column-gap: 8px;
        row-gap: 3px;
        align-items: center;
        min-width: 0;
        border: 0;
        border-radius: 14px;
        background: rgba(255, 255, 255, .08);
        color: #fff;
        font: inherit;
        text-align: left;
        cursor: pointer;
        transition: background .2s, color .2s;
    }

    .cfg-tab:active {
        background: rgba(255, 255, 255, .16);
    }

    .cfg-tab.is-active {
        background: var(--color-alt, #97bf74);
        color: #1d1f1d;
    }

    .cfg-tab--color {
        grid-column: span 3;
        grid-template-areas: "label label" "ico value";
        padding: 8px 12px 9px;
    }

    .cfg-tab.cfg-tab--color small {
        grid-area: label;
        font-size: 10px;
        font-weight: 500;
        letter-spacing: .06em;
        text-transform: uppercase;
        color: var(--color-alt, #97bf74);
        opacity: 1;
    }

    .cfg-tab--color.is-active.cfg-tab small {
        color: inherit;
    }

    .cfg-tab--color .cfg-tab-ico {
        grid-area: ico;
    }

    .cfg-tab.cfg-tab--color b {
        grid-area: value;
        font-size: 13px;
    }

    .cfg-tab--main {
        grid-column: span 2;
        grid-template-columns: minmax(0, 1fr);
        justify-items: center;
        row-gap: 2px;
        padding: 10px 4px 9px;
        text-align: center;
    }

    .cfg-tab-ico {
        display: grid;
        place-items: center;
        height: 26px;
    }

    .cfg-tab-ico svg {
        width: 31px;
        height: 26px;
    }

    .cfg-tab--color .cfg-tab-ico svg {
        width: 26px;
        height: 22px;
    }

    .cfg-tab-sw {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background: var(--sw) center / cover;
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3);
    }

    /* Плюсик вкладки «Опции» */
    .cfg-tab-plus {
        position: relative;
        width: 22px;
        height: 22px;
        border-radius: 50%;
        background: rgba(255, 255, 255, .1);
    }

    .cfg-tab-plus::before,
    .cfg-tab-plus::after {
        content: "";
        position: absolute;
        left: 50%;
        top: 50%;
        width: 10px;
        height: 2px;
        margin: -1px 0 0 -5px;
        border-radius: 1px;
        background: currentColor;
    }

    .cfg-tab-plus::after {
        transform: rotate(90deg);
    }

    .cfg-tab small {
        font-size: 10px;
        line-height: 1.2;
        letter-spacing: .02em;
        opacity: .7;
    }

    .cfg-tab b {
        max-width: 100%;
        overflow: hidden;
        font-size: 11px;
        font-weight: 500;
        line-height: 1.2;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    /* Итог — две строки: цена с кнопками-иконками и кнопка заявки */
    .cfg-deal {
        flex-direction: column;
        gap: 4px;
        margin-top: 6px;
        padding: 0;
    }

    .cfg-total {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        padding: 6px 0 2px 4px;
        border-radius: 16px;
    }

    .cfg-price {
        gap: 6px;
    }

    .cfg-price b {
        font-size: 28px;
    }

    .cfg-price-note small {
        display: none;
    }

    .cfg-price-note {
        font-size: 12px;
    }

    .cfg-coin {
        width: 16px;
        height: 16px;
    }

    .cfg-exports {
        flex-wrap: nowrap;
        gap: 4px;
    }

    .cfg-export {
        justify-content: center;
        width: 32px;
        height: 32px;
        padding: 0;
    }

    .cfg-export span {
        display: none;
    }

    /* Призыв — под серой полосой, на белом во всю ширину экрана */
    .cfg-offer {
        min-width: 0;
        gap: 12px;
        margin: 6px calc(50% - 50vw) 0;
        padding: 20px calc(50vw - 50%) 0;
        background: #fff;
    }
}

/* «На весь экран»: только конфигуратор — сцена тянется на всю высоту, панель справа прокручивается своя.
   position: fixed — для iPhone, где Fullscreen API для блоков нет; в настоящем полноэкранном режиме не мешает */
html.cfg-lock,
html.cfg-lock body {
    overflow: hidden;
}

.cfg.is-full {
    position: fixed;
    inset: 0;
    z-index: 10000;
    width: auto;
    height: 100%;
    max-width: none;
    margin: 0;
    padding: 16px;
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    overflow: hidden;
    background: #ecedea;
}

.cfg.is-full .cfg-view {
    position: relative;
    top: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.cfg.is-full .cfg-stage {
    flex: 1;
    height: auto;
    min-height: 240px;
    aspect-ratio: auto;
}

.cfg.is-full > .cfg-panel {
    max-height: 100%;
    overflow-y: auto;
}

@media (min-width: 601px) and (max-width: 1024px) {
    .cfg.is-full {
        grid-template-rows: auto;
        overflow: auto;
    }

    .cfg.is-full .cfg-view {
        height: calc(100dvh - 32px);
    }

    .cfg.is-full > .cfg-panel {
        max-height: none;
    }
}

@media (max-width: 600px) {
    .cfg.is-full {
        padding: 8px;
    }
}

/* Стрелки прокрутки рядов (rails.js): только на устройствах с мышью, появляются при наведении на ряд.
   Высота стрелки — --cfg-arrow-top (по умолчанию середина ряда; для карточек — середина снимка) */
.cfg-rail {
    position: relative;
}

.cfg-arrow {
    position: absolute;
    z-index: 2;
    top: var(--cfg-arrow-top, calc(50% - 18px));
    right: -6px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d1f1d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5l7 7-7 7'/%3E%3C/svg%3E") center / 20px no-repeat;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, background-color .2s;
}

.cfg-arrow--prev {
    right: auto;
    left: -6px;
    transform: scaleX(-1);
}

.cfg-arrow[hidden] {
    display: none;
}

.cfg-arrow:hover {
    background-color: var(--color-alt, #97bf74);
}

@media (hover: hover) and (pointer: fine) {
    .cfg-rail:hover .cfg-arrow {
        opacity: 1;
        pointer-events: auto;
    }
}
