/* ═══════════════════════════════════════════════
   Velocity Widgets - Photo Gallery Styles
   ═══════════════════════════════════════════════ */

/* ─── Grid ─── */
.vw-gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--vw-cols, 3), 1fr);
    gap: var(--vw-gap, 10px);
}

.vw-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--vw-radius, 8px);
    cursor: pointer;
    line-height: 0;
}

.vw-gallery-grid .vw-gallery-item {
    aspect-ratio: 1;
}

.vw-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

/* Hover Effects */
.vw-hover-zoom .vw-gallery-item:hover img { transform: scale(1.08); }

.vw-hover-darken .vw-gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: var(--vw-transition);
    pointer-events: none;
}
.vw-hover-darken .vw-gallery-item:hover::after { background: rgba(0, 0, 0, 0.3); }

.vw-hover-fade-caption .vw-gallery-caption {
    opacity: 0;
    transform: translateY(8px);
}
.vw-hover-fade-caption .vw-gallery-item:hover .vw-gallery-caption {
    opacity: 1;
    transform: translateY(0);
}

.vw-hover-slide-up .vw-gallery-caption {
    transform: translateY(100%);
}
.vw-hover-slide-up .vw-gallery-item:hover .vw-gallery-caption {
    transform: translateY(0);
}

/* Captions */
.vw-gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: #fff;
    line-height: 1.4;
    transition: var(--vw-transition);
    z-index: 2;
}

.vw-gallery-caption strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.vw-gallery-caption span {
    display: block;
    font-size: 12px;
    opacity: 0.85;
    margin-top: 2px;
}

/* ─── Masonry ─── */
.vw-gallery-masonry {
    columns: var(--vw-cols, 3);
    column-gap: var(--vw-gap, 10px);
}

.vw-gallery-masonry .vw-gallery-item {
    break-inside: avoid;
    margin-bottom: var(--vw-gap, 10px);
    aspect-ratio: unset;
}

.vw-gallery-masonry .vw-gallery-item img {
    height: auto;
}

/* ─── Slider with Thumbnails ─── */
.vw-gallery-slider {
    position: relative;
}

.vw-gallery-slider-main {
    position: relative;
    overflow: hidden;
    border-radius: var(--vw-radius, 8px);
    aspect-ratio: 16/10;
    background: #000;
}

.vw-gallery-slider-slide {
    display: none;
    position: absolute;
    inset: 0;
    animation: vwGalleryFade 0.5s ease;
}

.vw-gallery-slider-slide.active { display: block; }

.vw-gallery-slider-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.vw-gallery-slider-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
    color: #fff;
    line-height: 1.4;
}

.vw-gallery-slider-caption strong { font-size: 16px; }
.vw-gallery-slider-caption span { font-size: 13px; opacity: 0.85; }

.vw-gallery-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    padding: 4px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.vw-gallery-thumb {
    flex-shrink: 0;
    width: 72px;
    height: 52px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    border: 2px solid transparent;
    transition: var(--vw-transition);
}

.vw-gallery-thumb.active,
.vw-gallery-thumb:hover {
    opacity: 1;
    border-color: var(--vw-primary);
}

.vw-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ─── Carousel ─── */
.vw-gallery-carousel {
    position: relative;
    overflow: hidden;
    padding: 0 20px;
}

.vw-gallery-carousel-track {
    display: flex;
    gap: var(--vw-gap, 10px);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.vw-gallery-carousel-item {
    flex: 0 0 calc(25% - 8px);
    border-radius: var(--vw-radius, 8px);
    overflow: hidden;
    aspect-ratio: 1;
    cursor: pointer;
}

.vw-gallery-carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.vw-gallery-carousel-item:hover img { transform: scale(1.05); }

/* ─── Justified ─── */
.vw-gallery-justified {
    display: flex;
    flex-wrap: wrap;
    gap: var(--vw-gap, 4px);
}

.vw-gallery-justified .vw-gallery-item {
    flex-grow: 1;
    height: 220px;
    aspect-ratio: unset;
}

.vw-gallery-justified .vw-gallery-item img {
    max-height: 100%;
    min-width: 100%;
    object-fit: cover;
}

/* ─── Collage / Mosaic ─── */
.vw-gallery-collage {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 180px;
    gap: var(--vw-gap, 6px);
}

.vw-gallery-collage .vw-gallery-item {
    aspect-ratio: unset;
}

.vw-collage-large {
    grid-column: span 2;
    grid-row: span 2;
}

.vw-collage-wide {
    grid-column: span 2;
}

.vw-collage-tall {
    grid-row: span 2;
}

/* ─── Product Viewer ─── */
.vw-gallery-product {
    display: flex;
    gap: 16px;
}

.vw-gallery-product-main {
    flex: 1;
    position: relative;
    border-radius: var(--vw-radius, 8px);
    overflow: hidden;
    aspect-ratio: 1;
    background: #f8f9fa;
}

.vw-gallery-product-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.vw-gallery-product-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
    color: #fff;
}

