/* ============================================
   owen.city - brand layer
   Typefaces and the handful of layout moves that sit on top of styles.css.
   ============================================ */

/* ---------- Typefaces ----------
   Uncut Sans (Kasper Nordkvist) and Redaction (Jeremy Mickel / Forest Young),
   both SIL Open Font License. Licence texts sit beside the files. */
@font-face {
    font-family: 'Uncut Sans';
    src: url('public/fonts/UncutSans-Variable.woff2') format('woff2');
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Redaction';
    src: url('public/fonts/Redaction-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* The 35 grade is the same serif part-way through being pixelated. Not in
   use: it read as out of step with the rest of the site. */
@font-face {
    font-family: 'Redaction 35';
    src: url('public/fonts/Redaction35-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --font-brand: 'Uncut Sans', 'Helvetica Neue', Arial, sans-serif;
    --font-serif: 'Redaction', 'Times New Roman', serif;
    /* Page titles. Swap in 'Redaction 35' here for the
       pixelated grade; it is still defined above but not downloaded unless used. */
    --font-title: 'Redaction', 'Times New Roman', serif;
    --page-gutter: var(--space-md);
}

@media (min-width: 768px) {
    :root {
        --page-gutter: var(--space-xl);
    }
}

h1, h2, h3, h4, h5, h6 {
    font-stretch: normal;
}

h1, h2 {
    font-family: var(--font-serif);
    font-weight: 400;
    letter-spacing: -0.015em;
}

/* ---------- Home intro ----------
   The name at the full width of the page, then one ruled row that locks the
   description, the practical line and the three ways in onto a shared top
   edge, so none of them trails after the others. */
.front-intro,
.front-intro[class] {
    display: block;
}

.front-name {
    font-family: var(--font-serif);
    font-size: clamp(3.4rem, 15.5vw, 13rem);
    font-weight: 400;
    font-stretch: normal;
    line-height: 0.82;
    letter-spacing: -0.045em;
    white-space: nowrap;
    margin: 0 0 0 -0.045em;
    padding-bottom: 0.11em;
}

/* The intro sentence is the hero text, with two buttons under it: one opens
   the note card (quick-note.js), the other goes to the gallery. Everything is
   sized from --front-size so that, on wide screens, two lines of text and the
   buttons take no more height than three lines of text would. */
.front-lockup {
    --front-size: clamp(1.6rem, 3.3vw, 3.1rem);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: calc(var(--front-size) * 0.3);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-ink);
}

.front-text {
    font-family: var(--font-serif);
    font-size: var(--front-size);
    line-height: 1.2;
    letter-spacing: -0.025em;
    color: var(--color-ink);
    max-width: 42ch;
    margin: 0;
    text-wrap: balance;
}

.front-sub {
    margin: 0;
    font-family: var(--font-brand);
    font-size: clamp(0.95rem, 1.15vw, 1.15rem);
    line-height: 1.4;
    color: var(--color-ink);
}

/* The extra space above makes the gap under the small line look the same as
   the gap over it, which is measured from the big sentence's baseline. */
.front-actions {
    margin-top: calc(var(--front-size) * 0.25);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    font-family: var(--font-serif);
    font-size: max(0.85rem, calc(var(--front-size) * 0.36));
    letter-spacing: -0.02em;
}

/* The same box as the Contact pill in the nav (styles.css, .nav-cta). */
.front-actions .front-pill {
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    min-height: 2.5rem;
    padding: 0 1.25rem;
    border-width: 1.5px;
}

/* Filled where the plain pill is outlined, and the other way round on hover. */
.front-pill.front-pill-solid {
    background-color: var(--color-ink);
    color: var(--color-paper);
}

.front-pill.front-pill-solid:hover {
    background-color: transparent;
    color: var(--color-ink);
}

/* Words in my handwriting, traced from a scan (public/images/site/hand-*.svg)
   and drawn as a mask so they take the colour of the text around them. The
   word itself is still there for screen readers, in an .sr-only span beside
   it. The numbers are each tracing's size in its own units: width, height,
   and how far it hangs below the line it was written on. Every word is given
   the same room above and below the line, so a long tail (the y of "gallery")
   hangs out of its box instead of pushing things apart. */
.hand {
    --hand-unit: calc(1em / 130);
    --hand-rise: 140;
    --hand-fall: 20;
    display: inline-block;
    width: calc(var(--hand-w) * var(--hand-unit));
    height: calc(var(--hand-h) * var(--hand-unit));
    margin-top: calc((var(--hand-rise) - var(--hand-h) + var(--hand-drop)) * var(--hand-unit));
    margin-bottom: calc((var(--hand-fall) - var(--hand-drop)) * var(--hand-unit));
    vertical-align: calc(var(--hand-fall) * var(--hand-unit) * -1);
    background-color: currentColor;
    -webkit-mask: var(--hand-src) center / 100% 100% no-repeat;
    mask: var(--hand-src) center / 100% 100% no-repeat;
    transform: translateY(calc(var(--hand-nudge, 0) * var(--hand-unit)));
}

/* Inside a pill, "contact" sits a little low and "gallery" a little high, so
   the first looks centred and the tail of the y stays clear of the edge. */
.nav-cta .hand-contact {
    --hand-nudge: 14;
}

.front-pill .hand-contact {
    --hand-nudge: -4;
}

.front-pill .hand-gallery {
    --hand-nudge: -27;
}

/* The nav's own type is small; handwriting needs a little more to read. */
.nav-link .hand {
    font-size: 1.15em;
}

.hand-about { --hand-w: 454; --hand-h: 139; --hand-drop: 10; --hand-src: url("public/images/site/hand-about.svg"); }
.hand-contact { --hand-w: 611; --hand-h: 146; --hand-drop: 9; --hand-src: url("public/images/site/hand-contact.svg"); }
.hand-gallery { --hand-w: 576; --hand-h: 201; --hand-drop: 79; --hand-src: url("public/images/site/hand-gallery.svg"); }

/* An outlined pill. */
.front-pill {
    display: inline-block;
    padding: 0.04em 0.42em 0.1em;
    border: 1px solid var(--color-ink);
    border-radius: 999px;
    line-height: 1;
    color: var(--color-ink);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.front-pill:hover {
    background-color: var(--color-ink);
    color: var(--color-paper);
}

.front-pill:focus-visible {
    outline: 2px solid var(--color-ink);
    outline-offset: 3px;
}

/* The reel's bottom padding must not change once its script starts, or the
   centred opening position would move while the loader is still up. */
.front .reel,
.front .reel.is-interactive {
    padding-bottom: var(--space-lg);
}

/* ---------- Home opening ----------
   While .is-intro is set (script.js), the mark and reel sit centred in the
   window and the intro text is held back. Removing the class lets them
   settle to where they belong. Transforms only, so nothing reflows.
   The reel and the mark move separately on purpose: a transform on their
   shared parent would cut the mark's blend off from the paper behind it. */
.front-stage .reel,
.front-mark,
.front .reel-player {
    transition: transform 0.8s cubic-bezier(0.7, 0, 0.15, 1);
}

.front-name,
.front-lockup {
    transition: opacity 0.9s ease, transform 1.1s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Held until the mark's tall strokes have passed down through this space. */
.front-name { transition-delay: 0.45s; }
.front-lockup { transition-delay: 0.65s; }

.front.is-intro .front-stage .reel,
.front.is-intro .reel-player {
    transform: translateY(var(--intro-shift, 0px));
    transition: none;
}

.front.is-intro .front-mark {
    transform: translate(-50%, var(--intro-shift, 0px));
    transition: none;
}

.front.is-intro .front-name,
.front.is-intro .front-lockup {
    opacity: 0;
    transform: translateY(-14px);
    transition: none;
}

@media (prefers-reduced-motion: reduce) {
    .front-stage .reel,
    .front-mark,
    .front .reel-player,
    .front-name,
    .front-lockup {
        transition: none;
    }
}

/* ---------- Page titles ----------
   One word, as wide as the page allows. fit.js sets the exact size; the
   clamp is what shows without it. */
.page-hero {
    display: block;
    height: auto;
    min-height: 0;
    margin-top: var(--header-height);
    padding: var(--space-lg) var(--page-gutter) 0;
    /* Same column as the container below, so the title's ends land on the
       ends of the rule under it rather than out toward the window edges. */
    padding-inline: calc(max(0px, (100% - var(--container-max)) / 2) + var(--page-gutter));
}

.page-hero-title {
    font-family: var(--font-title);
    font-size: clamp(3.25rem, 13vw, 12rem);
    font-weight: 400;
    line-height: 0.86;
    letter-spacing: -0.035em;
    text-align: left;
    text-wrap: balance;
}

.page-hero-title.is-fitted {
    white-space: nowrap;
    /* Optical: pull the first letter's side bearing back to the gutter. */
    margin-left: -0.015em;
}

.project-intro {
    padding: var(--space-xl) 0 var(--space-lg);
}

.project-intro-text {
    max-width: 46ch;
    margin: 0;
    text-align: left;
    line-height: 1.5;
}

/* ---------- Header ----------
   On wide screens, at the top of the page, the header uses the same
   inverting blend as the mark and has no bar. Once the page scrolls it gets
   the paper bar from styles.css, so text never passes under bare nav. */
@media (min-width: 769px) {
    .site-header:not(.scrolled) {
        background-color: transparent;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        border-bottom-color: transparent;
        mix-blend-mode: difference;
        /* The bar goes at once on the way back up: a paper bar fading out
           under the blend would invert the whole header for a moment. */
        transition: none;
    }

    .site-header:not(.scrolled) .logo-img {
        filter: invert(1);
    }

    .site-header:not(.scrolled) .nav-link,
    .site-header:not(.scrolled) .nav-link:hover {
        color: var(--color-on-dark);
    }

    .site-header:not(.scrolled) .nav-cta {
        color: var(--color-on-dark) !important;
        border-color: var(--color-on-dark);
    }

    .site-header:not(.scrolled) .nav-cta:hover {
        background-color: var(--color-on-dark);
        color: #000 !important;
    }
}

/* ---------- Photo grid ----------
   Hover: the tile lifts a touch and the picture inside eases in slightly.
   Nothing else on the page changes. */
@media (hover: hover) and (pointer: fine) {
    .photo-item {
        transition: transform var(--transition-base);
    }

    .photo-item:hover {
        transform: scale(1.012);
    }

    .photo-item:hover img,
    .photo-item:hover video {
        transform: scale(1.015);
    }
}

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

/* Inner pages wrap their footer in .footer-content, which had no layout of
   its own and stacked in one column. Match the home page footer. */
.footer-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
    align-items: start;
}

@media (min-width: 768px) {
    .footer-content {
        grid-template-columns: minmax(0, 1fr) auto auto;
    }

    /* The email address stays on one line. */
    .footer-contact a {
        white-space: nowrap;
    }
}

@media (min-width: 1024px) {
    .footer-grid,
    .footer-content {
        grid-template-columns: minmax(0, 400px) minmax(0, 1fr) minmax(0, 1fr);
    }
}

/* Fitted titles stop at the gutters (fit.js). The clip is a backstop for a
   rounding pixel, so nothing ever scrolls sideways. */
.page-hero,
.front {
    overflow-x: clip;
}

/* On phones the name sits on two lines, so fit.js sizes it by "Hudson" alone
   and it comes out close to twice as big. */
@media (max-width: 600px) {
    .front-name-line {
        display: block;
    }
}

/* ---------- Filter grid with captions ----------
   Home and Design reuse the photo grid. A captioned tile keeps the justified
   row maths on the tile and the picture's shape on the media box inside it,
   so the caption can sit underneath without squeezing the image. */
.photo-item.has-caption {
    aspect-ratio: auto;
    overflow: visible;
    background: none;
    border-radius: 0;
    color: var(--color-ink);
    font-family: var(--font-body);
    text-align: left;
    text-decoration: none;
}

a.photo-item {
    cursor: pointer;
}

.photo-media {
    display: block;
    aspect-ratio: var(--ar);
    overflow: hidden;
    border-radius: 2px;
    background-color: rgba(0, 0, 0, 0.04);
}

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

.photo-caption {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.6em;
    padding: 0.5rem 0 var(--space-sm);
    font-size: var(--type-xs);
    line-height: 1.35;
}

.photo-caption-name {
    font-weight: 500;
}

.photo-caption-meta {
    color: var(--color-text-muted);
}

.front-grid {
    padding-top: var(--space-xl);
}

/* ---------- Clients row ---------- */
.clients {
    padding: var(--space-2xl) 0 var(--space-3xl);
}

.clients-label {
    margin-bottom: var(--space-xl);
    font-size: var(--type-base);
}

/* A ruled grid, one logo to a cell. Each logo is fitted inside the same box,
   so tall marks and long wordmarks carry about the same weight. */
.client-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--color-line);
    border-left: 1px solid var(--color-line);
}

.client-cell {
    position: relative;
    aspect-ratio: 3 / 2;
    border-right: 1px solid var(--color-line);
    border-bottom: 1px solid var(--color-line);
}

.client-grid .client-logo {
    /* Placed, not flowed, so a tall logo cannot stretch its cell. */
    position: absolute;
    top: 25%;
    left: 18%;
    width: 64%;
    height: 50%;
    object-fit: contain;
    opacity: 0.9;
}

/* A logo already drawn in ink, with white inside it that must stay white. */
.client-grid .client-logo.is-inked {
    filter: none;
}

@media (min-width: 768px) {
    .client-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

/* ---------- Header mark ----------
   The mark sits in the same pill as the Contact link and inverts the same way. */
.site-header .logo {
    padding: 0.4rem 1rem;
    border: 1.5px solid var(--color-ink);
    border-radius: 50px;
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.site-header .logo .logo-img {
    height: 24px;
    transition: filter var(--transition-fast);
}

.site-header .logo:hover,
.site-header .logo:focus-visible {
    background-color: var(--color-ink);
}

.site-header .logo:hover .logo-img,
.site-header .logo:focus-visible .logo-img {
    filter: invert(1);
}

/* Over the hero the header is drawn in white and blended (see above). */
@media (min-width: 769px) {
    .site-header:not(.scrolled) .logo {
        border-color: var(--color-on-dark);
    }

    .site-header:not(.scrolled) .logo:hover,
    .site-header:not(.scrolled) .logo:focus-visible {
        background-color: var(--color-on-dark);
    }

    .site-header:not(.scrolled) .logo:hover .logo-img,
    .site-header:not(.scrolled) .logo:focus-visible .logo-img {
        filter: none;
    }
}

/* ---------- Sign-off ----------
   The closing line on inner pages: one ruled row, title left, sentence right. */
.signoff {
    padding: 0 0 var(--space-2xl);
}

.signoff-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-sm);
}

.signoff-row::before {
    content: "";
    grid-column: 1 / -1;
    border-top: 1px solid var(--color-ink);
    margin-bottom: var(--space-sm);
}

.signoff-title {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    line-height: 1;
    margin: 0;
}

.signoff-text {
    max-width: 44ch;
    margin: 0;
    line-height: 1.5;
    color: var(--color-text-secondary);
}

.signoff-text a {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

@media (min-width: 768px) {
    .signoff-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
        column-gap: var(--space-2xl);
        align-items: baseline;
    }
}

/* ---------- Loader: the mark written on ----------
   Three pen strokes and a period, in the order a hand would make them:
   the loop and long bar in one sweep, the two stems, then the dot.
   Keep the total under LOADER_MIN_MS in script.js. */
.loading-icon.is-written {
    --write-ease: cubic-bezier(0.6, 0, 0.4, 1);
    display: block;
    height: auto;
    overflow: visible;
    fill: var(--color-ink);
    animation: none;
}

.write-stroke {
    fill: none;
    stroke: #fff;
    stroke-linecap: round;
    stroke-linejoin: round;
    /* The gap is longer than the path so no stray end cap shows before a stroke starts. */
    stroke-dasharray: 1 2;
    stroke-dashoffset: 1;
    animation: write-on 0.13s var(--write-ease) forwards;
}

/* Each stroke has its own bell-shaped pace (slow, quick, slow), with a
   short lift of the pen between the two stems and a longer rest before the
   period. */
.write-loop   { animation-duration: 0.42s; animation-delay: 0.12s; }
.write-stem-a { animation-duration: 0.15s; animation-delay: 0.58s; }
.write-stem-b { animation-duration: 0.15s; animation-delay: 0.8s; }

/* Each pool starts as the pen reaches the bar and spreads over a few frames. */
.write-blob {
    fill: #fff;
    transform-box: fill-box;
    transform-origin: center;
    transform: scale(0);
    animation: write-blob 0.1s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

.write-blob-a { animation-delay: 0.64s; }
.write-blob-b { animation-delay: 0.86s; }

.write-dot {
    transform-box: fill-box;
    transform-origin: center;
    transform: scale(0);
    animation: write-dot 0.14s cubic-bezier(0.3, 1.9, 0.5, 1) 1.16s forwards;
}

@keyframes write-on {
    to { stroke-dashoffset: 0; }
}

.write-final {
    opacity: 0;
    animation: write-final 0.01s linear 1.32s forwards;
}

@keyframes write-final {
    to { opacity: 1; }
}

@keyframes write-blob {
    from { transform: scale(0.35); }
    to { transform: scale(1); }
}

@keyframes write-dot {
    to { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .write-stroke { stroke-dashoffset: 0; animation: none; }
    .write-dot,
    .write-blob { transform: none; animation: none; }
    .write-final { opacity: 1; animation: none; }
}

/* ---------- Page subtitle ----------
   One serif line under a ruled edge, the same lockup as the home intro. */
/* Room for the title's descenders, so the rule below never crosses a g or y. */
.page-hero-title {
    padding-bottom: 0.17em;
}

.page-sub {
    margin-top: var(--space-sm);
}

.page-sub-text {
    margin: 0;
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-ink);
    font-family: var(--font-serif);
    font-size: clamp(1.35rem, 2.15vw, 1.95rem);
    line-height: 1.12;
    letter-spacing: -0.015em;
    color: var(--color-ink);
    text-wrap: balance;
}

.page-sub + .photos-section {
    padding-top: var(--space-xl);
}

/* ---------- Review pass ---------- */

/* Body links are ink and underlined; colour alone no longer marks them. */
.about-text a,
.contact-details a,
.contact-cta-alt a,
.case-study-text a {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

.nav-link.active:not(.nav-cta) {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.3em;
}

.site-header a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 4px;
}

/* Case-study pages: subtitle on the gutter under the title, serif section
   headings, plain left-aligned captions. */
.page-hero + .container > .case-study-subtitle {
    margin: var(--space-md) 0 0;
    text-align: left;
}

.case-study-title {
    font-family: var(--font-serif);
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 400;
    line-height: 1;
}

.project-caption {
    padding-left: 0;
    text-align: left;
    font-style: normal;
}

/* A white logo needs a dark ground. */
.project-item-dark {
    margin: var(--space-lg) 0;
    padding: var(--space-2xl) var(--space-xl) var(--space-md);
    border-radius: 4px;
    background-color: #383838;
}

.project-item-dark img {
    display: block;
    max-width: min(760px, 100%);
    margin: 0 auto;
}

.project-item-dark .project-caption {
    color: rgba(255, 255, 255, 0.75);
}

/* A tile never grows taller than most of the window. A photograph is held
   back by its width, so it is never cropped (filter-grid.js then pairs tall
   ones up so they are not left alone in a row); a captioned piece crops. */
.photo-item:not(.has-caption) {
    max-width: min(100%, calc(80vh * var(--ar)));   /* TILE_MAX_VH in filter-grid.js */
}

.photo-media {
    max-height: 80vh;
}

.page-sub-note {
    max-width: 44ch;
    margin: var(--space-md) 0;
    color: var(--color-text-secondary);
}

.page-sub-links {
    flex-direction: row;
    margin-bottom: var(--space-2xl);
}

/* Spacing: the home grid runs straight into the client row. */
.front-grid {
    padding-bottom: var(--space-xl);
}

@media (max-width: 767px) {
    .contact-grid {
        gap: var(--space-xl);
    }
}

/* The centred column gets a little wider on very large screens. */
@media (min-width: 1600px) {
    :root {
        --container-max: 1440px;
    }
}

/* ---------- Contact forms ----------
   The same ruled lines and outlined pill as the note dialog. */
.contact-form .form-group label:not(.sr-only) {
    font-size: var(--type-sm);
    color: var(--color-text-muted);
}

.contact-form .form-group input,
.contact-form .form-group select,
.contact-form .form-group textarea {
    padding: 0.5rem 0 0.55rem;
    border: 0;
    border-bottom: 1px solid var(--color-ink);
    border-radius: 0;
    background-color: transparent;
    color: var(--color-ink);
    font-family: var(--font-serif);
    font-size: 1.25rem;
    line-height: 1.35;
    -webkit-appearance: none;
    appearance: none;
}

.contact-form .form-group select {
    padding-right: 1.5rem;
    background-image: linear-gradient(45deg, transparent 50%, var(--color-ink) 50%), linear-gradient(135deg, var(--color-ink) 50%, transparent 50%);
    background-position: calc(100% - 9px) 55%, calc(100% - 4px) 55%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    cursor: pointer;
}

.contact-form .form-group textarea {
    resize: vertical;
}

.contact-form .form-group input:focus,
.contact-form .form-group select:focus,
.contact-form .form-group textarea:focus {
    outline: none;
    background-color: var(--color-field);
    border-bottom-color: var(--color-ink);
    box-shadow: 0 1px 0 0 var(--color-ink);
}

.contact-form .btn-dark {
    width: auto;
    padding: 0.7rem 1.6rem;
    border: 1.5px solid var(--color-ink);
    border-radius: 999px;
    background-color: transparent;
    color: var(--color-ink);
    justify-self: start;
    align-self: flex-start;
}

.contact-form .btn-dark:hover:not(:disabled) {
    background-color: var(--color-ink);
    color: var(--color-on-dark);
}

/* Arriving from another page of the site: no loader (see the head script). */
.skip-intro .loading-screen {
    display: none;
}

/* Photographs do not take the pointer, so a right-click lands on the tile
   behind them and the browser's menu has no "Save image" or "Open image in
   new tab". Opening the file directly is redirected in vercel.json. */
button.photo-item img,
.reel-photos .reel-item img,
.lightbox img {
    pointer-events: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    user-select: none;
}

/* ---------- Home work grid: a couple of rows until opened (grid-fold.js) ---------- */
.grid-fold {
    overflow: hidden;
}

.front-grid.is-folded .photo-controls {
    display: none;
}

.fold-toggle {
    display: inline-flex;
    align-items: center;
    margin-top: var(--space-lg);
    padding: 0.7em 1.4em;
    border: 1px solid var(--color-ink);
    border-radius: 999px;
    background: transparent;
    color: var(--color-ink);
    font: inherit;
    font-size: var(--type-sm);
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.fold-toggle[hidden] {
    display: none;
}

.fold-toggle:hover {
    background-color: var(--color-ink);
    color: var(--color-paper);
}

.fold-toggle:focus-visible {
    outline: 2px solid var(--color-ink);
    outline-offset: 3px;
}

/* ---------- Living rules (live-rules.js) ---------- */
.live-rule {
    position: absolute;
    z-index: 40;
    overflow: visible;
    pointer-events: none;
    mix-blend-mode: difference;
}

.live-rule path {
    fill: none;
    stroke: #fff;
    stroke-width: 1;
    stroke-linecap: butt;
    stroke-linejoin: miter;
    shape-rendering: crispEdges;
}

/* Blob tracking boxes (blob-track.js): same hairline and blend as the lines. */
.blob-track rect,
.blob-track line {
    fill: none;
    stroke: #fff;
    stroke-width: 1;
    shape-rendering: crispEdges;
}

.blob-track rect {
    transform-box: fill-box;
    transform-origin: center;
}

.blob-track line {
    shape-rendering: geometricPrecision;
    stroke-width: 0.75;
}

.blob-track text {
    fill: #fff;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    letter-spacing: 0.02em;
}

/* ---------- Looks for the living lines and tracker (fx-modes.js) ----------
   html[data-fx] picks one. "invert" is the plain difference blend set above.
   - green:  autofocus green with a soft glow. Green cannot survive the
             difference blend (it would turn magenta on the paper), so this
             one draws normally.
   - glitch: the difference blend again, with the red and blue channels
             knocked sideways like corrupted data, and an occasional tear. */
:root {
    --focus-green: #19e64f;
    --focus-glow: rgba(40, 255, 100, 0.5);
}

[data-fx="green"] .live-rule {
    mix-blend-mode: normal;
    filter: drop-shadow(0 0 2.5px var(--focus-glow));
}

[data-fx="green"] .live-rule path,
[data-fx="green"] .blob-track rect,
[data-fx="green"] .blob-track line {
    stroke: var(--focus-green);
}

[data-fx="green"] .blob-track text {
    fill: var(--focus-green);
}

[data-fx="glitch"] .live-rule {
    filter: url(#fx-rgb-shift);
    animation: fx-glitch 2.3s steps(1) infinite;
}

@keyframes fx-glitch {
    0%, 100% { filter: url(#fx-rgb-shift); }
    37% { filter: url(#fx-rgb-tear); }
    41% { filter: url(#fx-rgb-shift); }
    78% { filter: url(#fx-rgb-tear); }
    80% { filter: url(#fx-rgb-shift); }
}

/* ---------- The island (island.js, blob-sound.js) ----------
   A pill of live controls pinned to the corner: a bar of buttons, and a tray
   of dials above it that folds away. */
.island[hidden] {
    display: none;
}

/* The mark in the footer brings the island out and puts it back. */
.island-finder {
    cursor: pointer;
}

.island {
    position: fixed;
    left: var(--page-gutter);
    bottom: var(--space-md);
    z-index: 900;
    max-width: calc(100vw - 2 * var(--page-gutter));
    padding: 3px;
    border: 1px solid var(--color-ink);
    border-radius: 22px;
    background-color: var(--color-paper);
    font-size: var(--type-xs, 0.75rem);
}

.island-bar {
    display: flex;
    align-items: center;
    gap: 2px;
}

.island-btn {
    padding: 0.5em 0.95em;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--color-ink);
    font: inherit;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.island-btn[aria-pressed="true"] {
    background-color: var(--color-ink);
    color: var(--focus-green);
}

.island-btn:focus-visible,
.dial:focus-visible {
    outline: 2px solid var(--color-ink);
    outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
    .island-btn:not([aria-pressed="true"]):hover {
        background-color: var(--color-line);
    }
}

/* The tray takes no room when folded, and grows to its contents when open. */
.island-tray {
    display: grid;
    grid-template-rows: 0fr;
    max-width: 0;
    transition: grid-template-rows 0.32s cubic-bezier(0.3, 1.2, 0.4, 1), max-width 0.32s cubic-bezier(0.3, 1.2, 0.4, 1);
}

.island.is-open .island-tray {
    grid-template-rows: 1fr;
    max-width: 30rem;
}

.island-tray-inner {
    display: flex;
    gap: 18px;
    min-height: 0;
    overflow: hidden;
}

.island.is-open .island-tray-inner {
    padding: 12px 12px 10px;
}

.dial-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dial-group + .dial-group {
    padding-left: 18px;
    border-left: 1px solid var(--color-line);
}

.dial-group-title {
    color: var(--color-text-secondary);
}

.dial-row {
    display: flex;
    gap: 14px;
}

.dial {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border-radius: 6px;
    cursor: ns-resize;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* A ring that fills as the dial turns, around a knob with a tick. */
.dial-knob {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: conic-gradient(from 225deg, var(--color-ink) var(--turn, 0deg), var(--color-line) 0 270deg, transparent 0);
}

.dial-knob::before {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background-color: var(--color-ink);
    box-shadow: 0 0 0 3.5px var(--color-paper);
}

.dial-knob::after {
    content: "";
    position: absolute;
    left: calc(50% - 1px);
    bottom: 50%;
    width: 2px;
    height: 10px;
    background-color: var(--color-paper);
    transform-origin: 50% 100%;
    transform: rotate(calc(-135deg + var(--turn, 0deg)));
}

.dial-name {
    color: var(--color-ink);
}

@media (max-width: 600px) {
    .island-tray-inner { gap: 12px; }
    .dial-row { gap: 9px; }
    .dial-group + .dial-group { padding-left: 12px; }
}

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

/* ---------- "What's it about?" as a row of choices ----------
   A native dropdown takes its menu size from the field's type size, which
   made a window-wide menu here. Four options fit on the page as they are. */
.contact-form .form-choices {
    min-width: 0;
    margin-inline: 0;
    padding: 0;
    border: 0;
}

.contact-form .form-choices legend {
    padding: 0;
    margin-bottom: var(--space-sm);
    font-size: var(--type-sm);
    color: var(--color-text-secondary);
}

.choice-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.choice {
    position: relative;
    cursor: pointer;
}

.contact-form .form-choices .choice input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    cursor: pointer;
}

.choice span {
    display: block;
    padding: 0.6em 1.15em;
    border: 1px solid var(--color-ink);
    border-radius: 999px;
    color: var(--color-ink);
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.choice input:checked + span {
    background-color: var(--color-ink);
    color: var(--color-paper);
}

.choice input:focus-visible + span {
    outline: 2px solid var(--color-ink);
    outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
    .choice input:not(:checked):hover + span {
        background-color: var(--color-line);
    }
}

/* Filter groups that belong to one kind of work stay out of the way until it is chosen. */
.photo-sort {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* The arrow over the order in use: down is the order as named, up is the
   same order turned around. It carries a view-transition name, so it slides
   from chip to chip and turns over while the grid rearranges. */
.photo-chip[data-sort] {
    position: relative;
}

.sort-arrow {
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 3px);
    width: 9px;
    height: 9px;
    margin-left: -4.5px;
    background-color: var(--color-ink);
    clip-path: polygon(50% 100%, 0 45%, 36% 45%, 36% 0, 64% 0, 64% 45%, 100% 45%);
    transition: transform 0.25s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.photo-chip.is-active .sort-arrow {
    display: block;
    view-transition-name: sort-arrow;
}

.photo-chip.is-reversed .sort-arrow {
    transform: rotate(180deg);
}

::view-transition-group(sort-arrow) {
    animation-duration: 0.25s;
    animation-timing-function: cubic-bezier(0.3, 1.4, 0.5, 1);
}

.photo-filter-group[hidden] {
    display: none;
}

/* Lines and tracker switched off from the island (fx-modes.js): anything
   already on the page goes at once. */
.fx-off .live-rule {
    display: none;
}

.photo-chip[hidden] {
    display: none;
}

/* ---------- Home contact ---------- */
/* No form here (the contact page and the note button have one). The address
   itself is the headline, set as wide as the column by fit.js, over three
   ruled ways in that open the contact page with the subject already chosen. */
.contact-front {
    padding: var(--space-2xl) 0 var(--space-3xl);
}

.contact-front-label {
    margin: 0 0 var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-ink);
    font-family: var(--font-body);
    font-size: var(--type-sm);
    font-weight: inherit;
    letter-spacing: 0;
    color: var(--color-text-secondary);
}

.contact-front-lede {
    max-width: 22em;
    margin: 0 0 var(--space-xl);
    font-family: var(--font-serif);
    font-size: clamp(1.5rem, 2.6vw, 2.2rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--color-ink);
}

.contact-front-mail {
    display: block;
    font-family: var(--font-serif);
    font-size: clamp(1.5rem, 6.4vw, 3.4rem);   /* when too narrow to fit on one line */
    line-height: 1;
    letter-spacing: -0.035em;
    overflow-wrap: anywhere;
    color: var(--color-ink);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-decoration-thickness: 0.035em;
    text-underline-offset: 0.1em;
    transition: text-decoration-color var(--transition-base);
}

.contact-front-mail.is-fitted {
    white-space: nowrap;
}

.contact-front-mail:hover,
.contact-front-mail:focus-visible {
    color: var(--color-ink);
    text-decoration-color: currentColor;
}

.contact-ways {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin-top: var(--space-xl);
    border-top: 1px solid var(--color-ink);
}

.contact-way {
    display: grid;
    align-content: start;
    gap: var(--space-xs);
    padding: var(--space-md) 0 var(--space-lg);
    color: var(--color-ink);
    text-decoration: none;
}

.contact-way + .contact-way {
    border-top: 1px solid var(--color-line);
}

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

.contact-way-title {
    font-family: var(--font-serif);
    font-size: clamp(1.6rem, 3.2vw, 2.6rem);
    line-height: 1;
    letter-spacing: -0.025em;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-decoration-thickness: 0.04em;
    text-underline-offset: 0.12em;
    transition: text-decoration-color var(--transition-base);
}

.contact-way:hover .contact-way-title,
.contact-way:focus-visible .contact-way-title {
    text-decoration-color: currentColor;
}

.contact-way:focus-visible,
.contact-front-mail:focus-visible {
    outline: 2px solid var(--color-ink);
    outline-offset: 4px;
}

.contact-way-meta {
    max-width: 26em;
    font-size: var(--type-sm);
    color: var(--color-text-secondary);
}

.contact-front-note {
    max-width: 44em;
    margin: var(--space-lg) 0 0;
    font-size: var(--type-sm);
    color: var(--color-text-secondary);
}

.contact-front-note a {
    color: var(--color-ink);
}

@media (min-width: 768px) {
    .contact-ways {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        column-gap: var(--space-xl);
    }

    .contact-way + .contact-way {
        border-top: 0;
    }
}

/* ---------- Design showcase ---------- */
/* The home page's design work, one project at a time: a mosaic of its pieces
   in rows of different heights, every picture at its own shape, its name
   underneath, and a row of buttons: the current project's is a pill that
   fills with inverted colour as its time runs out. tools/home-showcase.py
   builds the markup; showcase.js adds .is-rotating and moves it along.
   Without the script the projects are listed one under the other. */
.showcase {
    --showcase-dwell: 5s;
    --showcase-fade: 600ms;
    --showcase-gap: 6px;
}

.showcase-stage {
    display: grid;
    gap: var(--space-2xl);
}

.showcase-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr);   /* never wider than the page, whatever is inside */
    gap: var(--space-sm);
    min-width: 0;
    color: var(--color-ink);
    text-decoration: none;
}

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

.showcase-group:focus-visible {
    outline: 2px solid var(--color-ink);
    outline-offset: 4px;
}

/* The stage keeps one shape so the page does not jump; the mosaic inside it
   keeps its own (--nat, worked out by the script) and is as large as fits. */
.showcase-frame {
    display: grid;
    place-items: center start;
    aspect-ratio: 16 / 9;       /* STAGE_ASPECT in tools/home-showcase.py */
    container-type: size;
}

.showcase-mosaic {
    display: flex;
    flex-direction: column;
    gap: var(--showcase-gap);
    width: min(100cqw, calc(100cqh * var(--nat)));
    aspect-ratio: var(--nat);
}

.showcase-row {
    display: flex;
    flex: calc(var(--h) * 100) 1 0;   /* scaled so the shares add up to more than 1 and fill the stage */
    gap: var(--showcase-gap);
    min-height: 0;
}

.showcase-tile {
    flex: calc(var(--ar) * 100) 1 0;
    min-width: 0;
    overflow: hidden;
    border-radius: 2px;
    background-color: rgba(0, 0, 0, 0.04);
}

.showcase-tile img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
}

/* Mockups (Picture.frame in the script). The sizes here are shares of the
   tile's width and match BROWSER_BAR and PHONE_EDGE there. */
.showcase-tile.is-browser {
    display: flex;
    flex-direction: column;
    border-radius: 6px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.14);
    container-type: inline-size;
}

.mock-bar {
    flex: none;
    height: 5cqw;
    background:
        radial-gradient(circle at 3.2cqw 50%, rgba(0, 0, 0, 0.3) 0 0.75cqw, transparent 0.85cqw),
        radial-gradient(circle at 6cqw 50%, rgba(0, 0, 0, 0.3) 0 0.75cqw, transparent 0.85cqw),
        radial-gradient(circle at 8.8cqw 50%, rgba(0, 0, 0, 0.3) 0 0.75cqw, transparent 0.85cqw),
        #ececec;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

.showcase-tile.is-browser img {
    flex: 1;
    min-height: 0;
}

.showcase-tile.is-phone {
    container-type: inline-size;
    background-color: #0b0b0c;
    /* Round corners from the tile's own width: the vertical share is scaled by its shape. */
    border-radius: 14% / calc(14% * var(--ar));
}

.showcase-tile.is-phone img {
    box-sizing: border-box;
    padding: 4cqw;
    border-radius: 13cqw;
}

/* The fold down the middle of a printed spread. */
.showcase-tile.is-spread {
    position: relative;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.showcase-tile.is-spread::after {
    content: "";
    position: absolute;
    inset: 0 46% 0 46%;
    background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.12) 49%, rgba(0, 0, 0, 0.2) 50%, rgba(255, 255, 255, 0.12) 51%, transparent);
    pointer-events: none;
}

.showcase-caption {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-xs) var(--space-md);
}

.showcase-name {
    font-family: var(--font-serif);
    font-size: clamp(1.6rem, 3.2vw, 2.6rem);
    line-height: 1;
    letter-spacing: -0.025em;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-decoration-thickness: 0.04em;
    text-underline-offset: 0.12em;
    transition: text-decoration-color var(--transition-base);
}

.showcase-group:hover .showcase-name,
.showcase-group:focus-visible .showcase-name {
    text-decoration-color: currentColor;
}

.showcase-meta {
    font-size: var(--type-sm);
    color: var(--color-text-secondary);
}

.showcase-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-top: var(--space-md);
    margin-left: -12px;         /* lines the first label up with the pictures */
}

.showcase-nav[hidden] {
    display: none;
}

.showcase-chip {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    border: 1px solid transparent;
}

/* The current project: an outlined pill. Its fill is white under a
   difference blend, so the part of the pill it has reached turns ink with
   paper lettering. */
.showcase-chip.is-active {
    border-color: var(--color-ink);
    background-color: var(--color-paper);
    color: var(--color-ink);
}

.showcase-chip::after {
    content: "";
    position: absolute;
    inset: 0;
    background-color: #fff;
    mix-blend-mode: difference;
    transform: scaleX(0);
    transform-origin: left;
}

.showcase-chip.is-active::after {
    animation: showcase-dwell calc(var(--showcase-dwell) * var(--stay, 1)) linear forwards;   /* --stay: a project given longer by the script */
}

.showcase.is-paused .showcase-chip.is-active::after {
    animation-play-state: paused;
}

@keyframes showcase-dwell {
    to { transform: scaleX(1); }
}

/* Pause and resume (showcase.js): two bars while it runs, a triangle once held. */
.showcase-pause {
    display: inline-flex;
    align-items: center;
}

.showcase-pause-icon {
    width: 9px;
    height: 10px;
    background-color: currentColor;
    clip-path: polygon(0 0, 35% 0, 35% 100%, 0 100%, 0 0, 65% 0, 100% 0, 100% 100%, 65% 100%, 65% 0);
}

.showcase.is-held .showcase-pause-icon {
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}

/* Rotating: the projects share one cell and cross-fade, the tiles of the
   arriving one coming up one after another. */
.showcase.is-rotating .showcase-stage {
    gap: 0;
}

.showcase.is-rotating .showcase-group {
    grid-area: 1 / 1;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--showcase-fade) ease, visibility 0s linear var(--showcase-fade);
}

.showcase.is-rotating .showcase-group.is-active {
    opacity: 1;
    visibility: visible;
    transition: opacity var(--showcase-fade) ease;
}

/* A project's pictures are not laid out, and so not fetched, until it is next in line. */
.showcase.is-rotating .showcase-group:not(.is-primed) .showcase-row {
    display: none;
}

.showcase.is-rotating .showcase-tile {
    opacity: 0;
    transform: scale(0.985);
    transition: opacity 500ms ease, transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.showcase.is-rotating .showcase-group.is-active .showcase-tile {
    opacity: 1;
    transform: none;
    transition-delay: calc(var(--i) * 60ms);
}

/* Phones: the wide mosaic would be too small to read, so each project has a
   second one made for a nearly square stage (.is-compact, built by
   tools/home-showcase.py): its first few pictures, the lead one large and
   the rest in a row under it. Nothing scrolls sideways: the project names
   wrap onto as many rows as they need. */
.showcase-mosaic.is-compact {
    display: none;
}

@media (max-width: 600px) {
    .showcase-frame {
        aspect-ratio: 10 / 9;       /* PHONE_STAGE_ASPECT in tools/home-showcase.py */
        place-items: end start;     /* a shallow mosaic stands on the caption below */
    }

    .showcase-mosaic {
        display: none;
    }

    .showcase-mosaic.is-compact {
        display: flex;
    }

    .showcase-nav .photo-chip {
        padding-block: 10px;        /* tall enough to tap */
    }
}

@media (prefers-reduced-motion: reduce) {
    .showcase.is-rotating .showcase-group,
    .showcase.is-rotating .showcase-group.is-active,
    .showcase.is-rotating .showcase-tile,
    .showcase.is-rotating .showcase-group.is-active .showcase-tile {
        transition: none;
        transform: none;
    }

    .showcase-chip.is-active::after {
        animation: none;
        transform: scaleX(1);
    }

    /* Nothing rotates, so there is nothing to pause. */
    .showcase-pause {
        display: none;
    }
}

/* ---------- Click-to-play video (click-video.js) ---------- */
[data-click-video] {
    cursor: pointer;
}

[data-click-video] video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

[data-click-video] .photo-media,
.click-video {
    position: relative;
}

.click-video-badge {
    position: absolute;
    left: 10px;
    bottom: 10px;
    padding: 0.4em 0.9em;
    border-radius: 999px;
    background-color: var(--color-ink);
    color: var(--color-paper, #fff);
    font-family: var(--font-body);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: opacity var(--transition-base);
}

/* While it plays the badge steps back, and returns under the pointer. */
[data-click-video].is-playing .click-video-badge {
    opacity: 0;
}

[data-click-video].is-playing:hover .click-video-badge,
[data-click-video].is-playing:focus-visible .click-video-badge {
    opacity: 1;
}

/* ---------- Home feature ----------
   One piece of work shown whole: a ruled serif title, then its pictures side
   by side at one height, each as wide as its own shape needs. */
.feature {
    padding-bottom: var(--space-xl);
}

.feature-label {
    display: grid;
    gap: var(--space-xs);
    padding: var(--space-md) 0 var(--space-lg);
    border-top: 1px solid var(--color-ink);
}

.feature-title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: clamp(2.4rem, 6.2vw, 6rem);
    font-weight: inherit;
    line-height: 0.95;
    letter-spacing: -0.035em;
}

.feature-meta {
    margin: 0;
    font-size: var(--type-sm);
    color: var(--color-text-secondary);
}

.feature-row {
    display: flex;
    gap: 10px;
}

.feature-tile {
    flex: calc(var(--ar) * 100) 1 0;
    min-width: 0;
    aspect-ratio: var(--ar);
    overflow: hidden;
    padding: 0;
    border: 0;
    border-radius: 2px;
    background-color: rgba(0, 0, 0, 0.04);
}

.feature-tile img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.feature-tile:focus-visible {
    outline: 2px solid var(--color-ink);
    outline-offset: 2px;
}

/* The video plays in a phone that floats beside the pictures. The slot keeps
   the row's height; the phone inside it is a little smaller and drifts. */
.feature-phone-slot {
    flex: 56.25 1 0;
    min-width: 0;
    aspect-ratio: 0.5625;
    display: grid;
    place-items: center;
}

.phone {
    --phone-edge: clamp(5px, 0.7vw, 10px);
    --phone-corner: clamp(18px, 3vw, 44px);
    position: relative;
    width: 80%;
    padding: var(--phone-edge);
    border: 0;
    border-radius: var(--phone-corner);
    background-color: #0b0b0c;
    box-shadow:
        inset 0 0 0 1.5px #3a3a3d,
        0 2px 4px rgba(0, 0, 0, 0.18),
        0 28px 50px -12px rgba(0, 0, 0, 0.38);
    transform: rotate(3deg);
    animation: phone-float 7s ease-in-out infinite;
}

.phone-screen {
    position: relative;
    display: block;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    border-radius: calc(var(--phone-corner) - var(--phone-edge));
    background-color: #000;
}

/* Clear of the screen's rounded corner. */
.phone .click-video-badge {
    left: 8%;
    bottom: 5%;
}

/* The camera pill at the top of the screen. */
.phone-screen::before {
    content: "";
    position: absolute;
    z-index: 1;
    top: 2.2%;
    left: 50%;
    width: 30%;
    height: 3.4%;
    border-radius: 999px;
    background-color: #000;
    transform: translateX(-50%);
}

.phone:focus-visible {
    outline: 2px solid var(--color-ink);
    outline-offset: 4px;
}

@keyframes phone-float {
    0%, 100% { transform: translateY(-1.5%) rotate(3deg); }
    50% { transform: translateY(1.5%) rotate(1.5deg); }
}

@media (prefers-reduced-motion: reduce) {
    .phone {
        animation: none;
    }
}

@media (max-width: 600px) {
    .feature-row {
        flex-wrap: wrap;
    }

    .feature-phone-slot {
        flex: 0 0 100%;
        aspect-ratio: auto;
        padding: var(--space-lg) 0 var(--space-sm);
    }

    .phone {
        width: 58%;
    }
}

@media (max-width: 600px) {
    .feature-row {
        gap: 6px;
    }
}

/* ---------- Logo process pages ----------
   The rounds of a logo, in order. Each round is a ruled section with its
   sheets laid out in a grid. */
.round-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 10px;
    margin: var(--space-lg) 0;
}

.round-grid.is-five {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

.round-grid.is-wide {
    grid-template-columns: minmax(0, 1fr);
}

.round-grid.is-pair {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.round-grid img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 2px;
    background-color: #fff;
}

.round-grid.is-final {
    grid-template-columns: minmax(0, 520px);
}

/* ---------- Japan collage ---------- */
/* The way on from the home grid: a ruled serif title saying where the
   pictures were taken, then a full-bleed strip whose tiles butt together
   into one continuous picture and drift sideways (reel.js makes it
   draggable). The title links to the photographs from there. */
.collage {
    --collage-height: min(80vh, 800px);
    --collage-pass: 120s;
}

.collage-link {
    color: var(--color-ink);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-decoration-thickness: 0.04em;
    text-underline-offset: 0.12em;
    transition: text-decoration-color var(--transition-base);
}

.collage-link:hover,
.collage-link:focus-visible {
    color: var(--color-ink);
    text-decoration-color: currentColor;
}

.collage-link:focus-visible {
    outline: 2px solid var(--color-ink);
    outline-offset: 4px;
}

.collage-label {
    display: grid;
    gap: var(--space-xs);
    margin-top: var(--space-xl);
    padding: var(--space-md) 0 var(--space-lg);
    border-top: 1px solid var(--color-ink);
}

.collage-title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: clamp(2.4rem, 6.2vw, 6rem);
    font-weight: inherit;
    line-height: 0.95;
    letter-spacing: -0.035em;
}

/* Hokkaido in outline beside the title, a little taller than the letters,
   with a point where the rock is. */
.collage-map {
    display: inline-block;
    height: 1.1em;
    width: auto;
    margin-left: 0.3em;
    vertical-align: -0.2em;
    overflow: visible;
}

.collage-map path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.25;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.collage-map circle {
    fill: var(--focus-green, currentColor);
    stroke: currentColor;
    stroke-width: 1.25;
    vector-effect: non-scaling-stroke;
}

.collage-place {
    margin: 0;
    font-size: var(--type-sm);
    color: var(--color-text-secondary);
}

.collage-strip {
    height: var(--collage-height);
    overflow: hidden;
    background: #000;
}

.collage-track {
    display: flex;
    width: max-content;
    height: 100%;
    animation: collage-drift var(--collage-pass) linear infinite;
    will-change: transform;
}

.collage-track img {
    display: block;
    flex: none;
    height: 100%;
    width: auto;
    max-width: none;
    margin-right: -1px; /* hides hairline gaps between tiles */
}

@keyframes collage-drift {
    to { transform: translateX(-50%); }
}

.collage.is-interactive .collage-track {
    animation: none;
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.collage.is-dragging .collage-track {
    cursor: grabbing;
}

@media (prefers-reduced-motion: reduce) {
    .collage-strip {
        overflow-x: auto;
    }

    .collage-track {
        animation: none;
    }
}

/* ---------- Phones and touch ---------- */
@media (max-width: 600px) {
    .front-text {
        max-width: none;
    }
}

/* Once found, the island stays above the open menu on small screens. */
@media (max-width: 768px) {
    .island {
        z-index: 1000;
        bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
    }
}

/* Fingers need more to aim at than a pointer does. */
@media (pointer: coarse) {
    .photo-chip {
        padding-block: 11px;
    }

    .island-btn {
        padding-block: 0.85em;
    }
}
