/* ==========================================================================
   EMYC Gallery — album grid + lightbox
   Structure/interaction layer only; colors and type follow the site's
   existing palette (primary lemon-green #65a30d, gray-800 text).
   ========================================================================== */

/* ---------- Toolbar (sort control) ---------- */
.gallery-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
    max-width: 1200px;
    margin: 0 auto 1.75rem;
    padding: 0 .25rem;
}

.gallery-toolbar__label {
    font-size: .875rem;
    font-weight: 600;
    color: #6b7280;
}

.gallery-sort {
    font: inherit;
    font-size: .875rem;
    font-weight: 600;
    color: #374151;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: .55rem .75rem;
    min-height: 44px;
    cursor: pointer;
}

.gallery-sort:focus-visible {
    outline: 2px solid #65a30d;
    outline-offset: 2px;
}

/* ---------- Album grid ---------- */
.gallery-albums {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.75rem;
    max-width: 1200px;
    margin: 0 auto;
}

.album-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    font: inherit;
    text-align: left;
    color: inherit;
    background: #fff;
    border: 1px solid #eceff2;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
    transition: transform .55s cubic-bezier(.2, .7, .2, 1),
                box-shadow .55s cubic-bezier(.2, .7, .2, 1);
}

.album-card:hover,
.album-card:focus-visible {
    transform: translateY(-7px);
    box-shadow: 0 22px 40px -18px rgba(16, 24, 40, .35);
}

.album-card:focus-visible {
    outline: 2px solid #65a30d;
    outline-offset: 3px;
}

.album-card__frame {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #0b0f19;
}

.album-card__cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 1.1s cubic-bezier(.2, .7, .2, 1);
}

.album-card:hover .album-card__cover,
.album-card:focus-visible .album-card__cover {
    transform: scale(1.06);
}

.album-card__body {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: 1rem 1.1rem 1.15rem;
}

.album-card__name {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    color: #1f2937;
}

.album-card__desc {
    font-size: .9rem;
    line-height: 1.5;
    color: #6b7280;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.album-card__divider {
    height: 1px;
    background: #e5e7eb;
    margin: .15rem 0 .05rem;
}

.album-card__meta {
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .01em;
    color: #939aa4;
}

/* ---------- Fade-up on load (JS-gated so content never hides without JS) --- */
.has-js .gallery-reveal {
    opacity: 0;
    transform: translateY(16px);
}

.has-js .gallery-reveal.is-in {
    opacity: 1;
    transform: none;
    transition: opacity .7s cubic-bezier(.2, .7, .2, 1),
                transform .7s cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    background: rgba(9, 11, 17, .93);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
    padding: clamp(.75rem, 3vw, 2rem);
}

.lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

body.lightbox-open {
    overflow: hidden;
}

.lightbox__header,
.lightbox__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex: 0 0 auto;
    color: #e5e7eb;
}

.lightbox__header {
    padding-bottom: .75rem;
}

.lightbox__footer {
    padding-top: .75rem;
}

.lightbox__title {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lightbox__header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 0 0 auto;
}

.lightbox__counter {
    font-size: .9rem;
    font-weight: 600;
    color: #cbd5e1;
    font-variant-numeric: tabular-nums;
}

.lightbox__caption {
    font-size: .9rem;
    color: #cbd5e1;
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lightbox__hint {
    font-size: .8rem;
    color: #8b93a1;
    white-space: nowrap;
}

.lightbox__stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox__figure {
    margin: 0;
    max-width: calc(100% - 120px);
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 6px;
}

.lightbox__img {
    display: block;
    max-width: 100%;
    max-height: 76vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.lightbox__img.is-enter-right {
    animation: lbInRight .45s cubic-bezier(.2, .7, .2, 1);
}

.lightbox__img.is-enter-left {
    animation: lbInLeft .45s cubic-bezier(.2, .7, .2, 1);
}

@keyframes lbInRight {
    from { opacity: 0; transform: translateX(34px); }
    to   { opacity: 1; transform: none; }
}

@keyframes lbInLeft {
    from { opacity: 0; transform: translateX(-34px); }
    to   { opacity: 1; transform: none; }
}

.lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
    color: #fff;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .28);
    transition: transform .3s ease, background-color .3s ease, border-color .3s ease;
}

.lightbox__nav:hover {
    background: rgba(255, 255, 255, .2);
    border-color: rgba(132, 204, 22, .9);
}

.lightbox__nav--prev { left: 0; }
.lightbox__nav--next { right: 0; }

.lightbox__nav--prev:hover { transform: translateY(-50%) translateX(-4px); }
.lightbox__nav--next:hover { transform: translateY(-50%) translateX(4px); }

.lightbox__close {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    cursor: pointer;
    font-size: 1.15rem;
    color: #fff;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .28);
    transition: background-color .3s ease, border-color .3s ease;
}

.lightbox__close:hover {
    background: rgba(255, 255, 255, .2);
    border-color: rgba(132, 204, 22, .9);
}

.lightbox :focus-visible,
.album-card:focus-visible {
    outline: 2px solid #a3e635;
    outline-offset: 3px;
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
    .gallery-albums {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 1.25rem;
    }

    .lightbox__figure { max-width: calc(100% - 84px); }
    .lightbox__caption { max-width: 100%; }
    .lightbox__hint { display: none; }
    .lightbox__nav { width: 44px; height: 44px; font-size: 1.1rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .has-js .gallery-reveal,
    .album-card,
    .album-card__cover,
    .lightbox,
    .lightbox__nav,
    .lightbox__close {
        transition: none !important;
        animation: none !important;
    }

    .has-js .gallery-reveal {
        opacity: 1 !important;
        transform: none !important;
    }

    .album-card:hover,
    .album-card:focus-visible,
    .album-card:hover .album-card__cover,
    .album-card:focus-visible .album-card__cover {
        transform: none !important;
    }

    .lightbox__nav--prev:hover,
    .lightbox__nav--next:hover {
        transform: translateY(-50%) !important;
    }

    .lightbox__img.is-enter-right,
    .lightbox__img.is-enter-left {
        animation: none !important;
    }
}
