@font-face {
    font-family: "Geist Serif";
    src: url("/assets/fonts/GeistSerifVF.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --ink: #000;
    --muted: #8a8a8a;
    --page-pad: 32px;
    --bar: 88px; /* header and footer band */
    /* Display type scales with the clip size scroll.js sets as --clip-h (684px on a
       1512 x 860 window, 920px at most): titles 106px there, ~142px at the cap. */
    --title-size: max(40px, var(--clip-h, 684px) * 0.155);
    --side: var(--page-pad); /* stage inset left and right */
    --icon-gap-ratio: 0.18; /* gap between alt icons, as a share of icon size */

    /* SIP's phone frame: 14.5% of frame width (sip-web PHONE_RADIUS_RATIO). */
    --phone-radius-ratio: 0.145;
}

* {
    box-sizing: border-box;
}

html {
    scroll-snap-type: y mandatory;
    scrollbar-width: none; /* the counter shows position; no scrollbar flashing at the edge */
    overscroll-behavior-y: none;
}

body {
    margin: 0;
    background: #fff;
    color: var(--ink);
    font: 16px/1.4 "Geist Serif", Georgia, serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: #999;
}

/* ---------- Header and footer ---------- */

header,
footer {
    position: fixed;
    left: var(--page-pad);
    right: var(--page-pad);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--bar);
    pointer-events: none;
    color: var(--muted);
}

header {
    top: 0;
}

/* Back to top on the left and the i key on the right, centered on the spot the i key
   held when centered in the bar. */
footer {
    bottom: calc((var(--bar) - 20px) / 2);
    height: 20px;
}

/* Desktop: the section in view names itself in the top left, and raffi.zip moves to
   the bottom right (with the localhost keys to its left). Phones keep raffi.zip up top. */
header .back {
    display: none;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Nothing to go back to on the cover. */
.to-top {
    transition: color 200ms, opacity 200ms;
}

.to-top[aria-hidden="true"] {
    opacity: 0;
    pointer-events: none;
}

footer .info-toggle {
    padding: 0;
}

header > *,
footer > * {
    pointer-events: auto;
}

.back,
.where,
.to-top,
.info-toggle,
.count {
    margin: 0;
    padding: 6px 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: color 200ms;
}

.back:hover,
.where:hover,
.to-top:hover,
.info-toggle:hover,
.count:hover,
.count:has(+ :popover-open) {
    color: var(--ink);
}

.count {
    font-variant-numeric: tabular-nums;
}

.back:focus:not(:focus-visible),
.where:focus:not(:focus-visible),
.to-top:focus:not(:focus-visible),
.info-toggle:focus:not(:focus-visible),
.count:focus:not(:focus-visible) {
    outline: none;
}

.info-toggle:not([hidden]) {
    display: inline-flex;
    align-items: center;
}

/* The arrow keys sit midway down the right edge, across from the rail. */
.arrows {
    position: fixed;
    z-index: 2;
    top: 50%;
    right: var(--page-pad);
    translate: 0 -50%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--muted);
}

.arrow {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    line-height: 0;
    cursor: pointer;
    transition: color 200ms;
}

.arrow:hover {
    color: var(--ink);
}

.arrow:focus:not(:focus-visible) {
    outline: none;
}

kbd {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px; /* square */
    padding: 0;
    /* A solid hairline reads darker than thin serif strokes of the same gray, so the
       frame is drawn lighter to match the text it sits beside. */
    border: 1px solid color-mix(in srgb, currentColor 65%, transparent);
    border-radius: 6px;
    corner-shape: superellipse(1.25);
    font: inherit;
    font-size: 13px;
    line-height: 1;
}

