/* ==========================================================================
   Noah Vice · sections
   ========================================================================== */

@layer sections {
  /* ------------------------------------------------------------------------
     Portrait hero

     The photo always covers the hero, cropped around the person. The name is
     placed in the photo's own coordinates, so it stays in the empty space
     either side of the person at every screen size, and shrinks when that
     space gets tight. All positions are fractions of the photo:

       --hero-ratio        photo width / height (1672 × 941)
       --hero-focus-x/y    point kept in view when cropping (the face)
       --hero-baseline     height where the name sits (just above the shoulders)
       --hero-clear-left   person's left edge at that height
       --hero-clear-right  person's right edge at that height
     Re-measure these if you swap in a differently framed photo.
     ------------------------------------------------------------------------ */
  .hero {
    container: hero / size;
    position: relative; height: 100svh; min-height: 560px; overflow: hidden;
    background: var(--bg);
  }
  .hero-frame {
    --hero-ratio: 1.77683;
    --hero-focus-x: 0.54;
    --hero-focus-y: 0.4;
    --hero-baseline: 0.47;
    --hero-clear-left: 0.37;
    --hero-clear-right: 0.625;
    --hero-name-max: 0.14;          /* largest name size, as a fraction of photo width */
    --first-em: 2.35;               /* word widths in em; site.js measures the real ones */
    --last-em: 1.95;

    /* Photo box (object-fit: cover, done by hand so text can share its coordinates) */
    --W: max(100cqw, 100cqh * var(--hero-ratio));
    --H: calc(var(--W) / var(--hero-ratio));
    --X: clamp(100cqw - var(--W), 50cqw - var(--W) * var(--hero-focus-x), 0px);
    --Y: clamp(100cqh - var(--H), 50cqh - var(--H) * var(--hero-focus-y), 0px);

    /* Name: baseline height and the largest size that fits each side */
    --G: var(--gutter);
    --baseline: calc(var(--Y) + var(--H) * var(--hero-baseline));
    --room-left: calc(var(--X) + var(--W) * var(--hero-clear-left) - var(--G));
    --room-right: calc(100cqw - var(--G) - var(--X) - var(--W) * var(--hero-clear-right));
    --F: max(40px, min(var(--W) * var(--hero-name-max), var(--room-left) / var(--first-em), var(--room-right) / var(--last-em)));

    position: absolute; inset: 0;
  }
  .hero-photo {
    position: absolute; left: var(--X); top: var(--Y);
    width: var(--W); height: var(--H); max-width: none; object-fit: cover;
  }
  .hero-shade {
    position: absolute; inset: 0; pointer-events: none;
    background:
      linear-gradient(0deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 60%, transparent) 9%, transparent 22%),
      linear-gradient(90deg, color-mix(in srgb, var(--bg) 35%, transparent) 0%, transparent 35%);
  }

  /* Name, shared */
  .hero-word {
    display: block; font-family: var(--font-display); font-weight: var(--weight-display);
    line-height: 1; letter-spacing: var(--tracking-display); white-space: nowrap;
    padding-inline: 0.02em;                                /* room for the gradient on the edge glyphs */
    background: var(--metal); -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 0.06em 0.18em rgb(0 0 0 / .35));
  }
  .hero-left, .hero-right { display: flex; flex-direction: column; }
  .hero-role {
    display: flex; flex-direction: column; gap: 0.9em;
    font-size: var(--text-caps); letter-spacing: 0.2em; text-transform: uppercase; line-height: 1;
    color: var(--ink-soft);
  }

  /* Wide screens: the name sits either side of the person, on --baseline. */
  @container hero (aspect-ratio >= 1.15) {
    .hero-left, .hero-right { position: absolute; top: var(--baseline); }
    .hero-left { left: var(--G); align-items: flex-start; transform: translateY(-100%); }
    .hero-right { right: var(--G); align-items: flex-end; text-align: right; }
    .hero-word { font-size: var(--F); }
    /* With line-height 1, Inter's baseline sits 0.863em from the top. These margins
       put both words' baselines exactly on --baseline. */
    .hero-left .hero-word { margin-bottom: calc(var(--F) * -0.137); }
    .hero-right .hero-word { margin-top: calc(var(--F) * -0.863); }
    .hero-left .pill { margin-bottom: clamp(14px, 2.6cqh, 34px); }
    .hero-role {
      align-items: flex-end; margin-top: calc(var(--F) * 0.137 + clamp(18px, 4cqh, 52px));
      margin-right: -0.2em;                                 /* tracking adds space after the last letter */
    }
  }

  .hero .scroll-cue { position: absolute; left: var(--G); bottom: clamp(24px, 6cqh, 72px); }

  /* Portrait and narrow screens: too little room beside the person, so the
     name stacks at the bottom in front of the photo. */
  @container hero (aspect-ratio < 1.15) {
    .hero-frame { --hero-focus-x: 0.545; }
    .hero-shade {
      background: linear-gradient(0deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 82%, transparent) 30%, transparent 58%);
    }
    .hero-name {
      position: absolute; left: var(--G); right: var(--G); bottom: calc(clamp(24px, 6cqh, 72px) + 76px);
      display: flex; flex-direction: column; align-items: flex-start;
    }
    .hero-left, .hero-right { align-items: flex-start; }
    .hero-word { font-size: min(25cqw, 15cqh); line-height: 0.92; }
    .hero-left .pill { margin-bottom: 18px; }
    .hero-role { align-items: flex-start; margin-top: 22px; }
  }

  /* ------------------------------------------------------------------------
     Shared section frame
     ------------------------------------------------------------------------ */
  .section { padding: var(--section-space) var(--gutter); }
  .section-inner { max-width: var(--page-max); margin: 0 auto; }

  /* ------------------------------------------------------------------------
     Positioning statement
     ------------------------------------------------------------------------ */
  .intro { padding-top: clamp(80px, 10vw, 168px); padding-bottom: clamp(72px, 9vw, 144px); }
  .intro-grid {
    display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
    gap: clamp(32px, 5vw, 96px); align-items: end;
  }
  .intro-statement {
    max-width: 24ch; margin-top: 0;
    font-family: var(--font-display); font-weight: 500; font-size: var(--text-statement);
    line-height: 1.06; letter-spacing: -0.035em; color: var(--soft-text); text-wrap: balance;
  }
  .eyebrow + .intro-statement { margin-top: clamp(20px, 2.4vw, 36px); }
  .intro-highlight { color: var(--ink); }
  .intro-aside { display: flex; flex-direction: column; align-items: flex-start; gap: 28px; padding-bottom: 0.45em; }
  .intro-text { max-width: 40ch; font-size: var(--text-body); line-height: 1.65; color: var(--muted); text-wrap: pretty; }
  .intro-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
  @media (max-width: 1119px) {
    .intro-grid { grid-template-columns: minmax(0, 1fr); align-items: start; }
    .intro-statement { max-width: 22ch; font-size: clamp(30px, 5.6vw, 64px); }
  }

  /* ------------------------------------------------------------------------
     Featured work
     ------------------------------------------------------------------------ */
  .work { padding-top: clamp(48px, 6vw, 96px); scroll-margin-top: 24px; }
  .work-head {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px 48px;
    margin-bottom: var(--block-gap);
  }
  .work-heading-inner { display: block; }
  .work-heading {
    font-family: var(--font-display); font-weight: 600; font-size: var(--text-section);
    line-height: 0.92; letter-spacing: -0.05em; color: var(--ink);
  }
  .work-text { max-width: 32ch; padding-bottom: 0.5em; font-size: var(--text-body); line-height: 1.55; color: var(--muted); }
  .work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(48px, 5vw, 80px) var(--grid-gap); }
  @media (max-width: 819px) { .work-grid { grid-template-columns: minmax(0, 1fr); } }

  /* Project card */
  .project-link { display: block; color: inherit; }
  .project-link:focus-visible { outline: none; }
  .project-link:focus-visible .project-media { outline: 2px solid var(--accent); outline-offset: 4px; }
  .project-media {
    position: relative; aspect-ratio: 1600 / 1035; overflow: hidden; isolation: isolate;
    border-radius: var(--radius-media); background: var(--surface);
  }
  .project-parallax { position: absolute; inset: -7% 0; }
  .project-media img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
    transition: transform var(--duration-slow) var(--ease), opacity var(--duration-slow) var(--ease);
  }
  /* Hairline edge so dark artwork doesn't melt into the page */
  .project-media::after {
    content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; pointer-events: none;
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / .07);
  }
  .project-hover { opacity: 0; }
  /* Preview video: a muted scroll-through of the live site over the still.
     site.js loads it only near the screen and adds .is-playing once frames are
     really moving, so the crossfade never reveals a blank or stalled video.
     Plays on hover (mouse) or while the card is in view (touch). */
  /* The video fills just the visible card, not the parallax overscan (7% above and
     below), and cancels the parallax shift, so cover-cropping never cuts into the
     sides of the recording (left-aligned headlines stay whole). */
  .project-video {
    position: absolute; left: 0; top: 6.1404%; width: 100%; height: 87.7193%; object-fit: cover;
    translate: 0 calc(var(--q, 0) * 6.84%);
    opacity: 0; pointer-events: none; background: transparent;
    transition: opacity 600ms var(--ease), transform var(--duration-slow) var(--ease);
  }
  .project-media.is-playing .project-video {
    opacity: 1;
    transition: opacity 900ms var(--ease-out), transform var(--duration-slow) var(--ease);
  }
  .epic-edit .project-video { display: none; }
  @media (prefers-reduced-motion: reduce) { .project-video { display: none; } }
  .project-cta {
    position: absolute; left: 50%; top: 50%; z-index: 2;
    display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px;
    border-radius: var(--radius-pill); background: var(--ink); color: var(--bg);
    font-size: 14px; font-weight: 500; white-space: nowrap;
    opacity: 0; transform: translate(-50%, calc(-50% + 8px));
    transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease);
    pointer-events: none;
  }
  @media (hover: hover) {
    .project-link:hover :is(.project-media img, .project-video) { transform: scale(1.035); }
    .project-link:hover .project-hover { opacity: 1; }
    .project-link:hover .project-cta, .project-link:focus-visible .project-cta { opacity: 1; transform: translate(-50%, -50%); }
  }
  .project-info { padding-top: clamp(18px, 1.8vw, 26px); }
  .project-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
  .project-title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-card-title); letter-spacing: -0.025em; line-height: 1.15; }
  .project-year { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
  .project-summary { margin-top: 6px; font-size: var(--text-body); line-height: 1.55; color: var(--muted); }
  .project-tags { margin-top: 12px; font-size: 14px; color: var(--ink-soft); }
  .project-tags span + span::before { content: "·"; margin: 0 0.55em; color: var(--muted); }

  /* ------------------------------------------------------------------------
     Shared section heading (Services, How it works)
     ------------------------------------------------------------------------ */
  .section-head {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px 48px;
    margin-bottom: var(--block-gap);
  }
  .h2 {
    font-family: var(--font-display); font-weight: 600; font-size: var(--text-h2);
    line-height: 0.95; letter-spacing: -0.045em; color: var(--ink);
  }
  .section-lede { max-width: 34ch; padding-bottom: 0.4em; font-size: var(--text-body); line-height: 1.55; color: var(--muted); text-wrap: pretty; }

  /* ------------------------------------------------------------------------
     Services: large titles in rows. A row opens (.is-open, set by site.js on
     hover or tap): a colour wave fills it from below, its description slides
     open and the other rows dim. Without JS every row stays open.
     ------------------------------------------------------------------------ */
  .services-list {
    --row-pad: clamp(14px, 1.6vw, 28px);
    margin: 0 calc(-1 * var(--row-pad)); padding: 0; list-style: none; counter-reset: service;
  }
  .service {
    position: relative; isolation: isolate; overflow: clip; counter-increment: service;
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 3fr) auto;
    column-gap: clamp(32px, 5vw, 96px); align-items: center;
    padding: clamp(18px, 2vw, 30px) var(--row-pad);
    border-radius: var(--radius-card);
    transition: opacity 500ms var(--ease);
  }
  .service::before {                                       /* hairline, drawn in by motion.css */
    content: ""; position: absolute; left: var(--row-pad); right: var(--row-pad); top: 0; height: var(--border);
    background: var(--line); transform-origin: left; transition: opacity 400ms var(--ease);
  }
  .services-list::after {                                  /* closing hairline */
    content: ""; display: block; height: var(--border); margin: 0 var(--row-pad); background: var(--line);
  }
  /* the colour wave */
  .service::after {
    content: ""; position: absolute; inset: 0; z-index: -1; background: var(--accent);
    border-radius: 50% 50% 0 0 / 64px 64px 0 0;
    transform: translateY(101%);
    transition: transform 800ms var(--ease-out), border-radius 800ms var(--ease-out);
  }
  .service.is-open::after { transform: none; border-radius: 0; }
  .service.is-open::before, .service.is-open + .service::before { opacity: 0; }

  .service-num::before { content: counter(service, decimal-leading-zero); }
  .service-num { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
  .service-title {
    font-family: var(--font-display); font-weight: 500; font-size: clamp(38px, 5.4vw, 96px);
    line-height: 1; letter-spacing: -0.045em; color: var(--ink);
  }
  .service-toggle {
    display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit;
    font: inherit; letter-spacing: inherit; text-align: left; cursor: pointer;
  }
  .service-toggle::after { content: ""; position: absolute; inset: 0; z-index: 1; }   /* whole row is the target */
  .service-toggle:focus-visible { outline: none; }
  .service:has(.service-toggle:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
  .service-icon {                                          /* plus that turns into a cross */
    position: relative; width: clamp(40px, 3.4vw, 56px); aspect-ratio: 1; border-radius: 50%;
    border: var(--border) solid color-mix(in srgb, var(--ink) 22%, transparent);
    transition: rotate 700ms var(--ease-out), border-color 400ms var(--ease);
  }
  .service-icon::before, .service-icon::after {
    content: ""; position: absolute; left: 50%; top: 50%; width: 32%; height: 1.5px; margin: -0.75px 0 0 -16%;
    background: currentColor; border-radius: 2px;
  }
  .service-icon::after { transform: rotate(90deg); }
  .service.is-open .service-icon { rotate: 135deg; border-color: color-mix(in srgb, var(--on-accent) 60%, transparent); }

  .service-panel { grid-column: 2 / -1; }
  .service-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 700ms var(--ease-out); }
  .motion-ready .service:not(.is-open) .service-body { grid-template-rows: 0fr; }
  .service-body-inner {
    min-height: 0; overflow: hidden;
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 48px;
  }
  .service-text { max-width: 46ch; padding-top: 18px; font-size: clamp(16px, 1.25vw, 19px); line-height: 1.55; color: var(--muted); }
  .service-details { padding-top: 18px; font-size: 14px; color: var(--ink-soft); }
  .service-body-inner > :last-child { padding-bottom: 6px; }

  /* open row: everything on the accent */
  .service :is(.service-num, .service-title, .service-icon, .service-text, .service-details) { transition-property: color, opacity, transform, translate, rotate, border-color; transition-duration: 500ms; }
  .service.is-open :is(.service-title, .service-icon) { color: var(--on-accent); }
  .service.is-open .service-num { color: color-mix(in srgb, var(--on-accent) 70%, transparent); }
  .service.is-open .service-text { color: color-mix(in srgb, var(--on-accent) 88%, transparent); }
  .service.is-open .service-details { color: var(--on-accent); }
  .service.is-open .service-title { translate: 12px 0; }
  /* the rest step back */
  .services-list.has-open .service:not(.is-open) { opacity: 0.38; }

  @media (max-width: 819px) {
    .service { grid-template-columns: 32px minmax(0, 1fr) auto; column-gap: 14px; }
    .service-title { font-size: clamp(30px, 8.4vw, 48px); }
    .service-panel { grid-column: 2 / -1; }
    .service.is-open .service-title { translate: 0 0; }
  }

  /* ------------------------------------------------------------------------
     How it works. Default: steps in a grid (phones, reduced motion, no JS).
     With .is-hscroll (site.js, wide screens): the section pins and the
     track slides sideways; --travel is the sideways distance in px.
     ------------------------------------------------------------------------ */
  .process-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px 48px; }
  .process-viewport { max-width: var(--page-max); margin: var(--block-gap) auto 0; padding: 0 var(--gutter); }
  .process-track {
    margin: 0; padding: 0; list-style: none; counter-reset: step;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 48px clamp(24px, 3vw, 48px);
  }
  .step { position: relative; counter-increment: step; display: flex; flex-direction: column; gap: 28px; padding-top: 28px; border-top: var(--border) solid var(--line); }
  .step::before {                                          /* accent line that fills on the active step */
    content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px; background: var(--accent);
    transform: scaleX(0); transform-origin: left; transition: transform 900ms var(--ease-out);
  }
  .step.is-active::before, .step.is-done::before { transform: none; }
  .step-num::before { content: counter(step, decimal-leading-zero); }
  .step-num {
    font-family: var(--font-display); font-weight: 500; font-size: clamp(72px, 9vw, 168px);
    line-height: 0.85; letter-spacing: -0.06em; color: var(--soft-text); font-variant-numeric: tabular-nums;
    transition: color 600ms var(--ease);
  }
  .step.is-active .step-num { color: var(--ink); }
  .step-title {
    font-family: var(--font-display); font-weight: 500; font-size: clamp(26px, 2.4vw, 40px);
    line-height: 1.05; letter-spacing: -0.03em; color: var(--ink);
  }
  .step-text { max-width: 30ch; margin-top: 12px; font-size: var(--text-body); line-height: 1.55; color: var(--muted); }
  .step-result { margin-top: 18px; font-size: 14px; color: var(--ink-soft); }
  .step-result-label { color: var(--muted); }
  .step-result-label::after { content: ":"; }

  /* Pinned, sideways */
  .process.is-hscroll { height: calc(100vh + var(--travel, 0px) * 2); height: calc(100svh + var(--travel, 0px) * 2); padding-block: 0; }
  .is-hscroll .process-pin {
    position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
    display: flex; flex-direction: column; justify-content: center;
  }
  .is-hscroll .process-head { width: 100%; }
  .is-hscroll .process-viewport { max-width: none; padding: 0; }
  .is-hscroll .process-track {
    display: flex; gap: clamp(32px, 4vw, 72px); width: max-content;
    padding: 0 max(var(--gutter), calc((100vw - var(--page-max)) / 2 + var(--gutter)));
    translate: calc(var(--x, 0) * -1px) 0; will-change: translate;
  }
  .is-hscroll .step { width: clamp(300px, 34vw, 540px); min-height: 52vh; justify-content: space-between; }
  .is-hscroll .step > * { transition: opacity 600ms var(--ease); }
  .is-hscroll .step:not(.is-active) .step-body { opacity: 0.45; }

  /* ------------------------------------------------------------------------
     About: a live portrait (portrait.js) beside one large sentence whose
     underlined phrases show a picture beside the cursor (site.js).
     ------------------------------------------------------------------------ */
  .about-grid {
    display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 40px clamp(40px, 6vw, 120px); align-items: start;
  }
  .about-portrait { position: sticky; top: clamp(80px, 12vh, 140px); margin: 0; display: flex; flex-direction: column; gap: 16px; }
  .about-portrait-frame {
    position: relative; aspect-ratio: 4 / 5; max-height: 86vh; overflow: hidden;
    border-radius: var(--radius-media); background: var(--surface);
  }
  .about-portrait-inner { position: absolute; inset: 0; }
  .about-portrait-img, .about-portrait-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
  .about-portrait-img { object-fit: cover; object-position: 50% 30%; transition: opacity 600ms var(--ease); }
  .about-portrait-canvas { opacity: 0; touch-action: pan-y; transition: opacity 600ms var(--ease); }
  .about-portrait.is-live .about-portrait-canvas { opacity: 1; }
  .about-portrait.is-live .about-portrait-img { opacity: 0; }
  .about-caption { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; color: var(--ink-soft); }
  .about-caption-detail { color: var(--muted); }

  .about-content { display: flex; flex-direction: column; gap: clamp(36px, 5vh, 64px); padding-top: clamp(0px, 4vh, 48px); }
  .about-label { font-size: var(--text-small); font-weight: 400; color: var(--muted); }
  .about-lead {
    font-family: var(--font-display); font-weight: 500; font-size: clamp(30px, 3.3vw, 60px);
    line-height: 1.12; letter-spacing: -0.035em; color: var(--soft-text); text-wrap: pretty;
  }
  .about-phrase {
    position: relative; color: var(--ink); cursor: default; outline: none;
    background: linear-gradient(currentColor, currentColor) 0 calc(100% - 0.04em) / 100% 0.06em no-repeat;
    transition: color 400ms var(--ease), background-size 500ms var(--ease-out);
  }
  .about-phrase:is(:hover, :focus-visible, .is-active) { color: var(--accent); }
  .about-text { max-width: 44ch; font-size: var(--text-body); line-height: 1.6; color: var(--muted); }
  .about-meta { display: grid; gap: 14px; margin: 0; padding-top: 24px; border-top: var(--border) solid var(--line); }
  .about-meta-row { display: grid; grid-template-columns: minmax(96px, 0.3fr) minmax(0, 1fr); gap: 16px; align-items: baseline; }
  .about-meta dt { font-size: 14px; color: var(--muted); }
  .about-meta dd { margin: 0; }
  .about-meta ul { display: flex; flex-wrap: wrap; gap: 4px 0; margin: 0; padding: 0; list-style: none; font-size: var(--text-body); color: var(--ink-soft); }
  .about-meta li:not(:last-child)::after { content: "/"; margin: 0 0.7em; color: var(--line); }

  /* floating picture for underlined phrases */
  .phrase-card {
    position: fixed; left: 0; top: 0; z-index: 65; pointer-events: none;
    width: clamp(240px, 22vw, 380px); aspect-ratio: 16 / 10; margin: 0;
  }
  .phrase-card-inner {
    position: absolute; inset: 0; overflow: hidden; border-radius: 14px; background: var(--surface);
    box-shadow: 0 30px 60px -20px rgb(0 0 0 / .7), 0 0 0 1px rgb(255 255 255 / .06);
    clip-path: inset(50% 50% 50% 50% round 14px); scale: 0.9;
    transition: clip-path 650ms var(--ease-out), scale 650ms var(--ease-out);
  }
  .phrase-card.is-visible .phrase-card-inner { clip-path: inset(0 0 0 0 round 14px); scale: 1; }
  .phrase-card img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
    opacity: 0; scale: 1.15; transition: opacity 400ms var(--ease), scale 900ms var(--ease-out);
  }
  .phrase-card img.is-current { opacity: 1; scale: 1; }

  @media (max-width: 899px) {
    .about-grid { grid-template-columns: minmax(0, 1fr); }
    .about-portrait { position: static; max-width: 520px; }
    .about-content { gap: 32px; }
    .about-meta-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  }

  /* ------------------------------------------------------------------------
     Contact: two very large lines, a hairline with a round button on it,
     then the email address.
     ------------------------------------------------------------------------ */
  .contact { padding-top: clamp(120px, 14vw, 240px); padding-bottom: clamp(80px, 9vw, 150px); scroll-margin-top: 0; }
  .contact-heading {
    display: flex; flex-direction: column;
    font-family: var(--font-display); font-weight: 600; font-size: var(--text-section);
    line-height: 0.98; letter-spacing: -0.05em; color: var(--ink);
  }
  .contact-line { display: block; white-space: nowrap; }
  .contact-line-inner { display: inline-block; }
  .contact-line-soft { color: var(--soft-text); padding-left: clamp(0px, 9vw, 180px); }
  .contact-bar { position: relative; display: flex; align-items: center; margin-top: clamp(48px, 6vw, 96px); }
  .contact-rule { flex: 1; height: var(--border); background: var(--line); transform-origin: left; }
  .contact-circle {
    position: absolute; right: clamp(0px, 8vw, 160px); top: 50%; z-index: 1;
    display: grid; place-items: center; width: clamp(140px, 13vw, 220px); aspect-ratio: 1; margin-top: calc(clamp(140px, 13vw, 220px) / -2);
    border-radius: 50%; background: var(--accent); color: var(--on-accent);
    font-size: clamp(15px, 1.1vw, 18px); font-weight: 500;
    isolation: isolate; overflow: hidden;
  }
  .contact-circle::before {
    content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 50%; background: var(--ink);
    transform: translateY(101%); transition: transform var(--duration-slow) var(--ease-out);
  }
  .contact-circle:hover { color: var(--bg); }
  .contact-circle:hover::before { transform: none; }
  .contact-circle-label { transition: color var(--duration-slow) var(--ease-out); }
  .contact-foot {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 32px 48px;
    margin-top: clamp(72px, 9vw, 150px);
  }
  .contact-text { max-width: 36ch; font-size: var(--text-body); line-height: 1.6; color: var(--muted); }
  .contact-links { display: flex; flex-wrap: wrap; gap: 12px; }
  .contact-email { display: inline-flex; align-items: stretch; gap: 8px; }
  @media (max-width: 699px) {
    .contact-heading { font-size: clamp(38px, 11.4vw, 80px); }
    .contact-line { white-space: normal; }
    .contact-line-soft { padding-left: 0; }
    .contact-bar { margin-top: 112px; }
    .contact-circle { right: 0; width: 132px; margin-top: -66px; }
    .contact-foot { margin-top: clamp(110px, 30vw, 150px); }
  }

  /* ------------------------------------------------------------------------
     3D logo finale: a tall section whose stage pins while the particles
     assemble (finale.js), then scrolls away into Contact.
     ------------------------------------------------------------------------ */
  .finale { position: relative; height: 280vh; height: 280svh; }
  .finale-stage {
    position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
    display: grid; place-items: center;
  }
  .finale-stage::after {                                  /* soft vignette so the edges melt into the page */
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background:
      linear-gradient(var(--bg), transparent 18%, transparent 82%, var(--bg)),
      radial-gradient(ellipse 75% 70% at 50% 50%, transparent 55%, var(--bg) 100%);
  }
  .finale-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; }
  .finale-fallback { display: none; width: min(44vw, 380px); opacity: 0.9; }
  .finale.is-fallback .finale-canvas { display: none; }
  .finale.is-fallback .finale-fallback { display: block; }
  .finale.is-fallback { height: auto; }
  .finale.is-fallback .finale-stage { position: static; height: auto; padding: var(--section-space) 0; }
  .finale-hint {
    position: absolute; left: 50%; bottom: clamp(36px, 7vh, 72px); z-index: 1; translate: -50% 0;
    display: inline-flex; align-items: center; gap: 10px;
    font-size: 14px; color: var(--muted); white-space: nowrap;
    opacity: 0; transition: opacity 900ms var(--ease-out);
  }
  .finale-hint::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
  .finale.is-formed .finale-hint { opacity: 1; }
  .finale.is-touched .finale-hint { opacity: 0; transition-delay: 1200ms; }
  .finale-hint-touch { display: none; }
  @media (hover: none) {
    .finale-hint-pointer { display: none; }
    .finale-hint-touch { display: inline; }
  }
  @media (prefers-reduced-motion: reduce) {
    .finale { height: 100vh; height: 100svh; }
  }
}
