/* ========================= ABOUT ========================= */

.about {
    min-height: 100svh;

    display: flex;
    align-items: center;
}


/* Main layout */

.about__inner {
    width: 100%;

    /*
     * Centered 1120px composition. On narrow Desktop
     * screens it keeps at least the page gutter on
     * each side instead of running to the screen edge.
     */
    max-width: min(1120px, 100% - 2 * var(--gutter-page));

    margin-inline: auto;
    padding-inline: 0;

    display: grid;
    grid-template-columns: 1fr 248px;
    align-items: center;

    column-gap: 140px;
}


/* ========================= ABOUT — CONTENT ========================= */

.about__content {
    max-width: 560px;

    display: flex;
    flex-direction: column;
    gap: var(--space-72);
}


/* Heading */

.about__heading {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

.about__title {
    margin: 0;

    font-family: var(--font-display);
    font-size: min(var(--font-display-desktop), 10.94svh);
    font-weight: var(--weight-bold);

    line-height: 0.85;
    letter-spacing: 0;
}


/* Roles */

.about__roles {
    font-family: var(--font-mono);
    font-size: min(var(--font-subtitle-desktop), 2.34svh);
    font-weight: var(--weight-bold);

    line-height: 1.2;
}


/*
 * The roles line break belongs to the mobile
 * composition only — Desktop and Tablet keep the
 * three roles on a single line.
 */

.about__roles-break {
    display: none;
}


/* Body copy */

.about__body {
    max-width: 520px;

    display: flex;
    flex-direction: column;
    gap: var(--space-24);

    font-family: var(--font-mono);
    font-size: min(var(--font-body-desktop), 1.95svh);
    font-weight: var(--weight-regular);

    line-height: 1.35;
}


/* ========================= ABOUT — GALLERY ========================= */

.about__gallery {
    width: 248px;

    display: flex;
    flex-direction: column;

    flex-shrink: 0;

    overflow: hidden;
}

.about__image {
    width: 100%;
    height: auto;

    display: block;

    object-fit: cover;
}

/* ========================= ABOUT CAROUSEL ========================= */

.about {
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
}

.about__gallery {
    height: 100vh;
    overflow: hidden;
}

.about__carousel {
    width: 100%;
    height: 100%;

    overflow-y: auto;
    overflow-x: hidden;

    overscroll-behavior: contain;

    scrollbar-width: none;
    -ms-overflow-style: none;
}

.about__carousel::-webkit-scrollbar {
    display: none;
}

.about__carousel-track {
    display: flex;
    flex-direction: column;

    width: 100%;
}

.about__carousel img {
    display: block;

    width: 100%;
    height: auto;

    flex-shrink: 0;
}

/* ========================= ABOUT — TEXT MASKING ========================= */

.about__mask {
    overflow: hidden;
}

/* =========================
   TABLET
========================= */

@media (min-width: 768px) and (max-width: 1024.98px) {

    /* =========================
       ABOUT
    ========================= */

    .about {
        width: 100%;
        height: 100svh;
        min-height: 100svh;

        display: flex;
        align-items: stretch;

        overflow: hidden;
    }


    /* =========================
       MAIN LAYOUT
    ========================= */

    .about__inner {
        width: 100%;
        max-width: none;
        height: 100%;

        margin: 0;
        padding: 0;

        display: grid;

        grid-template-columns: 1fr;

        /*
         * The photo strip keeps 260px whenever the copy
         * leaves room for it. On shorter screens it takes
         * only the height left under the copy, so it never
         * runs past the bottom of the pinned panel.
         */

        grid-template-rows:
            1fr
            minmax(0, 260px);

        column-gap: 0;
    }


    /* =========================
       CONTENT
    ========================= */

    .about__content {
        width: 100%;
        max-width: 560px;

        padding:
            var(--space-120)
            var(--gutter-stage)
            var(--space-48);

        display: flex;
        flex-direction: column;

        gap: var(--space-72);

        align-self: start;
    }


    /* =========================
       HEADING
    ========================= */

    .about__heading {
        gap: var(--space-8);
    }

    .about__title {
        font-size: var(--font-display-tablet);
        line-height: 0.85;
    }

    .about__roles {
        font-size: var(--font-subtitle-tablet);
        line-height: 1.2;
    }


    /* =========================
       BODY
    ========================= */

    .about__body {
        max-width: 520px;

        gap: var(--space-24);

        font-size: var(--font-body-tablet);
        line-height: 1.35;
    }


    /* =========================
       GALLERY
    ========================= */

    .about__gallery {
        width: 100%;
        height: 100%;

        overflow: hidden;

        flex-direction: row;
    }


    /* =========================
       CAROUSEL
    ========================= */

    .about__carousel {
        width: 100%;
        height: 100%;

        overflow-x: auto;
        overflow-y: hidden;

        /*
         * The base rule contains both axes (Desktop column);
         * the strip releases the vertical one, so a vertical
         * swipe that starts on a photo scrolls the page.
         */

        overscroll-behavior-x: contain;
        overscroll-behavior-y: auto;

        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .about__carousel::-webkit-scrollbar {
        display: none;
    }


    .about__carousel-track {
        width: max-content;
        height: 100%;

        display: flex;
        flex-direction: row;
    }


    .about__carousel img {
        width: auto;

        /*
         * Never narrower than at the full 260px strip, so a
         * shorter strip crops the photos instead of shortening
         * the sequence the infinite loop depends on.
         */

        min-width: 193px;
        height: 100%;

        display: block;

        object-fit: cover;

        flex-shrink: 0;
    }
}

/* =========================
   MOBILE
========================= */

@media (max-width: 767.98px) {

    /* =========================
       ABOUT
    ========================= */

    .about {
        width: 100%;
        height: 100svh;
        min-height: 100svh;

        display: flex;
        align-items: stretch;

        overflow: hidden;
    }


    /* =========================
       MAIN LAYOUT
    ========================= */

    .about__inner {
        width: 100%;
        max-width: none;
        height: 100%;

        margin: 0;

        /*
         * Keeps the gallery off the bottom edge of
         * the panel.
         */

        padding: 0 0 clamp(6px, 1svh, 12px);

        display: grid;

        grid-template-columns: 1fr;

        /*
         * Both rows take their own height and
         * space-between parks everything that is left
         * in the single gap between the copy and the
         * gallery.
         *
         * That gap is then the only value that flexes
         * with the viewport, so a short phone
         * compresses it instead of overflowing, and
         * the row-gap below is its lower bound.
         */

        grid-template-rows:
            auto
            auto;

        align-content: space-between;

        column-gap: 0;
        row-gap: clamp(24px, 4svh, 40px);
    }

    /*
     * The sticky panel is one screen tall whenever
     * the copy and the gallery fit, and grows only
     * when they don't (very short phones). Its
     * sticky top is then minus that overflow
     * (--about-overflow, set by
     * panel-transition.js), so the panel keeps
     * scrolling until the whole gallery is in view
     * and holds there.
     */

    .panel-stage > .about .about__inner {
        height: auto;
        min-height: 100svh;

        top: calc(-1 * var(--about-overflow, 0px));
    }


    /* =========================
       CONTENT
    ========================= */

    .about__content {
        width: 100%;
        max-width: none;

        /*
         * Clears the fixed 64px Nav and sets where the
         * whole composition starts. The lower of two
         * fluid lines:
         *
         * - 35svh - 138px, the original spacing, which
         *   wins from about 800px tall up
         *   (852 → 160.2px, 812 → 146.2px);
         *
         * - 76px at 667px tall plus half of every
         *   extra pixel. Below about 800px the copy and
         *   the gallery need roughly 0.54px of every
         *   pixel the phone loses, so this line keeps
         *   the gallery in full view down to 667px.
         *
         * 76px keeps the title 12px below the Nav;
         * 168px caps tall phones as before.
         */

        padding:
            clamp(
                76px,
                min(
                    calc(76px + (100svh - 667px) / 2),
                    calc(35svh - 138px)
                ),
                168px
            )
            var(--gutter-stage)
            0;

        display: flex;
        flex-direction: column;

        /*
         * The column keeps its own rhythm: the free
         * space of the panel belongs to the grid, not
         * to the gap between roles and body.
         */

        justify-content: flex-start;

        /*
         * Roles → body: 852svh → 56px   667svh → 32px
         */

        gap: clamp(28px, calc(13svh - 55px), 56px);

        align-self: stretch;
    }


    /* =========================
       HEADING
    ========================= */

    .about__heading {
        gap: clamp(8px, 1.6svh, 16px);
    }

    .about__title {
        font-size: clamp(38px, 10.13vw, 42px);
        line-height: 0.88;
    }

    .about__roles {
        max-width: 280px;

        font-size: 16px;
        line-height: 1.35;
    }


    /*
     * "Front-end" carries a hyphen, which the browser
     * treats as a break opportunity, so the line is
     * broken explicitly and the single-line separator
     * is dropped.
     */

    .about__roles-break {
        display: inline;
    }

    .about__roles-sep {
        display: none;
    }


    /* =========================
       BODY
    ========================= */

    .about__body {
        width: 100%;
        max-width: 340px;

        gap: 18px;

        font-size: 15px;
        line-height: 1.5;
    }


    /* =========================
       GALLERY
    ========================= */

    .about__gallery {
        width: 100%;

        /*
         * Rounded to whole pixels: a fractional band
         * height puts the image widths back on half
         * pixels.
         */

        --about-gallery-height: clamp(150px, 26svh, 220px);

        height: round(var(--about-gallery-height), 1px);

        flex-direction: row;

        overflow: hidden;
    }


    /* =========================
       CAROUSEL
    ========================= */

    .about__carousel {
        /*
         * One pixel of horizontal overscan.
         *
         * The geometry is exact — uniform 165px images,
         * a 2475px track, and no uncovered pixel at any
         * scroll offset — but the compositor still
         * leaves a hairline of the panel showing where
         * the carousel meets the right edge of the
         * viewport.
         *
         * Running the scroll area one pixel past the
         * gallery moves that boundary underneath the
         * gallery's existing overflow clip. The track,
         * the image widths and the sequence maths stay
         * exactly as they are.
         */

        width: calc(100% + 1px);

        /*
         * The gallery is a flex row, so without this the
         * extra pixel is shrunk straight back out.
         */

        flex-shrink: 0;

        height: 100%;

        overflow-x: auto;
        overflow-y: hidden;

        /*
         * The base rule contains both axes (Desktop column);
         * the strip releases the vertical one, so a vertical
         * swipe that starts on a photo scrolls the page.
         */

        overscroll-behavior-x: contain;
        overscroll-behavior-y: auto;

        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .about__carousel::-webkit-scrollbar {
        display: none;
    }


    .about__carousel-track {
        width: max-content;
        height: 100%;

        display: flex;
        flex-direction: row;
    }


    .about__carousel img {
        /*
         * image-1 is 327x440 while the other four are
         * 1536x2048, so `width: auto` rendered it at
         * 163.5px against their 165px. One sequence
         * measured 823.5px and the track 2470.5px, so
         * the scroller rounded its width up to 2471 —
         * half a pixel of the panel stayed uncovered
         * at the right edge, and the sequence size the
         * carousel derives from scrollWidth / 3 missed
         * the real one by 0.167px on every wrap.
         *
         * A uniform, whole-pixel width keeps the track
         * an exact multiple of the sequence; object-fit
         * below absorbs the ratio difference.
         */

        width: round(down, calc(var(--about-gallery-height) * 0.75), 1px);
        height: 100%;

        display: block;

        object-fit: cover;

        flex-shrink: 0;
    }
}

/* =========================
   ABOUT — NARROW MOBILE
========================= */

@media (max-width: 366px) {

    /*
     * From 366px down the body wraps one more line
     * (11 instead of 10), so the composition starts
     * one body line higher: the same fluid top
     * spacing minus one 16px body line, with the
     * same 76px floor.
     */

    .about__content {
        padding-top: clamp(
            76px,
            calc(
                min(
                    calc(76px + (100svh - 667px) / 2),
                    calc(35svh - 138px)
                ) -
                15px * 1.5
            ),
            168px
        );
    }
}

/* =========================
   ABOUT — LARGE TABLET (PORTRAIT)
========================= */

@media (min-width: 1025px) and (max-width: 1199px) and (orientation: portrait) {

    /*
     * Large tablets in portrait (iPad Pro 13": 1032 x
     * 1376) are wider than Tablet, but the Desktop
     * composition does not work for them: its 1120px
     * container has no side margin below 1120px, and
     * the full-height photo column leaves the copy
     * floating in a tall panel. They take the Tablet
     * structure instead (copy above, a horizontal photo
     * strip below), at Desktop type sizes and on the
     * Desktop 7.5vw side line, which Works and Contact
     * share at this size.
     */

    .about__inner {
        --about-strip-height: round(30svh, 1px);

        max-width: none;

        margin: 0;
        padding: 0;

        grid-template-columns: 1fr;
        grid-template-rows:
            1fr
            var(--about-strip-height);

        column-gap: 0;
    }

    /* The copy is centered in the space above the strip */

    .about__content {
        max-width: none;

        padding-inline: var(--gutter-stage);
    }

    .about__gallery {
        width: 100%;
        height: 100%;

        flex-direction: row;
    }

    .about__carousel {
        overflow-x: auto;
        overflow-y: hidden;

        /*
         * The base rule contains both axes (Desktop column);
         * the strip releases the vertical one, so a vertical
         * swipe that starts on a photo scrolls the page.
         */

        overscroll-behavior-x: contain;
        overscroll-behavior-y: auto;
    }

    .about__carousel-track {
        width: max-content;
        height: 100%;

        flex-direction: row;
    }

    /*
     * One whole-pixel width for every image (they are
     * 3:4; image-1 is a hair narrower), so the track
     * stays an exact multiple of one sequence and the
     * loop the carousel derives from it stays exact.
     */

    .about__carousel img {
        width: round(down, calc(var(--about-strip-height) * 0.75), 1px);
        height: 100%;

        object-fit: cover;
    }
}

/* =========================
   ABOUT — PHONE LANDSCAPE
========================= */

/*
 * A phone held sideways is too short for the copy and the
 * photo strip together, in both bands. The panel takes the
 * Mobile short-screen behaviour: it is as tall as its
 * content and its sticky top is minus the overflow
 * (--about-overflow, set by panel-transition.js), so it
 * scrolls until the strip is in full view and holds there.
 * The section grows by that same overflow, so Works Intro
 * starts covering the panel only after the usual 40svh
 * with everything in view.
 *
 * The strip is 220px tall, the Mobile maximum (Mobile
 * photos 165px wide; Tablet keeps its 193px crop), which
 * keeps one sequence long enough for the carousel loop at
 * every landscape width.
 */

@media (max-width: 1024.98px) and (orientation: landscape) and (max-height: 500px) {

    .panel-stage > .about {
        height: calc(240svh + var(--about-overflow, 0px));
        min-height: calc(240svh + var(--about-overflow, 0px));
    }

    .panel-stage > .about .about__inner {
        height: auto;
        min-height: 100svh;

        top: calc(-1 * var(--about-overflow, 0px));

        grid-template-rows:
            auto
            auto;
    }

    .about__gallery {
        --about-gallery-height: 220px;

        height: 220px;
    }
}
