/* =========================================================
   EcoFeed Solutions – Gallery page
   Same palette / type / layout language as the other pages
   ========================================================= */

.gallery-page {
    --green: #4CAF50;
    --green-deep: #2e7d32;
    --gold: #FFD700;
    --cream: #FBF4E4;
    --ink: #111;
    --muted: #4d4d4d;
    --ease: cubic-bezier(.22, .8, .24, 1);
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    color: var(--ink);
    background: #fff;
}

.gallery-page *, .gallery-page *::before, .gallery-page *::after { box-sizing: border-box; }
.gallery-page h1, .gallery-page h2, .gallery-page p { margin: 0; padding: 0; }
.gallery-page img { display: block; max-width: 100%; }
.gallery-page .wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.gallery-page :focus-visible { outline: 3px solid var(--green); outline-offset: 3px; border-radius: 6px; }

/* ---------- Banner ---------- */
.gallery-hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: clamp(340px, 52vh, 460px);
    padding: 140px 0 64px;
    color: #fff;
    background: #1d3a21 url('../img/insect.jpg') center / cover no-repeat;
    border-radius: 0 0 44px 44px;
    overflow: hidden;
}

.gallery-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, .6) 0%, rgba(0, 0, 0, 0) 38%),
        linear-gradient(90deg, rgba(0, 0, 0, .7) 0%, rgba(0, 0, 0, .3) 60%, rgba(0, 0, 0, .15) 100%);
}

.gallery-hero .wrap { position: relative; z-index: 1; width: 100%; }

.gallery-hero h1 {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 800;
    font-size: clamp(42px, 6.6vw, 86px);
    line-height: .98;
    letter-spacing: -.035em;
}

/* ---------- Intro ---------- */
.gallery-container { padding: clamp(48px, 7vw, 88px) 0 clamp(56px, 8vw, 96px); }

.gallery-intro { border-top: 2px solid var(--ink); padding-top: 28px; margin-bottom: 48px; }

.gallery-intro p {
    max-width: 34em;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 600;
    font-size: clamp(22px, 2.5vw, 32px);
    line-height: 1.25;
    letter-spacing: -.02em;
}

/* ---------- Grid: rows alternate wide / narrow ---------- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: clamp(240px, 26vw, 340px);
    gap: 20px;
}

.gallery-item:nth-child(4n + 1),
.gallery-item:nth-child(4n + 4) { grid-column: span 2; }

.gallery-item {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 14px;
    overflow: hidden;
    cursor: zoom-in;
    background: var(--cream);
    font: inherit;
    color: #fff;
    text-align: left;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .9s var(--ease);
}

.gallery-item:hover img, .gallery-item:focus-visible img { transform: scale(1.06); }

.gallery-item .cap {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 56px 22px 20px;
    background: linear-gradient(0deg, rgba(0, 0, 0, .75), rgba(0, 0, 0, 0));
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 700;
    font-size: 20px;
    line-height: 1.2;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .3s ease, transform .4s var(--ease);
}

.gallery-item:hover .cap, .gallery-item:focus-visible .cap { opacity: 1; transform: none; }

@media (hover: none) {
    .gallery-item .cap { opacity: 1; transform: none; }
}

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 70px 24px 56px;
    background: rgba(0, 0, 0, .92);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility 0s linear .3s;
    font-family: 'DM Sans', system-ui, sans-serif;
}

.lightbox.active { opacity: 1; visibility: visible; transition: opacity .3s ease, visibility 0s; }

.lightbox *, .lightbox *::before, .lightbox *::after { box-sizing: border-box; }

.lightbox-content { max-width: min(1100px, 100%); max-height: 100%; display: flex; flex-direction: column; align-items: center; }

.lightbox-img {
    max-width: 100%;
    max-height: calc(100vh - 190px);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
    transition: opacity .25s ease;
}

.lightbox-caption {
    margin-top: 18px;
    color: #fff;
    text-align: center;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 700;
    font-size: 20px;
}

.lightbox-count { margin-top: 4px; color: rgba(255, 255, 255, .7); font-size: 14px; }

.lightbox-close, .lightbox-nav {
    position: absolute;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    cursor: pointer;
    transition: background .25s ease, color .25s ease;
}

.lightbox-close:hover, .lightbox-nav:hover { background: #FFD700; color: #111; }
.lightbox :focus-visible { outline: 3px solid #FFD700; outline-offset: 3px; }

.lightbox-close { top: 18px; right: 20px; width: 48px; height: 48px; }
.lightbox-nav { top: 50%; width: 56px; height: 56px; transform: translateY(-50%); }
.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }
.lightbox svg { width: 22px; height: 22px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .gallery-grid { grid-template-columns: 1fr 1fr; grid-auto-rows: clamp(200px, 34vw, 280px); gap: 14px; }
    .gallery-item:nth-child(4n + 1),
    .gallery-item:nth-child(4n + 4) { grid-column: span 2; }
}

@media (max-width: 600px) {
    .gallery-page .wrap { padding: 0 18px; }
    .gallery-hero { min-height: 300px; padding: 110px 0 40px; border-radius: 0 0 28px 28px; }
    .gallery-grid { grid-template-columns: 1fr; grid-auto-rows: 240px; gap: 12px; }
    .gallery-item:nth-child(4n + 1),
    .gallery-item:nth-child(4n + 4) { grid-column: auto; }

    .lightbox { padding: 64px 12px 48px; }
    .lightbox-nav { top: auto; bottom: 12px; transform: none; width: 48px; height: 48px; }
    .lightbox-prev { left: 18px; }
    .lightbox-next { right: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-page *, .lightbox, .lightbox * { transition-duration: .01ms !important; }
}