/* Home, first screen (2026-11-11, D090; the climb, chosen by Brian at 20:36). Every rule is scoped under .hm-first.
   Screen 1: one sentence on plain ground, a ruled line, then who it is for and the button.
   Screen 2: the wall. Columns of real pages, each column a step higher than the one before it. A page opens in the middle,
   page-shaped, and the others step back while it plays. Every picture is whole; no words sit on a picture; the layout is
   complete before anything moves. Sizes come from the section's own width (cqw), never from the window's. */

.hm-first { display: block; container-type: inline-size; }

/* ---------- 1. the sentence, and the mark ----------
   The arrival, once, as the page opens (class is-arriving, about two and a half seconds): the ring of the mark is drawn like a
   pen stroke, the nib and the leaves form inside it, the sentence comes to full strength word by word, the rule is drawn.
   The sentence is readable from the first frame. --q is how far the visitor has scrolled off the top (0 to 1): the mark lets go. */
.hm-first .hf-top { display: grid; gap: 20px; padding: calc(var(--hd) + 22px) var(--pad) 26px; }
.hm-first .hf-mark { --ms: 92px; --fade: 16px; position: relative; width: var(--ms); height: var(--ms); color: var(--paper); }
.hm-first .hf-mk { display: block; width: 100%; height: 100%; overflow: visible; transition: opacity .3s ease; }
/* the ink film (a first visit only): it plays where the mark is, placed so the mark it ends on lands exactly on the coded mark,
   which is hidden until the film hands over to it. A round, soft-edged window just larger than the mark holds it, so no rectangle
   shows and it never reaches the words. Laid on as light (screen), so its black is the page's Ink. */
.hm-first.is-film .hf-mk { opacity: 0; }
.hm-first .hf-filmbox { position: absolute; inset: calc(-1 * var(--fade)); overflow: hidden; pointer-events: none; mix-blend-mode: screen; opacity: 0; transition: opacity .3s ease;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 calc(var(--ms) * .5), transparent calc(var(--ms) * .5 + var(--fade)));
  mask-image: radial-gradient(circle at 50% 50%, #000 calc(var(--ms) * .5), transparent calc(var(--ms) * .5 + var(--fade))); }
.hm-first.is-film-on .hf-filmbox { opacity: 1; }
.hm-first .hf-filmbox.is-out { opacity: 0; }
.hm-first .hf-film { position: absolute; max-width: none; --fh: calc(var(--ms) * .9677 / var(--fd)); height: var(--fh); width: calc(var(--fh) * var(--far));
  left: calc(50% - var(--fx) * var(--fh) * var(--far)); top: calc(50% - var(--fy) * var(--fh)); object-fit: fill; }
.hm-first .hf-mk circle { fill: none; stroke: color-mix(in srgb, var(--signal) calc(var(--q, 0) * 100%), var(--paper)); stroke-width: 5.1; transform-box: fill-box; transform-origin: center; transform: rotate(-90deg); stroke-dasharray: 296.6; stroke-dashoffset: 0; }
.hm-first .hf-mk path { fill: currentColor; transform-box: view-box; transform-origin: 51.41px 86px; opacity: calc(1 - var(--q, 0) * 1.5); }
.hm-first .hf-mk .mk-nib { transform: translateY(calc(var(--q, 0) * -16px)); }
.hm-first .hf-mk .mk-l { transform: rotate(calc(var(--q, 0) * -34deg)); }
.hm-first .hf-mk .mk-r { transform: rotate(calc(var(--q, 0) * 34deg)); }
/* once its ring has gone to the wall, the mark is whole again only when the visitor is back at the top */
.hm-first .hf-mark.is-flown .hf-mk circle { opacity: 0; transition: opacity .25s; }
.hm-first .hf-mark.is-flown .hf-mk path { opacity: 0; transition: opacity .4s, transform .5s var(--ease); }
.hm-first .hf-mark.is-flown .hf-mk .mk-nib { transform: translateY(-16px); }
.hm-first .hf-mark.is-flown .hf-mk .mk-l { transform: rotate(-34deg); }
.hm-first .hf-mark.is-flown .hf-mk .mk-r { transform: rotate(34deg); }
.hm-first .hf-mark.is-flown.is-home .hf-mk circle { opacity: 1; transition: opacity .6s; }
.hm-first .hf-mark.is-flown.is-home .hf-mk path { opacity: 1; transform: none; }
.hm-first .hf-h1 { font-size: clamp(1.7rem, 7.3vw, 2.15rem); line-height: 1.08; letter-spacing: -.022em; max-width: 19em; text-wrap: pretty; }
/* before the page opens: the ring not yet drawn, the sentence soft, the rule not yet drawn */
.fx .hm-first:not(.is-go) .hf-mk circle { stroke-dashoffset: 296.6; }
.fx .hm-first:not(.is-go) .hf-mk path { opacity: 0; transform: scale(.6); }
.fx .hm-first:not(.is-go) .hf-w { color: var(--soft); }
.fx .hm-first:not(.is-go) .hf-foot::before { transform: scaleX(0); }
.hm-first.is-arriving .hf-mk circle { transition: stroke-dashoffset .85s var(--inout); }
.hm-first.is-arriving .hf-mk path { transition: opacity .4s ease .7s, transform .6s cubic-bezier(.16, 1, .3, 1) .7s; }
.hm-first.is-arriving .hf-w { transition: color .5s ease calc(.95s + var(--i, 0) * 45ms); }
.hm-first.is-arriving .hf-foot::before { transition: transform .8s var(--inout) 1.75s; }
/* with the film, nothing is drawn before the words: they begin at once, and are whole before the drop lands at two seconds */
.hm-first.is-film.is-arriving .hf-w { transition-delay: calc(.2s + var(--i, 0) * 45ms); }
.hm-first.is-film.is-arriving .hf-foot::before { transition-delay: 1s; }
.hm-first .hf-foot { position: relative; display: grid; gap: 16px; }
.hm-first .hf-foot::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--rule2); transform-origin: 0 50%; display: none; }
.hm-first .hf-sub { font-size: 1.02rem; line-height: 1.45; color: var(--soft); max-width: none; }
.hm-first .hf-ask { display: grid; gap: 10px; justify-items: start; }
.hm-first .hf-call { font-size: 14.5px; line-height: 1.45; color: var(--soft); white-space: nowrap; }

