/* Portfolio: the index (portfolio.html) and the project pages (portfolio/*.html).
   This file holds what every design shares: undoing the blog's reading-column
   defaults, the larger photo view, video posters. The look itself follows. */

/* clip, not hidden: `hidden` turns <body> into a scroll box and the sidebar
   could no longer stick to the window */
html:has(> body.pf),
body.pf {
    overflow-x: clip;
}

body.pf main {
    max-width: none;
    margin: 0;
    padding: 0;
}

body.pf *,
body.pf *::before,
body.pf *::after {
    box-sizing: border-box;
}

body.pf img,
body.pf video {
    margin: 0;
    border-radius: 0;
    max-height: none;
}

body.pf figure {
    margin: 0;
}

body.pf figcaption {
    text-align: left;
    margin: 0;
}

body.pf [hidden] {
    display: none !important;
}

body.pf ul,
body.pf ol,
body.pf dl,
body.pf dd {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* ---------- The longer notes: folded away until asked for ---------- */

/* Closed, only the pictures show, side by side; open, the text sits between
   them in its original order */
.pf-story[data-notes="closed"] > :is(p, h3) {
    display: none;
}

.pf-story[data-notes="closed"] > figure {
    grid-column: auto !important;
    max-width: none !important;
}

.pf-story-toggle {
    grid-column: 1 / -1;
    justify-self: start;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

/* ---------- Video: a poster that plays on click ---------- */

.pf-embed {
    position: relative;
    width: 100%;
    background: #000;
    overflow: hidden;
}

.pf-embed img,
.pf-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: cover;
}

/* The video has black bars baked in: show its poster whole, as the player will */
.pf-embed-whole img {
    object-fit: contain;
}

.pf-embed button {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.pf-embed button span {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.9) inset;
    display: grid;
    place-items: center;
    transition: background 0.15s, transform 0.15s;
}

.pf-embed button span::after {
    content: "";
    margin-left: 5px;
    border-style: solid;
    border-width: 11px 0 11px 19px;
    border-color: transparent transparent transparent #fff;
}

.pf-embed button:hover span,
.pf-embed button:focus-visible span {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.06);
}

.pf-embed button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -4px;
}

.pf-video video {
    display: block;
    width: 100%;
    height: auto;
    background: #000;
}

/* ---------- A larger view of any photo ---------- */

.pf-zoomable {
    cursor: zoom-in;
}

.pf-zoomable:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

.pf-lightbox {
    width: 100vw;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(8, 8, 8, 0.96);
    color: #eee;
}

.pf-lightbox[open] {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) 64px;
    align-items: center;
}

.pf-lightbox::backdrop {
    background: rgba(8, 8, 8, 0.96);
}

.pf-lightbox figure {
    grid-column: 2;
    grid-row: 1;
    height: 100dvh;
    padding: 24px 0 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 0;
}

.pf-lightbox img {
    max-width: 100%;
    max-height: calc(100dvh - 76px);
    width: auto;
    height: auto;
    object-fit: contain;
}

.pf-lightbox figcaption {
    font: 13px/1.4 system-ui, sans-serif;
    color: #aaa;
    text-align: center;
    min-height: 1.4em;
    white-space: pre-wrap;
}

.pf-lightbox button {
    grid-row: 1;
    width: 48px;
    height: 48px;
    justify-self: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #ddd;
    font: 22px/1 system-ui, sans-serif;
    cursor: pointer;
}

.pf-lightbox button:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.pf-lightbox button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.pf-lightbox-prev {
    grid-column: 1;
}

.pf-lightbox-next {
    grid-column: 3;
}

.pf-lightbox .pf-lightbox-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 30px;
    z-index: 1;
}

@media (max-width: 700px) {
    .pf-lightbox[open] {
        grid-template-columns: 44px minmax(0, 1fr) 44px;
    }

    .pf-lightbox button {
        width: 40px;
        height: 40px;
    }
}

/* The look */

/* Design A12 · Wall Label + Procession
   The index is A7 Wall Label; a project page is A8 Procession, with no sidebar.
   Built from mockups/a7.css and mockups/a8.css: each rule is scoped to its pages
   (html body.pf-index or html body.pf-work), which adds the same weight to every
   rule, so each design keeps its own cascade. */

/* ======================================== */
/* Index: A7 Wall Label                     */
/* ======================================== */

