/*==========================================================================
   PROJECT DETAILS — the case-study page each project tile leads to.
   Written for aurora.html, and kept free of anything AURORA-specific so the
   other projects can reuse it: a page is an intro (gallery + facts +
   description) followed by any number of .case-section blocks.

   Desktop values measured off ProjectsDetailsBlueprint.pdf. That PDF is
   1920pt wide, so its own text and image coordinates are already 1920-design
   px; the vw below are those figures over 19.2.

   At 1920 the page is one centred column, x 209 - 1711, on three tracks:
       a  425   the text column          (22.14vw)
       w  583   the wide media track     (30.40vw)
       n  426   the narrow media track   (22.20vw)
   with a 34px gutter (1.76vw) between each. The intro runs the wide track
   first, then the facts across the other two.

   Type, sized by fitting Chromium's Raleway to the PDF's own line widths:
       heading  Black 38.8px          label    ExtraBold Italic 16px
       body     Regular 18px / 34.5   caption  Regular 11.4px
   all in black, not the site's navy.

   There is no mobile reference for this page. The phone layout stacks the
   blueprint's columns in reading order, with the same type pairing as the
   About page's mobile story section.
==========================================================================*/

/* Matches the last section, so the strip below it on a short page does
   not show as bare body. See the note on `body` in style.css. */
body { background: #fdfdfd; }   /* the watermarked ground */

/* Back to top scrolls rather than jumps. */
@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

.case {
    padding: 2rem 1.25rem max(4rem, calc(var(--footer-badge-clear) + 2.5rem));
    color: #000;
}

/* A phone-shaped column on a tablet, rather than images a whole screen
   wide. */
.case > * {
    max-width: 40rem;
    margin-inline: auto;
}

/*--------------------------------------------------------------------------
   Shared type
--------------------------------------------------------------------------*/
/* Labels, the title and the fact values are set solid (1.16 is Raleway's
   own ascent-to-descent), so the gaps between them are the blueprint's
   gaps between glyph boxes. */
.case-label {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 800;
    font-style: italic;
    line-height: 1.16;
}

.case-title {
    margin: 0.05em 0 0;
    font-size: clamp(1.6rem, 7.4vw, 2.25rem);
    font-weight: 900;
    line-height: 1.16;
}

.case-heading {
    margin: 0;
    font-size: clamp(1.5rem, 6.4vw, 2.05rem);
    font-weight: 900;
    line-height: 1.1;
}

.case-body {
    font-size: clamp(0.9rem, 3.9vw, 1.1rem);
    line-height: 1.9;
    /* The blueprint's copy is hyphenated and ragged right, like the rest of
       the site. */
    hyphens: auto;
}

.case-body p { margin: 0; }

/* A blank line between paragraphs, which is how the blueprint spaces them. */
.case-body p + p { margin-top: 1.9em; }

/*==========================================================================
   INTRO
==========================================================================*/
/*--------------------------------------------------------------------------
   Gallery — the hero and three thumbnails
--------------------------------------------------------------------------*/
/* Everything in the gallery is measured against the gallery's own width, so
   the corners and shadows keep the blueprint's proportions at any size.
   The blueprint's gallery is 583.6 wide; 1cqw is 5.836px of it. */
.case-gallery {
    container-type: inline-size;
}

/* The Projects tiles' frame: two corners rounded hard, two nearly square
   (50px and 10px on a 565.5px hero), and the same drop shadow. The hero is
   a touch narrower than the row of thumbnails under it in the blueprint.
   It holds the first picture and a large copy of each thumbnail's, stacked,
   and shows one at a time; the frame clips them to its corners. */
.case-gallery__hero {
    position: relative;
    width: 96.9%;
    aspect-ratio: 565.5 / 356;
    border-radius: 8.57cqw 1.71cqw 8.57cqw 1.71cqw;
    box-shadow: 1.03cqw 1.03cqw 2.06cqw rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.case-gallery__slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.6s var(--ease);
}

.case-gallery__slide.is-current { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
    .case-gallery__slide { transition: none; }
}

.case-gallery__thumbs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2.04cqw;                  /* 11.9px at 1920 */
    margin-top: 4.46cqw;           /* 26px at 1920 */
}

