.gallery {
    width: 100%;
    min-height: 100vh;
    text-align: center;
    padding: 2rem 1rem 6rem;
    margin-top: -6rem;
    position: relative;
}

@media (min-width: 768px) {
    .gallery {
        padding: 4rem 2rem 8rem;
    }
}

/* --- UNIFORM RESPONSIVE GALLERY GRID --- */
.album-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    width: 100%;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .album-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.album-category {
    width: 100%;
    box-sizing: border-box;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.album-category:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.album-cover {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f8f8f8;
    border: 2px solid #bdbdbd;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

.album-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #f8f8f8;
}

.album-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    text-align: left;
}

.album-info h3 {
    font-family: var(--libre-bodoni);
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.album-info small {
    font-size: 0.9rem;
    opacity: 0.9;
}

.photo-view-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.photo-view-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.close-button {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    transition: background-color 0.3s ease;
}

.close-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.close-button i {
    font-size: 1.8rem;
    color: white;
}

.photo-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.photo-container img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
}

.photo-info {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    text-align: center;
}

.photo-info h3 {
    font-family: var(--libre-bodoni);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.photo-count {
    font-size: 0.9rem;
    opacity: 0.8;
}

.gallery h2#gallery-title {
    font-family: var(--sacramento);
    font-size: var(--fontSize-heading-base);
    font-weight: 400;
    padding: 2rem 1rem;
    margin-bottom: 1rem;
}

.gallery div:nth-of-type(2) h2 {
    font-family: var(--libre-bodoni);
    font-size: 1.8rem;
    font-weight: 400;
    padding: 1rem;
    color: #333;
}

.gallery .container figure {
    width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f8f8f8;
    border-radius: 15px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

.gallery .container figure img {
    width: 100%;
    height: 35rem;
    object-fit: cover;
    border-radius: 15px;
    transition: transform 0.5s ease;
}

.gallery .container figure img:hover {
    transform: scale(1.02);
}

.gallery .container ul {
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 5.6rem;
}

.gallery .container ul li {
    width: 1.8rem;
    height: 0.25rem;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 1px;
    list-style-type: none;
    cursor: pointer;
}

.gallery .container ul li:hover, .gallery .container ul li.active {
    background-color: #fff;
}

.nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
    z-index: 1001;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.nav-btn i {
    font-size: 2rem;
    color: white;
}

.nav-btn.prev {
    left: 1rem;
}

.nav-btn.next {
    right: 1rem;
}

.gallery .container button:nth-of-type(3) {
    padding: 0.8rem 1.5rem;
    background-color: #fff;
    border: 2px solid #333;
    border-radius: 25px;
    margin-top: 2rem;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.gallery .container button:nth-of-type(3):hover {
    color: #fff;
    background-color: #333;
    cursor: pointer;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.gallery .container ~ div:not(.container) {
    width: 100%;
    height: 100vh;
    padding: 4rem 0.5rem 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.98);
    z-index: 99;
    overflow-y: auto;
    transition: all .3s ease;
    transform: scale(0);
    opacity: 0;
    transform-origin: bottom;
    display: none;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

@media (min-width: 768px) {
    .gallery .container ~ div:not(.container) {
        padding: 4rem 8rem;
    }
}

.gallery .container ~ div:not(.container) > div {
    box-shadow: none;
    border-radius: 20px;
    padding: 1rem;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
}

@media (min-width: 768px) {
    .gallery .container ~ div:not(.container) > div {
        padding: 2rem;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 2rem;
    }

    .gallery .container ~ div:not(.container) > div img {
        max-width: calc(50% - 1rem);
        max-height: 70vh;
    }
}

.gallery .container ~ div:not(.container) > div img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 15px;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 0 auto;
}

.gallery .container ~ div:not(.container) > div img:hover {
    transform: scale(1.02);
}

.gallery .container ~ div:not(.container) button {
    padding: 0.5rem;
    font-size: 2rem;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    position: fixed;
    top: 1rem;
    right: 1rem;
    transition: all 0.3s ease;
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

@media (min-width: 768px) {
    .gallery .container ~ div:not(.container) button {
        font-size: 2.5rem;
        top: 2rem;
        right: 2rem;
        width: 4rem;
        height: 4rem;
    }
}

.gallery .container ~ div:not(.container) button:hover {
    background: rgba(0, 0, 0, 0.2);
}

.gallery .container ~ div:not(.container) button i {
    transition: transform 0.3s ease;
}

.gallery .container ~ div:not(.container) button:hover i {
    transform: rotate(90deg);
}

.gallery .container ~ div:not(.container).active {
    transform: scale(1);
    opacity: 1;
    display: block;
}

/* Update navigation buttons */
.gallery .container button:nth-of-type(1),
.gallery .container button:nth-of-type(2) {
    font-size: 3rem;
    color: rgba(0, 0, 0, 0.5);
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 4rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
}

.gallery .container button:nth-of-type(1):hover,
.gallery .container button:nth-of-type(2):hover {
    background: rgba(255, 255, 255, 1);
    color: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.gallery > i {
    top:2rem;
    left: 10rem;
}

@media (max-width: 480px) {
.gallery {
padding: 1.5rem 0.5rem 4rem;
margin-top: -4rem;
}
}

.album-grid {
grid-template-columns: 1fr;
gap: 1rem;
width: 100%;
}


.album-category {
border-radius: 10px;
}


.album-cover {
aspect-ratio: 1 / 1;
border: 1px solid #ccc;
}


.album-info h3 {
font-size: 1.2rem;
}


.album-info small {
font-size: 0.85rem;
}


.photo-view-overlay {
padding: 0;
}


.photo-container img {
max-height: 75vh;
padding: 0 0.5rem;
}


.nav-btn {
width: 3rem;
height: 3rem;
}


.nav-btn i {
font-size: 1.8rem;
}


.close-button {
width: 2.8rem;
height: 2.8rem;
}


.gallery .container ul {
bottom: 4rem;
gap: 0.3rem;
}

.album-category img {
    transition: opacity 0.6s ease-in-out;
    opacity: 1;
}

.thumbnail-fade {
    opacity: 0;
}

.fade-out {
    opacity: 0;
    transition: opacity 0.25s ease;
}

.fade-in {
    opacity: 1;
    transition: opacity 0.25s ease;
}