/* ---------- 2. the wall ----------
   --cols columns of --rows pages. --cw and --th are one page; --colh one column; each column stands --step higher than the one
   to its left, so the field is one column plus (--cols - 1) steps tall. */
.hm-first .hf-wallsec { position: relative; padding: 10px var(--pad) 30px;
  --cols: 3; --rows: 2; --g: 6px; --rg: 6px; --tar: .4621; --step: 36px;
  /* a page is as wide as its column, and never so tall that the wall would not fit one screen (--room is what is left of the
     screen for the columns once the header, the steps and the line under the wall are taken off) */
  --room: calc(100svh - var(--hd) - 100px - 2 * 36px);
  --cw: min(calc((100cqw - 2 * var(--pad) - (var(--cols) - 1) * var(--g)) / var(--cols)), calc((var(--room) - (var(--rows) - 1) * var(--rg)) / var(--rows) * var(--tar))); --th: calc(var(--cw) / var(--tar));
  --colh: calc(var(--rows) * var(--th) + (var(--rows) - 1) * var(--rg)); --fh: calc(var(--colh) + (var(--cols) - 1) * var(--step)); }
.hm-first .hf-field { position: relative; isolation: isolate; height: var(--fh); }
.hm-first .hf-wall { display: grid; grid-template-columns: repeat(var(--cols), var(--cw)); grid-auto-rows: var(--th); justify-content: space-between; row-gap: var(--rg); }
/* every page on the wall is a link to its client's case study (Brian, 22:11) */
/* the wall is kinetic (Brian, 22:37): on a desktop pointer every page turns toward the cursor and the nearest lifts. The script
   sets --rx, --ry and --ks on each page; at rest they are nothing, so the page is exactly where the climb puts it. */
