/* =====================================================================
   Add-to-cart popup (рынок PL / акции с подарками) — см. modules/atcpopup/
   Токены скопированы из макета Black Month, чтобы не зависеть от .bw
   Разметка: betta/atcpopup.htm — новый дизайн, atcpopup.htm — старый
   (класс atcp-ov--alpha, стили alpha в конце файла).
   ===================================================================== */
body.atcp-lock {
    overflow: hidden;
}

.atcp-ov {
    --atcp-red: #F5372A;
    --atcp-red-h: #E02818;
    --atcp-night: #0F142B;
    --atcp-asphalt: #262B40;
    --atcp-g1: #ECEDEE;
    --atcp-g2: #D4D6DE;
    --atcp-g3: #828595;
    --atcp-g4: #474B62;
    --atcp-pale: #FEEBEA;
    --atcp-success: #2E7349;
    --atcp-ease: cubic-bezier(.2, .7, .2, 1);
    --atcp-r-card: 18px;
    --atcp-r-tile: 12px;
    --atcp-r-sheet: 24px;
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    /* Betta задаёт h1–h4 свой шрифт (degblack/degbold) — внутри попапа он не нужен */
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 500;
}

.atcp-ov h2,
.atcp-ov h3,
.atcp-ov p,
.atcp-ov dl,
.atcp-ov dt,
.atcp-ov dd,
.atcp-ov summary,
.atcp-ov strong {
    font-family: inherit;
}

.atcp-ov__scrim {
    position: absolute;
    inset: 0;
    background: rgba(15, 20, 43, .55);
    opacity: 0;
    transition: opacity .22s var(--atcp-ease);
}

.atcp-ov.is-open .atcp-ov__scrim {
    opacity: 1;
}

.atcp {
    position: relative;
    width: min(560px, 100%);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: var(--atcp-r-sheet);
    box-shadow: 0 24px 64px rgba(15, 20, 43, .28);
    opacity: 0;
    transform: translateY(10px) scale(.96);
    transition: opacity .2s var(--atcp-ease), transform .26s var(--atcp-ease);
    outline: none;
    color: var(--atcp-asphalt);
    text-align: left;
}

.atcp-ov.is-open .atcp {
    opacity: 1;
    transform: none;
}

.atcp__handle {
    display: none;
    width: 44px;
    height: 5px;
    border-radius: 99px;
    background: var(--atcp-g2);
    margin: 10px auto 0;
}

.atcp__grab {
    touch-action: none;
    flex: none;
}

.atcp__head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 28px 28px 18px;
}

.atcp__ok {
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--atcp-success);
    display: grid;
    place-items: center;
    color: #fff;
}

.atcp__ok svg {
    width: 24px;
    height: 24px;
}

.atcp__ok path {
    stroke-dasharray: 24;
    stroke-dashoffset: 0;
}

.atcp-ov.is-open .atcp__ok {
    animation: atcpOkPop .45s var(--atcp-ease) both;
}

.atcp-ov.is-open .atcp__ok path {
    animation: atcpOkDraw .4s .18s var(--atcp-ease) both;
}

@keyframes atcpOkPop {
    0% { transform: scale(.4); opacity: 0; }
    60% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}

@keyframes atcpOkDraw {
    from { stroke-dashoffset: 24; }
    to { stroke-dashoffset: 0; }
}

.atcp__title {
    font-weight: 800;
    font-size: 30px;
    line-height: 1.05;
    letter-spacing: -.015em;
    flex: 1;
    min-width: 0;
    margin: 0;
}

.atcp__x {
    flex: none;
    align-self: flex-start;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 0;
    background: var(--atcp-red);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background .15s, transform .15s;
}

.atcp__x:hover {
    background: var(--atcp-red-h);
    transform: rotate(90deg);
}

.atcp__x svg {
    width: 14px;
    height: 14px;
}

.atcp__body {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overscroll-behavior: contain;
    min-height: 0;
}

