/* =========================================
   ОБЩАЯ ГАЛЕРЕЯ НАВОЛОЧЕК
   ========================================= */

.product-gallery {
    width: 100%;
    max-width: 900px;
    margin: 28px auto;
    color: #514541;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}

.product-gallery *,
.gallery-lightbox * {
    box-sizing: border-box;
}

/* ЗАГОЛОВОК */

.pg-heading {
    margin: 0 0 20px;
    text-align: center;
}

.pg-heading h3 {
    margin: 0;
    color: #654d48;
    font-size: 25px;
    line-height: 1.5;
    font-weight: 800;
}

.pg-heading-arrow {
    display: inline-block;
    margin-left: 3px;
    color: #a77b6d;
    font-size: 30px;
    font-weight: 800;
    animation: pg-arrow-down 1.5s ease-in-out infinite;
    vertical-align: middle;
}

@keyframes pg-arrow-down {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(5px);
    }
}

/* БОЛЬШОЕ ФОТО */

.pg-main {
    position: relative;
    width: 100%;
    height: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #faf9f8;
    border: 1px solid #eee9e6;
    border-radius: 12px;
    touch-action: pan-y;
}

.pg-main img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    cursor: zoom-in;
    user-select: none;
    -webkit-user-drag: none;
}

.pg-main-button {
    position: absolute;
    inset: 0;
    z-index: 2;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.pg-main-button:focus-visible,
.pg-thumb:focus-visible,
.pg-arrow:focus-visible,
.pg-lightbox-close:focus-visible,
.pg-lightbox-arrow:focus-visible {
    outline: 3px solid #b58b7e;
    outline-offset: 3px;
}

/* НАВИГАЦИЯ МЕЖДУ ФОТО И МИНИАТЮРАМИ */

.pg-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    margin: 13px 0 10px;
}

.pg-arrow {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 4px;
    border: 1px solid #d9c9c2;
    border-radius: 50%;
    background: #fff;
    color: #654d48;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(80, 60, 50, .08);
    transition: background .2s, border-color .2s;
}

.pg-arrow:hover {
    background: #f7f2ef;
    border-color: #b99b8f;
}

.pg-position {
    min-width: 70px;
    color: #654d48;
    font-size: 17px;
    font-weight: 700;
    text-align: center;
}

/* МИНИАТЮРЫ */

.pg-thumbs-wrap {
    position: relative;
    margin-top: 0;
}

.pg-thumbs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 3px 2px 9px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #c9b9b2 #f3efed;
    overscroll-behavior-x: contain;
}

.pg-thumb {
    flex: 0 0 104px;
    width: 104px;
    height: 82px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 8px;
    background: #faf9f8;
    cursor: pointer;
    transition: border-color .2s, opacity .2s, transform .2s;
}

.pg-thumb:hover {
    border-color: #c8aaa0;
}

.pg-thumb.is-active {
    border-color: #8c665a;
    box-shadow: 0 0 0 2px rgba(140, 102, 90, .15);
    transform: translateY(-2px);
}

.pg-thumb img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.pg-thumb-name {
    display: none;
}

/* СОСТОЯНИЯ */

.pg-loading {
    padding: 35px 15px;
    color: #817671;
    text-align: center;
    font-size: 14px;
}

.pg-error {
    padding: 20px;
    color: #a33b32;
    text-align: center;
    font-size: 14px;
}

.pg-empty {
    padding: 30px 15px;
    color: #817671;
    text-align: center;
    font-size: 14px;
    background: #faf9f8;
    border-radius: 10px;
}

/* =========================================
   ПОЛНОЭКРАННЫЙ ПРОСМОТР
   ========================================= */

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 55px 65px;
    background: rgba(20, 18, 17, .94);
}

.gallery-lightbox.is-open {
    display: flex;
}

.pg-lightbox-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.pg-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

/* КНОПКА ЗАКРЫТИЯ */

.pg-lightbox-close {
    position: absolute;
    z-index: 10;
    top: 14px;
    right: 18px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.14);
    color: #fff;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}

/* БОКОВЫЕ СТРЕЛКИ */

.pg-lightbox-arrow {
    position: absolute;
    z-index: 5;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 4px;
    border: 0;
    border-radius: 8px;
    background: rgba(255,255,255,.18);
    color: #fff;
    font-size: 38px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s;
}

.pg-lightbox-arrow:hover {
    background: rgba(255,255,255,.32);
}

.pg-lightbox-prev {
    left: 12px;
}

.pg-lightbox-next {
    right: 12px;
}

/* ПОДПИСЬ ПОД ФОТО */

.pg-lightbox-caption {
    position: absolute;
    z-index: 2;
    bottom: 17px;
    left: 15px;
    right: 15px;
    color: #fff;
    text-align: center;
    font-size: 14px;
    pointer-events: none;
}

/* СЧЁТЧИКА В ПОЛНОЭКРАННОМ РЕЖИМЕ НЕТ */

/* БЛОКИРОВКА ПРОКРУТКИ СТРАНИЦЫ */

body.gallery-no-scroll {
    overflow: hidden;
}

/* =========================================
   ПЛАНШЕТЫ
   ========================================= */

@media (max-width: 900px) {
    .product-gallery {
        max-width: 100%;
    }

    .pg-main {
        height: 420px;
    }

    .pg-thumb {
        flex-basis: 92px;
        width: 92px;
        height: 74px;
    }
}

/* =========================================
   МОБИЛЬНЫЕ УСТРОЙСТВА
   ========================================= */

@media (max-width: 600px) {
    .product-gallery {
        margin: 22px auto;
    }

    .pg-heading {
        margin-bottom: 14px;
        padding: 0 5px;
    }

    .pg-heading h3 {
        font-size: 21px;
        line-height: 1.5;
        font-weight: 800;
    }

    .pg-heading-arrow {
        font-size: 25px;
    }

    .pg-main {
        height: min(72vw, 390px);
        min-height: 230px;
        border-radius: 9px;
    }

    .pg-nav {
        gap: 25px;
        margin: 11px 0 9px;
    }

    .pg-arrow {
        width: 44px;
        height: 44px;
        font-size: 31px;
    }

    .pg-position {
        min-width: 68px;
        font-size: 16px;
    }

    .pg-thumbs {
        gap: 8px;
    }

    .pg-thumb {
        flex-basis: 76px;
        width: 76px;
        height: 66px;
    }

    .gallery-lightbox {
        padding: 55px 12px;
    }

    .pg-lightbox-arrow {
        width: 38px;
        height: 48px;
        font-size: 29px;
    }

    .pg-lightbox-prev {
        left: 5px;
    }

    .pg-lightbox-next {
        right: 5px;
    }

    .pg-lightbox-close {
        top: 9px;
        right: 9px;
    }

    .pg-lightbox-caption {
        bottom: 10px;
        font-size: 13px;
    }
}

/* УМЕНЬШЕНИЕ АНИМАЦИИ */

@media (prefers-reduced-motion: reduce) {
    .pg-thumbs {
        scroll-behavior: auto;
    }

    .pg-thumb {
        transition: none;
    }

    .pg-heading-arrow {
        animation: none;
    }
}