/* ============================================================
   MAIN — full-width wrapper on project pages
============================================================ */

main.project-feature {
    max-width: none;
    margin: 0;
    padding: 0;
    min-height: calc(100svh);
    height: auto;
}


/* ============================================================
   PROJECT HERO — fills exactly 100svh below the site header.
   Image absorbs remaining vertical space; text sits at the bottom.
   Center-aligned ≥ 720px, left-aligned on mobile.
============================================================ */

.project-hero {
    min-height: calc(100svh - var(--header-h, 68px) - 2 * var(--gutter));
    /*overflow: hidden;*/
    width:100%;
    max-width: var(--w);
    margin: 6px auto var(--gutter) auto;
    padding: 0;
    padding-bottom: var(--gutter);
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    grid-auto-rows: auto;
    justify-items: center;
    text-align: center;
    flex-shrink: 0;
    background: var(--lime);
    grid-template-columns: 1fr;
}

/* Text-only hero (no image/picture): let content distribute the
   leftover space instead of concentrating it all above the h1 */
.project-hero:not(:has(> img)):not(:has(> picture)) {
    grid-template-rows: none;
    grid-auto-rows: auto;
    align-content: center;
}


.project-hero *{ 
    margin: 0px; 
}

.plain-p{
    margin: 8px auto;
    line-height: 1.3rem;
}


/* Direct-child image (current markup) */
.project-hero > img {
    width: 100%;
    height: 100%;
    min-height: 0;
    align-self: stretch;
    justify-self: stretch;
    object-fit: cover;
    object-position: center;
    margin: 0 0 clamp(12px, 2vw, 24px);
    background: #eee;
    display: block;
}

/* If wrapped in <picture>, keep the sizing intact */
.project-hero > picture {
    width: 100%;
    height: 100%;
    min-height: 0;
    align-self: stretch;
    justify-self: stretch;
    display: block;
    margin: 0 0 clamp(12px, 2vw, 24px);
}
.project-hero > picture > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    margin: 0;
    background: #eee;
}

/* Hero + main-feature H1 spacing */
.project-hero > h1,
main.project-feature h1 {
    margin: var(--gutter);
}
.project-hero > h1 {
    font-size: clamp(28px, 5vw, 52px);
}

.project-hero > .work-tagline {
    font-family: var(--sans);
    font-style: italic;
    font-size: clamp(14px, 1.7vw, 17px);
    line-height: 1.35;
    max-width: 32em;
    margin-bottom: 10px;
    text-align: center;
}
.project-hero .work-meta {
    font-family: var(--sans);
    font-size: 12px;
    text-transform: uppercase;
    line-height: 1.4;
    max-width: 42em;
    margin-bottom: var(--gutter);
    text-align: center;
}
.project-hero .button {
    background-color: #00C7BC;
}

/* hero content always visible on load — beats .js-reveal .reveal by specificity */
.js-reveal .project-hero .reveal {
    opacity: 1;
    transform: none;
    animation: fadeIn 0.6s ease-in both;
}


/* ============================================================
   INTRA-SECTION LAYOUT UTILITIES
============================================================ */

.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

.split > * {
    width: 100%;
}

.asymmetric {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    align-items: end;
}
.asymmetric--reverse { grid-template-columns: 1fr 2fr; }


/* ============================================================
   FIGURES
============================================================ */

figure {
    margin: var(--gutter) 0;
}
/*
.gallery figure { 
    margin: 0px; 
}*/

figure img {
    width: 100%;
    height: auto;
    display: block;
    background: none;
    cursor: zoom-in;
}
figure figcaption {
    font-family: var(--sans);
    color: black;
    font-size: 12px;
    opacity: .7;
    text-align: center;
    margin-top: 8px;
    margin-bottom: 8px;
    letter-spacing: .04em;
}


/* ============================================================
   MULTI-IMAGE TILE (2 or 3 across)
============================================================ */

.figure-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.figure-group.triptych { grid-template-columns: repeat(3, 1fr); }
.figure-group img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
}
.section--lime .figure-group img { border-color: var(--paper); }
.section--ink  .figure-group img { border-color: var(--lime); }


/* ============================================================
   GALLERY — single column on mobile (with figure-group pairs kept),
   masonry on desktop (figure-group flattens into the flow)
============================================================ */

.gallery {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 32px 0;
}


