/*
 * Слайдер на главной (includes/smt-slider.php, js/smt-slider.js) — на месте баннера в .smt-hero.
 * Прокрутка — scroll-snap (свайп на телефоне — сам браузер), переключатели — точки с полоской времени,
 * анимация текста при появлении слайда. Размеры карточек товаров внутри — по ширине самого слайдера
 * (container queries), а не экрана: на компьютере слайдер в половину ширины, на планшете — во всю.
 */

.smt-slider {
    grid-column: span 2;
    position: relative;
    min-width: 0;
    min-height: 320px;
    border-radius: var(--smt-radius-l);
    overflow: hidden;
    background: var(--smt-dark);
    container-type: inline-size;
    isolation: isolate;
}

.smt-slider__track {
    display: flex;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
}

.smt-slider__track::-webkit-scrollbar {
    display: none;
}

/* ---------- слайд ---------- */

.smt-slide {
    position: relative;
    flex: 0 0 100%;
    min-width: 0;
    min-height: 320px;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 32px 40px 68px;
    box-sizing: border-box;
    overflow: hidden;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    color: #FFFFFF;
    text-decoration: none;
}

.smt-slider.is-single .smt-slide {
    padding-bottom: 32px;
}

.smt-slide--dark {
    background: radial-gradient(120% 140% at 100% 0%, #2A2D34 0%, #16181D 62%);
}

.smt-slide--red {
    background: radial-gradient(120% 150% at 100% 0%, #E94B48 0%, #B3302D 45%, #5E1412 100%);
}

.smt-slide--green {
    background: radial-gradient(120% 150% at 100% 0%, #31A866 0%, #1F7A46 45%, #0C341E 100%);
}

.smt-slide--light {
    background: linear-gradient(135deg, #FFFFFF 0%, #EEF0F3 100%);
    color: var(--smt-text);
}

/* фоновая картинка справа под затемнением (как прежний баннер) */
.smt-slide__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-size: cover;
    background-position: right center;
    transform: scale(1.06);
    transition: transform 7s ease-out;
}

.smt-slide__bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(22, 24, 29, .97) 0%, rgba(22, 24, 29, .9) 50%, rgba(22, 24, 29, .35) 100%);
}

.smt-slide--red .smt-slide__bg::after {
    background: linear-gradient(90deg, rgba(110, 23, 21, .97) 0%, rgba(179, 48, 45, .88) 50%, rgba(179, 48, 45, .3) 100%);
}

.smt-slide--green .smt-slide__bg::after {
    background: linear-gradient(90deg, rgba(12, 52, 30, .97) 0%, rgba(31, 122, 70, .88) 50%, rgba(31, 122, 70, .3) 100%);
}

.smt-slide--light .smt-slide__bg::after {
    background: linear-gradient(90deg, rgba(255, 255, 255, .98) 0%, rgba(255, 255, 255, .9) 50%, rgba(255, 255, 255, .2) 100%);
}

.smt-slide.is-active .smt-slide__bg {
    transform: scale(1);
}

/* декор слайдов без картинки: мягкое свечение справа и тонкое кольцо */
.smt-slide--banner:not(.has-bg)::before,
.smt-slide--products::before {
    content: "";
    position: absolute;
    top: -30%;
    right: -12%;
    width: 70%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, .16) 0%, rgba(255, 255, 255, 0) 65%);
    pointer-events: none;
}

.smt-slide--banner:not(.has-bg)::after {
    content: "";
    position: absolute;
    right: 6%;
    bottom: -38%;
    width: 46%;
    aspect-ratio: 1;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 50%;
    pointer-events: none;
}

.smt-slide--light.smt-slide--banner::before,
.smt-slide--light.smt-slide--products::before {
    background: radial-gradient(circle, rgba(210, 59, 56, .1) 0%, rgba(210, 59, 56, 0) 65%);
}

