/* ============================================
   Product Detail — bumlavka.ru
   Двухколоночная вёрстка: галерея слева, инфо справа.

   Шкала отступов (8-pt grid):
     --gap-xs: 8px,  --gap-sm: 16px, --gap-md: 24px,
     --gap-lg: 40px, --gap-xl: 64px, --gap-xxl: 96px
   ============================================ */

.product-page {
    --gap-xs: 8px;
    --gap-sm: 16px;
    --gap-md: 24px;
    --gap-lg: 32px;
    --gap-xl: 48px;
    --gap-xxl: 64px;

    padding-top: 140px;
    min-height: 100vh;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .9), transparent 45%),
        radial-gradient(circle at 80% 10%, rgba(255, 255, 255, .6), transparent 40%),
        #f6f2e6;
}

.product-content-block {
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    /* нижний отступ задаёт сам site-footer (margin-top), здесь паддинга нет */
    padding: 0 var(--gap-xl);
    box-sizing: border-box;
}

/* ---- Двухколоночный layout ---- */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap-xl);
    max-width: 1780px;
    margin: 0 auto var(--gap-xxl);
}

/* ---- Галерея ---- */
.product-detail__gallery {
    position: sticky;
    top: 120px;
    align-self: start;
    min-width: 0;
}

/* Сетка: вертикальные тамбы слева (88px) + главное фото справа */
.product-gallery {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: var(--gap-sm);
    align-items: start;
}

.product-gallery__main {
    grid-column: 2;
    grid-row: 1;
    border-radius: 32px;
    overflow: hidden;
    background: var(--product-card-bg);
    cursor: zoom-in;
    position: relative;
}

.product-gallery__main img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    display: block;
}

.product-gallery__main::after {
    content: "";
    position: absolute;
    right: 16px;
    bottom: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .85)
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-4-4M11 8v6M8 11h6'/></svg>") center / 18px no-repeat;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    pointer-events: none;
    opacity: .85;
    transition: opacity .2s ease;
}

.product-gallery__main:hover::after {
    opacity: 1;
}

.product-gallery__thumbs {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: var(--gap-xs);
    align-self: start;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
    scrollbar-width: thin;
}

.product-gallery__thumb {
    width: 88px;
    height: 88px;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .2s ease;
    flex-shrink: 0;
    background: var(--product-card-bg);
    padding: 0;
}

.product-gallery__thumb.is-active {
    border-color: var(--color-primary);
}

.product-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---- Инфо (справа) ---- */
.product-detail__info {
    font-family: var(--font-display);
    min-width: 0;
}

.product-detail__info .breadcrumbs {
    margin-bottom: var(--gap-md);
}

.product-info__title {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: -.01em;
    color: #1a1a1a;
    margin: 0 0 var(--gap-sm);
}

.product-info__availability {
    margin-bottom: var(--gap-xs);
}

.product-info__stock {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 14px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
}

.product-info__stock--yes {
    color: #fff;
    background: #4CAF50;
}

.product-info__stock--no {
    color: #fff;
    background: #c7493d;
}

.product-info__stock::before {
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.product-info__stock--yes::before {
    content: "✓";
}

.product-info__stock--no::before {
    content: "✕";
}

.product-info__sku {
    font-size: 15px;
    color: rgba(17, 17, 17, 0.55);
    margin-bottom: var(--gap-md);
}

/* Тех. информация (артикул, упаковка) — inline-список */
.product-meta {
    margin-bottom: var(--gap-md);
}

.product-meta--inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    font-size: 14px;
    line-height: 1.4;
}

.product-meta__item {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.product-meta__label {
    color: rgba(17, 17, 17, 0.55);
}

.product-meta__value {
    color: #111;
    font-weight: 500;
}

/* Селектор цвета */
.product-info__color {
    margin-bottom: var(--gap-md);
}

.product-info__color-label {
    display: block;
    font-size: 16px;
    color: #555;
    margin-bottom: var(--gap-xs);
}

.product-info__color-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-xs);
}

.product-info__color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, .08);
    cursor: pointer;
    padding: 0;
    transition: border-color .15s ease, transform .15s ease;
}

.product-info__color-btn:hover {
    border-color: rgba(100, 125, 25, .35);
}

