.gallery-page {
    padding: 4rem 0;
}

.gallery-intro {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 2.5rem;
}

.gallery-filters, .photo-toolbar { display: flex; flex-wrap: wrap; gap: .8rem; align-items: end; justify-content: center; margin: 0 auto 2rem; }
.gallery-filters label { display: grid; gap: .25rem; color: #526049; font-size: .8rem; font-weight: 700; }
.gallery-filters input, .gallery-filters select { min-width: 190px; padding: .7rem .8rem; border: 1px solid #cfd8c2; border-radius: 8px; background: white; }
.gallery-filters button, .photo-toolbar button { border: 0; border-radius: 999px; padding: .7rem 1rem; background: #e5ecd7; color: #4d5d2e; font-weight: 700; cursor: pointer; }
.gallery-filters button, .photo-toolbar button.is-active { background: #6d813c; color: white; }
.gallery-filters a { color: #66783d; padding: .65rem; }
.photo-person-filter { display: flex; align-items: center; gap: .45rem; color: #526049; font-size: .8rem; font-weight: 700; }
.photo-person-filter select { padding: .65rem .8rem; border: 1px solid #cfd8c2; border-radius: 999px; background: white; color: #405032; }
.album-person-toolbar { display: flex; justify-content: center; margin: -1rem auto 2rem; }
.photo-grid-item[hidden] { display: none; }

.gallery-year-heading {
    color: #2c3e50;
    font-size: 1.6rem;
    margin: 2.5rem 0 1.25rem;
    text-align: center;
}

.gallery-year-heading:first-of-type {
    margin-top: 0;
}

.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.album-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease;
}

.album-card:hover {
    transform: translateY(-3px);
}

.album-card-thumb {
    width: 100%;
    height: 170px;
    background: #edf4df;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.album-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.album-card-placeholder {
    font-size: 2.5rem;
}

.album-card-title {
    padding: 0.9rem 1rem 0.2rem;
    font-weight: 700;
    color: #2c3e50;
}

.album-card-meta {
    padding: 0 1rem 0.9rem;
    color: #7f8c8d;
    font-size: 0.85rem;
}

.album-header {
    max-width: 1100px;
    margin: 0 auto 2rem;
    text-align: center;
}

.album-header h2 {
    color: #2c3e50;
    margin-bottom: 0.4rem;
}

.album-header p {
    color: #7f8c8d;
}

.album-back-link {
    display: block;
    max-width: 1100px;
    margin: 0 auto 1rem;
}

.album-back-link a {
    color: #6d7e38;
    text-decoration: none;
    font-weight: 600;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    max-width: 1400px;
    margin: 0 auto;
}

.photo-grid-item {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: #eef1e6;
}

.photo-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease;
}

.photo-grid-item:hover img {
    transform: scale(1.05);
}

.photo-grid-item.is-favorite::after {
    content: '\2764';
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    font-size: 0.95rem;
}

.gallery-load-more {
    text-align: center;
    margin: 2rem 0;
}

.photo-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    touch-action: pan-y pinch-zoom;
}

.photo-lightbox-frame {
    position: relative;
    max-width: 94vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.photo-lightbox img {
    max-width: 92vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
    background: #111;
}

.photo-lightbox-caption {
    color: #f1f1f1;
    text-align: center;
    margin-top: 0.75rem;
    max-width: 80vw;
}

.photo-lightbox-caption .title {
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.photo-lightbox-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #2f3d2b;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.photo-lightbox-prev {
    left: -20px;
}

.photo-lightbox-next {
    right: -20px;
}

.photo-lightbox-close {
    position: absolute;
    top: -50px;
    right: -10px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #2f3d2b;
    font-size: 1.6rem;
    cursor: pointer;
}

.photo-lightbox-download {
    position: absolute;
    top: -50px;
    right: 42px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #2f3d2b;
    font-size: 1.2rem;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-lightbox-fullscreen { position: absolute; top: -50px; right: 94px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgba(255,255,255,.9); cursor: pointer; font-size: 1.1rem; }
.photo-lightbox-counter { position: absolute; top: -42px; left: 0; color: white; font-weight: 700; }
.photo-lightbox.is-slideshow .photo-lightbox-caption,
.photo-lightbox.is-slideshow .photo-lightbox-counter,
.photo-lightbox.is-slideshow .photo-lightbox-btn,
.photo-lightbox.is-slideshow .photo-lightbox-download,
.photo-lightbox.is-slideshow .photo-lightbox-fullscreen,
.photo-lightbox.is-slideshow .photo-lightbox-close { display: none; }
.photo-lightbox.is-slideshow .photo-lightbox-frame { max-width: 100vw; max-height: 100vh; }
.photo-lightbox.is-slideshow img { max-width: 96vw; max-height: 94vh; box-shadow: none; border-radius: 0; }

@media (max-width: 640px) {
    .photo-lightbox-prev,
    .photo-lightbox-next {
        display: none;
    }
}
