
.caught-reading-section {
    padding: 55px 0 65px;
    background: #f7f9fc;
}

.caught-reading-section.archive-section {
    background: #ffffff;
}

/* Section heading */
.caught-reading-heading {
    text-align: center;
    margin-bottom: 35px;
}

.caught-reading-heading .heading-icon {
    width: 58px;
    height: 58px;
    margin: 0 auto 15px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    color: #fff;
    font-size: 25px;
    box-shadow: 0 8px 22px rgba(13, 110, 253, .20);
}

.caught-reading-heading h2 {
    margin: 0 0 10px;
    font-size: 30px;
    font-weight: 700;
    color: #172033;
}

.caught-reading-heading p {
    max-width: 850px;
    margin: 0 auto;
    color: #697386;
    font-size: 16px;
    line-height: 1.75;
}

/* Archive heading */
.archive-heading {
    margin-bottom: 35px;
}

.archive-heading h2 {
    margin-bottom: 8px;
}

.archive-heading p {
    max-width: 700px;
}

/* Gallery grid */
.caught-reading-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 25px;
}

/* Individual card */
.caught-reading-card {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 6px 22px rgba(30, 41, 59, .09);
    transition: transform .3s ease, box-shadow .3s ease;
}

.caught-reading-card:hover {
    transform: translateY(-7px);
    box-shadow: 0 15px 35px rgba(30, 41, 59, .16);
}

/* Image link */
.caught-reading-card a {
    display: block;
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

/* Equal image height */
.caught-reading-image {
    width: 100%;
    height: 310px;
    display: block;
    object-fit: cover;
    object-position: center;
    transition: transform .55s ease;
}

/* Slight zoom on hover */
.caught-reading-card:hover .caught-reading-image {
    transform: scale(1.06);
}

/* Dark gradient over image */
.caught-reading-card a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 60%;
    background: linear-gradient(
        to top,
        rgba(7, 15, 30, .92) 0%,
        rgba(7, 15, 30, .55) 45%,
        transparent 100%
    );
    pointer-events: none;
}

/* Caption */
.caught-reading-caption {
    position: absolute;
    z-index: 2;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 22px 18px 17px;
    color: #fff;
}

/* Student name */
.caught-reading-caption .student-name {
    display: block;
    margin-bottom: 5px;
    font-size: 17px;
    line-height: 1.3;
    font-weight: 700;
    color: #fff;
}

/* Class */
.caught-reading-caption .student-class {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,.82);
}

/* Caught by */
.caught-reading-caption .caught-by {
    display: block;
    font-size: 12px;
    line-height: 1.45;
    color: rgba(255,255,255,.88);
}

/* Small badge */
.caught-reading-badge {
    position: absolute;
    z-index: 3;
    top: 14px;
    left: 14px;
    padding: 6px 11px;
    border-radius: 30px;
    background: rgba(255,255,255,.92);
    color: #334155;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

/* Empty caption images */
.caught-reading-card.no-caption a::after {
    display: none;
}

/* View icon */
.caught-reading-view {
    position: absolute;
    z-index: 3;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.92);
    color: #0d6efd;
    font-size: 17px;
    opacity: 0;
    transform: translateY(-5px);
    transition: all .3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

.caught-reading-card:hover .caught-reading-view {
    opacity: 1;
    transform: translateY(0);
}

/* Section divider */
.caught-reading-divider {
    width: 75px;
    height: 4px;
    margin: 18px auto 0;
    border-radius: 10px;
    background: linear-gradient(90deg, #0d6efd, #6610f2);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1199px) {
    .caught-reading-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .caught-reading-image {
        height: 300px;
    }
}

@media (max-width: 991px) {
    .caught-reading-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .caught-reading-image {
        height: 330px;
    }
}

@media (max-width: 575px) {
    .caught-reading-section {
        padding: 40px 0 50px;
    }

    .caught-reading-heading h2 {
        font-size: 25px;
    }

    .caught-reading-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .caught-reading-image {
        height: 380px;
    }
}
/* =========================================================
   IMAGE MODAL — IMAGE ABOVE, CAPTION BELOW
   ========================================================= */

#imageModal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 999999 !important;

    width: 100vw !important;
    height: 100vh !important;
}


/* Full viewport dialog */

#imageModal .modal-dialog {
    width: 100vw !important;
    max-width: none !important;
    height: 100vh !important;

    margin: 0 !important;
    padding: 20px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}


/* Modal content */

#imageModal .image-modal-content {
    width: auto !important;
    max-width: 96vw !important;

    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;

    display: block !important;
}


/* =========================================================
   THIS IS THE IMPORTANT PART
   ========================================================= */

#imageModal .image-modal-body {

    position: relative !important;

    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;

    width: 100% !important;

    padding: 20px !important;

    background: transparent !important;

    text-align: center !important;
}


/* =========================================================
   IMAGE
   ========================================================= */

#imageModal #modalImage {

    display: block !important;

    width: auto !important;
    height: auto !important;

    max-width: 92vw !important;
    max-height: 82vh !important;

    margin: 0 auto !important;

    object-fit: contain !important;

    border-radius: 10px;

    box-shadow:
        0 20px 70px rgba(0, 0, 0, .65);
}


/* =========================================================
   CAPTION — ALWAYS BELOW IMAGE
   ========================================================= */

#imageModal #imageCaption {

    display: block !important;

    width: 100% !important;

    max-width: 900px !important;

    margin: 15px auto 0 !important;

    padding: 8px 20px !important;

    color: #fff !important;

    text-align: center !important;

    font-size: 15px !important;

    line-height: 1.5 !important;

    font-weight: 500 !important;

    white-space: normal !important;

    clear: both !important;

    text-shadow:
        0 2px 5px rgba(0, 0, 0, .9);
}


/* =========================================================
   CLOSE BUTTON
   ========================================================= */

#imageModal .image-modal-close {

    position: fixed !important;

    top: 18px !important;
    right: 22px !important;

    z-index: 1000000 !important;

    width: 45px !important;
    height: 45px !important;

    display: flex !important;

    align-items: center !important;
    justify-content: center !important;

    padding: 0 !important;

    border: 0 !important;
    border-radius: 50% !important;

    background: rgba(0, 0, 0, .65) !important;

    color: #fff !important;

    font-size: 30px !important;

    cursor: pointer;

    transition: all .2s ease;
}


#imageModal .image-modal-close:hover {

    background: rgba(0, 0, 0, .9) !important;

    transform: rotate(90deg);
}


/* =========================================================
   BACKDROP
   ========================================================= */

.modal-backdrop {

    z-index: 999990 !important;
}


#imageModal.show {

    background: rgba(0, 0, 0, .80) !important;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 767px) {

    #imageModal .modal-dialog {

        padding: 10px !important;
    }

    #imageModal .image-modal-body {

        padding: 45px 5px 10px !important;
    }

    #imageModal #modalImage {

        max-width: 96vw !important;
        max-height: 76vh !important;
    }

    #imageModal #imageCaption {

        max-width: 95vw !important;

        margin-top: 10px !important;

        padding: 5px 10px !important;

        font-size: 13px !important;
    }

}