.product-info__color-btn.is-active {
    border-color: var(--color-primary);
    border-width: 3px;
}

/* Описание */
.product-info__description {
    font-size: 18px;
    line-height: 1.55;
    color: #444;
    margin-bottom: var(--gap-md);
    max-width: 640px;
}

/* Характеристики */
.product-info__attributes {
    margin-bottom: var(--gap-md);
    padding: var(--gap-sm) var(--gap-md);
    background: rgba(255, 255, 255, 0.55);
    border-radius: 20px;
}

.product-info__attr {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--gap-md);
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 15px;
    line-height: 1.4;
}

.product-info__attr:last-child {
    border-bottom: none;
}

/* Характеристики плашками — равные карточки в адаптивной сетке */
.product-info__attributes--chips {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    background: transparent;
    padding: 0;
    border-radius: 0;
}

.product-info__attr--chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 22px 24px;
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 1px 2px rgba(60, 45, 20, 0.04), 0 8px 24px -12px rgba(60, 45, 20, 0.10);
    border: 0;
    line-height: 1.1;
    min-height: 118px;
}

.product-info__attr--chip:last-child {
    border-bottom: 0;
}

.product-info__attr--chip .product-info__attr-label {
    color: #8b7d63;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: left;
}

.product-info__attr--chip .product-info__attr-value {
    color: #1a1611;
    font-weight: 600;
    font-size: 30px;
    letter-spacing: -0.015em;
    text-align: left;
    margin-top: auto;
    font-variant-numeric: tabular-nums;
}

/* Адаптив: на мобильных — компактные chip'ы (правила в конце файла
   ниже, чтобы перебить @media (max-width: 999px) на строке ~700). */

.product-info__attr-label {
    color: rgba(17, 17, 17, 0.55);
    flex-shrink: 0;
}

.product-info__attr-value {
    font-weight: 500;
    color: #111;
    text-align: right;
}

/* Блок покупки: левая колонка (цена + контролы) и кнопка корзины справа */
.product-info__purchase {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap-md);
    flex-wrap: wrap;
    margin-top: var(--gap-md);
    margin-bottom: var(--gap-md);
    padding: var(--gap-md) 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.product-info__purchase-left {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
    min-width: 0;
}

.product-info__purchase-controls {
    display: flex;
    align-items: center;
    gap: var(--gap-xs);
    flex-wrap: wrap;
}

.product-info__price {
    font-size: 40px;
    font-weight: 600;
    color: #1d1d1b;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: -.02em;
}

/* Количество */
.product-info__qty {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border: 1px solid #cbcbcb;
    border-radius: 35px;
    overflow: hidden;
}

.product-info__qty-btn {
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    transition: background .15s ease;
}

.product-info__qty-btn:hover {
    background: rgba(100, 125, 25, 0.08);
}

.product-info__qty-value {
    min-width: 32px;
    text-align: center;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 500;
}

.product-info__cart-btn {
    flex: 0 0 auto;
    min-width: 220px;
}

/* Кнопки «избранное», «сравнить» */
.product-info__fav-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, .12);
    background: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.product-info__fav-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: #fff;
}

.product-info__fav-btn.is-active {
    border-color: var(--color-primary);
    background: var(--color-accent);
    color: var(--color-primary);
}

/* Подписка на наличие */
.product-info__subscribe {
    margin-top: var(--gap-md);
    padding: var(--gap-md);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.5);
}

.product-info__subscribe-text {
    margin: 0 0 var(--gap-sm);
    font-size: 17px;
    color: #333;
}

.product-info__subscribe-row {
    display: flex;
    gap: var(--gap-xs);
}

.product-info__subscribe-input {
    flex: 1;
    height: 44px;
    padding: 0 16px;
    border: 1px solid #cbcbcb;
    border-radius: 22px;
    background: #fff;
    --autofill-bg: #fff;
    font-family: var(--font-display);
    font-size: 16px;
}

/* Теги */
.product-info__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-xs);
}

.product-info__tag {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 16px;
    border-radius: 35px;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    font-family: var(--font-display);
    font-size: 14px;
}