html body.pf-index.pf {
    --ink: var(--color-text);
    --soft: var(--color-text-secondary);
    --muted: var(--color-text-muted);
    --faint: var(--color-text-disabled);
    --line: var(--color-border);
    --wash: var(--color-bg-light);
    --mat: var(--color-bg-medium);
    --pad: clamp(1rem, 3.5vw, 3rem);
}

html body.pf-index.pf a:focus-visible,
html body.pf-index.pf button:focus-visible {
    outline: 2px solid var(--color-link);
    outline-offset: 2px;
}

/* ==================== */
/* Index                */
/* ==================== */

html body.pf-index.pf main.pf-main {
    padding: 0 var(--pad) 6rem;
}

html body.pf-index .pf-intro {
    padding: clamp(1rem, 2.2vw, 1.75rem) 0 0;
}

html body.pf-index .pf-intro h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

html body.pf-index .pf-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem 1.75rem;
}

html body.pf-index .pf-filter button {
    padding: 0.35rem 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: var(--fs-small);
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
}

html body.pf-index .pf-filter button:hover {
    color: var(--ink);
}

html body.pf-index .pf-filter button[aria-pressed="true"] {
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 0.3em;
}

html body.pf-index .pf-section {
    margin-top: clamp(4.5rem, 9vw, 8rem);
}

/* The first section showing (no shown section before it) follows the filter
   closely: the pictures open the page */
html body.pf-index .pf-section:not(.pf-section:not([hidden]) ~ .pf-section) {
    margin-top: clamp(1.25rem, 2.5vw, 2rem);
}

/* A section name you can find: a rule, then the word at reading size */
html body.pf-index .pf-section-title {
    margin: 0 0 clamp(1.5rem, 3vw, 2.5rem);
    padding-top: 0.85rem;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: var(--fs-h4);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--ink);
}

/* One work at a time: each as large as the window allows (whole, never
   cropped), centred, with a long pause before the next */
html body.pf-index .pf-grid {
    --one-h: min(calc(100dvh - var(--pf-header-h, 5.5rem) - 14rem), 48rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(3.5rem, 8vw, 6.5rem);
}

html body.pf-index .pf-card {
    width: min(100%, calc(var(--one-h) * var(--ar)));
    min-width: 0;
}

html body.pf-index .pf-card a {
    display: block;
    color: inherit;
    text-decoration: none;
}

html body.pf-index .pf-card-photo {
    display: block;
    aspect-ratio: var(--ar);
    overflow: hidden;
    background: var(--wash);
}

html body.pf-index .pf-card-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* The label beneath, centred: the title, then the year */
html body.pf-index .pf-card-text {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: 0.15rem 0.6rem;
    padding-top: 0.85rem;
    font-size: var(--fs-body);
    line-height: 1.35;
    text-align: center;
}

html body.pf-index .pf-card-title {
    font-weight: 600;
}

html body.pf-index .pf-card a:hover .pf-card-title {
    color: var(--color-link);
}

html body.pf-index .pf-card-year {
    color: var(--faint);
    font-variant-numeric: tabular-nums;
}

html body.pf-index .pf-card-parts {
    display: none;
}

/* A screenshot sits on a mat with a soft shadow, so a white page reads as a
   screen and not as an empty box */
html body.pf-index .pf-card.pf-screen .pf-card-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mat);
}

html body.pf-index .pf-card.pf-screen .pf-card-photo img {
    width: 84%;
    height: auto;
    object-fit: contain;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 6px 22px rgba(0, 0, 0, 0.09);
}

/* A hairline, so a pale photo still has an edge on a white page */
html body.pf-index .pf-card:not(.pf-screen) .pf-card-photo,
html body.pf-index .pf-lead.pf-photo img,
html body.pf-index .pf-gallery img,
html body.pf-index .pf-story img {
    outline: 1px solid rgba(0, 0, 0, 0.07);
    outline-offset: -1px;
}

/* ==================== */
/* Project page         */
/* ==================== */

html body.pf-index .pf-layout {
    display: grid;
    grid-template-columns: clamp(14.5rem, 19vw, 18.5rem) minmax(0, 1fr);
    align-items: start;
}

/* The page measures itself, so the layout follows the room the sidebar leaves */
html body.pf-index.pf main.pf-work-main {
    container: pfmain / inline-size;
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    padding: clamp(1rem, 2.4vw, 2.25rem) var(--pad) 4rem;
}

