/* ============================
   Picture Plugin — Gallery + Lightbox
   ============================ */

/* --- Gallery Grid --- */
.picture-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--grid-gutter, 16px);
    margin-top: 2rem;
}

.picture-gallery__item {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: var(--radius, 10px);
    aspect-ratio: 3 / 2;
    text-decoration: none;
}

.picture-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.picture-gallery__item:hover img {
    transform: scale(1.04);
}

.picture-gallery__caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 10px;
    font-size: 12px;
    color: #fff;
    background: linear-gradient(transparent, rgba(0,0,0,0.55));
    pointer-events: none;
}

/* --- Zoom icon on hover --- */
.picture-gallery__item::after,
.picture-zoom-icon {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='8.5' cy='8.5' r='5.5' stroke='white' stroke-width='1.5'/%3E%3Cpath d='M13 13l4 4' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3Cpath d='M6.5 8.5h4M8.5 6.5v4' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.picture-gallery__item:hover::after,
.picture-zoom-wrap:hover .picture-zoom-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.picture-zoom-wrap {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.picture-zoom-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
}

.picture-zoom-icon svg {
    width: 20px;
    height: 20px;
}

@media (max-width: 900px) {
    .picture-gallery { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .picture-gallery { grid-template-columns: 1fr; }
}

/* --- Lightbox --- */
.picture-lb {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.picture-lb.is-open {
    opacity: 1;
}

.picture-lb__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
}

/* Close button */
.picture-lb__close {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 3;
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    padding: 10px;
    transition: color 0.15s;
    line-height: 0;
}
.picture-lb__close:hover {
    color: #fff;
}
.picture-lb__close svg {
    width: 24px;
    height: 24px;
}

/* Navigation */
.picture-lb__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    background: rgba(255,255,255,0.08);
    border: none;
    color: rgba(255,255,255,0.7);
    padding: 12px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
    user-select: none;
    line-height: 0;
}
.picture-lb__nav:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}
.picture-lb__nav svg {
    width: 28px;
    height: 28px;
}
.picture-lb__prev { left: 16px; }
.picture-lb__next { right: 16px; }

/* Stage */
.picture-lb__stage {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 80vh;
}

.picture-lb__img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
    transition: opacity 0.12s ease;
}
.picture-lb__img.is-switching {
    opacity: 0;
}

/* Footer: caption + counter */
.picture-lb__footer {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
    max-width: 90vw;
}

.picture-lb__caption {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
}

.picture-lb__counter {
    color: rgba(255,255,255,0.45);
    font-size: 13px;
    white-space: nowrap;
}

/* Mobile nav adjustments */
@media (max-width: 640px) {
    .picture-lb__nav { font-size: 32px; padding: 6px 10px; }
    .picture-lb__prev { left: 6px; }
    .picture-lb__next { right: 6px; }
    .picture-lb__close { top: 8px; right: 10px; font-size: 28px; }
}