/* ---- Блоки рекомендаций ---- */
.product-recommended {
    max-width: 1780px;
    margin: var(--gap-xxl) auto 0;
}

.product-recommended:first-of-type {
    margin-top: 0;
}

.product-recommended__title {
    font-family: var(--font-display);
    font-size: 44px;
    font-weight: 300;
    color: #333;
    margin: 0 0 var(--gap-lg);
    text-align: center;
}

.product-recommended__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap-md);
}

/* ---- Большие десктопы (1400-1599px) ---- */
@media (max-width: 1599px) {
    .product-page {
        --gap-xl: 40px;
        --gap-xxl: 56px;
    }
    .product-info__title {
        font-size: 40px;
    }
    .product-recommended__title {
        font-size: 38px;
    }
}

/* ---- Средние десктопы / ноутбуки (1000-1399px) ---- */
@media (max-width: 1399px) {
    .product-page {
        --gap-xl: 28px;
        --gap-xxl: 44px;
        --gap-md: 20px;
        padding-top: 120px;
    }

    .product-detail__gallery {
        top: 100px;
    }

    .product-gallery__main {
        border-radius: 24px;
    }

    .product-gallery__thumb {
        width: 72px;
        height: 72px;
        border-radius: 12px;
    }

    .product-info__title {
        font-size: 32px;
    }

    .product-info__price {
        font-size: 30px;
    }

    .product-recommended__title {
        font-size: 32px;
    }

    .product-recommended__grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--gap-sm);
    }
}

/* ---- Планшет / Мобайл (< 1000px) ---- */
@media (max-width: 999px) {
    .product-page {
        --gap-xl: 20px;
        --gap-xxl: 32px;
        --gap-md: 16px;
        padding-top: 88px;
        /* запас под фиксированный sticky CTA внизу (≈ 76px) */
        padding-bottom: 96px;
    }

    .product-content-block {
        /* на мобильном паддинг нужен только под sticky CTA — задаётся через padding-bottom у .product-page */
        padding-bottom: 0;
    }

    .product-detail {
        grid-template-columns: 1fr;
        gap: var(--gap-md);
        margin-bottom: var(--gap-lg);
    }

    .product-detail__gallery {
        position: static;
        overflow: visible;
    }

    /* На мобильном — тамбы под фото горизонтально (одна колонка) */
    .product-gallery {
        grid-template-columns: 1fr;
        gap: var(--gap-sm);
    }

    .product-gallery__main,
    .product-gallery__thumbs {
        grid-column: 1;
    }

    .product-gallery__main {
        grid-row: 1;
        border-radius: 20px;
    }

    .product-gallery__thumbs {
        grid-row: 2;
        flex-direction: row;
        max-height: none;
        overflow-x: auto;
        overflow-y: visible;
        padding-right: 0;
        padding-bottom: 4px;
    }

    .product-gallery__thumb {
        width: 64px;
        height: 64px;
        border-radius: 10px;
    }

    /* Лупы на мобиле не показываем — лайтбокс открывается тапом */
    .product-gallery__main::after {
        display: none;
    }

    .product-info__title {
        font-size: 24px;
    }

    .product-info__sku {
        margin-bottom: var(--gap-sm);
    }

    .product-info__color {
        margin-bottom: var(--gap-sm);
    }

    .product-info__description {
        font-size: 15px;
        line-height: 1.5;
        margin-bottom: var(--gap-sm);
    }

    .product-info__attr {
        font-size: 14px;
        padding: 10px 0;
    }

    .product-info__purchase {
        flex-direction: column;
        align-items: stretch;
        gap: var(--gap-sm);
        padding: var(--gap-sm) 0;
        margin-top: var(--gap-sm);
        margin-bottom: var(--gap-sm);
    }

    .product-info__purchase-left {
        gap: var(--gap-sm);
    }

    .product-info__purchase-controls {
        justify-content: flex-start;
    }

    .product-info__price {
        font-size: 28px;
    }

    .product-info__cart-btn {
        width: 100%;
        min-width: 0;
        margin-left: 0;
    }

    .product-recommended {
        margin-top: var(--gap-lg);
    }

    .product-recommended__title {
        font-size: 24px;
        margin-bottom: var(--gap-md);
    }

    /* Горизонтальный scroll-snap: одна карточка ~62vw + край следующей
       как тизер. На 171px карточка была слишком узкой — текст в 4 строки,
       характеристики обрезаны. */
    .product-recommended__grid {
        display: grid;
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: minmax(220px, 62vw);
        gap: var(--gap-sm);
        padding: 0 12px 4px;
        margin: 0 -12px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box;
    }
    .product-recommended__grid::-webkit-scrollbar { display: none; }
    .product-recommended__grid > * { scroll-snap-align: start; }
}