.sections {
    /* Drops down from the counter; scroll.js sets --popover-right from its position. */
    inset: calc(var(--bar) - 18px) var(--popover-right, calc(var(--page-pad) - 5px)) auto auto;
    margin: 0;
    padding: 0;
    overflow: visible; /* popovers default to overflow: auto, and iOS drops a scroller's shadow */
    width: 280px;
    font-size: 15px; /* 1px under the page text */
    -webkit-user-select: none; /* a control, not text: no selection on click or double-click */
    user-select: none;
    border: 0;
    border-radius: 14px;
    corner-shape: superellipse(1.25);
    background: #fff;
    box-shadow: 0 0 0 1px rgb(0 0 0 / 6%), 0 8px 24px rgb(0 0 0 / 8%);
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 160ms, transform 160ms, overlay 160ms allow-discrete, display 160ms allow-discrete;
}

/* The panel draws the border and shadow and clips nothing; the list inside rounds its
   own corners so row fills meet them. (iOS drops the shadow of a panel that clips or
   scrolls its content.) The list scrolls past four fifths of the viewport. */
.sections-list {
    max-height: 80svh;
    overflow: clip auto;
    overscroll-behavior: contain;
    border-radius: inherit;
    corner-shape: superellipse(1.25);
}

.sections:popover-open {
    opacity: 1;
    transform: none;
}

@starting-style {
    .sections:popover-open {
        opacity: 0;
        transform: translateY(-4px);
    }
}

/* Block rows keep the list vertical in every state, including its fade-out. */
.group-row {
    display: flex;
    align-items: center;
}

/* Only the name navigates; the rest of the row (and the chevron) toggles the group. */
.group-row {
    cursor: pointer;
}

/* Cover has no pages: its link fills the row, so the whole row navigates. */
.group--empty .group-row a {
    flex: 1 1 auto;
}

/* Cover stays pinned above the scrolling groups, with Expand all / Collapse all on
   its right. */
.group--empty {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #fff;
    box-shadow: 0 1px 0 rgb(0 0 0 / 6%);
}

/* Its pair of carets, the same as a group's, sit 4px apart: apart to expand,
   together to collapse. */
.toggle-all {
    place-content: center;
    gap: 0;
}

.chevron.toggle-all .caret:first-child,
.chevron.toggle-all.is-all-open .caret:last-child {
    transform: rotate(180deg);
}

.chevron.toggle-all.is-all-open .caret:first-child {
    transform: none;
}

/* The first project row gets 5px more room under the divider, for balance. */
.sections-list > .group--empty + .group .group-row > .name {
    padding-top: 11px;
}

/* Its chevron drops with the name. */
.sections-list > .group--empty + .group .chevron {
    padding-top: 5px;
}

/* Cover's pinned row gets 2px more room above and 4px more below, over the divider. */
.sections-list > .group--empty .group-row > a {
    padding-top: 12px;
    padding-bottom: 10px;
}

.group-row a,
.group-row .name {
    flex: 0 1 auto;
}


.chevron {
    margin-left: auto;
}

.chevron {
    display: grid;
    place-items: center;
    width: 32px;
    align-self: stretch;
    margin-right: 6px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    cursor: pointer;
}

.group-row:hover .chevron {
    color: var(--ink);
}

/* sip-web's hairline select caret (14 x 8, 1px stroke), drawn as a mask so it takes
   the text color. */
.caret {
    display: block;
    width: 14px;
    height: 14px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 8'%3E%3Cpath d='M.5.5 7 7 13.5.5' fill='none' stroke='%23000'/%3E%3C/svg%3E") center / 14px 8px no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 8'%3E%3Cpath d='M.5.5 7 7 13.5.5' fill='none' stroke='%23000'/%3E%3C/svg%3E") center / 14px 8px no-repeat;
    transition: transform 280ms cubic-bezier(0.32, 0.72, 0, 1);
}

.is-open .chevron .caret {
    transform: rotate(180deg);
}

/* Optical centering in the keys: each chevron leans toward the way it points. */
.arrow .caret {
    transform: translateY(1px);
}

/* "^" opens downward and reads low, so it needs less lift than "v" needs drop. */
.arrow .caret--up {
    transform: translateY(-0.5px) rotate(180deg);
}

.chevron .caret {
    width: 10px;
    height: 10px;
    -webkit-mask-size: 10px 6px;
    mask-size: 10px 6px;
}