/* Same frame at the thumbnail's size: 18px and 4px on a 186px tile. */
.case-gallery__thumb {
    display: block;
    width: 100%;
    border-radius: 3.08cqw 0.69cqw 3.08cqw 0.69cqw;
    box-shadow: 0.6cqw 0.6cqw 1.2cqw rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.case-gallery__thumb img {
    width: 100%;
    aspect-ratio: 186 / 114.2;
    height: auto;
    object-fit: cover;
}

/* The thumbnail whose picture is in the hero carries a navy ring, set off
   from it by a thin white gap so it reads against a dark picture too. */
.case-gallery__thumb[aria-pressed="true"] {
    box-shadow: 0 0 0 0.5cqw var(--white), 0 0 0 1cqw var(--blue),
                0.6cqw 0.6cqw 1.2cqw rgba(0, 0, 0, 0.25);
}

.case-gallery__thumb:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
}

@media (hover: hover) {
    .case-gallery__thumb {
        transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
    }

    .case-gallery__thumb:hover {
        transform: translateY(-0.6cqw);
        box-shadow: 0.8cqw 1.4cqw 2.2cqw rgba(0, 0, 0, 0.28);
    }

    .case-gallery__thumb[aria-pressed="true"]:hover {
        box-shadow: 0 0 0 0.5cqw var(--white), 0 0 0 1cqw var(--blue),
                    0.8cqw 1.4cqw 2.2cqw rgba(0, 0, 0, 0.28);
    }
}

/*--------------------------------------------------------------------------
   Facts and description
--------------------------------------------------------------------------*/
.case-info {
    margin-top: 2.25rem;
}

/* Two lists: the discipline on a row to itself, then timeline and client
   sharing the next. Two rather than one so a layout can place the rows
   apart. */
.case-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 1.1rem 1.75rem;
    margin: 0.85rem 0 0;
}

.case-facts--pair { margin-top: 1.1rem; }

.case-facts dd {
    margin: 0.3em 0 0;
    font-size: clamp(0.9rem, 3.9vw, 1.1rem);
    line-height: 1.16;
}

.case-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.55rem;
    padding-top: 0.2em;
}

/* 29.5px tall at 1920: the solid line plus 4.35px above and below, and
   ~14px either side of the word. */
.case-pills li {
    padding: 0.24em 0.77em;
    font-size: 0.9em;
    line-height: 1.16;
    color: var(--white);
    background: var(--blue);
    border-radius: 999px;
    white-space: nowrap;
}

/* A discipline left off on a phone, so the rest fit on one line. */
.case-pills__wide-only { display: none; }

/* The smallest phones are a few pixels short of that line, so the pills
   draw in a little there. */
@media (max-width: 22.49em) {
    .case-pills { column-gap: 0.4rem; }

    .case-pills li {
        padding-inline: 0.6em;
        font-size: min(0.9em, 3.8vw);
    }
}

.case-info__desc-label {
    margin-top: 1.6rem;
}

.case-info .case-body {
    margin-top: 0.15rem;
}

/*==========================================================================
   SECTIONS
==========================================================================*/
.case-section {
    margin-top: 3.5rem;
    /* clear of the sticky navbar when a thumbnail jumps here */
    scroll-margin-top: calc(var(--nav-height) + 1.5rem);
}

.case-section .case-label {
    margin-top: 1rem;
}

.case-text + .case-text { margin-top: 1.9em; }

.case-text .case-body { margin-top: 0.1rem; }

/* Mobile: the images follow the copy, one under another. */
.case-media,
.case-figures {
    display: grid;
    gap: 0.9rem;
    margin-top: 1.75rem;
}

.case-media img,
.case-media video,
.case-figure img,
.case-posts img {
    width: 100%;
    height: auto;
}

.case-figure {
    margin: 0;
}

.case-figure figcaption {
    margin-bottom: 0.2em;
    font-size: 0.8rem;
    line-height: 1.16;
}

