/* ===========================================================================
   Total Look page — /total-look/
   Базовые правила сетки скопированы из catalog.section/.default/style.css
   (секция .stylization с грид-ритмом 1, 4, 13, 14 BIG на десктопе),
   скоуплены под .total-look-page чтобы не задевать /catalog/combi/.
   =========================================================================== */

.total-look-page .catalog__container {
    max-width: none;
    margin: 0;
    padding: 0 16px;
}

/* ===== Section + grid (копия из .stylization) ===== */

.total-look-page .total-look-section {
    margin: 60px 0 0;
    padding: 0 16px;
    max-width: none;
}

.total-look-page .total-look-section .grid {
    display: grid;
    grid-gap: 15px;
    row-gap: 32px;
    grid-auto-flow: dense;
    max-width: none;
    margin: 0;
}

.total-look-page .total-look-section .grid-column-4 {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

/* BIG-ячейки 2x2 на десктопе — ритм как в .stylization */
.total-look-page .stylization-item:first-child,
.total-look-page .stylization-item:nth-child(4),
.total-look-page .stylization-item:nth-child(13),
.total-look-page .stylization-item:nth-child(14) {
    grid-column: span 2;
    grid-row: span 2;
}

/* ===== Карточка образа ===== */

.total-look-page .stylization-item {
    display: block;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.total-look-page .total-look-item__img {
    position: relative;
    line-height: 0;
    margin-bottom: 15px;
    overflow: hidden;
    background: var(--light-grey, #ECE7E1);
}

.total-look-page .total-look-item__img .total-look-swiper {
    width: 100%;
}

.total-look-page .total-look-item__img img {
    width: 100%;
    height: auto;
    aspect-ratio: 380 / 514;
    object-fit: cover;
    display: block;
}

.total-look-page .stylization-item:first-child .total-look-item__img img,
.total-look-page .stylization-item:nth-child(4) .total-look-item__img img,
.total-look-page .stylization-item:nth-child(13) .total-look-item__img img,
.total-look-page .stylization-item:nth-child(14) .total-look-item__img img {
    aspect-ratio: 776 / 1075;
}

.total-look-page .total-look-item__name {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 500;
    font-size: 14px;
    line-height: 100%;
    letter-spacing: 0;
    color: #130F0F;
    margin: 0 0 8px 0;
}

.total-look-page .total-look-item__items {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 100%;
    letter-spacing: 0;
    color: #8A8A8A;
    margin: 0 0 8px 0;
}

.total-look-page .total-look-item__price {
    font-size: 14px;
    line-height: 1.2;
    margin-top: 6px;
}

.total-look-page .total-look-item__price-old {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 500;
    font-size: 14px;
    line-height: 100%;
    letter-spacing: 0;
    text-align: center;
    text-decoration: line-through;
    color: #E6420C;
}

.total-look-page .total-look-item__price-new {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 500;
    font-size: 14px;
    line-height: 100%;
    letter-spacing: 0;
    text-align: center;
    color: #130F0F;
}

/* ===== Tablet (<= 1040): 3 кол визуально через grid-column-4 → 1fr×4, BIG только на nth-child(3n) ===== */
@media (max-width: 1040px) {
    .total-look-page .total-look-section {
        margin-top: 24px;
        padding: 0 16px;
    }

    .total-look-page .stylization-item:first-child,
    .total-look-page .stylization-item:nth-child(4),
    .total-look-page .stylization-item:nth-child(13),
    .total-look-page .stylization-item:nth-child(14) {
        grid-column: initial;
        grid-row: initial;
    }

    .total-look-page .stylization-item:nth-child(3n) {
        grid-column: span 2;
        grid-row: span 2;
    }

    .total-look-page .stylization-item:first-child .total-look-item__img img,
    .total-look-page .stylization-item:nth-child(4) .total-look-item__img img,
    .total-look-page .stylization-item:nth-child(13) .total-look-item__img img,
    .total-look-page .stylization-item:nth-child(14) .total-look-item__img img {
        aspect-ratio: 380 / 514;
    }
}

.total-look-page .catalog__tittle-block {
    padding: 42px 0 0;
}

.total-look-page__discount-info {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
    letter-spacing: 0.14px;
    color: #8A8A8A;
    margin: 24px 0 0;
}

@media (max-width: 767px) {
    .total-look-page__discount-info {
        margin-top: 16px;
    }
}

@media screen and (max-width: 1065px) {
    .total-look-page .catalog__tittle-block {
        padding: 7px 0 0;
    }
}

/* ===== Mobile (<= 767): 2 кол плоско, BIG в полную ширину ===== */
@media (max-width: 767px) {
    .total-look-page .total-look-section {
        margin-top: 36px;
    }

    .total-look-page .total-look-section .grid-column-4 {
        grid-template-columns: 1fr 1fr;
    }

    .total-look-page .total-look-section .grid {
        grid-gap: 8px;
        row-gap: 32px;
        padding: 0;
    }

    .total-look-page .stylization-item:nth-child(3n) {
        grid-column: initial;
        grid-row: initial;
    }

    .total-look-page .stylization-item:nth-child(3n+1) {
        grid-column: span 2;
        grid-row: initial;
    }

    .total-look-page .total-look-item__img {
        margin-bottom: 15px;
    }

    .total-look-page .stylization-item .total-look-item__img img,
    .total-look-page .stylization-item:nth-child(4) .total-look-item__img img,
    .total-look-page .stylization-item:nth-child(13) .total-look-item__img img,
    .total-look-page .stylization-item:nth-child(14) .total-look-item__img img {
        aspect-ratio: 335 / 552;
    }

    .total-look-page .stylization-item:nth-child(3n+1) .total-look-item__img img,
    .total-look-page .stylization-item:first-child .total-look-item__img img,
    .total-look-page .stylization-item:nth-child(13) .total-look-item__img img {
        aspect-ratio: 343 / 493;
    }

    .total-look-page .total-look-item__name { font-size: 14px; }
    .total-look-page .total-look-item__items { font-size: 13px; margin-top: 4px; }
    .total-look-page .total-look-item__price { font-size: 13px; margin-top: 6px; }
}

#total-look-popup {
    position: fixed;
    inset: 0;
    z-index: 999;
    background-color: #fff;
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease-out;
    padding: 0 16px;
    align-items: stretch;
    justify-content: flex-start;
    height: 100vh;
    width: 100vw;
}

#total-look-popup.--active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

#total-look-popup .popup {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    background: #fff;
    min-height: 100vh;
}

.tl-popup__loading,
.tl-popup__error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    font-family: 'Nunito Sans', sans-serif;
    color: #8A8A8A;
}