.smt-slide--light.smt-slide--banner::after {
    border-color: rgba(22, 24, 29, .08);
}

/* крупная иконка справа в стеклянном круге, слегка «парит» */
.smt-slide__art {
    position: relative;
    z-index: 1;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 190px;
    height: 190px;
    margin-left: auto;
    margin-right: 10px;
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .04));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22), 0 24px 60px rgba(0, 0, 0, .25);
    color: #FFFFFF;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    transform: scale(.9);
    transition: opacity .6s ease .15s, transform .8s cubic-bezier(.2, .7, .2, 1) .15s;
}

.smt-slide__art svg {
    width: 92px;
    height: 92px;
    animation: smt-slide-float 5s ease-in-out infinite;
}

.smt-slide.is-active .smt-slide__art,
.smt-slider:not(.is-ready) .smt-slide:first-child .smt-slide__art {
    opacity: 1;
    transform: none;
}

.smt-slide--light .smt-slide__art {
    background: linear-gradient(145deg, #FFFFFF, #F4F5F7);
    box-shadow: inset 0 0 0 1px var(--smt-border), 0 20px 50px rgba(22, 24, 29, .1);
    color: var(--smt-primary);
}

@keyframes smt-slide-float {
    50% { transform: translateY(-6px) rotate(-3deg); }
}

.smt-slide__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    max-width: 540px;
}

.smt-slide--products .smt-slide__content {
    flex: 0 0 38%;
    max-width: none;
}

.smt-slide__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.smt-slide__eyebrow::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #F5C33B;
    box-shadow: 0 0 0 3px rgba(245, 195, 59, .25);
}

.smt-slide--light .smt-slide__eyebrow {
    background: var(--smt-accent-soft);
    color: var(--smt-primary-hover);
}

.smt-slide--light .smt-slide__eyebrow::before {
    background: var(--smt-primary);
    box-shadow: 0 0 0 3px rgba(210, 59, 56, .18);
}

.smt-slide__title {
    margin: 0 !important;
    color: inherit !important;
    font-size: 34px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -.02em;
}

.smt-slide--products .smt-slide__title {
    font-size: 28px;
}

.smt-slide__text {
    margin: 0;
    color: var(--smt-on-dark);
    font-size: 16px;
    line-height: 1.5;
}

.smt-slide--red .smt-slide__text,
.smt-slide--green .smt-slide__text {
    color: rgba(255, 255, 255, .85);
}

.smt-slide--light .smt-slide__text {
    color: var(--smt-text-2);
}

.smt-slide__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.smt-slide--red .smt-btn--primary,
.smt-slide--green .smt-btn--primary {
    background: #FFFFFF;
    color: var(--smt-text);
}

.smt-slide--red .smt-btn--primary:hover,
.smt-slide--green .smt-btn--primary:hover {
    background: #F4F5F7;
    color: var(--smt-text);
}

/* таймер «До конца» */
.smt-slide__timer {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--smt-mono);
}

.smt-slide__timer-label {
    margin-right: 6px;
    font-family: var(--smt-font);
    font-size: 13px;
    font-weight: 700;
    opacity: .8;
}

