/* ==========================================================================
   motion.css — motion layer (DECISIONS 37–39). Colours, fonts and timing come
   from tokens.css only. Rule: every rule outside `.js-motion` is the FINAL,
   static state, so the page is complete without JS and with
   prefers-reduced-motion (motion.js then never adds html.js-motion).
   ========================================================================== */

/* ---------- 1. Home hero: photo + line art registered in one 3:2 stage ---------- */
/* .hero-frame is the size container (absolute, so a long title can still grow
   the hero). The stage reproduces object-fit: cover; object-position: 50% 40%
   for a 3:2 photo, so the SVG drawn in the photo's 1200x800 space stays on the
   house at any viewport. Overscan (scale 1.03) leaves room for the pointer offset. */
.hero-frame { position: absolute; inset: 0; overflow: hidden; container-type: size; }
.hero-stage { --sw: max(100vw, 150vh); --sw: max(100cqw, 150cqh); position: absolute; width: var(--sw); height: calc(var(--sw) / 1.5); left: calc((100cqw - var(--sw)) / 2); top: calc((100cqh - var(--sw) / 1.5) * .4); }
.hero-stage .hero-media { z-index: 0; transform: scale(1.03); will-change: transform; }
.hero-stage .hero-media::after { display: none; }
.hero-shade { position: absolute; inset: 0; z-index: 1; background: var(--hero-fade); pointer-events: none; }
.hero-lines { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; max-width: none; transform: scale(1.03); opacity: .35; pointer-events: none; overflow: visible; will-change: transform; }
.hero-lines path { fill: none; stroke: var(--bronze); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-linecap: square; }
.hero--home .hero-text, .hero--home .hero-cue { z-index: 3; }
/* Pointer network (hero-network.js, DECISIONS 46): above photo and line art, below the text; home, desktop only. */
.hero-net { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity 1.2s var(--ease); }
.hero-net.is-on { opacity: 1; }
@media (prefers-reduced-motion: reduce), (hover: none), (pointer: coarse), (max-width: 767px) { .hero-net { display: none; } }
/* Phones: main outline only — the 15 strokes (.m) inside the centre crop. */
@media (max-width: 600px) { .hero-lines path:not(.m) { display: none; } }

/* Veil: the photo comes "out of the dark" (all heroes). Final state: invisible. */
.hero-veil { position: absolute; inset: 0; z-index: 1; background: var(--bg); opacity: 0; pointer-events: none; }
.hero--page .hero-media picture { transform-origin: 50% 40%; will-change: transform; }
.hero h1 .w { display: inline-block; }

/* ---------- 2. Scroll progress hairline ---------- */
.progress { position: fixed; inset: 0 0 auto 0; z-index: 60; height: 1px; background: var(--bronze); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; display: none; }

/* ---------- 3. Hairlines beside numerals and labels (final state: drawn) ---------- */
.split-aside .num, .sec-head .num, .project-head .label { display: inline-flex; align-items: center; gap: 1.25rem; }
.sec-head .num { display: flex; }
.split-aside .num::after, .sec-head .num::after, .project-head .label::after { content: ""; flex: none; width: 3rem; height: 1px; background: var(--bronze); transform-origin: 0 50%; }
.project-head .label { display: flex; }
.eyebrow::before { transform-origin: 0 50%; }

/* ---------- 4. Project images: hover grid + label (desktop, precise pointer) ---------- */
.project-grid li:hover img, .gallery li:hover img { transform: scale(1.03); }
@media (prefers-reduced-motion: reduce) {
  .feature:hover .feature-media img, .project-grid li:hover img, .gallery li:hover img { transform: none; }
}
.gallery-cap { z-index: 3; }
@media (hover: hover) and (pointer: fine) and (min-width: 601px) {
  a.feature-media { position: relative; isolation: isolate; }
  .project-grid li, .gallery li { isolation: isolate; }
  a.feature-media::after, .project-grid li::after, .gallery li::after {
    content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0;
    background-image: linear-gradient(to right, var(--bronze) 1px, transparent 1px), linear-gradient(to bottom, var(--bronze) 1px, transparent 1px);
    background-size: 56px 56px; background-position: -1px -1px; transition: opacity .9s var(--ease);
  }
  [data-tag]::before {
    content: attr(data-tag); position: absolute; right: 1rem; bottom: .9rem; z-index: 2; pointer-events: none;
    padding: .45rem .6rem; background: var(--bg-tag); color: var(--bronze-text);
    font: 500 .62rem/1 var(--font-sans); letter-spacing: .22em; text-transform: uppercase;
    opacity: 0; transform: translateY(6px); transition: opacity .6s var(--ease), transform .6s var(--ease);
  }
  /* Renders: the "Architectural visualisation" caption keeps the bottom-right corner. */
  li:has(.gallery-cap)[data-tag]::before { top: .9rem; bottom: auto; }
  a.feature-media:hover::after, .project-grid li:hover::after, .gallery li:hover::after { opacity: .2; }
  [data-tag]:hover::before { opacity: 1; transform: none; }
}

