/* =============================================
   Smart Image Gallery - Public Styles v1.1.0
   Font: Libre Franklin
   Row pattern (per 10 items):
     Row 1 (1-2):  span2+span1  height A
     Row 2 (3-5):  3 equal      height B (taller)
     Row 3 (6-7):  span1+span2  height A (same as row1)
     Row 4 (8-10): 3 equal      height B (same as row2)
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Libre+Franklin:wght@400;500;600;700;800&display=swap');

:root {
    --sig-gap: 15px;
    --sig-row-A: 320px;
    --sig-row-B: 500px;
    --sig-overlay-bg: linear-gradient(to top, rgb(0 0 0) 0%, rgba(0, 0, 0, .38) 70%, transparent 100%);
}

.sig-gallery-wrapper {
    width: 100%;
    font-family: 'Libre Franklin', sans-serif;
    box-sizing: border-box;
}

/* =====================
   GRID
   ===================== */
.sig-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sig-gap);
    width: 100%;
}

.sig-grid-item {
    grid-column: span 1;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: #f3f3f3;
    display: block;
    border-radius: 10px;
}

/* Row 1 — span2 + span1, height A */
.sig-grid-item:nth-child(10n+1) { grid-column: span 2; height: var(--sig-row-A); }
.sig-grid-item:nth-child(10n+2) { grid-column: span 1; height: var(--sig-row-A); }

/* Row 2 — 3 equal, height B */
.sig-grid-item:nth-child(10n+3),
.sig-grid-item:nth-child(10n+4),
.sig-grid-item:nth-child(10n+5) { grid-column: span 1; height: var(--sig-row-B); }

/* Row 3 — span1 + span2, height A */
.sig-grid-item:nth-child(10n+6) { grid-column: span 1; height: var(--sig-row-A); }
.sig-grid-item:nth-child(10n+7) { grid-column: span 2; height: var(--sig-row-A); }

/* Row 4 — 3 equal, height B */
.sig-grid-item:nth-child(10n+8),
.sig-grid-item:nth-child(10n+9),
.sig-grid-item:nth-child(10n+10) { grid-column: span 1; height: var(--sig-row-B); }

/* =====================
   IMAGE — sharp, GPU composited
   ===================== */
.sig-image-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.sig-image-wrap img {
    width: 100%;
    height: 100%;
    scale: 1.04;
    object-fit: cover;
    object-position: center;
    display: block;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    transition: transform .45s cubic-bezier(.25,.46,.45,.94);
    will-change: transform;
    image-rendering: -webkit-optimize-contrast;
}

.sig-grid-item:hover .sig-image-wrap img {
    transform: scale(1.06) translateZ(0);
}

/* =====================
   OVERLAY — bottom only, always visible
   ===================== */
.sig-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--sig-overlay-bg);
    padding: 55px 25px 25px 25px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    pointer-events: none;
    z-index: 2;
}

.sig-category-label {
    font-family: 'Libre Franklin', sans-serif;
    font-size: 10px;
    color: #ffffff;
    line-height: 1.2;
    display: block;
}

.sig-image-name {
    font-family: 'Libre Franklin', sans-serif;
    font-size: 20px;
    color: #ffffff;
    line-height: 1.25;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sig-grid-item:nth-child(10n+1) .sig-image-name,
.sig-grid-item:nth-child(10n+7) .sig-image-name { font-size: 20px; }

/* =====================
   LOAD MORE
   ===================== */
.sig-load-more-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 28px 0 8px;
}

.sig-load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Libre Franklin', sans-serif;
    letter-spacing: 1.8px;
    text-transform: capitalize;
    cursor: pointer;
    background: linear-gradient(90deg, #3f94c5, #19ae90);
    border-radius: 6px;
    color: #fff;
    font-size: 16px;
    padding: 10px 25px;
    border: none;
    transition: opacity 0.2s ease;
}

.sig-load-more-btn:hover { 
    opacity: 0.9; 
}
.sig-load-more-btn:active { 
    background: #000; 
}
.sig-btn-text { position: relative; z-index: 1; }
.sig-btn-loader {
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: sig-spin .6s linear infinite;
}
@keyframes sig-spin { to { transform: rotate(360deg); } }