.atcp__promo {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Без активной акции блок промо не рендерится — убираем и его отступ */
.atcp__promo:empty {
    display: none;
}

.atcp__cta {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 22px 28px 28px;
    flex: none;
}

.atcp__cta-row {
    display: flex;
    gap: 14px;
}

.atcp__cta .atcp-btn--ghost {
    flex: 1 1 0;
}

.atcp__cta .atcp-btn--primary {
    flex: 1.25 1 0;
}

/* Ссылка «Przejdź do koszyka» под кнопками (акция активна, подарок доступен) */
.atcp__cart-link {
    align-self: center;
    font-size: 13px;
    font-weight: 800;
    color: var(--atcp-night);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 2px;
}

.atcp__cart-link:hover {
    color: var(--atcp-red);
    text-decoration-color: var(--atcp-red);
}

/* --- Кнопки --- */
.atcp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 22px;
    border-radius: 99px;
    border: 2px solid transparent;
    /* кнопки могут быть ссылками — подчёркивание берём только у .atcp__cart-link */
    text-decoration: none;
    font-family: inherit;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: .02em;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.15;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s, transform .1s, box-shadow .15s;
}

.atcp-btn:hover {
    text-decoration: none;
}

.atcp-btn:active {
    transform: scale(.98);
}

.atcp-btn--primary {
    background: var(--atcp-red);
    border-color: var(--atcp-red);
    color: #fff;
}

.atcp-btn--primary:hover {
    background: var(--atcp-red-h);
    border-color: var(--atcp-red-h);
    box-shadow: 0 6px 18px rgba(245, 55, 42, .28);
}

.atcp-btn--ghost {
    background: #fff;
    color: var(--atcp-night);
    border-color: var(--atcp-night);
}

.atcp-btn--ghost:hover {
    background: var(--atcp-night);
    color: #fff;
}

/* --- Карточка добавленного товара --- */
.atcp-pc {
    display: grid;
    grid-template-columns: 68px minmax(0, 1fr) auto;
    gap: 6px 16px;
    align-items: center;
    background: var(--atcp-g1);
    border-radius: var(--atcp-r-card);
    padding: 14px 18px 14px 14px;
}

.atcp-pc__img {
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    background: #fff;
    border-radius: var(--atcp-r-tile);
    overflow: hidden;
}

.atcp-pc__img img {
    max-width: 56px;
    max-height: 56px;
    object-fit: contain;
}

/* Слои конструктора PDP (#constructorimage1/2/3): накладываются друг на друга,
   как в .image_container_constructor на карточке товара. */
.atcp-pc__img--layers {
    display: block;
    position: relative;
}

.atcp-pc__img .atcp-pc__layer {
    position: absolute;
    top: 6px;
    left: 6px;
    width: calc(100% - 12px);
    height: calc(100% - 12px);
    max-width: none;
    max-height: none;
    object-fit: contain;
    background: transparent;
    border-radius: 0;
}

.atcp-pc__info {
    min-width: 0;
}

/* 1. Категория — крупно и жирно */
.atcp-pc__cat {
    font-size: 15px;
    font-family: 'degbold';
    line-height: 1.25;
    margin: 0;
    overflow-wrap: anywhere;
}

/* 2. Название модели — обычным текстом под категорией */
.atcp-pc__title {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
    margin: 2px 0 0;
    overflow-wrap: anywhere;
}

/* 3. Опции (все выбранные, без ограничения по строкам) */
.atcp-pc__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1px 12px;
    font-size: 12.5px;
    color: var(--atcp-g4);
    line-height: 1.45;
    margin: 4px 0 0;
}

.atcp-pc__meta span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.atcp-pc__dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(15, 20, 43, .18);
    vertical-align: -1px;
}

/* 4. Количество — отдельной строкой под опциями */
.atcp-pc__count {
    margin: 6px 0 0;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.3;
}