.tl-popup__layout {
    display: grid;
    grid-template-columns: 1fr calc(33.33vw - 16px);
    column-gap: 16px;
    padding: 40px 0 0;
    align-items: start;
}

.tl-popup__left {
    display: flex;
    flex-direction: column;
    gap: 52px;
    min-width: 0;
}

.tl-popup__sections {
    display: flex;
    flex-direction: column;
    gap: 52px;
    padding-bottom: 24px;
}

.tl-popup__section {
    display: block;
}


.tl-popup__photos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.tl-popup__video,
.tl-popup__slider {
    position: relative;
    aspect-ratio: 512 / 701;
    background: var(--light-grey, #ECE7E1);
    overflow: hidden;
    box-sizing: border-box;
}

.tl-popup__video { padding: 0; }
.tl-popup__slider { padding: 0; }

.tl-popup__video-el {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tl-popup__video-play {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 33px;
    height: 33px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.tl-popup__video-play svg path {
    transition: fill 0.25s ease;
}

.tl-popup__video-play:hover svg path {
    fill: #130F0F;
}

.tl-video-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tl-video-overlay.--active {
    display: flex;
    opacity: 1;
}

.tl-video-overlay__popup {
    position: relative;
    background: #000;
    border-radius: 12px;
    max-width: 80%;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.tl-video-overlay.--active .tl-video-overlay__popup {
    transform: scale(1);
}

.tl-video-overlay__video {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.tl-video-overlay__close {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 32px;
    height: 32px;
    font-size: 28px;
    line-height: 1;
    color: #fff;
    background: transparent;
    border: 0;
    cursor: pointer;
    z-index: 1001;
}

@media (min-width: 768px) {
    .tl-video-overlay__popup {
        height: 80vh;
        width: auto;
        aspect-ratio: 9 / 16;
    }
}

.tl-popup__slider-swiper {
    width: 100%;
    height: 100%;
}

.tl-popup__slider-swiper .swiper-wrapper,
.tl-popup__slider-swiper .swiper-slide {
    width: 100%;
    height: 100%;
}

.tl-popup__slider-swiper .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tl-popup__slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: block;
    z-index: 3;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#total-look-popup .tl-popup__slider-nav--prev { left: 16px; right: auto; }
#total-look-popup .tl-popup__slider-nav--next { right: 16px; left: auto; }

.tl-popup__slider-nav.swiper-button-disabled {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.total-look-page .product-card__content {
    padding-bottom: 0;
}

.tl-popup__right {
    display: flex;
    flex-direction: column;
    min-width: 0;
    font-family: 'Nunito Sans', sans-serif;
    color: #130F0F;
    position: sticky;
    top: 40px;
    align-self: start;
    max-height: calc(100vh - 80px);
    overflow: hidden;
}

@media (min-width: 768px) {
    /* Lock modal to viewport — each column scrolls internally */
    #total-look-popup {
        overflow: hidden;
    }

    #total-look-popup .popup,
    #total-look-popup .tl-popup,
    #total-look-popup #total-look-popup-body {
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    .tl-popup__layout {
        height: 100%;
        box-sizing: border-box;
        align-items: stretch;
    }

    .tl-popup__left {
        min-height: 0;
        max-height: 100%;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .tl-popup__right {
        position: static;
        top: auto;
        align-self: stretch;
        max-height: 100%;
        padding-bottom: 24px;
    }

    .tl-popup__right .look-buy-panel {
        height: 100%;
    }

    .tl-popup__right .look-buy-panel__items {
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}


.st-menu.tl-popup__cart-on-top {
    z-index: 1001;
}

@media (max-width: 1023px) {
    .tl-popup__layout {
        grid-template-columns: 1fr 341px;
    }
}

@media (max-width: 767px) {
    #total-look-popup {
        padding: 0;
    }

    .tl-popup__layout {
        display: flex;
        flex-direction: column;
        padding: 0 0 calc(96px + env(safe-area-inset-bottom));
        column-gap: 0;
        row-gap: 0;
        grid-template-columns: none;
        align-items: stretch;
    }

    .tl-popup__left,
    .tl-popup__right,
    .tl-popup__right .look-buy-panel {
        display: contents;
    }

    /* 1. Header */
    .tl-popup__right .look-buy-panel__header {
        order: 1;
        background: #fff;
        padding: 42px 16px 36px;
        margin: 0;
        align-items: center;
    }
    .tl-popup__right .look-buy-panel__title {
        font-family: 'Nunito Sans', NunitoSans, sans-serif;
        font-weight: 500;
        font-size: 20px;
        line-height: 100%;
        letter-spacing: 0;
    }

    /* 2. Photos — slider only, edge-to-edge */
    .tl-popup__photos {
        order: 2;
        grid-template-columns: 1fr;
        gap: 0;
    }
    .tl-popup__video {
        display: none;
    }
    .tl-popup__slider {
        aspect-ratio: 375 / 492;
    }
    #total-look-popup .tl-popup__slider-nav {
        display: block;
    }

    /* 3. Subtitle */
    .tl-popup__right .look-buy-panel__subtitle {
        order: 3;
        font-size: 16px;
        padding: 0 16px;
        margin: 38px 0 24px;
    }

    /* 4. Items list */
    .tl-popup__right .look-buy-panel__items {
        order: 4;
        padding: 0 16px;
        margin-bottom: 0;
    }
    .tl-popup__right .look-buy-panel__size {
        width: 49.6px;
    }

    /* 5. Summary */
    .tl-popup__right .look-buy-panel__summary {
        order: 5;
        padding: 16px 0 0;
        margin: 0 16px 48px;
        gap: 16px;
    }
    .tl-popup__right .look-buy-panel__summary-row--total {
        margin-top: 0;
    }
    .tl-popup__right .look-buy-panel__total-label,
    .tl-popup__right .look-buy-panel__total-value {
        font-size: 22px;
    }

    /* 6. Sections (Дополнить образ / Аксессуары) */
    .tl-popup__sections {
        order: 6;
        gap: 8px;
        padding-left: 16px;
    }

    /* 7. Sticky bottom buy bar — fixed wrapper provides the white backdrop */
    .tl-popup__right .look-buy-panel__buy-wrap {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 6;
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
        height: auto;
        background: #fff;
        margin: 0;
    }

    .tl-popup__right .look-buy-panel__buy {
        height: 48px;
    }
}

