/* Jungle Haus hero: a scroll move into the laptop. Lane E - hero, 2026-10-18; Lane A - hero and Lane C - hero laptop fit, 2026-10-19;
   into the site by Lane B - hero into the site, 2026-10-20 (storyboard controls removed).
   Built on the design system's tokens and components; only hero pieces here.
   Without motion (reduced motion, no script) the hero is one still screen
   and the idea section follows as an ordinary light band. */

/* The design system's .jh-hero gives the header its "over image" state;
   its own layout and shade are replaced here. */
.jh-hero.hx { display: block; min-height: 0; overflow: visible; background: none; isolation: auto; }
.jh-hero.hx::before { display: none; }

.hx-stage {
  position: relative; overflow: hidden; isolation: isolate;
  height: 100vh; height: 100svh; min-height: 560px;
  background: var(--hero-base); color: var(--text-on-image);
}
/* In motion the stage covers the large viewport (Safari's bars hidden), so
   no light strip shows under the scene when the bars slide away; with
   them showing, its bottom sits under the bottom bar. hero.js lays the
   settled screen and the words out on the small viewport, so they stay
   clear of the bar (#115, build 4, option A). */
.hx-motion .hx-track { height: calc(100lvh + var(--hx-length, 450svh)); }
.hx-motion .hx-stage { position: sticky; top: 0; height: 100lvh; }

/* Layers: placed and moved by hero.js (transform only, from 0 0). */
.hx-scene { position: absolute; inset: 0; z-index: 0; }
.hx-layer { position: absolute; left: 0; top: 0; display: block; transform-origin: 0 0; will-change: transform, opacity; overflow: visible; }
/* The focus blur is set once (hero.js, #75); this eases it in. */
.hx-layer { transition: filter .3s var(--ease-out); }



/* Mist over the far landscape only: it sits between the background and the
   set inside the scene, so the furniture stays clear. */
.hx-mist {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(180deg, rgb(237 242 239 / .0) 0%, rgb(237 242 239 / .55) 55%, rgb(237 242 239 / .35) 100%);
}
/* The soft shade that holds the words at 4.5:1 over the sky. It and the
   head shade keep a layer of their own from the first paint (#148): without
   one, Chrome gives the shade a new layer only when the scene's photos
   appear under it, and shows that frame before the new layer is drawn (the
   sky with no shade, then a band of shade over its top third). */
.hx-shade, .hx-headshade { will-change: opacity; }
.hx-shade {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 50% 30%, rgb(var(--hero-shade) / .45), rgb(var(--hero-shade) / 0) 70%),
    linear-gradient(180deg, rgb(var(--hero-shade) / .6) 0%, rgb(var(--hero-shade) / .35) 40%, rgb(var(--hero-shade) / 0) 62%);
}
/* Once the words have gone, this keeps the clear header readable over the
   bright, misty sky until the light page takes over. */
.hx-headshade {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2; height: 200px; pointer-events: none; opacity: 0;
  background: linear-gradient(180deg, rgb(var(--hero-shade) / .65) 0%, rgb(var(--hero-shade) / .45) 45%, rgb(var(--hero-shade) / 0) 100%);
}
/* On phones the words sit lower against the horizon's glow: a deeper shade. */
@container jh (max-width: 520px) {
  .hx-shade {
    background:
      radial-gradient(ellipse 70% 50% at 50% 30%, rgb(var(--hero-shade) / .45), rgb(var(--hero-shade) / 0) 70%),
      linear-gradient(180deg, rgb(var(--hero-shade) / .6) 0%, rgb(var(--hero-shade) / .52) 42%, rgb(var(--hero-shade) / 0) 64%);
  }
}
.hx-copy { position: relative; z-index: 3; will-change: transform, opacity; }
.hx-copy.jh-hero-copy { padding-bottom: 0; }
.hx-light { position: absolute; inset: 0; z-index: 4; background: var(--canvas); opacity: 0; pointer-events: none; }

/* Arrival: the scene settles and the words rise, once. */
.hx-motion .hx-scene { animation: hx-settle 1.4s var(--ease-out) both; }
.hx-copy > * { animation: hx-rise var(--duration-reveal, .8s) var(--ease-out) both; }
.hx-copy > :nth-child(2) { animation-delay: 90ms; }
.hx-copy > :nth-child(3) { animation-delay: 180ms; }
@keyframes hx-settle { from { transform: scale(1.03); } }
/* Lane F storyboard 1: the headline is at full contrast from the first
   frame, so the words rise without fading in. */
@keyframes hx-rise { from { transform: translateY(16px); } }

/* ---------- The idea, with the website from the screen ---------- */
.hx-end-inner {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: var(--space-64, 64px); align-items: center;
  max-width: var(--page-max); margin-inline: auto; padding: 0 var(--gutter);
}
.hx-end-inner > .hx-screen { order: 2; }
.hx-idea .jh-h2 { margin: 0; }
.hx-idea-body { margin-top: var(--space-24); display: grid; gap: var(--space-12); color: var(--text-muted); font-size: var(--text-body-lg, 1.125rem); }
.hx-idea-body p { margin: 0; }
@container jh (max-width: 760px) {
  .hx-end-inner { grid-template-columns: 1fr; gap: var(--space-40, 40px); }
  .hx-end-inner > .hx-screen { order: 0; }
}
/* Without motion on phones, the screen is 4:5, as the moving one settles
   (review 10-25, R5): the sample's phone layout, readable. */