.atcp-pc__price {
    text-align: right;
    white-space: nowrap;
    align-self: center;
}

.atcp-pc__price b {
    display: block;
    font-weight: 800;
    font-size: 21px;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.atcp-pc__price s {
    display: block;
    font-size: 12px;
    color: var(--atcp-g3);
    font-weight: 600;
}

.atcp-pc__price small {
    display: block;
    font-size: 11.5px;
    color: var(--atcp-g4);
    font-weight: 500;
    margin-top: 2px;
}

.atcp-pc__price.is-promo b {
    color: var(--atcp-red);
}

.atcp-pc__save {
    grid-column: 2 / -1;
    margin: -2px 0 0;
    font-size: 12px;
    font-style: italic;
    font-weight: 700;
    color: var(--atcp-g4);
}

.atcp-pc__details {
    grid-column: 1 / -1;
}

.atcp-pc__more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0 0;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--atcp-night);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--atcp-g3);
    min-height: 28px;
    cursor: pointer;
    list-style: none;
}

.atcp-pc__more::-webkit-details-marker {
    display: none;
}

.atcp-pc__more svg {
    width: 12px;
    height: 12px;
    transition: transform .25s var(--atcp-ease);
}

.atcp-pc__details[open] .atcp-pc__more svg {
    transform: rotate(180deg);
}

/* Состав комплекта и доп. товары: «название … цена до скидки» */
.atcp-pc__set {
    list-style: none;
    margin: 8px 0 0;
    padding: 8px 0 0;
    border-top: 1px solid var(--atcp-g2);
}

.atcp-pc__set li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 3px 0;
    font-size: 13px;
    line-height: 1.35;
}

.atcp-pc__set-n {
    min-width: 0;
    overflow-wrap: anywhere;
}

.atcp-pc__set-n small {
    display: block;
    margin-top: 1px;
    font-size: 12px;
    color: var(--atcp-g4);
}

.atcp-pc__set-p {
    flex: none;
    font-weight: 700;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.atcp-pc__extra {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed var(--atcp-g2);
}

.atcp-pc__extra-k {
    margin: 0;
    font-size: 12.5px;
    font-weight: 800;
}

.atcp-pc__extra .atcp-pc__set {
    margin-top: 0;
    padding-top: 4px;
    border-top: 0;
}

/* --- Сообщение акции --- */
.atcp-pm {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: var(--atcp-pale);
    border-radius: var(--atcp-r-card);
    padding: 16px 20px;
    font-size: 14.5px;
    line-height: 1.45;
}

.atcp-pm svg {
    flex: none;
    width: 26px;
    height: 26px;
    color: var(--atcp-red);
    margin-top: -1px;
}

.atcp-pm p {
    margin: 0;
}

.atcp-pm b {
    font-weight: 800;
}

/* --- Прогресс до следующего подарка --- */
.atcp-gb {
    position: relative;
    overflow: hidden;
    background: var(--atcp-night);
    color: #fff;
    border-radius: var(--atcp-r-card);
    padding: 16px 20px 18px;
}

.atcp-gb__row {
    display: flex;
    gap: 14px;
    align-items: center;
}

.atcp-gb__tile {
    position: relative;
    flex: none;
    width: 46px;
    height: 46px;
    border-radius: var(--atcp-r-tile);
    background: var(--atcp-asphalt);
    display: grid;
    place-items: center;
    color: #fff;
}

.atcp-gb__tile img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    transition: filter .3s, opacity .3s;
}

.atcp-gb__tile > svg {
    width: 24px;
    height: 24px;
    opacity: .8;
}

.atcp-gb__badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    box-shadow: 0 0 0 2px var(--atcp-night);
    color: #fff;
}

.atcp-gb__badge > svg {
    width: 8px;
    height: 8px;
    opacity: 1;
}

.atcp-gb__badge--lock {
    background: var(--atcp-g4);
}

.atcp-gb__badge--ok {
    background: var(--atcp-red);
}

