/* photos/index.html — gallery grid + lightbox */

#homeButton {
    position: absolute;
    top: 50%;
    right: 70px;
    transform: translateY(-50%);
    color: var(--secondaryText);
    font-size: 28px;
    text-decoration: none;
    transition: color 0.3s;
    z-index: 300;
}

#homeButton:hover {
    color: var(--primaryText);
}

@media only screen and (max-width: 600px) {
    #homeButton {
        right: 18px;
        font-size: 22px;
    }
}

#galleryContainer {
    position: relative;
    top: 170px;
    width: 90%;
    max-width: 1200px;
    left: 5%;
    padding-bottom: 100px;
    min-height: 40vh;
}

.galleryGrid,
.gallerySkeleton {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 25px;
}

.galleryGrid:not([hidden]),
.gallerySkeleton:not([hidden]) {
    display: grid;
}

.galleryGrid[hidden],
.gallerySkeleton[hidden] {
    display: none;
}

.galleryCard {
    display: block;
    width: 100%;
    background-color: var(--card);
    border: none;
    border-radius: 12px;
    overflow: hidden;
    padding: 0;
    cursor: pointer;
    text-align: left;
    box-shadow: 0px 15px 30px #111;
    transition: transform 0.3s, background-color 0.3s;
    font-family: 'Raleway', sans-serif;
}

.galleryCard:hover,
.galleryCard:focus-visible {
    background-color: var(--cardHover);
    transform: translateY(-6px);
}

.galleryCard img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background-color: var(--cardHover);
    opacity: 1;
    transition: opacity 0.3s ease;
}

.galleryCard.loading {
    background: linear-gradient(90deg, var(--card) 0%, var(--cardHover) 50%, var(--card) 100%);
    background-size: 200% 100%;
    animation: gallerySkeletonPulse 1.4s ease-in-out infinite;
}

.galleryCard.loading img {
    opacity: 0;
}

.galleryCaption {
    margin: 0;
    padding: 14px 16px;
    font-size: 16px;
    line-height: 1.4;
    color: var(--secondaryText);
}

/* loading skeleton */

.galleryCard.skeleton {
    aspect-ratio: 4 / 3;
    cursor: default;
    background: linear-gradient(90deg, var(--card) 0%, var(--cardHover) 50%, var(--card) 100%);
    background-size: 200% 100%;
    animation: gallerySkeletonPulse 1.4s ease-in-out infinite;
}

@keyframes gallerySkeletonPulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* empty / error state */

.galleryMessage {
    position: relative;
    text-align: center;
    padding-top: 60px;
}

.galleryRetryButton {
    margin-top: 20px;
    padding: 12px 28px;
    font-family: 'Raleway', sans-serif;
    font-size: 16px;
    color: var(--primaryText);
    background-color: var(--card);
    border: 2px solid var(--secondaryText);
    border-radius: 50px;
    cursor: pointer;
    transition: 0.3s;
}

.galleryRetryButton:hover {
    background-color: var(--cardHover);
}

/* lightbox */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.9);
}

.lightbox:not([hidden]) {
    display: flex;
}

.lightbox[hidden] {
    display: none;
}

.lightboxContent {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.lightboxContent img {
    max-width: 90vw;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0px 25px 50px #111;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.lightboxContent.loading {
    min-width: 240px;
    min-height: 180px;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--card) 0%, var(--cardHover) 50%, var(--card) 100%);
    background-size: 200% 100%;
    animation: gallerySkeletonPulse 1.4s ease-in-out infinite;
}

.lightboxContent.loading img {
    opacity: 0;
}

.lightboxCaption {
    margin-top: 18px;
    font-size: 20px;
    color: var(--primaryText);
    max-width: 80vw;
}

.lightboxClose,
.lightboxNav {
    position: absolute;
    background: none;
    border: none;
    color: var(--primaryText);
    cursor: pointer;
    font-size: 32px;
    padding: 12px;
    transition: color 0.3s;
}

.lightboxClose:hover,
.lightboxNav:hover {
    color: var(--secondaryText);
}

.lightboxClose {
    top: 20px;
    right: 20px;
}

.lightboxNav {
    top: 50%;
    transform: translateY(-50%);
}

.lightboxPrev {
    left: 20px;
}

.lightboxNext {
    right: 20px;
}

@media only screen and (max-width: 600px) {
    #galleryContainer {
        width: 92%;
        left: 4%;
    }

    .galleryGrid,
    .gallerySkeleton {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .galleryCaption {
        font-size: 14px;
        padding: 10px 12px;
    }

    .lightboxNav {
        font-size: 24px;
        padding: 8px;
    }

    .lightboxClose {
        font-size: 26px;
        top: 12px;
        right: 12px;
    }

    .lightboxPrev {
        left: 6px;
    }

    .lightboxNext {
        right: 6px;
    }

    .lightboxCaption {
        font-size: 16px;
    }
}