@media (max-width: 699px) { html:not(.hx-motion) .hx-screen { aspect-ratio: 4 / 5; } }

/* In motion the section rides inside the stage, above the light. */
.hx-motion .hx-stage > .hx-end { position: absolute; inset: 0; z-index: 5; padding: 0; background: none; pointer-events: none; }
.hx-motion .hx-stage > .hx-end .hx-end-inner { display: block; max-width: none; padding: 0; height: 100%; }
/* No will-change here: with it the browser draws the screen once, small,
   and stretches that copy as the camera moves in, so its words and the
   symbol go soft (Business, 10-23). Without it they are redrawn sharp. */
.hx-motion .hx-stage > .hx-end .hx-screen { position: absolute; left: 0; top: 0; width: 1200px; transform-origin: 0 0; }
.hx-motion .hx-stage > .hx-end .hx-idea { position: absolute; pointer-events: auto; opacity: 0; will-change: transform, opacity; }

/* The section after the hero. The stage covers the large viewport (above),
   so it is taller than the small one by the bars' height (0 outside
   Safari). The first section after the hero (hero.js has moved the idea
   into the stage) starts that much higher, under the stage's empty light
   bottom, so "Two ways we help" sits where it did with the small-viewport
   stage. (An older --hx-tail rule here never matched, because a <style>
   sits between the hero and that section; #121 removed it.)
   560px is the stage's min-height: where it holds the stage (a phone on
   its side), both heights are 560 and nothing moves. */
.hx-motion .hx ~ section:first-of-type { margin-top: calc(max(560px, 100svh) - max(560px, 100lvh)); }

/* ---------- The screen: a small website, drawn in code ---------- */
/* Sized in container units, so it is sharp at any size. Its shape is
   laptop-v2's display (1093.88 × 597 at the bottom edge). In the laptop the
   top corners are round and the bottom ones square; hero.js sets both. */
.hx-screen {
  position: relative; container-type: inline-size; margin: 0; aspect-ratio: 1093.88 / 597;
  border-radius: var(--hx-radius, 1.2cqw) var(--hx-radius, 1.2cqw) var(--hx-radius-b, var(--hx-radius, 1.2cqw)) var(--hx-radius-b, var(--hx-radius, 1.2cqw));
  overflow: hidden; background: #000; box-shadow: var(--hx-shadow, none);
}
/* The screen's site (#75): one made-up site's whole homepage as inline SVG,
   at the screen's width from its top; the screen shows as much as its shape
   allows (the taller 4:5 phone screen shows more). Once settled, hero.js
   scrolls it with a transform. geometricPrecision: the browser lays its text
   out once and scales it, instead of shaping it again at each size as the
   camera moves, which made the letters jump. */
.hx-still {
  position: absolute; left: 0; top: 0; display: block; width: 100%; height: auto;
  text-rendering: geometricPrecision;
}
/* Drawn as its own layer only while settled, so the camera move still
   redraws it sharp at each size. */
.hx-scrolling .hx-still { will-change: transform, opacity; }

/* Pause/Play for the settled screen's scrolling: the websites loop's button
   (Loop.astro, .loop-pp), at the screen's bottom corner (hero.js places it):
   bottom left at 900 px and wider, bottom right below. With motion only. */
.hx-pp {
  position: absolute; left: 0; top: 0; z-index: 3;
  display: grid; place-items: center; width: var(--target, 48px); height: var(--target, 48px);
  padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--neutral-0, #fff); color: var(--neutral-ink, #202822);
  box-shadow: 0 2px 8px rgb(23 28 27 / .14), inset 0 0 0 var(--stroke-hairline, 1px) var(--hairline, #d4ddd7);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: box-shadow .2s, opacity .3s var(--ease-out), visibility 0s .3s;
}
.hx-pp[hidden] { display: none; }
.hx-end.is-settled .hx-pp { opacity: 1; visibility: visible; pointer-events: auto; transition: box-shadow .2s, opacity .3s var(--ease-out); }
.hx-pp:hover { box-shadow: 0 3px 12px rgb(23 28 27 / .2), inset 0 0 0 var(--stroke-hairline, 1px) var(--hairline, #d4ddd7); }
.hx-pp:focus-visible { outline: var(--stroke-focus, 2px) solid var(--focus); outline-offset: var(--focus-offset, 3px); }
.hx-pp svg { width: 16px; height: 16px; fill: currentColor; }
.hx-pp .hx-icon-play, .hx-pp[data-state="paused"] .hx-icon-pause { display: none; }
.hx-pp[data-state="paused"] .hx-icon-play { display: inline; }


@media (prefers-reduced-motion: reduce) {
  .hx-scene, .hx-copy > * { animation: none !important; }
}