.smt-slide__timer b {
    min-width: 38px;
    padding: 6px 0;
    border-radius: 9px;
    background: rgba(255, 255, 255, .14);
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.smt-slide__timer i {
    font-style: normal;
    font-weight: 700;
    opacity: .6;
}

.smt-slide--light .smt-slide__timer b {
    background: var(--smt-surface);
    box-shadow: inset 0 0 0 1px var(--smt-border);
}

/* карточки товаров в слайде */
.smt-slide__products {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    gap: 12px;
    align-items: stretch;
}

.smt-slide__products--1 {
    grid-template-columns: minmax(0, 240px);
    justify-content: end;
}

.smt-slide__products--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.smt-slide__products--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.smt-slide .smt-pcard {
    color: var(--smt-text);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
    border-color: transparent;
}

.smt-slide--light .smt-pcard {
    box-shadow: 0 6px 20px rgba(22, 24, 29, .08);
    border-color: var(--smt-border);
}

.smt-slide .smt-pcard__pic {
    height: 120px;
}

/* картинка целиком */
.smt-slide--image {
    padding: 0;
    background: var(--smt-dark);
}

.smt-slide--image picture,
.smt-slide--image img {
    display: block;
    width: 100%;
    height: 100%;
}

.smt-slide--image img {
    position: absolute;
    inset: 0;
    object-fit: cover;
}

/* ---------- появление: текст снизу, карточки справа, по очереди ---------- */

.smt-slide__content > *,
.smt-slide__products > * {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .55s ease, transform .65s cubic-bezier(.2, .7, .2, 1);
}

.smt-slide__products > * {
    transform: translateX(24px);
}

.smt-slide.is-active .smt-slide__content > *,
.smt-slide.is-active .smt-slide__products > *,
.smt-slider:not(.is-ready) .smt-slide:first-child .smt-slide__content > *,
.smt-slider:not(.is-ready) .smt-slide:first-child .smt-slide__products > * {
    opacity: 1;
    transform: none;
}

.smt-slide.is-active .smt-slide__content > :nth-child(2) { transition-delay: .06s; }
.smt-slide.is-active .smt-slide__content > :nth-child(3) { transition-delay: .12s; }
.smt-slide.is-active .smt-slide__content > :nth-child(4) { transition-delay: .18s; }
.smt-slide.is-active .smt-slide__content > :nth-child(5) { transition-delay: .24s; }
.smt-slide.is-active .smt-slide__products > :nth-child(1) { transition-delay: .15s; }
.smt-slide.is-active .smt-slide__products > :nth-child(2) { transition-delay: .25s; }
.smt-slide.is-active .smt-slide__products > :nth-child(3) { transition-delay: .35s; }

/* ---------- переключатели ---------- */

.smt-slider__nav {
    position: absolute;
    left: 40px;
    right: 20px;
    bottom: 20px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    --smt-nav: #FFFFFF;
    --smt-nav-dim: rgba(255, 255, 255, .32);
    --smt-nav-bg: rgba(255, 255, 255, .14);
    --smt-nav-bg-hover: rgba(255, 255, 255, .26);
}

.smt-slider[data-tone="light"] .smt-slider__nav {
    --smt-nav: var(--smt-text);
    --smt-nav-dim: rgba(22, 24, 29, .2);
    --smt-nav-bg: rgba(22, 24, 29, .06);
    --smt-nav-bg-hover: rgba(22, 24, 29, .12);
}

.smt-slider__nav > * {
    pointer-events: auto;
}

.smt-slider__dots {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: auto;
}

.smt-slider__dot {
    position: relative;
    width: 8px;
    height: 8px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: var(--smt-nav-dim);
    overflow: hidden;
    cursor: pointer;
    transition: width .35s cubic-bezier(.2, .7, .2, 1), background-color .2s;
}

/* увеличенная зона нажатия — точку легко попасть пальцем */
.smt-slider__dot::before {
    content: "";
    position: absolute;
    inset: -10px -4px;
}

.smt-slider__dot:hover {
    background: var(--smt-nav-bg-hover);
}

.smt-slider__dot.is-active {
    width: 36px;
    background: var(--smt-nav-dim);
}

/* полоска времени до следующего слайда */
.smt-slider__dot span {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    background: var(--smt-nav);
}

.smt-slider__dot.is-active span {
    width: 100%;
}

.smt-slider.is-auto .smt-slider__dot.is-active span {
    width: 0;
    animation: smt-slider-progress var(--smt-slider-time, 7s) linear forwards;
}

.smt-slider.is-paused .smt-slider__dot.is-active span {
    animation-play-state: paused;
}

@keyframes smt-slider-progress {
    to { width: 100%; }
}

.smt-slider__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--smt-nav-bg);
    color: var(--smt-nav);
    cursor: pointer;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition: background-color .2s, transform .15s;
}