/* =====================
   LIGHTBOX
   ===================== */
.sig-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sig-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(5,5,10,.96);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.sig-lightbox-container {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1000px;
    max-height: 100vh;
    padding: 20px 20px 0;
    box-sizing: border-box;
    gap: 10px;
}

.sig-lightbox-close {
    position: fixed; top: 16px; right: 20px;
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    color: #fff; font-size: 22px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s; z-index: 10;
    line-height: 1; padding: 0; font-family: serif;
}
.sig-lightbox-close:hover { background: rgba(255,255,255,.25); }

.sig-lightbox-prev,
.sig-lightbox-next {
    position: fixed; top: 50%; transform: translateY(-50%);
    width: 48px; height: 48px; border-radius: 50%;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    color: #fff; font-size: 18px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s, transform .2s; z-index: 10; padding: 0;
}
.sig-lightbox-prev { left: 16px; }
.sig-lightbox-next { right: 16px; }
.sig-lightbox-prev:hover,
.sig-lightbox-next:hover {
    background: rgba(255,255,255,.25);
    transform: translateY(-50%) scale(1.1);
}

/* Full image — no crop, natural aspect ratio */
.sig-lightbox-main {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 0;
    max-height: calc(100vh - 175px);
    overflow: hidden;
}

.sig-lightbox-img {
    max-width: 100%;
    max-height: calc(100vh - 175px);
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 2px;
    transition: opacity .25s;
}
.sig-lightbox-img.sig-fading { opacity: 0; }

.sig-lightbox-info {
    display: flex; flex-direction: column; align-items: center;
    gap: 2px; padding: 4px 0 0;
}
.sig-lightbox-category {
    font-family: 'Libre Franklin', sans-serif;
    font-size: 12px;
    letter-spacing: 1.5px;
    color: #fff;
}
.sig-lightbox-name {
    font-family: 'Libre Franklin', sans-serif;
    font-size: 18px;
    color: #fff; letter-spacing: .2px;
}

.sig-lightbox-thumbs {
    display: flex; gap: 6px; overflow-x: auto;
    padding: 8px 0 16px; width: 100%;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent;
    justify-content: center; flex-wrap: nowrap;
}
.sig-lightbox-thumbs::-webkit-scrollbar { height: 4px; }
.sig-lightbox-thumbs::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }

.sig-thumb-item {
    flex-shrink: 0; width: 64px; height: 48px; border-radius: 3px;
    overflow: hidden; cursor: pointer; opacity: .4;
    transition: opacity .2s, transform .2s, outline .2s;
    outline: 2px solid transparent;
}
.sig-thumb-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sig-thumb-item:hover { opacity: .75; transform: scale(1.05); }
.sig-thumb-item.active { opacity: 1; outline: 2px solid #fff; transform: scale(1.08); }

/* =====================
   RESPONSIVE
   ===================== */
@media (max-width: 1024px) {
    :root {
        --sig-row-A: 230px;
        --sig-row-B: 330px;
    }
}   
   
@media (max-width: 768px) {
    :root { 
        --sig-gap: 10px;
        --sig-row-A: 170px;
        --sig-row-B: 240px;
    }
    .sig-grid-item {
        border-radius: 10px;
    }
    .sig-image-name { font-size: 11px !important; }
    .sig-category-label { font-size: 8px; }
    .sig-lightbox-prev { left: 6px; }
    .sig-lightbox-next { right: 6px; }
    .sig-thumb-item { width: 52px; height: 40px; }
    .sig-lightbox-container { padding: 14px 14px 0; }
}
@media (max-width: 480px) {
    :root { --sig-gap: 5px; --sig-row-A: 140px; --sig-row-B: 200px; }
    .sig-grid-item {
        border-radius: 5px;
    }
    .sig-lightbox-prev,
    .sig-lightbox-next { width: 36px; height: 36px; font-size: 14px; }
    .sig-lightbox-name { font-size: 15px; }
    .sig-thumb-item { width: 44px; height: 34px; }
}

.sig-grid-item.sig-new-item { animation: sig-fade-in .4s ease forwards; }
@keyframes sig-fade-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
