html {
    background-color: var(--md-sys-color-surface) !important;
}

body {
    background-color: var(--md-sys-color-surface) !important;
}

.galleryGrid {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    padding: 1rem;
    padding-bottom: 6rem;
    column-count: 3;
    column-gap: 1rem;
    overflow-y: scroll;
    break-inside: avoid;
    position: relative;
    min-height: 400px; /* Ensures spinner has space */
}

.galleryGrid > img {
    -webkit-column-break-inside: avoid;
    break-inside: avoid-column;
    break-inside: avoid;
    margin-bottom: 1rem;
}

.galleryGrid img {
    display: inline-block;
    width: 100%;
    border-radius: 2px;
    transition:
        filter 0.3s ease,
        box-shadow 0.3s ease;
    border-radius: 0.5rem;
}

.galleryGrid img:hover {
    filter: brightness(0.8);
}

/* Loading overlay + spinner */
.galleryLoadingOverlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--silver-100);
    z-index: 100;
}

.galleryLoadingOverlay .spinner {
    width: 64px;
    height: 64px;
    background-image: url("/assets/throbber.gif");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 0.5rem;
}

/* Mobile-optimized: two columns and smaller margins */
@media (max-width: 768px) {
    .galleryGrid {
        column-count: 2;
        column-gap: 12px;
        padding: 0.75rem;
        margin-bottom: 6rem;
    }

    .galleryGrid > img {
        margin-bottom: 12px;
    }

    .galleryLoadingOverlay .spinner {
        width: 48px;
        height: 48px;
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
    }
}

.galleryContent {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    overflow-y: scroll;
    overflow-x: hidden;
    padding: 0;
}

.navbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
}

/* Gallery item fly-up animation with staggered timing */
.galleryItem {
    animation: galleryFlyUp 0.3s var(--standard-cubic-bezier) forwards;
    opacity: 0;
}

@keyframes galleryFlyUp {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
