/* ==========================================================================
   GalleryLabPro - Grid & Lightbox Styles
   ========================================================================== */

/* ---------- CSS Custom Properties ---------- */
.gallerylabpro {
    --gl-columns: 3;
    --gl-gap: 16px;
    --gl-radius: 8px;
    --gl-overlay-bg: #000000;
    --gl-overlay-text: #ffffff;
}

/* ---------- Gallery Header ---------- */
.gallerylabpro-header {
    margin-bottom: 1.5rem;
}

.gallerylabpro-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}

.gallerylabpro-description {
    color: #64748b;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* ---------- Filter Bar ---------- */
.gallerylabpro-filterbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}

.gallerylabpro-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.gallerylabpro-filter-button {
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    font: inherit;
    font-size: 0.875rem;
    line-height: 1.2;
    padding: 0.45rem 0.75rem;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.gallerylabpro-filter-button:hover:not(.is-active),
.gallerylabpro-filter-button:focus-visible:not(.is-active) {
    border-color: #94a3b8;
    background: #f8fafc;
    color: #0f172a;
}

.gallerylabpro-filter-button:focus-visible {
    outline: 2px solid rgba(14, 165, 233, 0.28);
    outline-offset: 2px;
}

.gallerylabpro-filter-button.is-active {
    border-color: #0ea5e9;
    background: #e0f2fe;
    color: #075985;
}

.gallerylabpro-filter-button.is-active:hover,
.gallerylabpro-filter-button.is-active:focus-visible {
    border-color: #0284c7;
    background: #bae6fd;
    color: #075985;
}

.gallerylabpro-search {
    display: block;
    min-width: min(100%, 260px);
}

.gallerylabpro-search-input {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #0f172a;
    font: inherit;
    min-height: 2.35rem;
    padding: 0.45rem 0.7rem;
}

.gallerylabpro-search-input:focus {
    border-color: #2563eb;
    outline: 2px solid rgba(37, 99, 235, 0.2);
    outline-offset: 0;
}

.gallerylabpro-no-matches {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #64748b;
    text-align: center;
}

/* ---------- Image Grid ---------- */
.gallerylabpro-grid,
.gallerylabpro-masonry,
.gallerylabpro-justified,
.gallerylabpro-video-grid {
    display: grid;
    grid-template-columns: repeat(var(--gl-columns), 1fr);
    gap: var(--gl-gap);
}

.gallerylabpro-masonry {
    display: grid;
    grid-template-columns: repeat(var(--gl-columns), minmax(0, 1fr));
    grid-auto-rows: 8px;
    align-items: start;
    gap: var(--gl-gap);
}

.gallerylabpro-justified {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--gl-gap);
}

.gallerylabpro-video-grid {
    align-items: start;
}

.gallerylabpro-grid-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--gl-radius);
    clip-path: inset(0 round var(--gl-radius));
    background: #f1f5f9;
    aspect-ratio: 1;
    cursor: pointer;
}

.gallerylabpro-video-grid .gallerylabpro-grid-item {
    aspect-ratio: auto;
    overflow: visible;
    clip-path: none;
    background: transparent;
}

.gallerylabpro-video-thumb {
    position: relative;
    overflow: hidden;
    border-radius: var(--gl-radius);
    background-color: #0f172a;
    aspect-ratio: 16 / 9;
}

.gallerylabpro-video-grid .gallerylabpro-grid-item > img,
.gallerylabpro-video-grid .gallerylabpro-grid-item > .gallerylabpro-grid-item-placeholder {
    aspect-ratio: 16 / 9;
    height: auto;
    min-height: 0;
    object-fit: cover;
    border-radius: var(--gl-radius);
    background-color: #0f172a;
}

.gallerylabpro-video-thumb img,
.gallerylabpro-video-thumb .gallerylabpro-grid-item-placeholder {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
    border-radius: inherit;
}

.gallerylabpro-video-meta {
    display: grid;
    gap: 0.2rem;
    padding-top: 0.65rem;
    color: #0f172a;
    line-height: 1.35;
}

.gallerylabpro-video-meta strong {
    font-size: 0.98rem;
    font-weight: 700;
}

.gallerylabpro-video-meta span {
    color: #64748b;
    font-size: 0.875rem;
}

.gallerylabpro-masonry .gallerylabpro-grid-item {
    display: block;
    width: auto;
    aspect-ratio: auto;
    margin: 0;
    clip-path: none;
}

.gallerylabpro-justified .gallerylabpro-grid-item {
    flex: none;
    aspect-ratio: auto;
}

.gallerylabpro-grid-item[hidden] {
    display: none;
}

.gallerylabpro.is-filtering .gallerylabpro-masonry {
    opacity: 0.999;
}

.gallerylabpro-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: inherit;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.gallerylabpro-grid-item-placeholder {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 10rem;
    border-radius: inherit;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.78), rgba(37, 99, 235, 0.64)),
        #1e293b;
}