/* ============================================================
   VIDEO EMBEDS
============================================================ */

.work-video {
    margin: 32px 0;
    aspect-ratio: 16/9;
    width: 100%;
}
.work-video iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
}

.work-video iframe,
.work-video video {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
    object-fit: cover;
}

.gallery figure video {
    display: block;
    width: 100%;
    height: auto; /* Keep whatever original aspect ratio */
}


/* ============================================================
   CALLOUTS
============================================================ */

.work-callout {
    font-family: var(--script);
    font-size: clamp(36px, 6vw, 56px);
    line-height: 1.15;
    text-align: center;
    max-width: 14em;
    margin: 40px auto;
    padding: 0 24px;
    border: none;
    quotes: none;
    color: inherit;
}
.work-callout--poetry {
    font-family: var(--sans);
    font-style: italic;
    font-size: 15px;
    line-height: 1.8;
    white-space: pre-line;
    max-width: 32em;
    margin: 24px auto 24px 0;
    text-align: left;
    border-left: 2px solid currentColor;
    padding-left: 20px;
    transform: none;
}


/* ============================================================
   SCROLL-REVEAL FADE-IN
============================================================ */

.reveal { transition: opacity .6s ease, transform .6s ease; }
.js-reveal .reveal {
    opacity: 0;
    transform: translateY(14px);
}
.js-reveal .reveal.in {
    opacity: 1;
    transform: none;
}


/* ============================================================
   LIGHTBOX
============================================================ */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(100%);
    visibility: hidden;
    transition: transform .2s ease, visibility .3s ease;
}
.lightbox.open {
    transform: translateY(0);
    visibility: visible;
    transition: transform .5s ease, visibility .5s ease;
}
.lb-backdrop {
    position: absolute;
    inset: 0;
    background: var(--lime);
    cursor: zoom-out;
}
.lb-wrap {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lb-close {
    position: fixed;
    top: 20px;
    right: 24px;
    background: none;
    border: none;
    font-size: 40px;
    line-height: 1;
    cursor: pointer;
    color: var(--ink);
    padding: 8px;
    z-index: 2;
}
.lb-img-wrap { display: flex; align-items: center; justify-content: center; }
.lb-img-wrap img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    display: block;
}


/* ============================================================
   RESPONSIVE — DESKTOP (≥ 720px)
============================================================ */

@media (min-width: 720px) {
    /* Gallery becomes masonry; figure-group flattens into the flow */
    .gallery {
        display: block;
        column-count: 3;
        column-gap: 16px;
    }
    .gallery > * {
        break-inside: avoid;
        margin: 0 0 16px;
        display: block;
    }
    .gallery > .figure-group { display: contents; }
    .gallery > .figure-group > img {
        width: 100%;
        aspect-ratio: auto;
        object-fit: fill;
        display: block;
        margin: 0 0 16px;
        break-inside: avoid;
        cursor: zoom-in;
    }
}

@media (min-width: 1200px) {
    .gallery { column-count: 4; }
}


/* ============================================================
   RESPONSIVE — MOBILE (≤ 720px)
============================================================ */

@media (max-width: 720px) {
    .project-hero {
        justify-items: start;
        text-align: left;
        min-height: calc(100svh - var(--header-h, 68px));
    }
    .project-hero > h1 {
        font-size: clamp(24px, 7vw, 40px);
    }
    .project-hero h1,
    .project-hero h2,
    .project-hero p,
    .project-hero .button {
        margin-left: clamp(16px, 2.5vw, 28px);
    }
    main.project-feature h1 {
        margin-left: 0;
    }

    h1, h2, h3, h4, h5, p,
    .project-hero .work-meta, .project-hero .work-tagline,
    p.intro,
    main.project-feature h1 {
        text-align: left;
    }
    .category-buttons {
        justify-content: left;
    }

    .split,
    .asymmetric,
    .asymmetric--reverse {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .figure-group.triptych { grid-template-columns: repeat(2, 1fr); }

    .work-callout {
        font-size: clamp(32px, 8vw, 44px);
        margin: 24px auto;
    }
}


/* ============================================================
   REDUCED MOTION
============================================================ */

@media (prefers-reduced-motion: reduce) {
    .reveal,
    .js-reveal .reveal {
        opacity: 1;
        transform: none;
        transition: none;
        animation: none;
    }
}