.atcp-gb.is-locked .atcp-gb__tile img {
    filter: grayscale(1);
    opacity: .55;
}

.atcp-gb__txt {
    min-width: 0;
    flex: 1;
}

.atcp-gb__title {
    margin: 0;
    font-weight: 800;
    font-size: 14.5px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.atcp-gb__sub {
    margin: 3px 0 0;
    font-size: 13px;
    line-height: 1.35;
    color: rgba(255, 255, 255, .8);
    overflow-wrap: anywhere;
}

.atcp-gb__bar {
    height: 6px;
    border-radius: 99px;
    background: var(--atcp-asphalt);
    margin-top: 14px;
    overflow: hidden;
}

.atcp-gb__fill {
    height: 100%;
    width: 0;
    border-radius: 99px;
    background: var(--atcp-red);
    transition: width .7s var(--atcp-ease);
}

/* --- Мобилка: bottom sheet --- */
@media (max-width: 767px) {
    .atcp-ov {
        align-items: flex-end;
        /* лист не прилипает к самому низу: видно скругление нижних углов,
           env() учитывает домашнюю полоску iPhone */
        padding: 0 0 max(12px, env(safe-area-inset-bottom));
    }

    .atcp {
        width: 100%;
        max-height: 92dvh;
        /* скругляем все углы, включая нижние (раньше низ был прямым) */
        border-radius: var(--atcp-r-sheet);
        transform: translateY(40px);
        padding-bottom: 0;
    }

    .atcp-ov.is-open .atcp {
        transform: none;
    }

    .atcp__handle {
        display: block;
    }

    .atcp__head {
        padding: 12px 18px 14px;
        gap: 12px;
    }

    .atcp__ok {
        width: 38px;
        height: 38px;
    }

    .atcp__ok svg {
        width: 21px;
        height: 21px;
    }

    .atcp__title {
        font-size: 25px;
    }

    .atcp__x {
        width: 30px;
        height: 30px;
        align-self: center;
    }

    .atcp__body {
        padding: 0 18px;
        gap: 12px;
    }

    .atcp__promo {
        gap: 12px;
    }

    .atcp__cta {
        gap: 10px;
        /* отступ снизу без env(): safe-area уже учтён в .atcp-ov */
        padding: 16px 18px 18px;
        box-shadow: 0 -1px 0 var(--atcp-g1);
    }

    .atcp__cta-row {
        flex-direction: column-reverse;
        gap: 10px;
    }

    .atcp__cta .atcp-btn {
        width: 100%;
        flex: none;
        min-height: 52px;
    }

    .atcp-pc {
        grid-template-columns: 56px minmax(0, 1fr) auto;
        padding: 12px 14px 12px 12px;
    }

    .atcp-pc__img {
        width: 56px;
        height: 56px;
    }

    .atcp-pc__img img {
        max-width: 46px;
        max-height: 46px;
    }

    .atcp-pc__price b {
        font-size: 18px;
    }
}

@media (max-width: 374px) {
    .atcp__title {
        font-size: 20px;
    }

    .atcp__head {
        gap: 10px;
        padding: 10px 16px 12px;
    }

    .atcp__ok {
        width: 30px;
        height: 30px;
    }

    .atcp__ok svg {
        width: 17px;
        height: 17px;
    }

    .atcp__x {
        width: 28px;
        height: 28px;
    }

    .atcp__body {
        padding: 0 14px;
    }

    .atcp__cta {
        /* отступ снизу без env(): safe-area уже учтён в .atcp-ov */
        padding: 14px 14px 16px;
    }
}

/* =====================================================================
   Старый дизайн (Alpha) — шаблон modules/atcpopup/atcpopup.htm,
   класс-модификатор atcp-ov--alpha.

   Геометрия и состояния те же, что на betta; меняются только шрифты,
   цвета-токены и скругления под старый дизайн:
     · шрифты alpha подключены как 'light' (Inter Medium) и 'bold' (Inter Bold),
       у обоих начертание normal — «жирное» набираем семейством 'bold';
     · кнопки старого дизайна: degblack, uppercase, рамка 2px night-blue,
       радиус 3rem (см. .order_button / .sendbtn в css/css.css);
     · карточки — белые с рамкой 2px по --color-gray-1.
   Правила не трогают отступы/размеры: они общие и переопределяются
   в мобильном блоке выше.
   ===================================================================== */
.atcp-ov--alpha {
    --atcp-red: var(--color-fast-red, #F5372A);
    --atcp-red-h: #E02818;
    --atcp-night: var(--color-night-blue, #0F142B);
    --atcp-asphalt: var(--color-a-g, #262B40);
    --atcp-g1: var(--color-gray-1, #ECEDEE);
    --atcp-g2: var(--color-gray-2, #D4D6DE);
    --atcp-g3: var(--color-gray-3, #828595);
    --atcp-g4: var(--color-gray-4, #474B62);
    --atcp-pale: var(--color-pale-red, #FEEBEA);
    --atcp-success: #2E7349;
    --atcp-r-card: 14px;
    --atcp-r-tile: 8px;
    --atcp-r-sheet: 22px;
    font-family: 'light', Arial, 'Times New Roman', Times, serif;
    font-weight: normal;
}

/* «Жирный» текст старого дизайна — семейством 'bold' (Inter-Bold с normal) */
.atcp-ov--alpha .atcp__title,
.atcp-ov--alpha .atcp-pc__title,
.atcp-ov--alpha .atcp-pc__count,
.atcp-ov--alpha .atcp-pc__price b,
.atcp-ov--alpha .atcp-pc__save,
.atcp-ov--alpha .atcp-pc__more,
.atcp-ov--alpha .atcp-pc__set-p,
.atcp-ov--alpha .atcp-pc__extra-k,
.atcp-ov--alpha .atcp-pm b,
.atcp-ov--alpha .atcp-gb__title,
.atcp-ov--alpha .atcp__cart-link {
    font-family: 'bold', Arial, 'Times New Roman', Times, serif;
    font-weight: normal;
}

.atcp-ov--alpha .atcp-pc__count,
.atcp-ov--alpha .atcp-pc__set-p,
.atcp-ov--alpha .atcp-pc__price b,
.atcp-ov--alpha .atcp-pc__save {
    font-variant-numeric: tabular-nums;
}

/* Кнопки как .order_button в старом дизайне */
.atcp-ov--alpha .atcp-btn {
    font-family: 'degblack', 'bold', Arial, sans-serif;
    font-size: 16px;
    letter-spacing: .1rem;
    border-radius: 3rem;
    border-width: 2px;
    border-style: solid;
    text-transform: uppercase;
}

.atcp-ov--alpha .atcp-btn--primary {
    border-color: var(--atcp-night);
}

.atcp-ov--alpha .atcp-btn--primary:hover {
    border-color: var(--atcp-red-h);
}

.atcp-ov--alpha .atcp-btn--ghost {
    background: #fff;
    color: var(--atcp-night);
    border-color: var(--atcp-night);
}

.atcp-ov--alpha .atcp-btn--ghost:hover {
    background: var(--atcp-night);
    color: #fff;
}

/* Карточка товара: белая с серой рамкой, как блоки старого дизайна */
.atcp-ov--alpha .atcp-pc {
    background: #fff;
    border: 2px solid var(--atcp-g1);
    border-radius: var(--atcp-r-card);
}

.atcp-ov--alpha .atcp-pc__img {
    background: var(--atcp-g1);
}

.atcp-ov--alpha .atcp-pc__price s {
    font-weight: normal;
}

.atcp-ov--alpha .atcp-pc__save {
    font-style: normal;
}

.atcp-ov--alpha .atcp__cart-link {
    text-decoration-thickness: 1px;
}