/* In a key, the caret shrinks to sit inside the 20px cap. */
kbd .caret {
    width: 10px;
    height: 10px;
    -webkit-mask-size: 10px 6px;
    mask-size: 10px 6px;
}

/* Pages unfold by animating the row track from 0 to the content's height. */
.subs {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 280ms cubic-bezier(0.32, 0.72, 0, 1);
}

.subs > div {
    overflow: hidden;
}

.is-open .subs {
    grid-template-rows: 1fr;
}

.sections .subs a {
    display: flex;
    gap: 8px;
}

/* Every row stays on one line. */
.sections a,
.sections .name {
    white-space: nowrap;
}

.subs .num {
    font-variant-numeric: tabular-nums;
}

.sections a,
.sections .name {
    display: block;
    padding: 6px 16px;
    color: var(--muted);
    text-decoration: none;
}

/* The list's first and last rows get 4px more room inside them, against the edges. */
.sections-list > .group:first-child .group-row > :is(a, .name) {
    padding-top: 10px;
}

.sections-list > .group:last-child:not(.is-open) .group-row > :is(a, .name),
.sections-list > .group:last-child .subs a:last-child {
    padding-bottom: 10px;
}

/* One hover fill per row, spanning the full width (the chevron is part of the row).
   Pointer devices only: on touch, hover sticks to whatever was last tapped. */
@media (hover: hover) {
    .group-row:hover,
    .subs a:hover {
        background: rgb(0 0 0 / 4%);
    }

    .group-row:hover a,
    .group-row:hover .name,
    .subs a:hover {
        color: var(--ink);
    }

    /* The toggle's hover is its underline; the Cover row stays as it is. */
    .group-row:has(.toggle-all:hover) {
        background: none;
    }

    .group-row:has(.toggle-all:hover) a {
        color: var(--muted);
    }

    .group--empty .group-row:not(:has(.toggle-all:hover)) .toggle-all {
        color: var(--muted);
    }
}

/* No gray tap flash on phones anywhere on the page. */
* {
    -webkit-tap-highlight-color: transparent;
}

/* ---------- Page rail ---------- */

/* A tick per page down the left edge (scroll.js), after SIP's home screen history
   scrubber: 10.8px apart, shrinking to fit short windows. It shows while the pointer is
   in the left fifth of the window, and its hit area runs from the window's edge to
   20px past the longest label. */
.rail {
    position: fixed;
    z-index: 2;
    left: 0;
    top: 50%;
    translate: 0 -50%;
    display: grid;
    grid-template-rows: repeat(var(--rail-count), minmax(0, 1fr));
    width: var(--rail-w, calc(var(--page-pad) + 44px));
    height: min(calc(var(--rail-count) * 10.8px), calc(100% - 2 * var(--bar) - 48px));
    pointer-events: none;
}

.rail--shown {
    pointer-events: auto;
}

.rail-item {
    position: relative;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    cursor: pointer;
}

/* Hidden, ticks shrink into the left keyline and fade; shown, they grow back out. */
.rail-tick {
    position: absolute;
    top: 50%;
    left: var(--page-pad);
    width: var(--tick-w, 6.4px);
    height: 1px;
    background: rgb(0 0 0 / 18%);
    translate: 0 -50%;
    transform-origin: 0 50%;
    scale: 0 1;
    opacity: 0;
    transition: width 120ms ease, background-color 120ms ease, scale 240ms cubic-bezier(0.32, 0.72, 0, 1), opacity 240ms ease;
}

.rail--shown .rail-tick {
    scale: 1 1;
    opacity: 1;
}

/* scroll.js darkens ticks toward the hovered tick, or the current page at rest. */
.rail-item .rail-tick {
    background: rgb(0 0 0 / calc(var(--tick-a, 0.18) * 100%));
}

.rail-label {
    position: absolute;
    top: 50%;
    left: calc(var(--page-pad) + 31px); /* 10px past the longest tick */
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 16px;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
    translate: 0 -50%;
    opacity: 0;
}

