﻿#syl-photos.pswp-gallery {
    grid-template-columns: repeat(3, minmax(0,1fr));
}

@media (max-width: 992px) {
    #syl-photos.pswp-gallery {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }
}

@media (max-width: 576px) {
    #syl-photos.pswp-gallery {
        grid-template-columns: 1fr;
    }
}

.syl-viewer {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center
}

.syl-main {
    flex: 1;
    text-align: center
}

.syl-thumbs {
    width: 140px;
    display: flex;
    flex-direction: column;
    gap: 12px
}

.syl-thumbs img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.15);
    cursor: pointer;
    opacity: .9;
    transition: transform .15s,opacity .15s,box-shadow .15s
}

.syl-thumbs a.active img {
    opacity: 1;
    box-shadow: 0 4px 14px rgba(0,0,0,.15)
}

@media(max-width:992px) {
    .syl-viewer {
        flex-direction: column-reverse
    }

    .syl-thumbs {
        width: 100%;
        flex-direction: row;
        justify-content: center
    }

    .syl-main img {
        max-width: 360px !important
    }
}

.syl-viewer {
    gap: 12px;
    align-items: center;
}

.syl-main img {
    max-height: 800px !important;
    width: auto !important;
}

.syl-thumbs {
    width: 108px;
    gap: 8px;
    max-height: 800px;
    overflow-y: auto;
    padding-right: 4px;
}

.syl-thumbs a {
    padding: 6px;
    border-radius: 12px;
    background: rgba(255,255,255,.04);
}

.syl-thumbs img {
    display: block;
    height: 64px;
    width: auto;
    margin: 0 auto;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.15);
    opacity: .9;
    transition: transform .15s,opacity .15s,box-shadow .15s;
}

.syl-thumbs a.active img {
    opacity: 1;
    box-shadow: 0 4px 12px rgba(0,0,0,.14);
}

.product-card .syl-viewer {
    padding-block: 8px;
}

@media (max-width:992px) {
    .syl-viewer {
        flex-direction: column-reverse
    }

    .syl-thumbs {
        width: 100%;
        max-height: unset;
        overflow-y: visible;
        overflow-x: auto;
        justify-content: center;
    }

    .syl-thumbs img {
        height: 56px;
    }

    .syl-main img {
        max-height: 260px !important;
    }
}

.syl-thumbs {
    width: 160px;
    gap: 10px;
}

.syl-thumbs a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 12px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    transition: background .15s, box-shadow .15s, border-color .15s;
}

.syl-thumbs a:hover {
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.14);
}

.syl-thumbs a.active {
    background: rgba(255,255,255,.09);
    box-shadow: 0 4px 12px rgba(0,0,0,.14);
    border-color: rgba(255,255,255,.18);
}

.syl-thumbs img {
    display: block;
    height: 64px;
    width: auto;
    flex: 0 0 auto;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.15);
    opacity: .95;
    transition: transform .15s, opacity .15s;
}

.syl-thumbs a:hover img {
    transform: scale(1.03);
    opacity: 1;
}

.syl-thumbs a::after {
    content: attr(data-label);
    font-size: 12px;
    line-height: 1;
    color: #fff;
    opacity: .85;
    letter-spacing: .2px;
    white-space: nowrap;
    margin-left: auto;
}

@media (max-width: 992px) {
    .syl-thumbs {
        width: 100%;
        flex-direction: row;
        justify-content: center;
        gap: 8px;
    }

    .syl-thumbs a {
        flex-direction: column;
        min-width: 88px;
        gap: 6px;
    }

    .syl-thumbs img {
        height: 56px;
    }

    .syl-thumbs a::after {
        margin: 0;
        font-size: 11px;
        opacity: .9;
    }
}




/* === MOBILE: показати всі 4 позиції одразу, без скролу === */
@media (max-width: 576px) {
    .syl-viewer {
        flex-direction: column-reverse;
    }

    /* сітка 4 колонки для прев'ю */
    .syl-thumbs {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        max-height: unset;
        overflow: visible;
        justify-items: center;
    }

        /* плитки компактні, підпис під картинкою */
        .syl-thumbs a {
            flex-direction: column;
            min-width: 0;
            padding: 6px;
            gap: 6px;
        }

        .syl-thumbs img {
            height: 48px;
        }

        /* приховати “Лінійка” на мобілці, щоб лишилось рівно 4 позиції */
        .syl-thumbs a[data-label="Лінійка"] {
            display: none;
        }

    /* трохи зменшити головне фото, щоб все влізло красиво */
    .syl-main img {
        max-height: 240px !important;
    }
}

/* трішки компактніше на дуже вузьких екранах */
@media (max-width: 380px) {
    .syl-thumbs img {
        height: 44px;
    }

    .syl-main img {
        max-height: 220px !important;
    }
}




/* === NEHAZ: thumbnails зверху, всі 9 вміщуються === */

/* ставимо прев'ю над великим фото */
.syl-viewer {
    flex-direction: column;
    align-items: center;
}

.syl-thumbs {
    order: -1;
}

/* ПК: 9 у ряд, компактні плити */
@media (min-width: 1200px) {
    .syl-thumbs {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(10, 1fr);
        gap: 1px;
        margin-bottom: 8px;
        justify-items: center;
    }

        .syl-thumbs a {
            flex-direction: column;
            padding: 6px;
            gap: 2px;
            min-width: 0;
            border-radius: 8px;
            background: rgba(255,255,255,.05);
            border: 1px solid rgba(255,255,255,.10);
            transition: background .15s, box-shadow .15s, border-color .15s;
        }

        .syl-thumbs img {
            height: 40px;
            width: auto;
        }

        .syl-thumbs a::after {
            content: attr(data-label);
            font-size: 12px;
            line-height: 1;
            color: #fff;
            opacity: .9;
        }

        .syl-thumbs a:hover {
            background: rgba(255,255,255,.08);
            border-color: rgba(255,255,255,.18);
        }

        .syl-thumbs a.active {
            background: rgba(255,255,255,.11);
            box-shadow: 0 4px 12px rgba(0,0,0,.14);
        }

    /* головне зображення трохи нижче і нижче по висоті, щоб усе влізло красиво */
    .syl-main img {
        max-height: 380px !important;
    }
}

/* Laptop / планшет: 5 у ряд (2-й ряд заповнить решту) */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .syl-thumbs {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
        margin-bottom: 8px;
        justify-items: center;
    }

        .syl-thumbs a {
            flex-direction: column;
            padding: 6px;
            gap: 6px;
        }

        .syl-thumbs img {
            height: 44px;
        }

        .syl-thumbs a::after {
            font-size: 12px;
        }

    .syl-main img {
        max-height: 320px !important;
    }
}

@media (max-width: 767.98px) {
    .syl-thumbs {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 4px; /* менший відступ */
        margin-bottom: 4px;
        justify-items: center;
    }

        .syl-thumbs a {
            flex-direction: column;
            padding: 4px; /* менші внутрішні відступи */
            gap: 4px;
        }

        .syl-thumbs img {
            height: 36px; /* зменшені іконки */
        }

        .syl-thumbs a::after {
            font-size: 10px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 40px; /* жорсткіше обмежуємо ширину */
            display: inline-block;
        }

    .syl-main img {
        max-height: 200px !important;
    }
}