/* ─── HOME: the hero photograph + the sideways rail (inc/home-rail.php, assets/js/home-rail.js) ─────────────
   jb 2026-11-12. Tokens only: no hex, radius 0. THE GUTTER is --cao-frame (10px, 8px under 768px): the white frame on the page's sides, the
   gap between cards, the room above the cards when the rail pins, and the room below the captions. Front page only (enqueued by inc/home-rail.php). */

/* ─── Hero + the ORIGINALS. / COMMUNIQUE. bands (round 2): ONE photograph each, full width at its NATURAL ratio (never cropped to the
   screen, no fixed height). The box carries the ratio inline (inc/home-rail.php), so it is reserved before the file arrives (CLS 0);
   a photograph missing from the library is a grey box of that ratio. The word holds over it (home.css .cao-hold). ─── */
.home-hero__frame,
.home-band__frame { position: relative; }
.home-hero__media,
.home-band__media { display: block; overflow: hidden; background: var(--cao-studio); }
.home-hero__img,
.home-band__img { display: block; width: 100%; height: auto; }
.home-hero__media picture,
.home-band__media picture { display: contents; } /* PERF v1: the width ladder's <picture> (inc/hero-picture.php) draws no box of its own */
.home-hero__media > .pc-none,
.home-band__media > .pc-none { display: block; width: 100%; }
/* ─── Hero box on a DESKTOP (0.1.35): a viewport-height LANDSCAPE box, not the photograph's 3:4. The film is 16:9; in a 3:4 box (1420x1893 css px at 1440) `cover`
   cropped it to its middle 42% and magnified it 3.5x on a Retina screen. ONE rule gives the frame, the media, the <picture> and the <img> the SAME height, so the still
   and the film share ONE box and nothing shifts when the film starts. Same 820px line as the loader (inc/hero-video.js, the loader's phone list). Phones, portrait and narrow
   windows are NOT in this block: they keep the inline natural 3:4 (round 2) exactly.
   --cao-hero-h  the box: the screen less the white frame top and bottom, floored at 34vw so a very short window (a laptop with a toolbar and a dock) still gets a ~16:9-ish band, not a strip.
   --cao-hero-focus  where the still sits in that band: jb's portrait (the man's head and the brown bag sit around 38% down). ONE value to change. ─── */
.home-hero { --cao-hero-focus: 50% 38%; }
@media (min-width: 821px) and (orientation: landscape) {
  .home-hero { --cao-hero-h: max(calc(100vh - 2 * var(--cao-frame)), 34vw); --cao-hero-h: max(calc(100svh - 2 * var(--cao-frame)), 34vw); }
  .home-hero__frame, .home-hero__media, .home-hero__media picture, .home-hero__img { box-sizing: content-box; height: var(--cao-hero-h); aspect-ratio: auto !important; } /* !important: the media span carries its natural ratio INLINE */
  .home-hero__img { width: 100%; object-fit: cover; object-position: var(--cao-hero-focus); }
}
/* ─── Hero film (inc/hero-video.php + hero-video.js, 0.1.33): over the photograph, which stays the LCP and the fallback. Faded in only on 'playing'.
   No pause / play control (0.1.37): the film autoplays muted on a loop; reduced motion draws neither film nor nav, so that visitor sees exactly the photograph. ─── */
.home-hero__media { position: relative; }
.home-hero__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
/* The first-paint still while a film is configured (0.1.38): a frame of the default film, cropped EXACTLY as the film is (same box, same cover, same position), so the film
   fades in over itself and nothing moves or changes colour. With no poster there is no <img>: the box's flat --cao-studio ground, never the old photograph. */