.rail-label img {
    width: 22px;
    height: 22px;
    border-radius: 30%;
    corner-shape: superellipse(1.25);
    box-shadow: 0 0 0 0.5px rgb(0 0 0 / 8%);
}

.rail--shown .rail-item.is-hovered .rail-label {
    opacity: 1;
}

.rail-item:focus-visible {
    outline: none;
}

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

/* ---------- Edit mode (localhost only) ---------- */

.footer-keys {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-toggle:disabled {
    cursor: default;
    color: var(--muted);
}

.edit-toggle[aria-pressed="true"],
.edit-toggle[aria-pressed="true"]:hover {
    color: var(--ink);
}

.save-button {
    margin: 0 4px 0 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    font: inherit;
    font-size: 15px;
    line-height: 20px;
    cursor: pointer;
}

.save-button:disabled {
    color: var(--muted);
    cursor: default;
}

/* ---------- Icon captions ---------- */

/* Credits sit a caption gap below the icons and come and go with info mode. */
.icon-stack {
    position: relative;
    --caption-top: calc(100% + 56px);
    --caption-w: min(40em, 100vw - 2 * var(--side));
}

/* Same scale as clip captions (scroll.js CAPTION_SCALE), against the page's clip height. */
.icon-stack .icon-caption {
    font-size: max(14px, var(--clip-h, 684px) * 0.0222);
}

/* An empty caption only shows in edit mode, as a prompt. */
.icon-caption:empty {
    display: none;
}

.editing .icon-caption:empty {
    display: block;
    min-height: 1.5em;
}

.editing .icon-caption:empty::before {
    content: "Credit the icon designers";
    color: var(--muted);
}

/* ---------- Project intro ---------- */

.page--intro {
    display: grid;
    place-items: center;
}

.intro {
    width: min(34em, 100% - 2 * var(--side));
    font-size: max(20px, var(--clip-h, 684px) * 0.0468);
    line-height: 1.4;
    text-align: center;
    text-wrap: pretty;
}

/* Editable captions show the notes' markdown; the hairline marks what you can type in. */
.editing .caption,
.editing .intro {
    white-space: pre-wrap;
    cursor: text;
    outline: 1px dashed transparent;
    outline-offset: 10px;
    border-radius: 6px;
    corner-shape: superellipse(1.25);
    transition-property: opacity, transform, filter, outline-color;
}

.editing .caption:hover,
.editing .intro:hover {
    outline-color: color-mix(in srgb, var(--muted) 50%, transparent);
}

.editing .caption:focus,
.editing .intro:focus {
    outline: 1px solid color-mix(in srgb, var(--ink) 35%, transparent);
}

/* ---------- Pages ---------- */

.page,
.detail {
    position: relative;
}

.page {
    height: 100vh;
    height: 100svh;
}

.snap {
    position: absolute;
    top: 0;
    height: 1px;
    width: 1px;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

/* ---------- Title page ---------- */

.page--title {
    display: grid;
    place-items: center;
    text-align: center;
}

.page--title h2 {
    margin: 0;
    font-size: var(--title-size);
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

/* ---------- Cover ---------- */

/* The title pages' type, sized down so all the projects plus Start fit the screen. */
.page--cover {
    display: grid;
    place-items: center;
}

.cover {
    text-align: center;
    font-size: min(var(--title-size), 8.5vh); /* all projects plus Start still fit */
    line-height: 1.21;
    letter-spacing: -0.02em;
}

.cover ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.cover a {
    color: var(--muted);
    text-decoration: none;
    transition: color 120ms ease;
}

.cover a:hover,
.cover a:focus-visible {
    color: var(--ink);
}

.cover .start {
    display: inline-block;
    margin-top: 0.66em;
}

.page--end .start {
    margin-top: 0;
}

/* A single line of display type is box-centered, but its descenders and lowercase
   mass make it read low (ink measured ~0.065em below center). Lift it to center the ink. */
.page--title h2,
.page--end .start {
    translate: 0 -0.065em;
}

/* ---------- App icons ---------- */

/* scroll.js picks --cols and --icon so one row fills 1/3 of the viewport height
   and two or more rows fill up to 1/2. */
.page--icons {
    display: grid;
    place-items: center;
}

/* Wrapping rows exactly --cols icons wide, so a short last row stays centered. */
.icons {
    --gap: calc(var(--icon, 33.333vh) * var(--icon-gap-ratio));
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--gap);
    width: calc(var(--cols, 1) * var(--icon, 33.333vh) + (var(--cols, 1) - 1) * var(--gap));
}

.icon {
    display: block;
    width: var(--icon, 33.333vh);
    height: var(--icon, 33.333vh);
    border-radius: 30%; /* sip-web APP_ICON_RADIUS_RATIO */
    corner-shape: superellipse(1.25);
    /* sip-web's rim for icons on flat white surfaces, so white icons keep an edge */
    border: 1px solid rgb(0 0 0 / 8%);
}

/* Like a clip, an icon toggles its name on desktop. */
@media (min-width: 768px) {
    .page--icons .icon {
        cursor: pointer;
    }
}

/* ---------- Clip sections ---------- */

/* One page per clip. Info mode eases --e from 0 to 1, shrinking the clip up as its
   caption arrives. scroll.js resolves both endpoint layouts. */
@property --e {
    syntax: "<number>";
    inherits: true;
    initial-value: 0;
}

.detail {
    --e: 0;
    height: 100vh;
    height: 100svh;
    transition: --e 560ms cubic-bezier(0.32, 0.72, 0, 1);
}

.info .detail {
    --e: 1;
}

.info .caption {
    opacity: 1;
    transform: none;
    filter: none;
    transition-duration: 680ms;
    transition-timing-function: cubic-bezier(0.32, 0.72, 0, 1);
    transition-delay: 60ms;
}

/* The scrubber sits between a shrunk clip and its caption, the same size for every
   clip: a 220 x 3px bar at rest. The moment the pointer enters the area it can grow
   into (280 x 24px), it fills that area. It arrives and leaves on the caption's clock. */
.scrub {
    position: absolute;
    left: 50%;
    top: var(--scrub-top);
    --scrub-w: 280px;
    width: var(--scrub-w);
    height: 24px;
    margin-left: calc(var(--scrub-w) / -2);
    cursor: pointer;
    touch-action: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 80ms ease;
}

.info .scrub {
    opacity: 1;
    pointer-events: auto;
    transition-duration: 680ms;
    transition-timing-function: cubic-bezier(0.32, 0.72, 0, 1);
    transition-delay: 60ms;
}

.scrub-track {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 220px;
    height: 3px;
    translate: -50% -50%;
    overflow: hidden;
    border-radius: 1.5px; /* a pill at 3px tall */
    corner-shape: superellipse(1.25);
    background: rgb(0 0 0 / 8%);
    transition-property: width, height, border-radius;
    transition-duration: 220ms;
    transition-timing-function: cubic-bezier(0.32, 0.72, 0, 1);
}

.scrub:hover .scrub-track,
.scrub.is-scrubbing .scrub-track {
    width: 100%;
    height: 24px;
    border-radius: 8px;
}

.scrub-fill {
    height: 100%;
    background: rgb(0 0 0 / 38%);
    transform-origin: 0 50%;
    scale: 0 1;
}

/* Clicking a clip opens its detail view, and again closes it. */
.detail .clip {
    cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
    .scrub {
        transition-duration: 0ms !important;
        transition-delay: 0ms !important;
    }

    .detail,
    .caption {
        transition-duration: 0ms !important;
        transition-delay: 0ms !important;
    }
}

.sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
}

/* Groups a clip with its caption; on mobile two can share a page. Layout vars live here. */
.slot {
    display: contents;
}

.clip {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--w);
    height: var(--h);
    overflow: hidden;
    background: #fff;
    corner-shape: superellipse(1.25); /* continuous corners, as on sip-web */
    transform-origin: 50% 50%;
    transform: translateY(calc(var(--dy) * var(--e, 0))) scale(calc(1 - (1 - var(--s)) * var(--e, 0)));
    will-change: transform;
}

