/* ===========================
   SIG Frontend Gallery Styles
   =========================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Poppins:wght@600;700;800&display=swap');

/* ---- Gallery Wrapper ---- */
.sig-gallery-wrapper {
    font-family: 'Inter', sans-serif;
    margin: 40px 0;
    position: relative;
}

/* ---- Typewriter Header ---- */
.sig-gallery-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}

.sig-title-bar {
    display: block;
    width: 5px;
    border-radius: 99px;
    background: linear-gradient(180deg, #6366f1, #a855f7, #ec4899);
    flex-shrink: 0;
    align-self: stretch;
    min-height: 36px;
    box-shadow: 0 0 12px rgba(99, 102, 241, .5);
    animation: sig-bar-pulse 2s ease-in-out infinite;
}

@keyframes sig-bar-pulse {

    0%,
    100% {
        box-shadow: 0 0 12px rgba(99, 102, 241, .5);
    }

    50% {
        box-shadow: 0 0 24px rgba(168, 85, 247, .8);
    }
}

.sig-typewriter {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    font-weight: 700;
    color: #171f38;
    margin: 0;
    letter-spacing: -0.5px;
    position: relative;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.sig-typed-text {
    background: linear-gradient(135deg, #1e293b 0%, #6366f1 60%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Blinking dots */
.sig-dots {
    display: inline-block;
    font-size: 0.9em;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: sig-blink-dots 0.8s step-end infinite;
    margin-left: 3px;
}

@keyframes sig-blink-dots {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* ---- Gallery Grid ---- */
.sig-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

@media (max-width: 900px) {
    .sig-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 520px) {
    .sig-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .sig-gallery-header {
        margin-bottom: 18px;
    }
}

/* ---- Gallery Item ---- */
.sig-gallery-item {
    position: relative;
    cursor: pointer;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
}

.sig-gallery-item:nth-child(6n+1):not(:only-child) {
    grid-row: span 1;
}

/* Last odd item: center it */
.sig-gallery-grid .sig-gallery-item:last-child:nth-child(3n+1) {
    grid-column: 2;
}

@media (max-width: 900px) {
    .sig-gallery-grid .sig-gallery-item:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .sig-gallery-grid .sig-gallery-item:last-child:nth-child(odd) .sig-img-wrap img {
        max-height: 300px;
    }
}

.sig-img-wrap {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding-bottom: 72%;
    background: #f1f5f9;
}

.sig-img-wrap img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .55s cubic-bezier(.25, .8, .25, 1), filter .55s ease;
    display: block;
    will-change: transform;
}

/* Hover effect */
.sig-gallery-item:hover .sig-img-wrap img {
    transform: scale(1.08);
    filter: brightness(0.75) saturate(1.2);
}

/* Overlay */
.sig-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .35s ease;
    background: linear-gradient(135deg,
            rgba(99, 102, 241, .5) 0%,
            rgba(168, 85, 247, .4) 100%);
    backdrop-filter: blur(2px);
}

.sig-gallery-item:hover .sig-overlay {
    opacity: 1;
}

.sig-overlay-icon {
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, .15);
    border: 2px solid rgba(255, 255, 255, .8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.7);
    transition: transform .3s cubic-bezier(.34, 1.56, .64, 1);
    backdrop-filter: blur(8px);
}

.sig-gallery-item:hover .sig-overlay-icon {
    transform: scale(1);
}

.sig-overlay-icon svg {
    width: 22px;
    height: 22px;
    color: #fff;
}

/* Ripple on click */
.sig-gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    background: rgba(99, 102, 241, .25);
    opacity: 0;
    transition: opacity .3s;
}

.sig-gallery-item.sig-clicked::after {
    opacity: 1;
}

/* ============================
   MODAL
   ============================ */
.sig-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    align-items: center;
    justify-content: center;
}

.sig-modal.sig-open {
    display: flex;
    animation: sig-modal-in .3s ease forwards;
}

@keyframes sig-modal-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.sig-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 15, .92);
    backdrop-filter: blur(8px);
    cursor: zoom-out;
}

.sig-modal-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
    gap: 12px;
}

.sig-modal-img-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 70vh;
    flex: 0 0 auto;
}

.sig-modal-img {
    max-width: 90vw;
    max-height: 70vh;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .08);
    display: block;
    animation: sig-img-appear .35s cubic-bezier(.34, 1.56, .64, 1) forwards;
    object-fit: contain;
    background: #111;
}

@keyframes sig-img-appear {
    from {
        opacity: 0;
        transform: scale(.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Loader */
.sig-modal-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none;
}

.sig-modal-loader.loading {
    display: flex;
}

.sig-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, .15);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: sig-spin .7s linear infinite;
}

@keyframes sig-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Close button */
.sig-modal-close {
    position: fixed;
    top: 18px;
    right: 22px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .2);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, transform .2s;
    z-index: 2;
    backdrop-filter: blur(8px);
}

.sig-modal-close:hover {
    background: rgba(239, 68, 68, .7);
    transform: scale(1.1) rotate(90deg);
}

/* Prev / Next */
.sig-modal-prev,
.sig-modal-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .2);
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, transform .3s;
    z-index: 2;
    backdrop-filter: blur(8px);
}

.sig-modal-prev {
    left: 16px;
}

.sig-modal-next {
    right: 16px;
}

.sig-modal-prev:hover {
    background: rgba(99, 102, 241, .6);
    transform: translateY(-50%) scale(1.1);
}

.sig-modal-next:hover {
    background: rgba(99, 102, 241, .6);
    transform: translateY(-50%) scale(1.1);
}

/* Counter */
.sig-modal-counter {
    color: rgba(255, 255, 255, .55);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    letter-spacing: 1px;
}

/* Thumbnails */
.sig-modal-thumbnails {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 90vw;
    overflow-x: auto;
    padding: 4px 0 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, .4) transparent;
}

.sig-modal-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.sig-modal-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, .4);
    border-radius: 2px;
}

.sig-modal-thumb {
    width: 58px;
    height: 40px;
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.55;
    transition: opacity .2s, border-color .2s, transform .2s;
    flex-shrink: 0;
}

.sig-modal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sig-modal-thumb:hover {
    opacity: 0.85;
    transform: scale(1.05);
}

.sig-modal-thumb.sig-active {
    border-color: #6366f1;
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, .4);
    transform: scale(1.1);
}

/* Touch swipe hint */
@media (max-width: 768px) {

    .sig-modal-prev,
    .sig-modal-next {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    .sig-modal-prev {
        left: 8px;
    }

    .sig-modal-next {
        right: 8px;
    }

    .sig-modal-thumbnails {
        max-height: 55px;
        flex-wrap: nowrap;
        overflow-x: auto;
    }
}