/* =========================
   GALLERY GRID
========================= */

.gallery-card {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.gallery-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 12px;
    background: #f1f5f9;
}

.gallery-image img {
    width: 100%;
    height: 200px;
    display: block;
    object-fit: cover;
    transition: transform .35s ease;
}

.gallery-card:hover .gallery-image img {
    transform: scale(1.05);
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .35);
    opacity: 0;
    transition: .25s ease;
}

.gallery-overlay i {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .95);
    color: var(--primary);
    font-size: 18px;
}

.gallery-card:hover .gallery-overlay {
    opacity: 1;
}

.image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 30px;
}

.gallery-body {
    padding: 9px 2px 4px;
}

.gallery-body h3 {
    margin: 0 0 4px;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 800;
    color: var(--text);
}

.gallery-meta {
    font-size: 11px;
    color: var(--muted);
}


/* =========================
   MODAL
========================= */

.gallery-modal-dialog{
    max-width:640px;
    width:88%;
}

.gallery-lightbox-image{
    max-width:100%;
    max-height:calc(100vh - 220px);
    width:auto;
    height:auto;
    object-fit:contain;
    margin:auto;
}

.gallery-lightbox {
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    background: var(--white);
}

.gallery-lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.gallery-lightbox-title h5 {
    margin: 0 0 3px;
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
}

.gallery-lightbox-title span {
    font-size: 11px;
    color: var(--muted);
}

.gallery-close {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: var(--text);
    cursor: pointer;
}

.gallery-lightbox-body {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: min(58vh, 430px);
    min-height: 260px;
    padding: 12px 60px;
    background: #111827;
    touch-action: pan-y;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .92);
    color: #111827;
    font-size: 20px;
    cursor: pointer;
    transition: .2s ease;
}

.gallery-nav:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.05);
}

.gallery-prev {
    left: 18px;
}

.gallery-next {
    right: 18px;
}

.gallery-lightbox-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 13px 18px;
}

.gallery-lightbox-footer p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.gallery-lightbox-footer span {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
}


/* =========================
   GALLERY MOBILE
========================= */

@media (max-width: 575.98px) {

    /* GRID FOTO */
    .gallery-image {
        width: 100% !important;
        height: 115px !important;
        aspect-ratio: auto !important;
        overflow: hidden;
        border-radius: 10px;
    }

    .gallery-image img {
        width: 100% !important;
        height: 115px !important;
        max-height: none !important;
        object-fit: cover;
    }

    .gallery-card {
        width: 100%;
    }

    .gallery-body {
        padding: 7px 1px 3px;
    }

    .gallery-body h3 {
        font-size: 12px;
        line-height: 1.35;
        margin-bottom: 4px;
    }

    .gallery-meta {
        font-size: 10px;
    }

    /* MODAL */
    .gallery-modal-dialog {
        width: calc(100% - 12px);
        margin: 6px auto;
    }

    .gallery-lightbox {
        border-radius: 13px;
    }

    .gallery-lightbox-header {
        padding: 11px 13px;
    }

    .gallery-lightbox-title h5 {
        font-size: 14px;
    }

    .gallery-lightbox-body {
        height: min(55vh, 400px);
        height: min(55dvh, 400px);
        min-height: 180px;
        padding: 8px 45px;
    }

    .gallery-lightbox-image {
        max-height: 100%;
        height: auto;
    }

    .gallery-nav {
        width: 36px;
        height: 36px;
        font-size: 17px;
    }

    .gallery-prev {
        left: 7px;
    }

    .gallery-next {
        right: 7px;
    }

    .gallery-lightbox-footer {
        padding: 10px 13px;
    }

    .gallery-lightbox-footer p {
        font-size: 11px;
    }

    .gallery-lightbox-footer span {
        font-size: 11px;
    }
}

@media (max-height: 600px) {
    .gallery-lightbox-body {
        height: 52vh;
        min-height: 180px;
    }
}