.clip video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Phone clips arrive inside Connection's glass frame; this trims its white corners. */
.clip--phone {
    border-radius: calc(var(--w) * var(--phone-radius-ratio));
}

/* Web clips are not clipped: the chrome's own corner sits on white, and a CSS radius would cut into it. */
.clip--web {
    overflow: visible;
}

.caption {
    font-size: var(--caption-size, 16px);
    position: absolute;
    left: 50%;
    top: var(--caption-top);
    width: var(--caption-w);
    margin-left: calc(var(--caption-w) / -2);
    text-align: center;
    /* Appears in place: fades, scales up from 0.99 around its own center, and sharpens.
       On its own clock: it enters 60ms after the clip starts shrinking and runs 120ms
       longer (680ms); it exits immediately in 80ms. */
    opacity: 0;
    transform: scale(0.99);
    filter: blur(2px);
    transition-property: opacity, transform, filter;
    transition-duration: 80ms;
    transition-timing-function: ease;
    text-wrap: pretty; /* fill the width; balance would pull lines in */
}

/* Gaps in an icon grid keep their size but draw nothing. */
.icons .icon--empty {
    border-color: transparent;
}

/* ---------- Text ---------- */

.words > :first-child {
    margin-top: 0;
}

.words > :last-child {
    margin-bottom: 0;
}

