/* =========================================================
   Gallery — Frontend Grid Synced With Admin Console
   Stable version: uses PHP shape classes, no nth-child
   Fully synced with NETA fabric theme variables
========================================================= */

.gallery-section {
    position: relative;
    padding: var(--neta-section-padding, 112px 0);
    overflow: hidden;
    isolation: isolate;

    background:
        radial-gradient(
            circle at 78% 12%,
            color-mix(in srgb, var(--neta-white, #fffaf1) 62%, transparent),
            transparent 38%
        ),
        radial-gradient(
            circle at 16% 82%,
            color-mix(in srgb, var(--neta-brass, #8f7b5d) 12%, transparent),
            transparent 32%
        ),
        linear-gradient(
            150deg,
            var(--neta-paper-light, #fffaf1) 0%,
            var(--neta-paper, #eee6d8) 58%,
            var(--neta-linen, #ded4c2) 100%
        );
}

.gallery-section::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;

    background:
        linear-gradient(
            120deg,
            color-mix(in srgb, var(--neta-white, #fffaf1) 42%, transparent),
            transparent 48%
        ),
        repeating-linear-gradient(
            135deg,
            var(--neta-stripe, rgba(43, 33, 24, 0.035)) 0,
            var(--neta-stripe, rgba(43, 33, 24, 0.035)) 1px,
            transparent 1px,
            transparent 18px
        );

    opacity: 0.65;
    mix-blend-mode: multiply;
}

.gallery-section .container {
    position: relative;
    z-index: 2;
}

/* =========================================================
   Header
========================================================= */

.gallery-section__head {
    max-width: 840px;
    margin: 0 auto 58px;
    text-align: center;
}

.gallery-section__head .section-label {
    width: fit-content;
    margin: 0 auto 18px;
    justify-content: center;
    color: var(--neta-brass, #8f7b5d);
}

.gallery-section__head h2 {
    max-width: 780px;
    margin: 0 auto;

    color: var(--neta-walnut, #24190f);
    font-family: var(--font-display, Georgia, serif);
    font-size: clamp(52px, 7vw, 96px);
    font-weight: 650;
    line-height: 0.95;
    letter-spacing: -0.06em;
}

.gallery-section__head p {
    max-width: 660px;
    margin: 24px auto 0;

    color: var(--neta-walnut-soft, #493828);
    font-family: var(--font-body, Arial, sans-serif);
    font-size: 18px;
    line-height: 1.85;
}

/* =========================================================
   Grid Base
========================================================= */

.gallery-section .gallery-grid {
    width: 100%;
    margin: 0 auto;

    display: grid !important;
    grid-auto-flow: dense !important;
    gap: 18px !important;
}

.gallery-section .gallery-card {
    position: relative;

    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;

    margin: 0 !important;
    overflow: hidden;

    border-radius: 20px;

    background:
        linear-gradient(
            180deg,
            color-mix(in srgb, var(--neta-white, #fffaf1) 72%, transparent),
            color-mix(in srgb, var(--neta-linen, #ded4c2) 82%, transparent)
        );

    border: 1px solid var(--neta-line-soft, rgba(36, 25, 15, 0.08));

    box-shadow:
        0 24px 64px rgba(36, 25, 15, 0.13),
        inset 0 1px 0 color-mix(in srgb, var(--neta-white, #fffaf1) 44%, transparent);

    isolation: isolate;
}

.gallery-section .gallery-card::before {
    content: "";
    position: absolute;
    inset: 12px;
    z-index: 2;

    border: 1px solid color-mix(in srgb, var(--neta-white, #fffaf1) 48%, transparent);
    border-radius: 12px;
    pointer-events: none;
}

.gallery-section .gallery-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;

    background:
        linear-gradient(
            180deg,
            color-mix(in srgb, var(--neta-white, #fffaf1) 7%, transparent),
            transparent 36%
        ),
        linear-gradient(
            0deg,
            rgba(36, 25, 15, 0.13),
            transparent 56%
        );

    pointer-events: none;
}

.gallery-section .gallery-card__image,
.gallery-section .gallery-card img {
    width: 100% !important;
    height: 100% !important;

    display: block !important;
    object-fit: cover !important;
    object-position: center center !important;

    filter: saturate(0.95) sepia(0.03) contrast(1.01);

    transition:
        transform 0.35s ease,
        filter 0.35s ease;
}

.gallery-section .gallery-card:hover img {
    transform: scale(1.035);
    filter: saturate(1) sepia(0.01) contrast(1.03);
}

/* =========================================================
   Desktop Layout Base
========================================================= */

@media (min-width: 1025px) {
    .gallery-section .gallery-grid--classic,
    .gallery-section .gallery-grid--magazine,
    .gallery-section .gallery-grid--mosaic,
    .gallery-section .gallery-grid--clean {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        grid-auto-rows: 150px !important;
    }

    .gallery-section .gallery-grid--clean {
        max-width: 980px;
        gap: 16px !important;
    }
}

/* =========================================================
   Shape Engine — Desktop
========================================================= */

@media (min-width: 1025px) {
    .gallery-section .gallery-card--shape-normal {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
    }

    .gallery-section .gallery-card--shape-wide {
        grid-column: span 2 !important;
        grid-row: span 1 !important;
    }

    .gallery-section .gallery-card--shape-tall {
        grid-column: span 1 !important;
        grid-row: span 2 !important;
    }

    .gallery-section .gallery-card--shape-large,
    .gallery-section .gallery-card--shape-hero {
        grid-column: span 2 !important;
        grid-row: span 2 !important;
    }

    .gallery-section .gallery-grid--classic .gallery-card {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
    }
}

/* =========================================================
   Tablet
========================================================= */

@media (max-width: 1024px) {
    .gallery-section {
        padding: 86px 0;
    }

    .gallery-section__head {
        margin-bottom: 46px;
    }

    .gallery-section__head h2 {
        font-size: clamp(46px, 7vw, 76px);
    }

    .gallery-section .gallery-grid {
        gap: 14px !important;
    }

    .gallery-section .gallery-grid--classic,
    .gallery-section .gallery-grid--magazine,
    .gallery-section .gallery-grid--mosaic,
    .gallery-section .gallery-grid--clean {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-auto-rows: 145px !important;
    }

    .gallery-section .gallery-card--shape-normal {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
    }

    .gallery-section .gallery-card--shape-wide {
        grid-column: span 2 !important;
        grid-row: span 1 !important;
    }

    .gallery-section .gallery-card--shape-tall {
        grid-column: span 1 !important;
        grid-row: span 2 !important;
    }

    .gallery-section .gallery-card--shape-large,
    .gallery-section .gallery-card--shape-hero {
        grid-column: span 2 !important;
        grid-row: span 2 !important;
    }

    .gallery-section .gallery-grid--classic .gallery-card {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
    }
}

/* =========================================================
   Mobile
========================================================= */

@media (max-width: 899px) {
    .gallery-section {
        padding: 56px 0 60px;
    }

    .gallery-section__head {
        max-width: 430px;
        margin-bottom: 30px;
    }

    .gallery-section__head .section-label {
        margin-bottom: 14px;
        font-size: 11px;
        letter-spacing: 0.2em;
    }

    .gallery-section__head h2 {
        max-width: 390px;
        font-size: clamp(38px, 10vw, 54px);
        line-height: 1.03;
        letter-spacing: -0.05em;
    }

    .gallery-section__head p {
        max-width: 380px;
        margin-top: 16px;
        font-size: 15.6px;
        line-height: 1.65;
    }

    .gallery-section .gallery-grid {
        width: min(100%, 430px) !important;
        margin-inline: auto !important;

        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-auto-rows: 62px !important;
        grid-auto-flow: dense !important;
        gap: 8px !important;
    }

    .gallery-section .gallery-card {
        border-radius: 15px;
        box-shadow: 0 14px 34px rgba(36, 25, 15, 0.1);
    }

    .gallery-section .gallery-card::before {
        inset: 7px;
        border-radius: 8px;
    }

    .gallery-section .gallery-card:hover img {
        transform: none;
    }

    .gallery-section .gallery-card--shape-normal {
        grid-column: span 1 !important;
        grid-row: span 2 !important;
    }

    .gallery-section .gallery-card--shape-wide {
        grid-column: span 2 !important;
        grid-row: span 3 !important;
    }

    .gallery-section .gallery-card--shape-tall {
        grid-column: span 1 !important;
        grid-row: span 3 !important;
    }

    .gallery-section .gallery-card--shape-large,
    .gallery-section .gallery-card--shape-hero {
        grid-column: span 2 !important;
        grid-row: span 3 !important;
    }

    .gallery-section .gallery-grid--classic .gallery-card {
        grid-column: span 1 !important;
        grid-row: span 2 !important;
    }
}

/* =========================================================
   Small Mobile
========================================================= */

@media (max-width: 560px) {
    .gallery-section {
        padding: 48px 0 52px;
    }

    .gallery-section .gallery-grid {
        width: 100% !important;
        gap: 8px !important;
        grid-auto-rows: 56px !important;
    }

    .gallery-section .gallery-card {
        border-radius: 14px;
    }

    .gallery-section .gallery-card--shape-wide {
        grid-row: span 4 !important;
    }
}

/* =========================================================
   Very Small Mobile
========================================================= */

@media (max-width: 390px) {
    .gallery-section .gallery-grid {
        grid-auto-rows: 52px !important;
    }

    .gallery-section .gallery-card--shape-wide {
        grid-row: span 4 !important;
    }
}

/* =========================================================
   Touch
========================================================= */

@media (hover: none) {
    .gallery-section .gallery-card:hover img {
        transform: none;
    }
}