.hm-first .hf-tile { display: block; position: relative; background: var(--ink2); overflow: hidden; transform: translateY(calc(var(--k, 0) * var(--step))) perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(var(--ks, 1)); transition: opacity .8s ease; }
.hm-first .hf-tile img { width: 100%; height: 100%; object-fit: contain; }
/* the page's recording, over its still while the pointer rests on it (Brian, 2026-11-12 02:16); it never takes the press */
.hm-first .hf-tile .hf-pv { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--ink2); opacity: 0; transition: opacity .22s ease; pointer-events: none; }
.hm-first .hf-tile.is-playing .hf-pv { opacity: 1; }
.hm-first .hf-wall.is-deciding .hf-tile { opacity: .16; }
.hm-first .hf-wall.is-deciding .hf-tile.is-pick { opacity: 1; }
/* a page that has stepped back cannot be pressed or reached by keyboard */
.hm-first .hf-wall.is-clear .hf-tile { opacity: 0; visibility: hidden; transition: opacity .8s ease, visibility 0s .8s; }
/* the page that has grown has left its place: there is one of it, not two */
.hm-first .hf-wall .hf-tile.is-gone { opacity: 0; visibility: hidden; transition: none; }
/* where a page ends up when it opens: page-shaped, in the middle. Nothing is laid over the wall: .hf-open starts exactly on the
   picked page's own place in the wall, showing the same picture, and grows from there to fill .hf-box (Brian, 21:56: "There's
   already a spot in the walled grid that we have, so why not just use that?"). The script sets its transform. */
.hm-first .hf-box { position: absolute; top: 0; left: calc(50% - var(--fh) * var(--tar) * .5); width: calc(var(--fh) * var(--tar)); height: var(--fh); pointer-events: none; }
.hm-first .hf-open { position: absolute; inset: 0; z-index: 1; transform-origin: 0 0; opacity: 0; visibility: hidden; }
.hm-first .hf-open.is-up { opacity: 1; visibility: visible; pointer-events: auto; cursor: pointer; }
/* the pages of the client that is open: stacked in the same place, each drawn whole, one showing at a time. Each carries its
   poster as its ground, so the place is never blank while a recording arrives. */
.hm-first .hf-open video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--ink) center / contain no-repeat; opacity: 0; transition: opacity .09s linear; }
.hm-first .hf-open video.is-on { opacity: 1; }
/* the ring as it is found: Signal red and out of true, turning. It steadies, then the shared reveal (the mark) takes over. */
.hm-first .hf-ring { position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .3s; }
.hm-first .hf-ring.on { opacity: 1; }
.hm-first .hf-ring svg { display: block; width: 100%; height: 100%; overflow: visible; animation: hf-turn 6s linear infinite; }
.hm-first .hf-ring circle { fill: none; stroke: var(--signal); stroke-linecap: round; transform-box: fill-box; transform-origin: center; transform: rotate(-90deg) scale(1, .9); transition: stroke-dashoffset .9s var(--inout), transform .5s var(--ease), stroke .7s ease; filter: drop-shadow(0 1px 4px rgba(0, 0, 0, .45)); }
.hm-first .hf-ring.is-true svg { animation-play-state: paused; }
.hm-first .hf-ring.is-true circle { transform: rotate(-90deg); }
@keyframes hf-turn { to { transform: rotate(360deg); } }

/* Nothing on the wall plays by itself any more (Brian, 2026-11-12 02:09), so the open page's name and Pause show only while a
   page is playing, which is when the home page holds the wall for its zoom. They keep their room so nothing jumps. ?was (class
   is-was) is the earlier version, where the ring's show runs and they are always there. */
.hm-first:not(.is-was) .hf-now { visibility: hidden; }
.hm-first:not(.is-was)[data-phase="open"] .hf-now { visibility: visible; }
.hm-first .hf-now { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 13.5px; min-height: 44px; }
.hm-first .hf-cap { color: var(--soft); text-decoration: none; font-weight: 500; opacity: 0; transition: opacity .5s; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; white-space: nowrap; }
.hm-first .hf-cap.on { opacity: 1; }
.hm-first .hf-cap::after { content: "\2192"; }
.hm-first .hf-cap:hover, .hm-first .hf-cap:focus-visible { color: var(--paper); }
.hm-first .hf-pause { appearance: none; background: none; border: 0; margin-left: auto; padding: 0 4px; min-height: 44px; min-width: 44px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--soft); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.hm-first .hf-pause:hover { color: var(--paper); }

/* a phone: three columns of two phone pages */
@media (max-width: 599px) {
  .hm-first .hf-tile:nth-child(3n+1) { --k: 2; }
  .hm-first .hf-tile:nth-child(3n+2) { --k: 1; }
}