html body.pf-index .pf-work-main article {
    --lead-max: calc(100dvh - var(--pf-header-h, 5.5rem) - 4rem);
    --one-h: min(calc(100dvh - var(--pf-header-h, 5.5rem) - 5rem), 50rem);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* The lead photo is as large as it can be with its title still in the window */
html body.pf-index .pf-lead {
    width: min(100%, calc(var(--lead-max) * var(--ar)));
}

html body.pf-index .pf-lead img,
html body.pf-index .pf-lead video {
    display: block;
    width: 100%;
    height: auto;
}

/* A web piece's lead is a screenshot: on the mat, like the index */
html body.pf-index.pf-work[data-kind="web"] .pf-lead {
    padding: clamp(1rem, 5%, 2.75rem);
    background: var(--mat);
}

html body.pf-index.pf-work[data-kind="web"] .pf-lead img {
    outline: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 8px 28px rgba(0, 0, 0, 0.1);
}

/* Narrow: the page's own order, straight down: photo, description, materials,
   practice, then the rest of the label. The label block is opened up so its
   parts can take their places in that run. */
html body.pf-index .pf-text {
    display: flex;
    flex-direction: column;
    width: min(100%, 37rem);
    padding-top: clamp(1.75rem, 3vw, 2.5rem);
}

html body.pf-index .pf-label {
    display: contents;
}

html body.pf-index .pf-head {
    order: 1;
}

html body.pf-index .pf-about {
    order: 2;
}

html body.pf-index .pf-materials {
    order: 3;
}

html body.pf-index .pf-practice {
    order: 4;
}

html body.pf-index .pf-facts {
    order: 5;
}

html body.pf-index .pf-links {
    order: 6;
}

html body.pf-index .pf-posts {
    order: 7;
}

html body.pf-index .pf-head {
    text-align: center;
}

html body.pf-index .pf-head h1 {
    margin: 0;
    font-size: var(--fs-h1);
    line-height: 1.08;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

html body.pf-index .pf-subtitle {
    max-width: 40rem;
    margin: 0.5rem auto 0;
    font-size: var(--fs-h4);
    line-height: 1.3;
    color: var(--soft);
    text-wrap: pretty;
}

html body.pf-index .pf-meta {
    margin: 0.5rem 0 0;
    font-size: var(--fs-small);
    color: var(--muted);
}

html body.pf-index .pf-context::before {
    content: "·";
    margin: 0 0.5em 0 0.25em;
    color: var(--faint);
}

html body.pf-index .pf-about {
    margin-top: 1.5rem;
}

html body.pf-index .pf-about p:last-child,
html body.pf-index .pf-practice p:last-child {
    margin-bottom: 0;
}

html body.pf-index .pf-practice {
    margin-top: 1.5rem;
}

/* The wall label: materials set small between two rules */
html body.pf-index .pf-materials {
    margin: 1.5rem 0 0 !important;
    padding: 0.8rem 0 !important;
    border-block: 1px solid var(--line);
    font-size: var(--fs-small);
    line-height: 1.5;
    color: var(--soft);
}

html body.pf-index .pf-materials li {
    display: inline;
}

html body.pf-index .pf-materials li:not(:last-child)::after {
    content: ", ";
}

html body.pf-index .pf-facts {
    margin-top: 1.5rem !important;
    font-size: var(--fs-small);
    line-height: 1.5;
    color: var(--muted);
}

html body.pf-index .pf-facts div {
    display: flex;
    gap: 0.75rem;
}

html body.pf-index .pf-facts div + div {
    margin-top: 0.35rem;
}

html body.pf-index .pf-facts dt {
    flex: 0 0 4.5rem;
    margin: 0;
    font-weight: 500;
    color: var(--faint);
}

html body.pf-index .pf-facts dd {
    color: var(--soft);
}

html body.pf-index .pf-links {
    margin-top: 1.5rem !important;
    font-size: var(--fs-small);
}

html body.pf-index .pf-links li + li {
    margin-top: 0.25rem;
}

html body.pf-index .pf-links a::after {
    content: " \2192";
}

html body.pf-index .pf-posts {
    margin-top: 1.5rem;
    font-size: var(--fs-small);
}

html body.pf-index .pf-posts h2 {
    margin: 0 0 0.35rem;
    font-size: var(--fs-label);
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--faint);
}

html body.pf-index .pf-posts li + li {
    margin-top: 0.25rem;
}

/* More photos: one after another, centred, each as large as the window allows */
html body.pf-index .pf-gallery {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(2.5rem, 5vw, 4rem);
    width: 100%;
    margin-top: clamp(3.5rem, 7vw, 6rem);
}

html body.pf-index .pf-gallery > figure {
    width: min(100%, calc(var(--one-h) * var(--ar)));
    margin: 0 !important;
}

html body.pf-index.pf .pf-gallery figcaption {
    text-align: center;
}

html body.pf-index .pf-gallery img,
html body.pf-index .pf-gallery video,
html body.pf-index .pf-story img,
html body.pf-index .pf-story video {
    display: block;
    width: 100%;
    height: auto;
    background: var(--wash);
}

html body.pf-index.pf figcaption {
    padding-top: 0.4rem;
    font-size: var(--fs-small);
    line-height: 1.45;
    color: var(--muted);
}

/* The longer account: his text in the reading column, pictures two up */
html body.pf-index .pf-story {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    width: min(100%, 52rem);
    margin-top: clamp(2.5rem, 5vw, 4rem);
    padding-top: 2rem;
    border-top: 1px solid var(--line);
}

html body.pf-index .pf-story > :is(p, h3) {
    grid-column: 1 / -1;
    max-width: 37rem;
    margin: 0;
}

html body.pf-index .pf-story > h3 {
    margin-top: 1.25rem;
    font-size: var(--fs-h4);
}

html body.pf-index .pf-story-toggle {
    font-size: var(--fs-small);
    color: var(--color-link);
}

html body.pf-index .pf-story-toggle:hover {
    text-decoration: underline;
}

html body.pf-index .pf-story-toggle::before {
    content: "+ ";
}

html body.pf-index .pf-story-toggle[aria-expanded="true"]::before {
    content: "\2212  ";
}

html body.pf-index .pf-story-toggle + h3 {
    margin-top: 0.5rem;
}

html body.pf-index .pf-story > p + p {
    margin-top: 0.25rem;
}

html body.pf-index .pf-story > figure:not(figure + figure):not(:has(+ figure)) {
    grid-column: 1 / -1;
    max-width: 44rem;
}

/* A tall picture on its own stays a sensible height */
html body.pf-index .pf-story > figure.pf-tall:not(figure + figure):not(:has(+ figure)) {
    max-width: 24rem;
}

html body.pf-index .pf-story > figure {
    align-self: start;
}

/* Previous / all / next */
html body.pf-index .pf-pager {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    gap: 1.5rem;
    margin-top: clamp(4rem, 8vw, 6rem);
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    font-size: var(--fs-small);
}

html body.pf-index .pf-pager a {
    text-decoration: none;
}

html body.pf-index .pf-pager-link {
    display: grid;
    gap: 0.15rem;
    color: var(--ink);
}

html body.pf-index .pf-pager-label {
    font-size: var(--fs-label);
    color: var(--faint);
}

html body.pf-index .pf-pager-title {
    font-weight: 600;
}

html body.pf-index a.pf-pager-link:hover .pf-pager-title {
    color: var(--color-link);
}

html body.pf-index .pf-next {
    grid-column: 3;
    text-align: right;
}

html body.pf-index .pf-pager-all {
    grid-column: 2;
    padding-top: 0.95rem;
}

/* ==================== */
/* Sidebar              */
/* ==================== */

/* A screenshot is shown whole, on the mat */

/* Where you are: the blog sidebar's own marker */

/* Narrow screens: the page reads straight down and the other work follows as
   a strip you swipe sideways */
@media (max-width: 900px) {
    html body.pf-index .pf-layout {
        display: block;
    }

    html body.pf-index.pf main.pf-work-main {
        padding-bottom: 2.5rem;
    }

    html body.pf-index .pf-work-main article {
        --lead-max: 78dvh;
    }
}

@media (max-width: 560px) {
    html body.pf-index .pf-story {
        grid-template-columns: minmax(0, 1fr);
    }

    html body.pf-index .pf-pager {
        grid-template-columns: 1fr 1fr;
    }

    html body.pf-index .pf-pager-all {
        grid-column: 1 / -1;
        grid-row: 2;
        padding-top: 0;
    }

    html body.pf-index .pf-next {
        grid-column: 2;
    }
}

/* ==================== */
/* A7 · Wall Label      */
/* ==================== */

html body.pf-index.pf main.pf-main {
    container: pfindex / inline-size;
}

@container pfindex (min-width: 46rem) {
    html body.pf-index .pf-grid {
        --one-h: min(calc(100dvh - var(--pf-header-h, 5.5rem) - 10rem), 44rem);
        --label-w: clamp(13rem, 24cqi, 19rem);
        --gap: clamp(1.5rem, 3cqi, 3rem);
    }

    html body.pf-index .pf-card {
        width: min(100%, calc(var(--one-h) * var(--ar) + var(--label-w) + var(--gap)));
    }

    html body.pf-index .pf-card a {
        display: grid;
        grid-template-columns: minmax(0, calc(var(--one-h) * var(--ar))) var(--label-w);
        column-gap: var(--gap);
        align-items: end;
    }

    /* Every other work hangs its label on the left */
    html body.pf-index .pf-card:nth-child(even) a {
        grid-template-columns: var(--label-w) minmax(0, calc(var(--one-h) * var(--ar)));
    }

    html body.pf-index .pf-card:nth-child(even) .pf-card-photo {
        grid-column: 2;
        grid-row: 1;
    }

    html body.pf-index .pf-card:nth-child(even) .pf-card-text {
        grid-column: 1;
        grid-row: 1;
        align-items: flex-end;
        text-align: right;
    }

    html body.pf-index .pf-card-text {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: flex-start;
        justify-content: flex-end;
        gap: 0.4rem;
        padding: 0 0 0.25rem;
        text-align: left;
    }

    html body.pf-index .pf-card-title {
        font-size: var(--fs-h3);
        line-height: 1.12;
        letter-spacing: -0.015em;
        text-wrap: balance;
    }

    /* The materials in small type under the year, three lines at most */
    html body.pf-index .pf-card-parts {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        overflow: hidden;
        margin-top: 0.35rem;
        font-size: var(--fs-small);
        line-height: 1.45;
        color: var(--muted);
    }
}

html body.pf-index .pf-card-parts span:not(:last-child)::after {
    content: ", ";
}

/* Wide: the label beside the lead photo, as in A2. The photo takes the room
   the label column leaves, up to the window's height. */
@container pfmain (min-width: 50rem) {
    html body.pf-index .pf-work-main article {
        --side-w: clamp(16rem, 27cqi, 22rem);
        --gap: clamp(2rem, 4.5cqi, 3.5rem);
        --lead-max: calc(100dvh - var(--pf-header-h, 5.5rem) - 4.5rem);
        display: grid;
        grid-template-columns: auto minmax(var(--side-w), 1fr);
        column-gap: var(--gap);
        align-items: start;
    }

    html body.pf-index .pf-work-main article > .pf-lead {
        width: min(calc(100cqi - var(--side-w) - var(--gap)), calc(var(--lead-max) * var(--ar)));
    }

    html body.pf-index .pf-work-main article > .pf-text {
        width: auto;
        max-width: 30rem;
        padding-top: 0;
    }

    html body.pf-index .pf-head {
        text-align: left;
    }

    html body.pf-index .pf-subtitle {
        margin-left: 0;
    }

    html body.pf-index .pf-head h1 {
        font-size: var(--fs-h2);
    }

    html body.pf-index .pf-work-main article > :is(.pf-gallery, .pf-story) {
        grid-column: 1 / -1;
        justify-self: center;
    }
}

/* ======================================== */
/* Project page: A8 Procession              */
/* ======================================== */

html body.pf-work.pf {
    --ink: var(--color-text);
    --soft: var(--color-text-secondary);
    --muted: var(--color-text-muted);
    --faint: var(--color-text-disabled);
    --line: var(--color-border);
    --wash: var(--color-bg-light);
    --mat: var(--color-bg-medium);
    --pad: clamp(1rem, 3.5vw, 3rem);
}

html body.pf-work.pf a:focus-visible,
html body.pf-work.pf button:focus-visible {
    outline: 2px solid var(--color-link);
    outline-offset: 2px;
}

/* ==================== */
/* Index                */
/* ==================== */

html body.pf-work.pf main.pf-main {
    padding: 0 var(--pad) 6rem;
}

html body.pf-work .pf-intro {
    padding: clamp(1rem, 2.2vw, 1.75rem) 0 0;
}

html body.pf-work .pf-intro h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

html body.pf-work .pf-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem 1.75rem;
}