.home-hero__img--film { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.home-hero__img--film, .home-hero__video { object-position: 50% 50%; }
.home-hero__video.is-playing { opacity: 1; }
/* 0.1.39: NO opacity transition on the film. It appears INSTANTLY, on its first painted frame, which is the poster frame itself: a cross-fade between two different frames was the double exposure. Its from-state (opacity 0) is set by the loader, inline, just before the film starts: no hidden state exists without JS */
/* ─── Hero film NAV (0.1.36): a micro A / B switch bottom-RIGHT at the gutter (CookieYes sits bottom-left, so the right corner is free).
   Printed only with two or more films (inc/hero-video.php), hidden until a film plays, shown for a visitor the film is going to play for. Mono token, no font shorthand;
   hairline buttons, the current one inverted + underlined (state by colour tokens, aria-pressed). The row is --cao-hit tall;
   the buttons look small and keep a 44px target through the ::after (phones). Landscape desktop: roomier padding, nothing else moves. ─── */
.home-hero__films { position: absolute; z-index: 2; right: calc(var(--cao-frame) + var(--cao-space-4)); bottom: calc(var(--cao-frame) + var(--cao-space-4)); display: flex; align-items: center; gap: var(--cao-space-2); height: var(--cao-hit); }
.home-hero__films[hidden] { display: none; }
.home-hero__film { position: relative; box-sizing: border-box; min-width: calc(var(--cao-hit) - var(--cao-space-2)); height: var(--cao-space-6); padding: 0 var(--cao-space-3); border: 1px solid var(--cao-line); border-radius: 0; background: var(--cao-paper); color: var(--cao-ink); font-family: var(--cao-font-mono); font-size: var(--type-action); line-height: 1; letter-spacing: 0.04em; text-transform: uppercase; cursor: pointer; }
.home-hero__film::after { content: ''; position: absolute; inset: calc(-1 * var(--cao-space-2)) calc(-1 * var(--cao-space-1)); } /* the target: 36 x 32 looks small, 44 x 48 is what a thumb gets */
.home-hero__film[aria-pressed="true"] { background: var(--cao-ink); color: var(--cao-paper); border-color: var(--cao-ink); text-decoration: underline; text-underline-offset: var(--cao-space-1); }
@media (min-width: 821px) and (orientation: landscape) { .home-hero__film { padding: 0 var(--cao-space-4); } }
@media (prefers-reduced-motion: reduce) { .home-hero__video, .home-hero__films { display: none; } }
/* COMMUNIQUÉ. is held like ORIGINALS. (round 2): both words hold and rest by home.css's THE HOLD (one rule, jb 2026-11-13). */

/* ─── The rail ───
   --rail-cap   the caption block under a photograph: space-3 above, the NAME · PRICE line, space-1, the HOUSE line (heights set, not guessed)
   --rail-w     one card's width: the panel (gutter + photograph + caption + gutter) fills ONE screen height exactly, at ANY window size (round 2:
                no vw cap; the rail travels further). 1440x900 -> (900 - 20 - 50.35) x 2/3 = 553.1px · 900x900 -> 553.1px · 1920x1080 -> 673.1px.
                The one limit: never wider than the screen less a gutter each side (a portrait phone cannot hold a full-height 2:3 card).
   The pure twin of this formula is assets/js/home-rail.js railCardWidth (tests/themes/cao/home-rail.test.js holds them equal). */
.home-rail {
  --rail-cap: calc(var(--cao-space-3) + var(--type-body) * 1.35 + var(--cao-space-1) + var(--type-meta) * 1.4);
  --rail-w: min(calc(100vw - 2 * var(--cao-frame)), calc((100vh - 2 * var(--cao-frame) - var(--rail-cap)) * 2 / 3));
  background: var(--cao-paper);
}
@supports (height: 100svh) {
  /* svh: the SMALL viewport, so a phone's URL bar showing or hiding never resizes the cards mid-hold */
  .home-rail { --rail-w: min(calc(100vw - 2 * var(--cao-frame)), calc((100svh - 2 * var(--cao-frame) - var(--rail-cap)) * 2 / 3)); }
}

/* the panel: the gutter above and below the cards. Without the pin it is a native sideways swipe row (no JS, reduced motion, a mount that throws). */
.home-rail__pin {
  padding: var(--cao-frame) 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--cao-frame);
  background: var(--cao-paper);
}

.home-rail__track {
  display: flex;
  gap: var(--cao-frame);
  width: max-content;
  margin: 0;
  padding: 0 var(--cao-frame);
  list-style: none;
}

.home-rail__item { flex: none; width: var(--rail-w); scroll-snap-align: start; }

/* the card's caption block, exactly --rail-cap tall (its lines are set heights), so the panel's sum is exact */
.pc--rail .pc-text { box-sizing: border-box; height: var(--rail-cap); padding: var(--cao-space-3) 0 0; overflow: hidden; }
.pc--rail .pc-name,
.pc--rail .pc-price { line-height: calc(var(--type-body) * 1.35); }
.pc--rail .pc-house,
.pc--rail .pc-sold { line-height: calc(var(--type-meta) * 1.4); }
.pc--rail .pc-row--sub { margin-top: var(--cao-space-1); }

/* pinned (assets/js/home-rail.js adds .is-pinned): the panel clips, the track moves (transform only); will-change only while the pin is active */
.home-rail.is-pinned .home-rail__pin { position: sticky; top: 0; overflow: hidden; scroll-snap-type: none; overscroll-behavior-x: auto; }
/* the hold lasts the track's travel: a block after the panel (a sticky box holds only inside its parent's CONTENT, so padding would not do) */
.home-rail.is-pinned::after { content: ""; display: block; height: var(--rail-travel, 0px); }
.home-rail.is-pinned .home-rail__item { scroll-snap-align: none; }