.vw-gallery-product-thumbs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    max-height: 100%;
    width: 80px;
}

.vw-gallery-product-thumb {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    border: 2px solid transparent;
    transition: var(--vw-transition);
    flex-shrink: 0;
}

.vw-gallery-product-thumb.active,
.vw-gallery-product-thumb:hover {
    opacity: 1;
    border-color: var(--vw-primary);
}

.vw-gallery-product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ─── Filmstrip ─── */
.vw-gallery-filmstrip {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding: 8px 0;
}

.vw-gallery-filmstrip-track {
    display: flex;
    gap: var(--vw-gap, 6px);
}

.vw-gallery-filmstrip-frame {
    flex-shrink: 0;
    width: 280px;
    height: 200px;
    border-radius: var(--vw-radius, 8px);
    overflow: hidden;
    cursor: pointer;
    border: 3px solid var(--vw-border);
    transition: var(--vw-transition);
}

.vw-gallery-filmstrip-frame:hover {
    border-color: var(--vw-primary);
    transform: scale(1.03);
}

.vw-gallery-filmstrip-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ─── Lightbox ─── */
.vw-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    animation: vwLightboxIn 0.3s ease;
}

.vw-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
}

.vw-lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 80px;
}

.vw-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--vw-transition);
    z-index: 10;
}

.vw-lightbox-close:hover { background: rgba(255, 255, 255, 0.15); }

.vw-lightbox-prev,
.vw-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--vw-transition);
    z-index: 10;
}

.vw-lightbox-prev { left: 16px; }
.vw-lightbox-next { right: 16px; }
.vw-lightbox-prev:hover,
.vw-lightbox-next:hover { background: rgba(255, 255, 255, 0.25); }

.vw-lightbox-image {
    max-width: 100%;
    max-height: calc(100% - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.vw-lightbox-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.vw-lightbox-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.vw-lightbox-title { font-weight: 500; }
.vw-lightbox-counter { opacity: 0.6; font-size: 13px; }

@keyframes vwGalleryFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes vwLightboxIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ─── Responsive ─── */
@media (max-width: 1024px) {
    .vw-gallery-grid { grid-template-columns: repeat(2, 1fr); }
    .vw-gallery-masonry { columns: 2; }
    .vw-gallery-collage { grid-template-columns: repeat(3, 1fr); }
    .vw-gallery-carousel-item { flex: 0 0 calc(33.333% - 8px); }
    .vw-gallery-justified .vw-gallery-item { height: 180px; }
}

@media (max-width: 640px) {
    .vw-gallery-grid { grid-template-columns: repeat(2, 1fr); }
    .vw-gallery-masonry { columns: 2; }
    .vw-gallery-collage { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 140px; }
    .vw-collage-large { grid-column: span 2; grid-row: span 1; }
    .vw-collage-wide { grid-column: span 1; }
    .vw-collage-tall { grid-row: span 1; }
    .vw-gallery-carousel-item { flex: 0 0 calc(50% - 6px); }
    .vw-gallery-justified .vw-gallery-item { height: 140px; }

    .vw-gallery-product { flex-direction: column-reverse; }
    .vw-gallery-product-thumbs { flex-direction: row; width: 100%; max-height: none; overflow-x: auto; }
    .vw-gallery-product-thumb { width: 64px; height: 64px; }

    .vw-gallery-filmstrip-frame { width: 200px; height: 150px; }

    .vw-lightbox-content { padding: 50px 16px; }
    .vw-lightbox-prev { left: 4px; }
    .vw-lightbox-next { right: 4px; }
}
