/*
 * Responsive media + lightbox
 *
 * This file intentionally contains only:
 * - fluid image behavior;
 * - gallery/lightbox behavior.
 *
 * Layout, typography, navigation and site identity live elsewhere.
 */

/* ------------------------------------------------------------------ */
/* Fluid images: never stretch or force a crop.                       */
/* ------------------------------------------------------------------ */

.hero__image,
.hero__image img,
.portfolio-piece__image,
.portfolio-piece__image img,
.case-visual,
.case-visual img,
.case-video,
.case-video video {
    display: block;
    max-width: 100%;
}

.hero__image,
.portfolio-piece__image,
.case-visual {
    background: transparent;
    height: auto;
    min-height: 0;
    overflow: visible;
}

.hero__image img,
.portfolio-piece__image img,
.case-visual img {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
}

/* Home portfolio images keep their source aspect ratio. */
.portfolio-piece__image {
    position: relative;
}

.portfolio-piece__image::after {
    pointer-events: none;
}

.portfolio-piece--portrait,
.portfolio-piece--wide {
    min-width: 0;
}

.portfolio-piece--portrait .portfolio-piece__image,
.portfolio-piece--wide .portfolio-piece__image {
    min-height: 0;
}

/* Case study: natural ratio for every image. */
.case-visual--hero,
.case-visual--full,
.case-visual--portrait,
.case-visual--wide,
.case-visual--landscape {
    min-height: 0;
    width: 100%;
}

.case-visual--portrait {
    width: min(100%, 48rem);
}

.case-sequence__pair .case-visual--portrait {
    margin-left: 0;
}

.case-video video {
    width: 100%;
    height: auto;
    max-height: 80vh;
}

/* ------------------------------------------------------------------ */
/* Lightbox                                                           */
/* ------------------------------------------------------------------ */

.lightbox-open {
    overflow: hidden;
}

.lightbox {
    align-items: center;
    background: rgba(10, 10, 10, .96);
    color: var(--paper);
    display: flex;
    inset: 0;
    justify-content: center;
    opacity: 0;
    padding: clamp(1rem, 3vw, 3rem);
    pointer-events: none;
    position: fixed;
    visibility: hidden;
    z-index: 1000;
    transition: opacity .2s ease, visibility .2s ease;
}

.lightbox.is-open {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.lightbox__figure {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    height: 100%;
    justify-content: center;
    margin: 0;
    max-width: min(92vw, 110rem);
    width: 100%;
}

.lightbox__image {
    display: block;
    height: auto;
    max-height: calc(100vh - 6rem);
    max-width: calc(100vw - 8rem);
    object-fit: contain;
    width: auto;
}

.lightbox__caption {
    color: #c6c5bf;
    font-size: .75rem;
    max-width: 45rem;
    text-align: center;
}

.lightbox__close,
.lightbox__nav {
    background: transparent;
    border: 0;
    color: var(--paper);
    cursor: pointer;
    line-height: 1;
    position: absolute;
    z-index: 2;
}

.lightbox__close {
    font-size: 2.2rem;
    right: 1.25rem;
    top: 1rem;
}

.lightbox__nav {
    font-size: 2rem;
    padding: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox__nav:disabled {
    cursor: default;
    opacity: .25;
}

.lightbox__nav--prev { left: 1rem; }
.lightbox__nav--next { right: 1rem; }

.lightbox__counter {
    bottom: 1.2rem;
    color: #c6c5bf;
    font-size: .7rem;
    left: 50%;
    letter-spacing: .08em;
    position: absolute;
    transform: translateX(-50%);
}

.lightbox-trigger {
    cursor: zoom-in;
}

@media (max-width: 760px) {
    .hero__image img,
    .portfolio-piece__image img,
    .case-visual img {
        max-width: 100%;
    }

    .portfolio-piece--portrait,
    .portfolio-piece--wide {
        min-width: 0;
        max-width: 100%;
    }

    .case-sequence__pair {
        display: block;
    }

    .case-sequence__pair .case-visual--portrait {
        width: 100%;
    }

    .lightbox {
        padding: .75rem;
    }

    .lightbox__figure {
        max-width: 100%;
    }

    .lightbox__image {
        max-height: calc(100vh - 7rem);
        max-width: calc(100vw - 1rem);
    }

    .lightbox__nav {
        bottom: .35rem;
        font-size: 1.5rem;
        top: auto;
        transform: none;
    }

    .lightbox__nav--prev { left: .6rem; }
    .lightbox__nav--next { right: .6rem; }
    .lightbox__counter { bottom: .8rem; }
    .lightbox__close { right: .6rem; top: .35rem; }
}

@media (max-width: 430px) {
    .site-header__inner {
        gap: .75rem;
    }

    .wordmark {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
    }

    .site-brand__logo {
        max-width: min(42vw, 150px);
    }

    .site-header__actions {
        flex: 0 0 auto;
        gap: .65rem;
    }

    .language-switcher {
        gap: .22rem;
        font-size: .62rem;
    }

    .menu-toggle {
        gap: .45rem;
        font-size: .68rem;
        padding-block: .6rem;
    }

    .menu-toggle__lines {
        width: 16px;
    }
}

