/* Enhanced Gallery Page Styles for Better Image Viewing, optimized for mobile */

/* Universal box-sizing */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    /* Changed background color to a soft teal gradient */
    background: #e0dede;
    font-family: 'Thasadith', Arial, sans-serif;
    margin: 0;
    padding: 0;
    color: #2d3748;
}

.gallery-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 16px;
    padding-top: 110px; /* Add space for fixed header */
}

/* Responsive adjustment for top padding */
@media (max-width: 700px) {
    .gallery-main {
        padding-top: 70px;
    }
}
@media (max-width: 400px) {
    .gallery-main {
        padding-top: 50px;
    }
}

.gallery-section h1 {
    text-align: center;
    color: #2d3748;
    font-size: 2.4rem;
    margin-bottom: 36px;
    font-family: 'Poppins', Arial, sans-serif;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-shadow: 0 2px 8px rgba(56,178,172,0.08);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
    padding: 0 8px;
}

.gallery-item {
    background: rgba(255,255,255,0.95);
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(45,55,72,0.13);
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(.4,2,.6,1), box-shadow 0.25s;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.gallery-item::after {
    content: "";
    display: block;
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,rgba(56,178,172,0.08) 0%,rgba(56,178,172,0.02) 100%);
    pointer-events: none;
    z-index: 1;
}

.gallery-item:hover {
    transform: scale(1.045) translateY(-4px);
    box-shadow: 0 12px 40px rgba(56,178,172,0.18), 0 2px 16px rgba(45,55,72,0.10);
    z-index: 2;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
    border: none;
    border-radius: 14px;
    transition: filter 0.25s, box-shadow 0.25s, transform 0.25s;
    margin: 0;
    padding: 0;
    background: #f4f7fa;
    box-shadow: 0 2px 16px rgba(56,178,172,0.10);
    box-sizing: border-box;
    position: relative;
    z-index: 2;
    max-height: 340px;
}

.gallery-item:hover img {
    filter: brightness(1.08) saturate(1.15) drop-shadow(0 0 16px #38b2ac33);
    transform: scale(1.03);
    box-shadow: 0 8px 32px rgba(56,178,172,0.22);
}

.gallery-item::before {
    content: "\f065";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: #38b2ac;
    font-size: 2.2rem;
    opacity: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 3;
    transform: translate(-50%, -50%) scale(0.8);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}

.gallery-item:hover::before {
    opacity: 0.85;
    transform: translate(-50%, -50%) scale(1.1);
}

.gallery-caption {
    padding: 16px 12px;
    text-align: center;
    color: #38b2ac;
    font-size: 1.12rem;
    font-weight: 600;
    background: #f7fafc;
    width: 100%;
    border-radius: 0 0 18px 18px;
    letter-spacing: 0.6px;
    margin-top: 0;
    box-shadow: 0 1px 4px rgba(56,178,172,0.04);
    z-index: 2;
}

/* Tablet */
@media (max-width: 900px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 16px;
    }
    .gallery-item img {
        max-height: 180px;
        aspect-ratio: 4/3;
        height: 100%;
    }
}

/* Mobile */
@media (max-width: 700px) {
    .gallery-main {
        padding: 20px 2vw;
    }
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px; /* Increased gap for more space between images */
        padding: 0 6px; /* More horizontal space */
    }
    .gallery-item {
        border-radius: 10px;
        margin-bottom: 10px; /* Add vertical space between items */
    }
    .gallery-item img {
        max-height: none;
        min-height: 120px;
        aspect-ratio: 1/1;
        border-radius: 8px;
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        margin: 6px 0; /* Add vertical space around images */
    }
    .gallery-caption {
        font-size: 0.98rem;
        padding: 8px 2px;
        border-radius: 0 0 10px 10px;
    }
}

/* Smallest screens */
@media (max-width: 480px) {
    .gallery-section h1 {
        font-size: 1.1rem;
        margin-bottom: 14px;
    }
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 14px; /* More space between images */
        padding: 0 4px; /* More horizontal space */
    }
    .gallery-item {
        margin-bottom: 10px; /* Add vertical space between items */
    }
    .gallery-item img {
        max-height: none;
        min-height: 120px;
        aspect-ratio: 1/1;
        border-radius: 6px;
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        margin: 8px 0; /* Add vertical space around images */
    }
    .gallery-caption {
        font-size: 0.92rem;
        padding: 6px 2px;
        border-radius: 0 0 6px 6px;
    }
}

/* Make sure images never overflow their container */
.gallery-item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    aspect-ratio: 4/3;
    max-width: 100%;
}