/*--------------------------------------------------------------
# Gallery Page
--------------------------------------------------------------*/
.gallery-page {
    position: relative;
    display: block;
    padding: 120px 0 143px;
}

.gallery-page .row {
    --bs-gutter-x: 10px;
}

.gallery-page .container {
    max-width: 1572px;
}

.gallery-page__single {
    position: relative;
    display: block;
    margin-bottom: 10px;
}

.gallery-page__img {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 8px;
    z-index: 1;
}

.gallery-page__img:before {
    content: "";
    position: absolute;
    top: 0;
    bottom: -2px;
    left: 0;
    right: 0;
    background-color: var(--fistudy-black);
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transform-origin: top center;
    transform: scaleY(0) translateZ(100px);
    transition: opacity 500ms ease, visibility 500ms ease, transform 700ms ease;
    z-index: 2;
}

.gallery-page__single:hover .gallery-page__img:before {
    opacity: .90;
    visibility: visible;
    transform: scaleY(1) translateZ(0px);
}

.gallery-page__img-box {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 8px;
    z-index: 1;
}

.gallery-page__img img {
    width: 100%;
    border-radius: 8px;
}

.gallery-page__icon {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.gallery-page__icon a {
    height: 50px;
    width: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 25px;
    color: var(--fistudy-white);
    transform: scale(0);
    opacity: 0;
    transition: all 500ms ease;
    z-index: 2;
}

.gallery-page__single:hover .gallery-page__icon a {
    transform: scale(1);
    transition-delay: 500ms;
    opacity: 1;
}

.gallery-page__icon a:hover {
    color: var(--fistudy-base);
}

/*--------------------------------------------------------------
# Gallery Wrapper & Cards
--------------------------------------------------------------*/
.gallery-wrapper {
    padding: 0 20px 60px;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery-section {
    margin-bottom: 40px;
}

.gallery-section h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #222;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid #2563eb;
    display: inline-block;
    font-family: 'Outfit', sans-serif;
}

.gallery-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.gallery-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0,0,0,0.10);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
    aspect-ratio: 4/3;
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.16);
}

.gallery-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.gallery-card:hover img {
    transform: scale(1.05);
}

.gallery-card-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 14px;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/*--------------------------------------------------------------
# Gallery Modal - Images Only Lightbox
--------------------------------------------------------------*/
.gallery-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    overflow: hidden;
    animation: galleryFadeIn 0.25s ease;
}

@keyframes galleryFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.gallery-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    max-width: 100%;
}

/* Close button */
.gallery-close {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100001;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
}

.gallery-close:hover {
    background: rgba(255,255,255,0.35);
}

/*--------------------------------------------------------------
# Gallery Item Description (below title, above images)
--------------------------------------------------------------*/
.gallery-item-description {
    padding: 10px 20px 0;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.5;
    font-family: 'Outfit', sans-serif;
}

/*--------------------------------------------------------------
# Gallery Card Description (on card overlay)
--------------------------------------------------------------*/
.gallery-card-description {
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    padding: 8px 14px;
    background: linear-gradient(transparent, rgba(0,0,0,0.65));
    color: #fff;
    font-size: 0.78rem;
    font-weight: 400;
    font-family: 'Outfit', sans-serif;
    line-height: 1.3;
    max-height: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    pointer-events: none;
}

/*--------------------------------------------------------------
# Gallery Modal Header (title + description in modal)
--------------------------------------------------------------*/
.gallery-modal-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100000;
    padding: 16px 70px 12px 20px;
    background: linear-gradient(rgba(0,0,0,0.7), transparent);
    color: #fff;
}

.gallery-modal-header h3 {
    margin: 0 0 4px 0 !important;
    color: #fff !important;
    font-size: 1.1em !important;
    font-family: 'Outfit', sans-serif;
}

.gallery-modal-header p {
    margin: 0 !important;
    color: rgba(255,255,255,0.85) !important;
    font-size: 0.85em !important;
    line-height: 1.4 !important;
    font-family: 'Outfit', sans-serif;
    max-height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/*--------------------------------------------------------------
# Slideshow Container
--------------------------------------------------------------*/
.gallery-slideshow-container {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: transparent;
    overflow: hidden;
}

.gallery-mySlides {
    display: none;
    width: 100%;
    text-align: center;
}

.gallery-mySlides img {
    max-width: 90vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    border-radius: 4px;
}

/* Slide counter */
.gallery-slide-counter {
    position: absolute;
    top: 14px;
    left: 16px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 0.8rem;
    padding: 4px 12px;
    border-radius: 20px;
    font-family: 'Outfit', sans-serif;
    z-index: 5;
}

/* Prev/Next arrows */
.gallery-prev,
.gallery-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    transition: background 0.2s ease;
    text-decoration: none;
    user-select: none;
}

.gallery-prev { left: 16px; }
.gallery-next { right: 16px; }

.gallery-prev:hover,
.gallery-next:hover {
    background: rgba(255,255,255,0.35);
    color: #fff;
    text-decoration: none;
}

/*--------------------------------------------------------------
# Thumbnails
--------------------------------------------------------------*/
.gallery-thumbnails-container {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    overflow-x: auto;
    background: rgba(0,0,0,0.6);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
    justify-content: center;
    flex-wrap: nowrap;
}

.gallery-thumbnails-container::-webkit-scrollbar {
    height: 6px;
}

.gallery-thumbnails-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.gallery-thumbnail {
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0.5;
    border: 2px solid transparent;
    transition: opacity 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}

.gallery-thumbnail:hover {
    opacity: 0.8;
}

.gallery-thumbnail.gallery-active {
    opacity: 1;
    border-color: #2563eb;
}

/*--------------------------------------------------------------
# Dots (hidden by default, thumbnails are primary)
--------------------------------------------------------------*/
.gallery-dot-container {
    display: none;
}

/*--------------------------------------------------------------
# Fade animation
--------------------------------------------------------------*/
.gallery-fade {
    animation-name: galleryFadeSlide;
    animation-duration: 0.4s;
}

@keyframes galleryFadeSlide {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

/*--------------------------------------------------------------
# Responsive
--------------------------------------------------------------*/

/* Tablet */
@media (max-width: 991px) {
    .gallery-wrapper {
        padding: 0 16px 40px;
    }

    .gallery-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 14px;
    }

    .gallery-mySlides img {
        max-width: 92vw;
        max-height: 75vh;
    }

    .gallery-prev,
    .gallery-next {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .gallery-prev { left: 10px; }
    .gallery-next { right: 10px; }
}

/* Mobile */
@media (max-width: 575px) {
    .gallery-wrapper {
        padding: 0 12px 30px;
    }

    .gallery-section h2 {
        font-size: 1.2rem;
        margin-bottom: 14px;
    }

    .gallery-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .gallery-card {
        border-radius: 8px;
        aspect-ratio: 1/1;
    }

    .gallery-card-title {
        font-size: 0.75rem;
        padding: 8px 10px;
    }

    .gallery-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        font-size: 22px;
    }

    .gallery-mySlides img {
        max-width: 96vw;
        max-height: 70vh;
    }

    .gallery-prev,
    .gallery-next {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .gallery-prev { left: 6px; }
    .gallery-next { right: 6px; }

    .gallery-thumbnails-container {
        padding: 8px 10px;
        gap: 5px;
    }

    .gallery-thumbnail {
        width: 50px;
        height: 38px;
        border-radius: 4px;
    }

    .gallery-item-description {
        padding: 8px 14px 0;
        font-size: 0.88rem;
    }
}

/* Small mobile */
@media (max-width: 380px) {
    .gallery-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}