html body.pf-work .pf-filter button {
    padding: 0.35rem 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: var(--fs-small);
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
}

html body.pf-work .pf-filter button:hover {
    color: var(--ink);
}

html body.pf-work .pf-filter button[aria-pressed="true"] {
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 0.3em;
}

html body.pf-work .pf-section {
    margin-top: clamp(4.5rem, 9vw, 8rem);
}

/* The first section showing (no shown section before it) follows the filter
   closely: the pictures open the page */
html body.pf-work .pf-section:not(.pf-section:not([hidden]) ~ .pf-section) {
    margin-top: clamp(1.25rem, 2.5vw, 2rem);
}

/* A section name you can find: a rule, then the word at reading size */
html body.pf-work .pf-section-title {
    margin: 0 0 clamp(1.5rem, 3vw, 2.5rem);
    padding-top: 0.85rem;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: var(--fs-h4);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--ink);
}

/* One work at a time: each as large as the window allows (whole, never
   cropped), centred, with a long pause before the next */
html body.pf-work .pf-grid {
    --one-h: min(calc(100dvh - var(--pf-header-h, 5.5rem) - 14rem), 48rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(3.5rem, 8vw, 6.5rem);
}

html body.pf-work .pf-card {
    width: min(100%, calc(var(--one-h) * var(--ar)));
    min-width: 0;
}

html body.pf-work .pf-card a {
    display: block;
    color: inherit;
    text-decoration: none;
}

html body.pf-work .pf-card-photo {
    display: block;
    aspect-ratio: var(--ar);
    overflow: hidden;
    background: var(--wash);
}

html body.pf-work .pf-card-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* The label beneath, centred: the title, then the year */
html body.pf-work .pf-card-text {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: 0.15rem 0.6rem;
    padding-top: 0.85rem;
    font-size: var(--fs-body);
    line-height: 1.35;
    text-align: center;
}

html body.pf-work .pf-card-title {
    font-weight: 600;
}

html body.pf-work .pf-card a:hover .pf-card-title {
    color: var(--color-link);
}

html body.pf-work .pf-card-year {
    color: var(--faint);
    font-variant-numeric: tabular-nums;
}

html body.pf-work .pf-card-parts {
    display: none;
}

/* A screenshot sits on a mat with a soft shadow, so a white page reads as a
   screen and not as an empty box */
html body.pf-work .pf-card.pf-screen .pf-card-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mat);
}

