.mageos-gallery {
    max-width: 72rem;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.mageos-gallery__title {
    margin: 0 0 1.25rem;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--color-primary);
}

.mageos-gallery__back a {
    color: var(--color-primary);
    text-decoration: none;
}

.mageos-gallery__back a:hover {
    text-decoration: underline;
}

.mageos-gallery__description {
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.mageos-gallery__empty {
    color: #666;
}

.mageos-gallery-album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 1.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.mageos-gallery-album-card__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #eee;
    border-radius: 0.375rem;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.mageos-gallery-album-card__link:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--color-primary) 15%, transparent);
}

.mageos-gallery-album-card__cover {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    background: #f5f5f5;
}

.mageos-gallery-album-card__title {
    padding: 0.75rem 0.75rem 0.25rem;
    font-weight: 600;
}

.mageos-gallery-album-card__desc {
    padding: 0 0.75rem 0.75rem;
    font-size: 0.875rem;
    color: #555;
    line-height: 1.4;
}

.mageos-gallery-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 1rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.mageos-gallery-image-item figure {
    margin: 0;
}

.mageos-gallery-image-item__img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0.25rem;
    border: 1px solid #eee;
}

.mageos-gallery-image-item figcaption {
    margin-top: 0.35rem;
    font-size: 0.8125rem;
    color: #444;
    text-align: center;
}

/* Album viewer: large stage + thumbnail strip (WP-style) */
.mageos-gallery-viewer {
    margin-top: 0.5rem;
}

.mageos-gallery-viewer__stage {
    margin: 0;
    background: #f3f3f3;
    border-radius: 0.25rem;
    overflow: hidden;
}

.mageos-gallery-viewer__stage-img {
    display: block;
    width: 100%;
    max-height: min(70vh, 42rem);
    height: auto;
    object-fit: contain;
    background: #eee;
    margin-inline: auto;
}

.mageos-gallery-viewer__caption {
    margin: 0;
    padding: 0.65rem 0.75rem;
    text-align: center;
    font-size: 0.875rem;
    color: #555;
    background: #ececec;
}

.mageos-gallery-viewer__toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem;
    background: #4a4a4a;
    border-radius: 0.25rem;
}

.mageos-gallery-viewer__nav {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 0.2rem;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.mageos-gallery-viewer__nav:hover {
    background: rgba(255, 255, 255, 0.22);
}

.mageos-gallery-viewer__thumbs {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 0.4rem;
    list-style: none;
    margin: 0;
    padding: 0;
    justify-content: center;
}

.mageos-gallery-viewer__thumb {
    display: block;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 0.15rem;
    background: transparent;
    cursor: pointer;
    line-height: 0;
}

.mageos-gallery-viewer__thumb img {
    display: block;
    width: 4.5rem;
    height: 3.25rem;
    object-fit: cover;
    border-radius: 0.1rem;
}

.mageos-gallery-viewer__thumb.is-active,
.mageos-gallery-viewer__thumb:hover {
    border-color: var(--color-primary-lighter, #e276dc);
}

@media (max-width: 480px) {
    .mageos-gallery-album-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .mageos-gallery-image-grid {
        grid-template-columns: 1fr 1fr;
    }

    .mageos-gallery-viewer__thumb img {
        width: 3.5rem;
        height: 2.5rem;
    }
}