/* Copy in two columns with captioned figures down the narrow track (AURORA's
   Visual Identity and Inspiration, SLOW's Logo Design). On a phone the first
   figure follows the first paragraph and the rest follow the second, rather
   than all waiting until after both. The figures' wrapper steps aside so they
   can be ordered among the copy. */
.case-section--figures {
    display: flex;
    flex-direction: column;
}

.case-section--figures .case-figures { display: contents; }

.case-section--figures .case-figure { margin-top: 1.5rem; }

.case-section--figures .case-text               { order: 1; }
.case-section--figures .case-figure:first-child { order: 2; }
.case-section--figures .case-text--second       { order: 3; margin-top: 1.5rem; }
.case-section--figures .case-figure             { order: 4; }

/* The four social posts, two by two. */
.case-posts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

/*--------------------------------------------------------------------------
   Pieces the later write-ups need. None of these are in the AURORA
   blueprint; they extend its language rather than add a new one.
--------------------------------------------------------------------------*/
/* A second sub-head in the same column of copy, a blank line below the
   paragraph before it. */
.case-text .case-body + .case-label { margin-top: 1.9rem; }

/* An animation that belongs to the copy, under it in the text column,
   while the boards take the media tracks. */
.case-aside {
    margin-top: 1.75rem;
}

.case-aside img {
    display: block;
    width: 100%;
    height: auto;
}

/* A small piece of art on the right of the paragraph it illustrates, which
   runs beside it and carries on full width underneath. The art comes first
   in the markup so it can float up level with the paragraph's first line;
   flow-root keeps the float inside the block when the paragraph is short. */
.case-side { display: flow-root; }

.case-side .case-aside {
    float: right;
    width: 28%;
    margin: 0.35em 0 0.75rem 1rem;
}

/* A landscape piece reads at that width as a postage stamp. */
.case-side--wide-art .case-aside { width: 40%; }

/* Back to top, centred under the last section: the discipline pill drawn as
   an outline, filling on hover. */
.case-top {
    margin-top: 3.5rem;
    margin-bottom: 0;
    text-align: center;
}

.case-top a {
    display: inline-block;
    padding: 0.4em 1.1em;
    font-size: clamp(0.9rem, 3.9vw, 1.1rem);
    font-weight: 600;
    line-height: 1.16;
    color: var(--blue);
    text-decoration: none;
    border: 2px solid var(--blue);
    border-radius: 999px;
    transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.case-top a:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
}

@media (hover: hover) {
    .case-top a:hover {
        color: var(--white);
        background: var(--blue);
    }
}

.case-body a {
    color: var(--blue);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

.case-body a:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
    border-radius: 2px;
}

@media (hover: hover) {
    .case-body a:hover { text-decoration-thickness: 2px; }
}