html body.pf-work .pf-card.pf-screen .pf-card-photo img {
    width: 84%;
    height: auto;
    object-fit: contain;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 6px 22px rgba(0, 0, 0, 0.09);
}

/* A hairline, so a pale photo still has an edge on a white page */
html body.pf-work .pf-card:not(.pf-screen) .pf-card-photo,
html body.pf-work .pf-lead.pf-photo img,
html body.pf-work .pf-gallery img,
html body.pf-work .pf-story img {
    outline: 1px solid rgba(0, 0, 0, 0.07);
    outline-offset: -1px;
}

/* ==================== */
/* Project page         */
/* ==================== */

/* No sidebar: the project takes the whole width */
html body.pf-work .pf-layout {
    display: block;
}

html body.pf-work.pf main.pf-work-main {
    container: pfmain / inline-size;
    min-width: 0;
    padding: clamp(1rem, 2.4vw, 2.25rem) var(--pad) 4rem;
}

html body.pf-work .pf-work-main article {
    --lead-max: calc(100dvh - var(--pf-header-h, 5.5rem) - 4rem);
    --one-h: min(calc(100dvh - var(--pf-header-h, 5.5rem) - 5rem), 50rem);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* The lead photo is as large as it can be with its title still in the window */
html body.pf-work .pf-lead {
    width: min(100%, calc(var(--lead-max) * var(--ar)));
}

html body.pf-work .pf-lead img,
html body.pf-work .pf-lead video {
    display: block;
    width: 100%;
    height: auto;
}

/* A web piece's lead is a screenshot: on the mat, like the index */
html body.pf-work.pf-work[data-kind="web"] .pf-lead {
    padding: clamp(1rem, 5%, 2.75rem);
    background: var(--mat);
}

html body.pf-work.pf-work[data-kind="web"] .pf-lead img {
    outline: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 8px 28px rgba(0, 0, 0, 0.1);
}

/* At every width, one centred column straight down: photo, title, description,
   materials, practice, then the rest of the label, centred beneath. The label
   block is opened up so its parts can take their places in that run. */
html body.pf-work .pf-text {
    display: flex;
    flex-direction: column;
    width: min(100%, 37rem);
    padding-top: clamp(1.75rem, 3vw, 2.5rem);
}

html body.pf-work .pf-label {
    display: contents;
}

html body.pf-work .pf-head {
    order: 1;
}

html body.pf-work .pf-about {
    order: 2;
}

html body.pf-work .pf-materials {
    order: 3;
}

html body.pf-work .pf-practice {
    order: 4;
}

html body.pf-work .pf-facts {
    order: 5;
}

html body.pf-work .pf-links {
    order: 6;
}

html body.pf-work .pf-posts {
    order: 7;
}

html body.pf-work .pf-head {
    text-align: center;
}

html body.pf-work .pf-head h1 {
    margin: 0;
    font-size: var(--fs-h1);
    line-height: 1.08;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

html body.pf-work .pf-subtitle {
    max-width: 40rem;
    margin: 0.5rem auto 0;
    font-size: var(--fs-h4);
    line-height: 1.3;
    color: var(--soft);
    text-wrap: pretty;
}

html body.pf-work .pf-meta {
    margin: 0.5rem 0 0;
    font-size: var(--fs-small);
    color: var(--muted);
}

html body.pf-work .pf-context::before {
    content: "·";
    margin: 0 0.5em 0 0.25em;
    color: var(--faint);
}

html body.pf-work .pf-about {
    margin-top: 1.5rem;
}

html body.pf-work .pf-about p:last-child,
html body.pf-work .pf-practice p:last-child {
    margin-bottom: 0;
}

html body.pf-work .pf-practice {
    margin-top: 1.5rem;
}

/* The wall label: materials set small between two rules */
html body.pf-work .pf-materials {
    margin: 1.5rem 0 0 !important;
    padding: 0.8rem 0 !important;
    border-block: 1px solid var(--line);
    font-size: var(--fs-small);
    line-height: 1.5;
    color: var(--soft);
}

html body.pf-work .pf-materials li {
    display: inline;
}

html body.pf-work .pf-materials,
html body.pf-work .pf-links,
html body.pf-work .pf-posts {
    text-align: center;
}

html body.pf-work .pf-materials li:not(:last-child)::after {
    content: ", ";
}

/* Centred as a pair of columns: the names right-aligned against their values */
html body.pf-work .pf-facts {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: center;
    gap: 0.35rem 0.75rem;
    margin-top: 1.5rem !important;
    font-size: var(--fs-small);
    line-height: 1.5;
    color: var(--muted);
}

html body.pf-work .pf-facts div {
    display: contents;
}

html body.pf-work .pf-facts dt {
    margin: 0;
    text-align: right;
    font-weight: 500;
    color: var(--faint);
}

html body.pf-work .pf-facts dd {
    color: var(--soft);
}

html body.pf-work .pf-links {
    margin-top: 1.5rem !important;
    font-size: var(--fs-small);
}

html body.pf-work .pf-links li + li {
    margin-top: 0.25rem;
}

html body.pf-work .pf-links a::after {
    content: " \2192";
}

html body.pf-work .pf-posts {
    margin-top: 1.5rem;
    font-size: var(--fs-small);
}

html body.pf-work .pf-posts h2 {
    margin: 0 0 0.35rem;
    font-size: var(--fs-label);
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--faint);
}

html body.pf-work .pf-posts li + li {
    margin-top: 0.25rem;
}

/* More photos: one after another, centred, each as large as the window allows */
html body.pf-work .pf-gallery {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(2.5rem, 5vw, 4rem);
    width: 100%;
    margin-top: clamp(3.5rem, 7vw, 6rem);
}

html body.pf-work .pf-gallery > figure {
    width: min(100%, calc(var(--one-h) * var(--ar)));
    margin: 0 !important;
}

html body.pf-work.pf .pf-gallery figcaption {
    text-align: center;
}

html body.pf-work .pf-gallery img,
html body.pf-work .pf-gallery video,
html body.pf-work .pf-story img,
html body.pf-work .pf-story video {
    display: block;
    width: 100%;
    height: auto;
    background: var(--wash);
}

html body.pf-work.pf figcaption {
    padding-top: 0.4rem;
    font-size: var(--fs-small);
    line-height: 1.45;
    color: var(--muted);
}

/* The longer account: his text in the reading column, pictures two up */
html body.pf-work .pf-story {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    width: min(100%, 52rem);
    margin-top: clamp(2.5rem, 5vw, 4rem);
    padding-top: 2rem;
    border-top: 1px solid var(--line);
}

html body.pf-work .pf-story > :is(p, h3) {
    grid-column: 1 / -1;
    max-width: 37rem;
    margin: 0;
}

html body.pf-work .pf-story > h3 {
    margin-top: 1.25rem;
    font-size: var(--fs-h4);
}

html body.pf-work .pf-story-toggle {
    font-size: var(--fs-small);
    color: var(--color-link);
}

html body.pf-work .pf-story-toggle:hover {
    text-decoration: underline;
}

html body.pf-work .pf-story-toggle::before {
    content: "+ ";
}

html body.pf-work .pf-story-toggle[aria-expanded="true"]::before {
    content: "\2212  ";
}

html body.pf-work .pf-story-toggle + h3 {
    margin-top: 0.5rem;
}

html body.pf-work .pf-story > p + p {
    margin-top: 0.25rem;
}

html body.pf-work .pf-story > figure:not(figure + figure):not(:has(+ figure)) {
    grid-column: 1 / -1;
    max-width: 44rem;
}

/* A tall picture on its own stays a sensible height */
html body.pf-work .pf-story > figure.pf-tall:not(figure + figure):not(:has(+ figure)) {
    max-width: 24rem;
}

html body.pf-work .pf-story > figure {
    align-self: start;
}

/* Previous / all / next */
html body.pf-work .pf-pager {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    gap: 1.5rem;
    margin-top: clamp(4rem, 8vw, 6rem);
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    font-size: var(--fs-small);
}

html body.pf-work .pf-pager a {
    text-decoration: none;
}

html body.pf-work .pf-pager-link {
    display: grid;
    gap: 0.15rem;
    color: var(--ink);
}

html body.pf-work .pf-pager-label {
    font-size: var(--fs-label);
    color: var(--faint);
}

html body.pf-work .pf-pager-title {
    font-weight: 600;
}

html body.pf-work a.pf-pager-link:hover .pf-pager-title {
    color: var(--color-link);
}

html body.pf-work .pf-next {
    grid-column: 3;
    text-align: right;
}

html body.pf-work .pf-pager-all {
    grid-column: 2;
    padding-top: 0.95rem;
}

/* ==================== */
/* Sidebar              */
/* ==================== */

/* A screenshot is shown whole, on the mat */

/* Where you are: the blog sidebar's own marker */

/* Narrow screens: the page reads straight down and the other work follows as
   a strip you swipe sideways */
@media (max-width: 900px) {
    html body.pf-work .pf-layout {
        display: block;
    }

    html body.pf-work.pf main.pf-work-main {
        padding-bottom: 2.5rem;
    }

    html body.pf-work .pf-work-main article {
        --lead-max: 78dvh;
    }
}

@media (max-width: 560px) {
    html body.pf-work .pf-story {
        grid-template-columns: minmax(0, 1fr);
    }

    html body.pf-work .pf-pager {
        grid-template-columns: 1fr 1fr;
    }

    html body.pf-work .pf-pager-all {
        grid-column: 1 / -1;
        grid-row: 2;
        padding-top: 0;
    }

    html body.pf-work .pf-next {
        grid-column: 2;
    }
}

/* ==================== */
/* A8 · Procession      */
/* ==================== */

html body.pf-work.pf main.pf-main {
    container: pfindex / inline-size;
}

html body.pf-work .pf-section-title {
    text-align: left;
}

html body.pf-work .pf-grid {
    --one-h: min(calc(100dvh - var(--pf-header-h, 5.5rem) - 20rem), 34rem);
    gap: clamp(3rem, 6vw, 5rem);
}

@container pfindex (min-width: 46rem) {
    html body.pf-work .pf-grid:has(> .pf-card:nth-child(5)) > .pf-card:first-child {
        --lead-h: min(calc(100dvh - var(--pf-header-h, 5.5rem) - 13rem), 46rem);
        align-self: stretch;
        width: auto;
        margin-bottom: clamp(0.5rem, 2vw, 1.5rem);
    }

    html body.pf-work .pf-grid:has(> .pf-card:nth-child(5)) > .pf-card:first-child a {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        column-gap: clamp(1.5rem, 3.5cqi, 3rem);
        align-items: end;
    }

    html body.pf-work .pf-grid:has(> .pf-card:nth-child(5)) > .pf-card:first-child .pf-card-photo {
        width: min(calc(100cqi - 17rem), calc(var(--lead-h) * var(--ar)));
    }

    html body.pf-work .pf-grid:has(> .pf-card:nth-child(5)) > .pf-card:first-child .pf-card-text {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
        padding: 0;
        text-align: left;
    }

    html body.pf-work .pf-grid:has(> .pf-card:nth-child(5)) > .pf-card:first-child .pf-card-title {
        max-width: 13em;
        font-size: var(--fs-h1);
        line-height: 1.08;
        letter-spacing: -0.02em;
        text-wrap: balance;
    }
}