/* ---------- 5. Initial states — only while JS runs and motion is allowed ---------- */
.js-motion .progress { display: block; }

/* hero intro (motion.js drives opacity/transform inline, then leaves the final values) */
.js-motion .hero-veil { opacity: .94; }
.js-motion .hero-lines { opacity: 1; }
.js-motion .hero-lines path { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
.js-motion .hero [data-intro], .js-motion .hero [data-intro-lines]:not(.is-split) { opacity: 0; }
.js-motion .hero .w { opacity: 0; }
.js-motion .hero .eyebrow::before { transform: scaleX(0); transition: transform 1.3s var(--ease) .2s; }
.js-motion .hero .eyebrow.is-in::before { transform: none; }

/* content blocks: fade up once */
.js-motion [data-reveal]:not(.band):not(.cta),
.js-motion .band[data-reveal] > div:not(.band-media) > *,
.js-motion .cta[data-reveal] > .wrap > * {
  opacity: 0; transform: translateY(28px);
  transition: opacity 1.1s var(--ease), transform 1.1s var(--ease);
  transition-delay: calc(var(--d, 0s) + var(--k, 0s));
}
.js-motion [data-reveal].is-in:not(.band):not(.cta),
.js-motion .band.is-in > div:not(.band-media) > *,
.js-motion .cta.is-in > .wrap > * { opacity: 1; transform: none; }
.js-motion .band[data-reveal] > div > :nth-child(2), .js-motion .cta[data-reveal] > .wrap > :nth-child(2) { --k: .12s; }
.js-motion .band[data-reveal] > div > :nth-child(3), .js-motion .cta[data-reveal] > .wrap > :nth-child(3) { --k: .24s; }
.js-motion .band[data-reveal] > div > :nth-child(n+4), .js-motion .cta[data-reveal] > .wrap > :nth-child(n+4) { --k: .36s; }

/* hairlines draw left to right after their block arrives */
.js-motion [data-reveal] .num::after, .js-motion [data-reveal] .label::after, .js-motion [data-reveal] .eyebrow::before {
  transform: scaleX(0); transition: transform 1.3s var(--ease) calc(var(--d, 0s) + .35s);
}
.js-motion [data-reveal].is-in .num::after, .js-motion [data-reveal].is-in .label::after, .js-motion [data-reveal].is-in .eyebrow::before { transform: none; }

/* ---------- 6. Cursor dot (cursor.js, DECISIONS 51; notes in review/cursor-2026-10-20.md) ---------- */
/* Created by JS only on (hover:hover) and (pointer:fine) with motion allowed, so there is no static state.
   Colour: --bronze-logo #9C7F4A (tokens.css; the logo fill in src/assets/logo-dark.svg). System cursor stays.
   Follow: rAF lerp 0.18 per 60 Hz frame (frame-rate independent), about 97% of a jump covered in 0.3 s.
   Hover a, button, [role=button], label[for], .gallery-link, .feature-media, project tiles: grows to 24px
   (ring 36px); snaps to the target's centre only if the target is at most 240 x 96px, so photos and cards
   just grow. Fades out on window blur / pointer leaving the window. rAF stops when settled and when hidden.
   Layer: above the header (50) and mobile menu (60/70), below the skip link (100). A modal lightbox
   <dialog> sits in the top layer above every z-index, so cursor.js moves the dot inside it while it is open.
   pointer-events: none keeps every control underneath clickable. Position and size: JS transform only. */
.cursor { position: fixed; left: 0; top: 0; z-index: 90; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; background: var(--bronze-logo); pointer-events: none; opacity: 0; transition: opacity .3s var(--ease); will-change: transform; }
/* Preview variant ?cursor=ring: 28px outline, 36px on hover. Stroke is an inset shadow (a 1.5px border
   snaps to 1px on 1x screens) and is thinned while scaled up, so it reads 1.5px in both states. */
.cursor--ring { width: 28px; height: 28px; margin: -14px 0 0 -14px; background: none; box-shadow: inset 0 0 0 1.5px var(--bronze-logo); transition: opacity .3s var(--ease), box-shadow .25s var(--ease); }
.cursor--ring.is-hot { box-shadow: inset 0 0 0 calc(1.5px * 28 / 36) var(--bronze-logo); }
.cursor.is-on { opacity: 1; }
.cursor.is-on.is-snap:not(.cursor--ring) { opacity: .35; } /* DECISIONS 53: snapped onto a link/button the solid dot turns translucent so letters show through */
@media (prefers-reduced-motion: reduce), (hover: none), (pointer: coarse) { .cursor { display: none; } }
