/* =============================================================
   Acharya Jagadish Chandra Bose College — Gallery Stylesheet
   Companion file to styles.css
   ============================================================= */

/* =============================================================
   Standalone Gallery Page — .gallery-grid / .gallery-item
   ============================================================= */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 24px 0;
}

@media (max-width: 991px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 479px) {
    .gallery-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    border: 2px solid rgba(107, 98, 69, 0.18);
    box-shadow: 0 3px 12px rgba(107, 98, 69, 0.12);
    cursor: pointer;
    background: #f0ece2;
    transition: box-shadow 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
    aspect-ratio: 4 / 3;
}

.gallery-item:hover {
    box-shadow: 0 8px 28px rgba(107, 98, 69, 0.25);
    transform: translateY(-3px);
    border-color: #d4af37;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease, filter 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.07);
    filter: brightness(0.82);
}

.gallery-item .gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(85, 75, 40, 0.72) 0%,
        rgba(107, 98, 69, 0.15) 60%,
        transparent 100%
    );
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 14px 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.gallery-overlay .gallery-zoom-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    font-size: 1.8rem;
    color: #fff;
    opacity: 0.9;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.25s ease;
}

.gallery-item:hover .gallery-zoom-icon {
    transform: translate(-50%, -50%);
}

.gallery-overlay .gallery-caption {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    text-align: center;
    line-height: 1.3;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    width: 100%;
}

/* =============================================================
   Department Gallery — .dept-gallery-item
   Used in Joomla article body (right-content-area)
   ============================================================= */

.dept-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    border: 2px solid rgba(107, 98, 69, 0.15);
    box-shadow: 0 2px 10px rgba(107, 98, 69, 0.10);
    cursor: pointer;
    background: #f0ece2;
    aspect-ratio: 4 / 3;
    transition: box-shadow 0.28s ease, transform 0.28s ease, border-color 0.28s ease;
}

.dept-gallery-item:hover,
.dept-gallery-item:focus {
    box-shadow: 0 6px 22px rgba(107, 98, 69, 0.22);
    transform: translateY(-3px);
    border-color: #d4af37;
    outline: none;
}

.dept-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.38s ease, filter 0.28s ease;
}

.dept-gallery-item:hover img,
.dept-gallery-item:focus img {
    transform: scale(1.07);
    filter: brightness(0.78);
}

.dept-gallery-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(
        to top,
        rgba(85, 75, 40, 0.55) 0%,
        rgba(107, 98, 69, 0.08) 60%,
        transparent 100%
    );
    opacity: 0;
    transition: opacity 0.28s ease;
}

.dept-gallery-item:hover .dept-gallery-overlay,
.dept-gallery-item:focus .dept-gallery-overlay {
    opacity: 1;
}

.dept-gallery-overlay i {
    font-size: 1.6rem;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    transition: transform 0.22s ease;
}

.dept-gallery-item:hover .dept-gallery-overlay i {
    transform: scale(1.15);
}

.dept-gallery-grid .col-lg-4,
.dept-gallery-grid .col-md-6,
.dept-gallery-grid .col-12 {
    margin-bottom: 0;
}

/* =============================================================
   Lightbox Modal
   Uses visibility/opacity/pointer-events instead of
   display:none/flex so Bootstrap cannot interfere.
   All rules carry !important to win against any framework CSS.
   ============================================================= */

#galleryModal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 999999 !important;
    background: rgba(20, 16, 8, 0.92) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    /* Hidden state — use visibility/opacity, NOT display:none,
       so Bootstrap's modal CSS cannot override this element.   */
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

#galleryModal.active {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.gallery-modal-inner {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#galleryModalImage {
    max-width: 85vw !important;
    max-height: 82vh !important;
    width: auto !important;
    height: auto !important;
    display: block !important;
    border-radius: 6px;
    border: 3px solid #d4af37 !important;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
    object-fit: contain;
}

.gallery-modal-caption {
    position: absolute;
    bottom: -36px;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    margin: 0;
}

.gallery-modal-close {
    position: fixed !important;
    top: 18px !important;
    right: 24px !important;
    font-size: 2.2rem !important;
    color: #fff !important;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s, color 0.2s;
    z-index: 1000001 !important;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}

.gallery-modal-close:hover {
    opacity: 1;
    color: #d4af37 !important;
}

.gallery-modal-prev,
.gallery-modal-next {
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%);
    font-size: 1.6rem !important;
    color: #fff !important;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s, background 0.2s;
    z-index: 1000001 !important;
    background: rgba(107, 98, 69, 0.55) !important;
    border: none !important;
    padding: 10px 14px !important;
    border-radius: 4px;
    box-shadow: none !important;
}

.gallery-modal-prev {
    left: 16px !important;
}

.gallery-modal-next {
    right: 16px !important;
}

.gallery-modal-prev:hover,
.gallery-modal-next:hover {
    opacity: 1;
    background: rgba(107, 98, 69, 0.85) !important;
    color: #d4af37 !important;
}

.gallery-modal-counter {
    position: fixed !important;
    top: 20px !important;
    left: 50% !important;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    z-index: 1000001 !important;
}

body.gallery-modal-open {
    overflow: hidden !important;
}

/* Responsive */
@media (max-width: 575px) {
    #galleryModalImage {
        max-width: 92vw !important;
        max-height: 75vh !important;
        border-width: 2px !important;
    }

    .gallery-modal-prev,
    .gallery-modal-next {
        font-size: 1.2rem !important;
        padding: 8px 10px !important;
    }

    .gallery-modal-prev {
        left: 6px !important;
    }

    .gallery-modal-next {
        right: 6px !important;
    }

    .gallery-modal-caption {
        font-size: 0.78rem;
        bottom: -28px;
    }
}