.gallerylabpro-grid-item-play {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 3rem;
    height: 3rem;
    transform: translate(-50%, -50%);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.28);
    pointer-events: none;
}

.gallerylabpro-grid-item-play::before {
    content: "";
    position: absolute;
    left: 1.18rem;
    top: 0.86rem;
    width: 0;
    height: 0;
    border-top: 0.65rem solid transparent;
    border-bottom: 0.65rem solid transparent;
    border-left: 0.95rem solid #fff;
}

.gallerylabpro-masonry .gallerylabpro-grid-item img {
    height: auto;
    object-fit: contain;
}

.gallerylabpro-justified .gallerylabpro-grid-item img {
    height: 100%;
    object-fit: cover;
}

/* Hover effects */
.gallerylabpro--hover-zoom .gallerylabpro-grid-item:hover img {
    transform: scale(1.04);
}

.gallerylabpro--hover-fade .gallerylabpro-grid-item:hover img {
    opacity: 0.75;
}

/* Image overlay (title on hover) */
.gallerylabpro-grid-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 0 0 var(--gl-radius) var(--gl-radius);
    padding: 0.75rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: var(--gl-overlay-text);
    font-size: 0.875rem;
    font-weight: 500;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    pointer-events: none;
}

.gallerylabpro-grid-item-overlay--video {
    font-weight: 700;
}

.gallerylabpro-grid-item:hover .gallerylabpro-grid-item-overlay,
.gallerylabpro-grid-item:focus-visible .gallerylabpro-grid-item-overlay {
    transform: translateY(0);
}

/* ---------- Lightbox ---------- */
.gallerylabpro-lightbox {
    --gl-lightbox-inline-safe: 11rem;
    --gl-lightbox-block-safe: 6rem;
    position: fixed;
    inset: 0;
    z-index: 10000;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4.75rem 5.5rem 1.25rem;
    background: rgba(0, 0, 0, 0.92);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.gallerylabpro-lightbox[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.gallerylabpro-lightbox-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: calc(100vw - var(--gl-lightbox-inline-safe));
    max-height: calc(100vh - var(--gl-lightbox-block-safe));
    border-radius: 4px;
    overflow: visible;
}

.gallerylabpro-lightbox.is-video .gallerylabpro-lightbox-content {
    width: min(1120px, calc(100vw - var(--gl-lightbox-inline-safe)));
}

.gallerylabpro-lightbox.is-video .gallerylabpro-lightbox-caption {
    position: static;
    width: 100%;
    margin-top: 0.85rem;
    padding: 0;
    background: none;
}

.gallerylabpro-lightbox-image {
    max-width: 100%;
    max-width: calc(100vw - var(--gl-lightbox-inline-safe));
    max-height: calc(100vh - var(--gl-lightbox-block-safe));
    object-fit: contain;
    user-select: none;
    display: block;
}

.gallerylabpro-lightbox-video {
    position: relative;
    width: 100%;
    max-height: calc(100vh - var(--gl-lightbox-block-safe) - 6rem);
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.gallerylabpro-lightbox-video[hidden] {
    display: none;
}

.gallerylabpro-lightbox-video iframe,
.gallerylabpro-lightbox-video video {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #000;
}

.gallerylabpro-lightbox-image.is-changing-fade {
    animation: gallerylabproFadeIn 0.28s ease;
}

.gallerylabpro-lightbox-image.is-changing-slide {
    animation: gallerylabproSlideIn 0.28s ease;
}

.gallerylabpro-lightbox-toolbar {
    position: absolute;
    top: 1rem;
    right: 4.25rem;
    display: flex;
    gap: 0.5rem;
}

.gallerylabpro-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.gallerylabpro-lightbox-play,
.gallerylabpro-lightbox-fullscreen,
.gallerylabpro-lightbox-share-toggle {
    min-width: 3.75rem;
    height: 2.5rem;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 0.875rem;
    line-height: 1;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.8rem;
    transition: background 0.2s ease;
}

.gallerylabpro-lightbox-close:hover,
.gallerylabpro-lightbox-close:focus-visible,
.gallerylabpro-lightbox-play:hover,
.gallerylabpro-lightbox-play:focus-visible,
.gallerylabpro-lightbox-fullscreen:hover,
.gallerylabpro-lightbox-fullscreen:focus-visible,
.gallerylabpro-lightbox-share-toggle:hover,
.gallerylabpro-lightbox-share-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.3);
}

.gallerylabpro-lightbox-share {
    position: relative;
}

.gallerylabpro-lightbox-share-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 10rem;
    padding: 0.35rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.25);
}