.words p,
.words ul {
    margin: 0 0 1em;
}

.words ul {
    padding-left: 1.2em;
}

.words code {
    font-size: 0.9em;
}

/* ---------- Phone ---------- */

/* The phone dock (mobile only, below). */
.dock {
    display: none;
}

@media (max-width: 767px) {
    :root {
        --page-pad: 40px; /* the universal side inset on phones: header, text, clips, icons */
        --bar: 64px;
        /* Three vertical rhythms: an item to its subtitle, between content groups,
           and the larger break around each project's title + intro. */
        --gap-item: 26px;
        --gap-group: 64px;
        --gap-title: 96px;
        --text-inset: calc(var(--side) - 4px); /* paragraphs run 4px past the clips' inset on each side */
        --text-size: 16px; /* every paragraph and subtitle on phones */
    }

    .intro {
        font-size: var(--text-size);
    }

    /* One continuous column: no pages, no snapping, no controls; captions always shown. */
    html {
        scroll-snap-type: none;
        overscroll-behavior-y: auto; /* phones bounce at the top and bottom; desktop paging stays bounce-free */
    }

    footer,
    .arrows,
    .where {
        display: none;
    }

    header .back {
        display: block;
    }

    .rail {
        display: none;
    }

    .scrub {
        display: none;
    }

    /* The sections list sits 4px lower and 4px further right on phones, and its list scrolls
       past half the screen. */
    .sections {
        inset: calc(var(--bar) - 14px) calc(var(--popover-right, calc(var(--page-pad) - 5px)) - 4px) auto auto;
    }

    /* The list scrolls inside the panel: iOS drops a scroll container's own box-shadow,
       so the panel keeps the border and shadow and only its inner list scrolls. */
    .sections-list {
        max-height: 50svh;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .page--title,
    .page--intro,
    .page--icons,
    .detail {
        height: auto;
    }

    /* Each block owns the space below it. The title's top pad tops up the
       previous group's gap to the title gap. */
    .page--title {
        padding: calc(var(--gap-title) - var(--gap-group)) var(--side) var(--gap-item);
    }

    .page--title h2 {
        translate: none;
    }

    .page--intro {
        padding: 0 0 var(--gap-title);
    }

    .intro {
        width: calc(100% - 2 * var(--text-inset));
    }

    .page--icons,
    .detail {
        padding: 0 0 var(--gap-group);
    }

    .detail .sticky {
        position: static;
        height: auto;
        overflow: visible;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* Each clip shows its poster as a plain image (page content, not a layer); only
       clips near the screen get a live video above it (scroll.js). iOS composites every
       video element, and dozens of them made it drop layers mid-scroll: clips blinked out
       and the fixed header slid with the page. */
    .clip-poster {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .detail .clip video {
        position: relative;
    }

    .detail .clip video[hidden] {
        display: none;
    }

    /* The header keeps its own layer so it never rides along with the page. It has no
       background or blur, so Safari still leaves the status bar clear. */
    header {
        will-change: transform;
    }

    .detail .clip {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        will-change: auto;
    }

    .icon-stack {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    /* Every icon credit sits under its icons, alternates included. */
    .icon-stack .icon-caption {
        order: 1;
    }

    /* Captions run 6px wider than the paragraphs on each side. */
    .detail .caption,
    .icon-stack .icon-caption {
        position: static;
        width: auto;
        margin: var(--gap-item) 0 0;
        padding: 0 calc(var(--text-inset) - 6px);
        opacity: 1;
        transform: none;
        filter: none;
        transition: none;
        font-size: var(--text-size);
    }

    /* An iOS-style dock: the six app icons, one tap to each project. Icons keep
       the page's 30% radius; the platter's radius is concentric around them. */
    .dock {
        --dock-pad: 10px;
        --dock-gap: 12px;
        --dock-icon: min(48px, (100vw - 32px - 2 * var(--dock-pad) - 5 * var(--dock-gap)) / 6);
        position: fixed;
        z-index: 20;
        left: 50%;
        bottom: max(12px, env(safe-area-inset-bottom));
        translate: -50% 0;
        display: flex;
        gap: var(--dock-gap);
        padding: var(--dock-pad);
        /* Scrolling down tucks the dock to 85%; scrolling up restores it. A transition
           retargets from wherever it is, so quick reversals stay smooth. */
        transform-origin: 50% 100%;
        transition: scale 420ms cubic-bezier(0.32, 0.72, 0, 1);
    }

    .dock--compact {
        scale: 0.85;
    }

    /* The glass lives on a layer inside the dock so the fixed element stays bare;
       Safari 26 tints its toolbar from fixed elements near the bottom edge that
       carry their own background or backdrop-filter. */
    .dock::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        border-radius: calc(var(--dock-icon) * 0.3 + var(--dock-pad));
        corner-shape: superellipse(1.25);
        background: rgb(255 255 255 / 0.62);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        backdrop-filter: blur(20px) saturate(180%);
        /* A short shadow: a longer one reaches Safari's toolbar zone and gets cut
           off there as a hard line across the screen. */
        box-shadow: 0 0 0 0.5px rgb(0 0 0 / 0.08), 0 4px 16px rgb(0 0 0 / 0.1);
    }

    .dock a {
        position: relative;
        display: block;
        -webkit-tap-highlight-color: transparent;
    }

    .dock img {
        display: block;
        width: var(--dock-icon);
        height: var(--dock-icon);
        border-radius: 30%;
        corner-shape: superellipse(1.25);
        border: 1px solid rgb(0 0 0 / 8%); /* the page icons' rim, so light icons keep an edge */
        transition: transform 180ms cubic-bezier(0.32, 0.72, 0, 1);
    }

    .dock a:active img {
        transform: scale(0.88);
    }

    /* The project in view: a small dot in the padding under its icon. */
    .dock a::after {
        content: "";
        position: absolute;
        left: 50%;
        bottom: calc(var(--dock-pad) / -2 - 2px);
        width: 4px;
        height: 4px;
        margin-left: -2px;
        border-radius: 50%;
        background: var(--ink);
        opacity: 0;
        transition: opacity 200ms;
    }

    .dock a[aria-current]::after {
        opacity: 0.4;
    }

    /* Back to top: title-size, right under the last project instead of a page of
       its own, with the title gap above it. */
    .page--end {
        height: auto;
        padding: calc(var(--gap-title) - var(--gap-group)) var(--side) 0;
    }

    .page--end .start {
        translate: none;
    }

    /* Room under the last line. With the dock back, restore the dock's height too:
       calc(48px + 20px + 12px + var(--gap-group) + env(safe-area-inset-bottom)). */
    main {
        padding-bottom: calc(var(--gap-group) + env(safe-area-inset-bottom));
    }
}
