/* gallery.css — Gallery page sections */

.gallery-intro { padding-block: var(--space-16) var(--space-10); background: var(--bg-page); text-align: center; }
.gallery-intro .section-lede { max-width: 720px; margin-inline: auto; color: var(--text-body); }

/* Equal-cell grid — same hover treatment as homepage Recent Projects */
.gallery-grid-section { padding-block: var(--space-10) var(--space-16); background: var(--bg-page); }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-2);
}
@media (max-width: 1080px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 880px)  { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px)  { .gallery-grid { grid-template-columns: 1fr; } }

.gallery-cell {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--surface-placeholder);
    /* button reset (cells are now <button> for click-to-enlarge) */
    appearance: none; -webkit-appearance: none;
    border: 0; padding: 0; margin: 0;
    font: inherit; color: inherit; text-align: left;
    cursor: pointer;
    width: 100%;
}
.gallery-cell:focus-visible {
    outline: 3px solid var(--brand-primary);
    outline-offset: 2px;
}
.gallery-cell img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform 600ms ease;
}
.gallery-cell::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(to top,
        rgba(15,16,17,0.85) 0%,
        rgba(15,16,17,0.30) 45%,
        rgba(15,16,17,0)    75%);
    transition: opacity 300ms ease;
    z-index: 1;
}
.gallery-cell:hover img { transform: scale(1.04); }
.gallery-cell:hover::before { opacity: 0.6; }

.gallery-cell__caption {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: var(--space-4) var(--space-5);
    color: var(--text-on-dark);
    z-index: 2;
}
.gallery-cell__tag {
    display: inline-block;
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.10em;
    font-weight: var(--fw-semibold);
    color: var(--text-on-dark);
    margin-bottom: var(--space-1);
}
.gallery-cell h3 {
    font-size: var(--fs-md);
    font-weight: var(--fw-bold);
    margin: 0;
    color: var(--text-on-dark);
    line-height: 1.25;
    position: relative;
    padding-left: var(--space-3);
}
.gallery-cell h3::before {
    content: '';
    position: absolute;
    left: 0; top: 4px; bottom: 4px;
    width: 3px;
    background: var(--brand-primary);
}

.gallery-empty-state-note {
    margin-top: var(--space-8);
    text-align: center;
    color: var(--text-muted);
    font-size: var(--fs-sm);
}
.gallery-empty-state-note a {
    color: var(--brand-primary);
    font-weight: var(--fw-semibold);
}

/* ---- Submit Your Project — dark image-backed strip ---- */
.gallery-submit {
    padding-block: var(--space-16);
    color: var(--text-on-dark);
    background:
        linear-gradient(135deg, rgba(15,16,17,0.88) 0%, rgba(15,16,17,0.70) 100%),
        url('/assets/img/products/intro-detail.jpg') center/cover no-repeat;
    isolation: isolate;
}
.gallery-submit__inner {
    display: grid; grid-template-columns: 1.4fr 1fr;
    gap: var(--space-10); align-items: center;
}
@media (max-width: 880px) { .gallery-submit__inner { grid-template-columns: 1fr; } }
.gallery-submit h2 { color: var(--text-on-dark); margin: var(--space-2) 0 var(--space-4); }
.gallery-submit p { color: rgba(255,255,255,0.85); margin: 0; line-height: 1.6; max-width: 60ch; }
.gallery-submit__actions {
    display: flex; gap: var(--space-3); flex-wrap: wrap;
    justify-content: flex-end;
}
@media (max-width: 880px) { .gallery-submit__actions { justify-content: flex-start; } }
.gallery-submit__actions .btn--ghost {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.6);
    color: var(--text-on-dark);
}
.gallery-submit__actions .btn--ghost:hover {
    background: var(--text-on-dark);
    color: var(--text-strong);
    border-color: var(--text-on-dark);
}
.gallery-submit__actions .btn i { margin-right: var(--space-2); }

/* ---- Lightbox (click cell → fullscreen photo viewer) ---- */
.gallery-lightbox {
    position: fixed; inset: 0;
    z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: var(--space-6);
}
.gallery-lightbox[hidden] { display: none; }
.gallery-lightbox__backdrop {
    position: absolute; inset: 0;
    background: rgba(15, 16, 17, 0.92);
    backdrop-filter: blur(6px);
    animation: gallery-lightbox-fade 240ms ease;
}
@keyframes gallery-lightbox-fade { from { opacity: 0; } to { opacity: 1; } }

.gallery-lightbox__shell {
    position: relative;
    width: min(1200px, 100%);
    max-height: calc(100vh - var(--space-12));
    display: flex; align-items: center; justify-content: center;
    animation: gallery-lightbox-rise 320ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes gallery-lightbox-rise {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

.gallery-lightbox__close {
    position: absolute;
    top: -52px; right: 0;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-strong);
    border: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: var(--fs-lg);
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.30);
    transition: background 180ms ease, color 180ms ease, transform 180ms ease;
    z-index: 5;
}
.gallery-lightbox__close:hover,
.gallery-lightbox__close:focus-visible {
    background: var(--brand-primary);
    color: var(--text-on-dark);
    transform: scale(1.05);
    outline: 0;
}

.gallery-lightbox__panel {
    margin: 0;
    background: transparent;
    max-width: 100%;
    max-height: 100%;
    display: flex; flex-direction: column; align-items: center;
}
.gallery-lightbox__panel img {
    max-width: 100%;
    max-height: calc(100vh - var(--space-20));
    width: auto; height: auto;
    border-radius: var(--radius-md);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
    background: var(--bg-darker);
    display: block;
}
.gallery-lightbox__caption {
    margin-top: var(--space-4);
    color: var(--text-on-dark);
    text-align: center;
}
.gallery-lightbox__tag {
    display: inline-block;
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.10em;
    font-weight: var(--fw-semibold);
    color: var(--brand-primary-light);
    margin-bottom: var(--space-1);
}
.gallery-lightbox__title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-bold);
    color: var(--text-on-dark);
    margin: 0;
}

/* Prev / next nav buttons */
.gallery-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px; height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-on-dark);
    border: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: var(--fs-md);
    cursor: pointer;
    z-index: 4;
    transition: background 180ms ease, transform 180ms ease;
}
.gallery-lightbox__nav:hover,
.gallery-lightbox__nav:focus-visible {
    background: var(--brand-primary);
    transform: translateY(-50%) scale(1.06);
    outline: 0;
}
.gallery-lightbox__nav--prev { left: -64px; }
.gallery-lightbox__nav--next { right: -64px; }

@media (max-width: 880px) {
    .gallery-lightbox__nav--prev { left: var(--space-2); }
    .gallery-lightbox__nav--next { right: var(--space-2); }
}

body.gallery-lightbox-open { overflow: hidden; }
