/* Photo Gallery (page-only) */

.gallery-card {
    padding: 1.25rem;
}

/* Toolbar */
.gallery-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.gallery-toolbar .muted {
    color: rgba(0, 0, 0, 0.72);
}

.gallery-toolbar strong {
    color: rgba(0, 0, 0, 0.92);
}

.gallery-search {
    min-width: 240px;
    width: min(360px, 100%);
}

.gallery-search-input {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.14);
    background: rgba(255, 255, 255, 0.82);
    color: rgba(0, 0, 0, 0.9);
    outline: none;
}

.gallery-search-input::placeholder {
    color: rgba(0, 0, 0, 0.55);
}

.gallery-search-input:focus {
    border-color: rgba(42, 106, 148, 0.55);
    box-shadow: 0 0 0 4px rgba(42, 106, 148, 0.12);
}

/* Grid */
.gallery-grid {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: repeat(4, 1fr);
}

.gallery-item {
    position: relative;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.10);
    background: rgba(255, 255, 255, 0.52);
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    transition:
        transform 160ms ease,
        background 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease;
}

.gallery-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.78);
    border-color: rgba(42, 106, 148, 0.35);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}

.gallery-item img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.gallery-overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: 1.5rem 0.85rem 0.75rem;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.82),
        rgba(0, 0, 0, 0.45),
        rgba(0, 0, 0, 0)
    );
    opacity: 0;
    transition: opacity 160ms ease;
    pointer-events: none;
}

.gallery-item:hover .gallery-overlay,
.gallery-item:focus-visible .gallery-overlay {
    opacity: 1;
}

.gallery-caption {
    font-weight: 800;
    font-size: 0.95rem;
    text-transform: none;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

/* Empty state */
.gallery-empty {
    padding: 1.5rem;
    border: 1px dashed rgba(0, 0, 0, 0.18);
    border-radius: 14px;
    text-align: center;
}

/* Lightbox */
.no-scroll {
    overflow: hidden;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    color: #ffffff;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
}

.lightbox-dialog {
    position: absolute;
    inset: 4vh 4vw;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(10, 14, 18, 0.82);
    backdrop-filter: blur(8px);
    display: grid;
    grid-template-rows: 1fr auto;
    overflow: hidden;
    color: #ffffff;
}

.lightbox-body {
    display: grid;
    place-items: center;
    padding: 1rem;
    overflow: auto;
}

.lightbox-body img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    transition: transform 160ms ease;
    transform-origin: center center;
    cursor: zoom-in;
}

.lightbox-body img.is-zoomed {
    cursor: zoom-out;
    max-width: none;
    max-height: none;
}

.lightbox-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.48);
    color: #ffffff;
}

.lightbox-title {
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.lightbox-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.lightbox-actions .btn {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.10);
}

.lightbox-actions .btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.lightbox-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(0, 0, 0, 0.52);
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.16);
}

/* Screen-reader only label support */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsive */
@media (max-width: 1100px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .gallery-item img {
        height: 210px;
    }
}

@media (max-width: 820px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .lightbox-dialog {
        inset: 3vh 3vw;
    }

    .lightbox-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .lightbox-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 520px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-item img {
        height: 240px;
    }

    .gallery-search {
        width: 100%;
        min-width: 0;
    }

    .lightbox-dialog {
        inset: 2vh 2vw;
    }

    .lightbox-actions .btn {
        padding-left: 0.7rem;
        padding-right: 0.7rem;
    }
}