.gallerylabpro-lightbox-share-menu a,
.gallerylabpro-lightbox-share-menu button {
    width: 100%;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #fff;
    display: block;
    font: inherit;
    font-size: 0.875rem;
    line-height: 1.2;
    padding: 0.55rem 0.7rem;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.gallerylabpro-lightbox-share-menu a:hover,
.gallerylabpro-lightbox-share-menu a:focus-visible,
.gallerylabpro-lightbox-share-menu button:hover,
.gallerylabpro-lightbox-share-menu button:focus-visible {
    background: rgba(255, 255, 255, 0.14);
    outline: none;
}

.gallerylabpro-lightbox-prev,
.gallerylabpro-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 3rem;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.25rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.gallerylabpro-lightbox-prev {
    left: 1rem;
}

.gallerylabpro-lightbox-next {
    right: 1rem;
}

.gallerylabpro-lightbox-prev:hover,
.gallerylabpro-lightbox-prev:focus-visible,
.gallerylabpro-lightbox-next:hover,
.gallerylabpro-lightbox-next:focus-visible {
    background: rgba(255, 255, 255, 0.3);
}

.gallerylabpro-lightbox-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    color: #fff;
    font-size: 0.9375rem;
    line-height: 1.5;
    padding: 1.35rem 1rem 0.75rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.82) 34%, rgba(0, 0, 0, 0.82));
}

.gallerylabpro-lightbox-title {
    display: block;
    font-size: 1rem;
    font-weight: 700;
}

.gallerylabpro-lightbox-caption-text {
    display: block;
    margin-top: 0.15rem;
}

.gallerylabpro-lightbox-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 0.55rem;
}

.gallerylabpro-lightbox-tags span {
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.75rem;
    line-height: 1.2;
    padding: 0.25rem 0.55rem;
}

.gallerylabpro-lightbox-counter {
    position: absolute;
    top: 1rem;
    left: 1rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
}

/* ---------- Gallery List (Cards) ---------- */
.gallerylabpro-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.gallerylabpro-list-card {
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.gallerylabpro-list-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.gallerylabpro-list-card-image {
    overflow: hidden;
}

.gallerylabpro-list-card-image img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
    background: #f1f5f9;
    transition: transform 0.3s ease;
}

.gallerylabpro-list-card:hover .gallerylabpro-list-card-image img {
    transform: scale(1.05);
}

.gallerylabpro-list-card-body {
    padding: 1.25rem;
}

.gallerylabpro-list-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.375rem;
    color: #1e293b;
}

.gallerylabpro-list-card-desc {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0 0 0.75rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallerylabpro-list-card-count {
    font-size: 0.8125rem;
    color: #94a3b8;
}

/* ---------- Empty State ---------- */
.gallerylabpro-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
    .gallerylabpro-grid,
    .gallerylabpro-masonry,
    .gallerylabpro-justified,
    .gallerylabpro-video-grid {
        --gl-columns: 3;
    }
}

@media (max-width: 767px) {
    .gallerylabpro-lightbox {
        --gl-lightbox-inline-safe: 2rem;
        --gl-lightbox-block-safe: 5.75rem;
        padding: 1rem 1rem 4.75rem;
    }

    .gallerylabpro-grid,
    .gallerylabpro-masonry,
    .gallerylabpro-justified,
    .gallerylabpro-video-grid {
        --gl-columns: 2;
    }

    .gallerylabpro-lightbox-prev,
    .gallerylabpro-lightbox-next {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
    }

    .gallerylabpro-lightbox-toolbar {
        top: auto;
        right: 1rem;
        bottom: 1rem;
    }

    .gallerylabpro-lightbox-share-menu {
        top: auto;
        right: 0;
        bottom: calc(100% + 0.5rem);
    }

}

@media (max-width: 575px) {
    .gallerylabpro-grid,
    .gallerylabpro-masonry,
    .gallerylabpro-justified,
    .gallerylabpro-video-grid {
        --gl-columns: 1;
    }

    .gallerylabpro-list {
        grid-template-columns: 1fr;
    }
}

/* ---------- Accessibility ---------- */
.gallerylabpro-grid-item:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

.gallerylabpro-lightbox-close:focus-visible,
.gallerylabpro-lightbox-play:focus-visible,
.gallerylabpro-lightbox-fullscreen:focus-visible,
.gallerylabpro-lightbox-share-toggle:focus-visible,
.gallerylabpro-lightbox-prev:focus-visible,
.gallerylabpro-lightbox-next:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

@keyframes gallerylabproFadeIn {
    from {
        opacity: 0.45;
    }
    to {
        opacity: 1;
    }
}

@keyframes gallerylabproSlideIn {
    from {
        opacity: 0.5;
        transform: translateX(1.25rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .gallerylabpro-grid-item img,
    .gallerylabpro-grid-item-overlay,
    .gallerylabpro-lightbox,
    .gallerylabpro-lightbox-image,
    .gallerylabpro-lightbox-video,
    .gallerylabpro-lightbox-play,
    .gallerylabpro-lightbox-fullscreen,
    .gallerylabpro-lightbox-share-toggle,
    .gallerylabpro-filter-button,
    .gallerylabpro-card {
        transition: none;
        animation: none;
    }
}
