.gallery-year-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.gallery-year-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(0, 0, 0, 0.18);
}

.gallery-year-divider h2 {
    margin: 0;
}

.gallery-card {
    overflow: hidden;
    color: inherit;
    border-radius: 8px;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.gallery-card:hover,
.gallery-card:focus {
    color: inherit;
    transform: translateY(-2px);
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.14);
}

.gallery-card img {
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.gallery-card .card-body {
    padding: 0.75rem;
}

.gallery-card .card-title {
    font-size: 1rem;
}

.gallery-card time {
    font-size: 0.86rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.85rem;
}

.gallery-thumb {
    display: block;
    width: 100%;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 8px;
    background: #f8f9fa;
    cursor: pointer;
}

.gallery-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: 7 / 5;
    object-fit: cover;
    transition: transform 0.18s ease;
}

.gallery-thumb:hover img,
.gallery-thumb:focus img {
    transform: scale(1.035);
}

.gallery-backlink {
    display: inline-block;
    margin-bottom: 1rem;
}

.gallery-lightbox {
    position: fixed;
    z-index: 2000;
    inset: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.9);
}

.gallery-lightbox[hidden] {
    display: none;
}

.gallery-lightbox-close {
    grid-column: 3;
    justify-self: end;
}

.gallery-lightbox-image {
    grid-column: 2;
    grid-row: 2;
    justify-self: center;
    max-width: 100%;
    max-height: calc(100vh - 6rem);
    object-fit: contain;
}

.gallery-lightbox-prev,
.gallery-lightbox-next,
.gallery-lightbox-close {
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 999px;
    color: #fff;
    background: rgba(0, 0, 0, 0.35);
    font-size: 1.4rem;
    line-height: 1;
}

.gallery-lightbox-prev,
.gallery-lightbox-next {
    grid-row: 2;
    width: 3rem;
    height: 3rem;
}

.gallery-lightbox-close {
    width: 2.6rem;
    height: 2.6rem;
}

.gallery-lightbox-prev:hover,
.gallery-lightbox-next:hover,
.gallery-lightbox-close:hover,
.gallery-lightbox-prev:focus,
.gallery-lightbox-next:focus,
.gallery-lightbox-close:focus {
    background: rgba(255, 255, 255, 0.18);
}

.gallery-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.gallery-admin-thumb {
    display: grid;
    gap: 0.4rem;
}

.gallery-admin-thumb img {
    width: 100%;
    height: auto;
    border-radius: 6px;
}

.gallery-upload-progress {
    display: grid;
    gap: 0.7rem;
    box-sizing: border-box;
    max-width: 50rem;
    margin: 1.25rem 0;
    padding: 1rem;
    color: inherit;
    border: 1px solid rgba(148, 163, 184, 0.38);
    border-radius: 8px;
    background: rgba(148, 163, 184, 0.08);
}

.gallery-upload-progress[hidden] {
    display: none;
}

.gallery-upload-progress .help {
    color: inherit;
}

.gallery-upload-progress-count {
    font-weight: 700;
}

.gallery-upload-bar {
    height: 0.7rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.28);
}

.gallery-upload-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #198754;
    transition: width 0.15s ease;
}

.gallery-upload-progress.is-error .gallery-upload-bar span {
    background: #dc3545;
}

.gallery-upload-progress.is-complete .gallery-upload-bar span {
    background: #198754;
}

@media (max-width: 640px) {
    .gallery-lightbox {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr) auto;
    }

    .gallery-lightbox-image,
    .gallery-lightbox-close {
        grid-column: 1;
    }

    .gallery-lightbox-prev,
    .gallery-lightbox-next {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
    }

    .gallery-lightbox-prev {
        left: 0.75rem;
    }

    .gallery-lightbox-next {
        right: 0.75rem;
    }
}
