/* Public Stylesheet for WordPress Square Grid Gallery */

.sg-gallery-wrapper {
    width: 100%;
    margin: 30px auto;
    position: relative;
    box-sizing: border-box;
}

.sg-gallery-wrapper * {
    box-sizing: border-box;
}

/* ============================================================
 * TAB SWITCHER BAR
 * ============================================================ */
.sg-tab-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 28px;
    padding: 5px;
    background: rgba(15, 17, 26, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(15, 17, 26, 0.08);
    border-radius: 50px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 2px 16px rgba(15, 17, 26, 0.06);
}

.sg-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 20px;
    border: none;
    border-radius: 40px;
    background: transparent;
    color: rgba(15, 17, 26, 0.55);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: 0.2px;
    transition: color 0.25s ease, background 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
    white-space: nowrap;
    line-height: 1;
    position: relative;
    user-select: none;
}

.sg-tab-btn:hover {
    color: rgba(15, 17, 26, 0.85);
    background: rgba(15, 17, 26, 0.06);
    transform: translateY(-1px);
}

.sg-tab-btn.sg-tab-active {
    background: #0f111a;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(15, 17, 26, 0.28);
    transform: translateY(0);
}

.sg-tab-btn.sg-tab-active:hover {
    background: #1a1d2e;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(15, 17, 26, 0.35);
}

.sg-tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.75;
    transition: opacity 0.25s ease;
}

.sg-tab-btn.sg-tab-active .sg-tab-icon {
    opacity: 1;
}

.sg-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 20px;
    background: rgba(15, 17, 26, 0.08);
    color: inherit;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    transition: background 0.25s ease;
}

.sg-tab-btn.sg-tab-active .sg-tab-count {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* Filtered-out items */
.sg-gallery-item.sg-tab-hidden {
    display: none !important;
}

/* Tab switch transition on grid */
.sg-gallery-grid.sg-tab-switching .sg-gallery-item {
    animation: sgTabFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes sgTabFadeIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Responsive tweaks */
@media (max-width: 480px) {
    .sg-tab-bar {
        gap: 4px;
        padding: 4px;
    }
    .sg-tab-btn {
        padding: 8px 14px;
        font-size: 13px;
        gap: 5px;
    }
    .sg-tab-count {
        display: none; /* hide count badges on very small screens */
    }
}

/* 3-2-1 Column Grid Layout */
.sg-gallery-grid {
    display: grid;
    gap: 24px;
    grid-auto-flow: row;
}

/* Mobile: 1 Column */
@media (max-width: 600px) {
    .sg-gallery-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 16px;
    }
}

/* Tablet: 2 Columns */
@media (min-width: 601px) and (max-width: 900px) {
    .sg-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Desktop: 3 Columns */
@media (min-width: 901px) {
    .sg-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }
}

/* Grid Gallery Item */
.sg-gallery-item {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    position: relative;
    border-radius: 16px;
    background: #0f111a;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.sg-gallery-item .sg-item-inner {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* Images within item */
.sg-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.001);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Hover effects */
.sg-gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
}

.sg-gallery-item:hover img {
    transform: scale(1.06);
}

/* Glassmorphism Hover Overlay */
.sg-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(15, 17, 26, 0.2), rgba(15, 17, 26, 0.75));
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 3;
}

.sg-gallery-item:hover .sg-item-overlay {
    opacity: 1;
}

/* Overlay Play & Zoom Glassmorphism Icons */
.sg-play-button, 
.sg-zoom-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    margin-bottom: 14px;
    transform: scale(0.7);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.sg-play-button svg {
    margin-left: 3px; /* visual alignment of play arrow */
}

.sg-gallery-item:hover .sg-play-button,
.sg-gallery-item:hover .sg-zoom-icon {
    transform: scale(1);
}

.sg-play-button:hover,
.sg-zoom-icon:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Captions */
.sg-item-caption {
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transform: translateY(12px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.05s, opacity 0.4s ease 0.05s;
    letter-spacing: 0.2px;
}

.sg-gallery-item:hover .sg-item-caption {
    transform: translateY(0);
    opacity: 1;
}

/* Infinite Scroll Loading Indicators */
.sg-loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px 0;
    width: 100%;
    clear: both;
}

.sg-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(15, 17, 26, 0.06);
    border-top-color: #0f111a;
    border-radius: 50%;
    animation: sgSpinnerSpin 0.75s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
}

@keyframes sgSpinnerSpin {
    to { transform: rotate(360deg); }
}

/* AJAX Entry Animation */
.sg-gallery-item.sg-animate-in {
    opacity: 0;
    animation: sgItemFadeInUp 0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes sgItemFadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ----------------------------------------------------
 * PREMIUM LIGHTBOX CUSTOM STYLING
 * ---------------------------------------------------- */
.sg-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 9, 13, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.sg-lightbox.sg-active {
    opacity: 1;
    visibility: visible;
}

/* Content Frame */
.sg-lightbox-content {
    position: relative;
    max-width: 85%;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: sgLightboxScale 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sgLightboxScale {
    from {
        transform: scale(0.92);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.sg-lightbox img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* Video Containers */
.sg-lightbox-video-container {
    width: 80vw;
    max-width: 960px;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    background: #000;
}

/* 16:9 Aspect Ratio Box for Iframe Video Embeds */
.sg-lightbox-video-ratio {
    padding-top: 56.25%; /* 16:9 Ratio */
    position: relative;
    width: 100%;
    height: 0;
}

.sg-lightbox-video-ratio iframe,
.sg-lightbox-video-ratio video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

.sg-lightbox-video-container video {
    display: block;
    max-height: 80vh;
    width: 100%;
}

/* Lightbox UI Elements (Close, Prev, Next buttons) */
.sg-lightbox-close,
.sg-lightbox-prev,
.sg-lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, transform 0.2s;
    user-select: none;
    z-index: 1000000;
}

.sg-lightbox-close {
    top: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.sg-lightbox-prev,
.sg-lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
}

.sg-lightbox-prev {
    left: 30px;
}

.sg-lightbox-next {
    right: 30px;
}

/* Hover and active states */
.sg-lightbox-close:hover,
.sg-lightbox-prev:hover,
.sg-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.05) translateY(0);
}

.sg-lightbox-prev:hover {
    transform: translateY(-50%) scale(1.05);
}

.sg-lightbox-next:hover {
    transform: translateY(-50%) scale(1.05);
}

.sg-lightbox-close:active,
.sg-lightbox-prev:active,
.sg-lightbox-next:active {
    transform: scale(0.95);
}

.sg-lightbox-prev:active {
    transform: translateY(-50%) scale(0.95);
}

.sg-lightbox-next:active {
    transform: translateY(-50%) scale(0.95);
}

/* Hide navigation buttons on mobile if only one item or for thumb space */
@media (max-width: 768px) {
    .sg-lightbox-prev {
        left: 15px;
        width: 46px;
        height: 46px;
    }
    .sg-lightbox-next {
        right: 15px;
        width: 46px;
        height: 46px;
    }
    .sg-lightbox-close {
        top: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }
    .sg-lightbox-content {
        max-width: 90%;
    }
}

/* Lightbox Captions */
.sg-lightbox-caption {
    position: absolute;
    bottom: 30px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    background: rgba(15, 17, 26, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px 24px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 80%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 1000000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