.smt-slider__arrow:hover {
    background: var(--smt-nav-bg-hover);
}

.smt-slider__arrow:active {
    transform: scale(.94);
}

/* ---------- узкий слайдер (компьютер — половина ширины): 2 карточки вместо 3 ---------- */

@container (max-width: 900px) {
    .smt-slide__products--3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .smt-slide__products--3 > :nth-child(3) {
        display: none;
    }
}

/* ---------- совсем узкий (телефон): текст сверху, карточки лентой ---------- */

@container (max-width: 620px) {
    .smt-slide {
        flex-direction: column;
        align-items: stretch;
        justify-content: center;
        gap: 16px;
        padding: 24px 20px 60px;
    }

    .smt-slide__title {
        font-size: 24px;
    }

    /* иконка на телефоне — маленькая, в углу, за текстом */
    .smt-slide__art {
        position: absolute;
        top: 16px;
        right: 16px;
        width: 64px;
        height: 64px;
        margin: 0;
    }

    .smt-slide__art svg {
        width: 32px;
        height: 32px;
    }

    .smt-slide--banner:has(.smt-slide__art) .smt-slide__content {
        padding-right: 64px;
    }

    .smt-slide--products .smt-slide__title {
        font-size: 22px;
    }

    .smt-slide__text {
        font-size: 14.5px;
    }

    .smt-slide__buttons .smt-btn {
        height: 44px;
        padding: 0 16px;
        font-size: 14px;
    }

    /* товары — компактными строками (фото слева), не больше двух: слайдер не выше половины экрана,
       и нет прокрутки внутри прокрутки (свайп листает слайды) */
    .smt-slide__products,
    .smt-slide__products--1,
    .smt-slide__products--2,
    .smt-slide__products--3 {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .smt-slide__products > :nth-child(n+3) {
        display: none !important;
    }

    .smt-slide .smt-pcard {
        display: grid;
        grid-template-columns: 60px minmax(0, 1fr);
        grid-template-areas: "pic title" "pic foot";
        align-items: center;
        gap: 4px 12px;
        padding: 10px;
        border-radius: 14px;
    }

    .smt-slide .smt-pcard__pic {
        grid-area: pic;
        width: 60px;
        height: 60px;
    }

    .smt-slide .smt-pcard__title {
        grid-area: title;
        font-size: 13.5px;
    }

    .smt-slide .smt-pcard__foot {
        grid-area: foot;
    }

    .smt-slide .smt-pcard__sku,
    .smt-slide .smt-pcard__badge {
        display: none;
    }

    .smt-slide .smt-pcard__add {
        width: 34px;
        height: 34px;
    }

    .smt-slide__timer b {
        min-width: 32px;
        padding: 4px 0;
        font-size: 15px;
    }

    .smt-slider__nav {
        left: 20px;
        right: 12px;
        bottom: 14px;
    }

    .smt-slider__arrow {
        width: 36px;
        height: 36px;
    }
}

/* ---------- место в сетке главной ---------- */

@media (min-width: 768px) and (max-width: 1099.98px) {
    .smt-slider {
        grid-column: span 4;
        min-height: 280px;
    }

    .smt-slide {
        min-height: 280px;
    }
}

@media (max-width: 767.98px) {
    .smt-slider {
        min-height: 0;
        margin: 0 0 16px;
        border-radius: 18px;
    }

    .smt-slide {
        min-height: 220px;
    }

    .smt-slide__content {
        gap: 10px;
    }

    .smt-slider--no-mobile {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .smt-slide__bg,
    .smt-slide__content > *,
    .smt-slide__products > *,
    .smt-slide__art {
        transition: none;
        transform: none;
    }

    .smt-slide__art svg {
        animation: none;
    }
}