/* ---- Маленькие мобильные (< 480px) ---- */
@media (max-width: 479px) {
    .product-page {
        --gap-xl: 16px;
    }

    .product-info__title {
        font-size: 22px;
    }

    .product-info__price {
        font-size: 24px;
    }

    .product-gallery__thumb {
        width: 56px;
        height: 56px;
    }

    .product-recommended__title {
        font-size: 22px;
    }
}

/* ---- Лайтбокс ---- */
.product-lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(20, 20, 20, .92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.product-lightbox[hidden] {
    display: none;
}

.product-lightbox__img {
    max-width: 90vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
}

.product-lightbox__close,
.product-lightbox__nav {
    position: absolute;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease;
}

.product-lightbox__close:hover,
.product-lightbox__nav:hover {
    background: rgba(255, 255, 255, .22);
}

.product-lightbox__close {
    top: 24px;
    right: 24px;
}

.product-lightbox__nav--prev {
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
}

.product-lightbox__nav--next {
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
}

.product-lightbox__counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-family: var(--font-display);
    font-size: 14px;
    background: rgba(255, 255, 255, .12);
    padding: 6px 14px;
    border-radius: 20px;
    letter-spacing: .04em;
}

@media (max-width: 999px) {
    .product-lightbox__close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
    }
    .product-lightbox__nav {
        width: 40px;
        height: 40px;
    }
    .product-lightbox__nav--prev { left: 12px; }
    .product-lightbox__nav--next { right: 12px; }
    .product-lightbox__img {
        max-width: 96vw;
        max-height: 78vh;
    }
}

/* ---- Закреплённый CTA (мобильный) ---- */
.product-sticky-cta {
    display: none;
}

@media (max-width: 999px) {
    .product-sticky-cta {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 50;
        background: #fff;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        border-radius: 20px 20px 0 0;
        align-items: center;
        justify-content: space-between;
        gap: var(--gap-sm);
    }

    .product-sticky-cta__price {
        font-family: var(--font-display);
        font-size: 22px;
        font-weight: 600;
        white-space: nowrap;
    }

    .product-sticky-cta__btn {
        flex: 1;
    }
}

/* ---- Mobile chips override (после всех media) ---- */
@media (max-width: 991.98px) {
    .product-info__attributes--chips {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }
    .product-info__attr--chip {
        padding: 12px 12px !important;
        gap: 6px !important;
        min-height: 0 !important;
        border-radius: 14px !important;
    }
    .product-info__attr--chip .product-info__attr-label {
        font-size: 10px !important;
        letter-spacing: 0.06em !important;
    }
    .product-info__attr--chip .product-info__attr-value {
        font-size: 18px !important;
    }
}
@media (max-width: 360px) {
    .product-info__attr--chip .product-info__attr-value { font-size: 16px !important; }
}

/* ---- Mobile purchase plate (вёрстка плашки цены + корзины) ---- */
@media (max-width: 768px) {
    .product-info__purchase {
        flex-direction: column;
        align-items: stretch !important;
        gap: 14px !important;
        margin: 16px 0 !important;
        padding: 18px 18px !important;
        background: #fff !important;
        border: 0 !important;
        border-radius: 20px !important;
        box-shadow: 0 4px 24px rgba(60, 45, 20, .08) !important;
    }
    .product-info__purchase-left {
        gap: 14px;
    }
    .product-info__price {
        font-size: 32px !important;
        margin: 0 !important;
    }
    .product-info__purchase-controls {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        justify-content: flex-start;
    }
    .product-info__cart-btn {
        width: 100% !important;
        min-width: 0 !important;
        justify-content: center;
        font-size: 16px;
    }
}