/*==========================================================================
   DESKTOP — the blueprint layout
   From 64em, as on the other pages: drawn at 1920, the blueprint would put
   the body copy near 7px at a tablet's width.
==========================================================================*/
@media (min-width: 64em) {

    :root {
        --case-a:      22.14vw;   /* 425px — text   */
        --case-wide:   30.40vw;   /* 583px — media  */
        --case-narrow: 22.20vw;   /* 426px — media  */
        --case-gutter:  1.76vw;   /*  34px          */
        /* One rhythm between sections. The blueprint's own gaps run 91 to
           153px, which reads as hand placement rather than intent; 120 is
           their middle, and a later project page can rely on it. */
        --case-space:   6.25vw;   /* 120px          */
    }

    .case {
        /* Hero top at y=153.6, 67.6 under the navbar. */
        padding: 3.52vw 0 var(--case-space);
    }

    .case > * {
        max-width: none;
        width: calc(var(--case-a) + var(--case-wide) + var(--case-narrow)
                    + var(--case-gutter) * 2);
    }

    /*------------------------------------------------------ type --*/
    .case-label   { font-size: max(0.7rem, 0.833vw); }   /* 16px */
    .case-title   { font-size: max(1.35rem, 2.02vw); margin-top: 0; }   /* 38.8px */
    /* two lines 36.6px apart */
    .case-heading { font-size: max(1.35rem, 2.02vw); line-height: 0.945; }

    .case-body,
    .case-facts dd {
        font-size: max(0.8rem, 0.9375vw);  /* 18px */
    }

    .case-body { line-height: 1.917; }     /* 34.5px of leading */

    /*----------------------------------------------------- intro --*/
    .case-intro {
        display: grid;
        grid-template-columns: var(--case-wide) minmax(0, 1fr);
        column-gap: var(--case-gutter);
        align-items: start;
    }

    .case-info { margin-top: 0; }

    /* Gaps between glyph boxes at 1920: title 11.4, discipline 9.1,
       timeline 19.0, its value 4.4, description 27.3. */
    .case-facts {
        gap: 0.99vw 1.64vw;
        margin-top: 0.59vw;
    }

    .case-facts--pair { margin-top: 0.99vw; }

    .case-facts dd { margin-top: 0.23vw; }

    .case-pills {
        gap: 0.52vw;
        padding-top: 0.24vw;
    }

    .case-pills li { font-size: 1em; }

    .case-pills__wide-only { display: list-item; }

    .case-info__desc-label { margin-top: 1.42vw; }

    .case-info .case-body { margin-top: 0; }

    /* Two columns of 426 with the second starting at x=1283.9, in line with
       the narrow media track below. The browser balances them, so the break
       falls mid-paragraph the way the blueprint's does. */
    .case-body--columns {
        column-count: 2;
        column-gap: var(--case-gutter);
    }

    /*-------------------------------------------------- sections --*/
    /* Heading, then the copy, down the text column; the media takes the two
       tracks beside them. The second row is flexible, so when the media is
       the taller side the extra goes under the copy instead of opening a gap
       between the heading and its first label. */
    .case-section {
        display: grid;
        grid-template-columns: var(--case-a) var(--case-wide) var(--case-narrow);
        grid-template-rows: auto 1fr;
        column-gap: var(--case-gutter);
        align-items: start;
        margin-top: var(--case-space);
    }

    .case-heading { grid-area: 1 / 1; }
    .case-text    { grid-area: 2 / 1; }

    /* 19.6px from heading to label in every section. */
    .case-section .case-label { margin-top: 1.02vw; }

    .case-text .case-body { margin-top: 0; }

    .case-media,
    .case-figures {
        grid-area: 1 / 2 / 3 / 4;
        margin-top: 0;
    }

    /* Wide image then narrow (Social Media), narrow then wide (Logo +
       Poster), or one across both (Event Passes). The pairs sit on their
       foot, as the poster and the wall of posters do. */
    .case-media {
        grid-template-columns: var(--case-wide) var(--case-narrow);
        gap: var(--case-gutter);
        align-items: end;
    }

    .case-media--flipped {
        grid-template-columns: var(--case-narrow) var(--case-wide);
    }

    .case-media--single {
        grid-template-columns: 1fr;
    }

    /* The phones and the grid of posts are both 426.5 tall, so they meet top
       and bottom. */
    .case-posts { gap: 0.26vw; }   /* 5px */

    /*------------------------------- copy beside captioned figures --*/
    /* Two columns of copy, each under its own label, with the figures
       captioned down the narrow track. */
    .case-section--figures .case-text--second {
        grid-area: 2 / 2;
        max-width: 22.4vw;         /* its longest line ends at x=1097 */
        margin-top: 0;
    }

    .case-section--figures { display: grid; }

    .case-section--figures .case-figure { margin-top: 0; }

    .case-section--figures .case-figures {
        display: grid;
        grid-area: 1 / 3 / 3 / 4;
        gap: 1.54vw;               /* 29.5px from image to the next caption */
    }

    .case-figure figcaption {
        margin-bottom: 0.1vw;
        font-size: max(0.65rem, 0.594vw);   /* 11.4px */
    }

    /*---------------------------------------------- later pieces --*/
    .case-text .case-body + .case-label { margin-top: 1.8vw; }   /* 34.5px, a line */

    .case-aside { margin-top: 1.77vw; }   /* one line of the copy above */

    .case-side .case-aside { margin: 0.35em 0 0.75vw var(--case-gutter); }

    .case-top { margin-top: calc(var(--case-space) * 0.75); }

    .case-top a { font-size: max(0.8rem, 0.9375vw); }   /* the body's 18px */
}

