/* ============================================================
   Case study — Results gallery + image lightbox
   Rendered inside Panel 04 (.cs-results) of single-case_study.twig.
   Per-image width toggle (half / full) flows into rows:
   Half + Half (two-up), Full (spans the row, centered).
   Images are buttons that open #cs-lightbox.
   ============================================================ */

.cs-results-gallery {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 16px;
    margin-top: clamp(24px, 4vw, 44px);
}

/* Clickable image tile — reset the button chrome */
.cs-gallery-item {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    display: block;
    overflow: hidden;
    line-height: 0;
    transition: transform 0.25s ease;
}
.cs-gallery-item:hover,
.cs-gallery-item:focus-visible {
    transform: translateY(-3px);
    outline: none;
}
.cs-gallery-item:focus-visible {
    outline: 3px solid var(--clr-yellow, #c8dc3a);
    outline-offset: 3px;
}

.cs-gallery-item img {
    width: 100%;
    height: auto;          /* natural height — show the whole image, no crop */
    display: block;
}

/* Width variants — flex basis drives the two-up vs full-row layout.
   No fixed aspect-ratio: each image renders at its natural proportions so
   nothing (e.g. a "Website Redesign" band along the top) gets clipped. */
.cs-gallery-item--half {
    flex: 0 1 calc(50% - 8px);
}
.cs-gallery-item--full {
    flex: 0 0 100%;
}

@media (max-width: 640px) {
    /* Stack everything single-column on phones */
    .cs-gallery-item--half,
    .cs-gallery-item--full {
        flex-basis: 100%;
    }
}

/* ───────── Image lightbox ───────── */
.cs-lightbox[hidden] { display: none; }
.cs-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 5vw, 64px);
}
.cs-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 36, 0.82);
    backdrop-filter: blur(3px);
    cursor: pointer;
}
.cs-lightbox-figure {
    position: relative;
    margin: 0;
    max-width: min(1100px, 100%);
    max-height: 100%;
    display: flex;
    z-index: 1;
}
.cs-lightbox-img {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    display: block;
    border-radius: 10px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.cs-lightbox-close {
    position: absolute;
    top: clamp(12px, 3vw, 28px);
    right: clamp(12px, 3vw, 28px);
    z-index: 3;
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 40px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 12px;
}
.cs-lightbox-close:hover { color: var(--clr-yellow, #c8dc3a); }

.cs-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    background: rgba(255, 255, 255, 0.12);
    border: 0;
    color: #fff;
    font-size: 36px;
    line-height: 1;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}
.cs-lightbox-nav:hover { background: rgba(255, 255, 255, 0.28); }
.cs-lightbox-prev { left: clamp(8px, 3vw, 32px); }
.cs-lightbox-next { right: clamp(8px, 3vw, 32px); }

/* Hide nav arrows when there's only one image (JS toggles this class) */
.cs-lightbox--single .cs-lightbox-nav { display: none; }

@media (max-width: 640px) {
    .cs-lightbox-nav {
        width: 44px;
        height: 44px;
        font-size: 28px;
    }
}

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