/* a tablet: four columns of three pages; the page opens in a page-shaped place in the middle */
@media (min-width: 600px) {
  .hm-first .hf-wallsec { --cols: 4; --rows: 3; --g: 8px; --tar: 1.6; --room: calc(100svh - var(--hd) - 104px - 3 * 44px);
    --step: clamp(44px, calc((100svh - var(--hd) - 104px - var(--colh)) / 3), calc(var(--th) * .55));
    --bh: min(calc(var(--fh) - 2 * var(--step) - 8px), calc((100cqw - 2 * var(--pad)) / 1.6)); }
  .hm-first .hf-box { top: calc(2 * var(--step)); left: calc(50% - var(--bh) * .8); width: calc(var(--bh) * 1.6); height: var(--bh); }
}
@media (min-width: 600px) and (max-width: 1199px) {
  .hm-first .hf-tile:nth-child(4n+1) { --k: 3; }
  .hm-first .hf-tile:nth-child(4n+2) { --k: 2; }
  .hm-first .hf-tile:nth-child(4n+3) { --k: 1; }
}

/* from 900: the sentence gets most of a screen; the top of the wall shows under it */
@media (min-width: 900px) {
  .hm-first .hf-top { min-height: calc(100svh - clamp(104px, 15svh, 150px)); grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr) auto; gap: 30px clamp(32px, 4cqw, 64px); padding: calc(var(--hd) + 24px) var(--pad) 0; }
  /* the mark, large, standing on the rule beside the sentence */
  .hm-first .hf-mark { --ms: min(50svh, 32cqw); --fade: 24px; grid-column: 2; grid-row: 1; align-self: end; }
  .hm-first .hf-h1 { grid-column: 1; grid-row: 1; align-self: end; font-size: clamp(2.3rem, 4vw, 3.7rem); line-height: 1.04; letter-spacing: -.028em; max-width: none; }
  .hm-first .hf-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 32px; padding: 20px 0 24px; }
  .hm-first .hf-foot::before { display: block; }
  .hm-first .hf-sub { font-size: clamp(1.05rem, 1.25vw, 1.25rem); }
  .hm-first .hf-ask { display: flex; flex-direction: row-reverse; align-items: center; gap: 22px; }
  .hm-first .hf-wallsec { padding: 16px var(--pad) 36px; }
  .hm-first .hf-now { font-size: 14px; }
  .hm-first .hf-pause { font-size: 14px; }
}

/* a wide screen: five columns of three pages. The name of the open page and Pause sit in the open corner, bottom right. */
@media (min-width: 1200px) {
  .hm-first .hf-wallsec { --cols: 5; --g: 10px; padding-bottom: 40px; --room: calc(100svh - var(--hd) - 56px - 4 * 44px);
    --step: clamp(44px, calc((100svh - var(--hd) - 56px - var(--colh)) / 4), calc(var(--th) * .55));
    --bh: min(calc(var(--fh) - 2 * var(--step) - 84px), calc((100cqw - 2 * var(--pad)) / 1.6)); }
  .hm-first .hf-tile:nth-child(5n+1) { --k: 4; }
  .hm-first .hf-tile:nth-child(5n+2) { --k: 3; }
  .hm-first .hf-tile:nth-child(5n+3) { --k: 2; }
  .hm-first .hf-tile:nth-child(5n+4) { --k: 1; }
  .hm-first .hf-now { position: absolute; right: var(--pad); bottom: 40px; gap: 28px; }
  .hm-first .hf-pause { margin-left: 0; }
}

/* ---------- the home page's score (class is-score on the page's root, put there by the assembler; HOME-SCORE.md, hand-over 2).
   The assembler holds the wall at the top of the screen, one screen high, and scales .hf-field. Here: the wall is exactly one
   screen, on solid Ink, and starts below the header. .hf-now (the page's name and Pause) is outside the element that scales. ---------- */
.is-score .hm-first .hf-wallsec { height: 100svh; padding-top: calc(var(--hd) + 10px); background: var(--ink); }
@media (min-width: 900px) { .is-score .hm-first .hf-wallsec { padding-top: calc(var(--hd) + 16px); } }

@media (prefers-reduced-motion: reduce) {
  .hm-first .hf-ring svg { animation: none; }
  .hm-first .hf-tile, .hm-first .hf-open, .hm-first .hf-open video, .hm-first .hf-cap, .hm-first .hf-w, .hm-first .hf-mk, .hm-first .hf-mk circle, .hm-first .hf-mk path { transition: none; }
}