/*==========================================================================
   IMAGE VIEWER — js/viewer.js
   Any picture on the page opens large over a navy wash, with zoom buttons
   and arrows through the rest. The viewer is a modal dialog the
   script adds to the page; it takes the whole window at every width.
==========================================================================*/
.viewer-trigger { cursor: zoom-in; }

.viewer-trigger:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 4px;
}

/* The page under the viewer does not scroll. */
.viewer-open { overflow: hidden; }

.viewer {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    color: var(--white);
    background: transparent;
}

.viewer::backdrop { background: rgba(9, 45, 89, 0.97); }

@media (prefers-reduced-motion: no-preference) {
    .viewer[open],
    .viewer[open]::backdrop { animation: viewer-in 0.2s var(--ease); }
}

@keyframes viewer-in {
    from { opacity: 0; }
}

/* The stage fills the window; its padding keeps the fitted picture clear of
   the count and close button above and the zoom buttons below, and of the
   arrows either side on a wider screen. */
.viewer__stage {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 3.75rem 0.75rem 5rem;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

@media (min-width: 48em) {
    .viewer__stage { padding: 4.5rem 5.5rem 5rem; }
}

/* A white ground, so an animation on a transparent ground (the walking
   figure, the turning logomark) shows against the navy. */
.viewer__img {
    max-width: none;
    background: #fdfdfd;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.35);
    transform-origin: center;
    transition: transform 0.25s var(--ease);
    cursor: zoom-in;
    -webkit-user-drag: none;
}

.viewer.is-zoomed .viewer__img { cursor: grab; }
.viewer.is-gesturing .viewer__img { transition: none; }
.viewer.is-zoomed.is-gesturing .viewer__img { cursor: grabbing; }

@media (prefers-reduced-motion: reduce) {
    .viewer__img { transition: none; }
}

.viewer__btn {
    position: absolute;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    color: var(--white);
    /* navy rather than a tint of white, so it reads over a zoomed picture
       as well as over the wash */
    background: rgba(9, 45, 89, 0.82);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    transition: background-color 0.2s var(--ease), opacity 0.2s var(--ease);
}

.viewer__btn:focus-visible {
    outline: 2px solid var(--white);
    outline-offset: 3px;
}

.viewer__btn:disabled {
    opacity: 0.35;
    cursor: default;
}

@media (hover: hover) {
    .viewer__btn:not(:disabled):hover { background: var(--blue); }
}

.viewer__close { top: 0.75rem; right: 0.75rem; }

.viewer__prev,
.viewer__next {
    top: 50%;
    transform: translateY(-50%);
}

.viewer__prev { left: 0.5rem; }
.viewer__next { right: 0.5rem; }

@media (min-width: 48em) {
    .viewer__prev { left: 1.5rem; }
    .viewer__next { right: 1.5rem; }
}

/* Zoomed in, the arrows step aside so the picture can be read under them. */
.viewer.is-zoomed .viewer__prev,
.viewer.is-zoomed .viewer__next {
    opacity: 0;
    pointer-events: none;
}

.viewer__count {
    position: absolute;
    top: 1.2rem;
    left: 1rem;
    margin: 0;
    padding: 0.2em 0.65em;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    background: rgba(9, 45, 89, 0.82);
    border-radius: 999px;
}

.viewer__foot {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    width: min(42rem, calc(100% - 2rem));
    transform: translateX(-50%);
    display: grid;
    justify-items: center;
    gap: 0.75rem;
    pointer-events: none;
}

.viewer__tools {
    display: flex;
    gap: 0.75rem;
    pointer-events: auto;
}

.viewer__tools .viewer__btn { position: static; }
