/* ==========================================================================
   年年红 · 商品详情图集（仅商品详情页加载）
   主图 + 单行可横滑缩略图 + 站内大图灯箱
   ========================================================================== */

.pg-gallery {
    min-width: 0;
}

.product-brand-link {
    color: var(--brass-3);
    border-bottom: 1px solid currentColor;
}

.product-brand-link:hover {
    color: var(--ink);
}

.pg-main {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3.2;
    overflow: hidden;
    background: var(--paper-2);
    cursor: zoom-in;
}

.pg-main-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.2s var(--ease), opacity 0.35s ease;
}

.pg-main-img.is-loading {
    opacity: 0.35;
}

.pg-main:hover .pg-main-img {
    transform: scale(1.015);
}

.pg-zoom {
    position: absolute;
    right: 14px;
    bottom: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    background: rgba(20, 16, 13, 0.55);
    color: var(--paper);
    font-size: 10px;
    letter-spacing: 0.1em;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

.pg-zoom svg {
    width: 13px;
    height: 13px;
}

.pg-toolbar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-top: 12px;
}

.pg-counter {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin: 0;
    font-family: var(--font-serif);
    font-size: 12px;
    letter-spacing: 0.16em;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.pg-counter b {
    font-size: 21px;
    font-weight: 400;
    line-height: 1;
    color: var(--ink);
}

.pg-counter i {
    font-style: normal;
    color: var(--muted-2);
}

.pg-all {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 2px 0;
    border: 0;
    border-bottom: 1px solid currentColor;
    background: none;
    color: var(--brass-3);
    font: inherit;
    font-size: 11px;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: color 0.3s ease;
}

.pg-all:hover {
    color: var(--ink);
}

.pg-all svg {
    width: 13px;
    height: 13px;
}

.pg-rail {
    position: relative;
    margin-top: 10px;
}

.pg-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px;
    margin: -2px;
}

.pg-thumbs::-webkit-scrollbar {
    display: none;
}

.pg-thumb {
    flex: 0 0 calc((100% - 32px) / 5);
    min-width: 0;
    aspect-ratio: 1;
    padding: 0;
    border: 0;
    background: var(--paper-2);
    overflow: hidden;
    cursor: pointer;
    opacity: 0.72;
    outline: 1px solid transparent;
    outline-offset: -1px;
    scroll-snap-align: start;
    transition: opacity 0.3s ease, outline-color 0.3s ease;
}

.pg-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease);
}

.pg-thumb:hover {
    opacity: 0.92;
}

.pg-thumb:hover img {
    transform: scale(1.04);
}

.pg-thumb.is-active {
    opacity: 1;
    outline-color: var(--brass);
}

.pg-thumb:focus-visible {
    outline: 2px solid var(--brass);
    outline-offset: 2px;
}

.pg-arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    margin-top: -15px;
    padding: 0;
    border: 1px solid var(--line);
    background: rgba(247, 243, 236, 0.94);
    color: var(--ink);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, background 0.25s ease;
}

.pg-arrow svg {
    width: 12px;
    height: 12px;
}

.pg-arrow-prev {
    left: -10px;
}

.pg-arrow-next {
    right: -10px;
}

.pg-rail:hover .pg-arrow,
.pg-arrow:focus-visible {
    opacity: 1;
    pointer-events: auto;
}

.pg-arrow:hover {
    background: var(--white);
}

.pg-arrow:disabled {
    opacity: 0 !important;
    pointer-events: none;
}

/* 隐藏的灯箱数据源：不占布局，仅供站内大图按顺序浏览 */
.pg-sources {
    display: none;
}

@media (max-width: 900px) {
    .pg-main {
        aspect-ratio: 4 / 3;
    }

    .pg-thumb {
        flex-basis: calc((100% - 24px) / 4);
    }
}

@media (max-width: 620px) {
    .pg-main {
        aspect-ratio: 1 / 1;
    }

    .pg-toolbar {
        margin-top: 10px;
    }

    .pg-thumb {
        flex-basis: calc((100% - 18px) / 4);
    }

    .pg-thumbs {
        gap: 6px;
    }

    .pg-zoom {
        right: 10px;
        bottom: 10px;
        padding: 6px 9px;
        font-size: 9px;
    }

    .pg-arrow {
        display: none;
    }

    .pg-all {
        font-size: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pg-main-img,
    .pg-thumb,
    .pg-thumb img {
        transition: none;
    }
}
