/* =====================================================================
   Hoot v2 · scene.css (owner: scene builder)
   The dusk hero (illustrated, layered inline SVG) and the reusable
   night / dawn scene bands. Uses base.css tokens; every class is h-*.
   Static state = final, fully visible state. Entrance animations are
   written only under html.motion-ready; base.css stops every animation
   under html.motion-off and prefers-reduced-motion.
   ===================================================================== */

/* ---------- Hero frame ---------- */
body.v2 .h-hero {
  --h-land-h: clamp(300px, 46vw, 560px);
  position: relative;
  z-index: 0;
  isolation: isolate;
  overflow: clip;
  background: var(--h-bg);
  margin-top: calc(var(--h-nav-h) * -1);   /* sky starts behind the sticky nav */
  padding-top: var(--h-nav-h);
}

/* ---------- Scene (decorative, behind the content) ---------- */
body.v2 .h-hero__scene {
  position: absolute; inset: 0;
  z-index: var(--h-z-scene);
  isolation: isolate;
  pointer-events: none;
}
body.v2 .h-hero__sky { position: absolute; inset: 0; background: var(--h-sky-dusk); }
body.v2 .h-hero__layer { position: absolute; left: 0; right: 0; bottom: 0; height: var(--h-land-h); z-index: 1; will-change: transform; }
body.v2 .h-hero__layer--sky { top: 0; height: auto; }
body.v2 .h-hero__depth { position: absolute; inset: 0; }
body.v2 .h-hero__land { position: absolute; left: 0; bottom: 0; width: 100%; height: 100%; overflow: visible; display: block; }
body.v2 .h-hero__dim { position: absolute; inset: 0; z-index: 2; background: var(--h-bg); opacity: calc(var(--h-hero-p, 0) * .5); }

/* Hand-drawn strokes */
body.v2 :is(.h-hero__rim, .h-band__rim) { fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body.v2 .h-hero__rim { stroke: var(--h-dusk-rim); }
body.v2 .h-hero__rim--soft { stroke: rgba(242, 178, 122, .28); }
body.v2 .h-hero__hatch { fill: none; stroke-width: 1.5; stroke-linecap: round; }
body.v2 :is(.h-hero__tuft, .h-band__tuft) { fill: none; stroke-width: 2; stroke-linecap: round; }
body.v2 .h-hero__tuft { stroke: #262f3e; }
body.v2 .h-band__tuft { stroke: #2b4049; }

/* Stars (4-point sparkles and dots; upper 40% of the sky) */
body.v2 .h-hero__stars { position: absolute; inset: calc(var(--h-nav-h) + 8px) 0 auto 0; height: calc(48% - var(--h-nav-h)); } /* integrator: keep stars out of the nav strip */
body.v2 .h-hero__star { position: absolute; width: var(--s); height: var(--s); fill: var(--h-star); filter: none; }
body.v2 .h-hero__star--honey { fill: var(--h-honey); }
body.v2 .h-hero__star--dot { border-radius: 50%; background: var(--h-star); box-shadow: 0 0 6px rgba(232, 237, 255, .6); }
/* phones and small tablets: the star box spans the copy column, so the stars that would land on the eyebrow,
   title or lede are hidden and two move into the clear sky right of the title / above the eyebrow */
@media (max-width: 719px) {
  body.v2 .h-hero__stars > :is(:nth-child(1), :nth-child(2), :nth-child(5), :nth-child(7)) { display: none; }
  body.v2 .h-hero__stars > :nth-child(3) { left: 74% !important; top: 14% !important; }
  body.v2 .h-hero__stars > :nth-child(4) { left: 62% !important; top: 2% !important; }
}

/* Shooting star: invisible at rest, crosses the upper sky once every ~17s */
body.v2 .h-hero__shooting {
  position: absolute; left: 74%; top: 9%;
  width: 130px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(232, 237, 255, 0), rgba(232, 237, 255, .9));
  transform: rotate(-24deg); transform-origin: 100% 50%;
  opacity: 0;
}
html.motion-ready body.v2 .h-hero__shooting { animation: h-scene-shoot 17s linear 4s infinite; }
@keyframes h-scene-shoot {
  0%, 93% { opacity: 0; transform: rotate(-24deg) translateX(0) scaleX(.3); }
  94% { opacity: 1; transform: rotate(-24deg) translateX(-20px) scaleX(1); }
  98%, 100% { opacity: 0; transform: rotate(-24deg) translateX(-300px) scaleX(.6); }
}

/* ---------- Content ---------- */
body.v2 .h-hero__inner {
  position: relative; z-index: var(--h-z-content);
  display: flex; flex-direction: column;
  padding-top: clamp(40px, 9vw, 72px);
}
body.v2 .h-hero__copy { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: var(--h-s-5); max-width: 640px; }
body.v2 .h-hero__eyebrow { color: var(--h-ink-soft); }
body.v2 .h-hero__title { color: var(--h-ink); max-width: 12ch; }
body.v2 .h-hero__title .h-underline__svg { bottom: -.06em; }
body.v2 .h-hero__lede { color: var(--h-ink-soft); max-width: 40ch; }
body.v2 .h-hero__actions { display: flex; flex-wrap: wrap; gap: var(--h-s-3); margin-top: var(--h-s-2); }
body.v2 .h-hero__trust { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--h-ink-soft); font-size: var(--h-fs-small); font-weight: 500; }
body.v2 .h-hero__trust li { display: inline-flex; align-items: center; gap: 8px; }
body.v2 .h-hero__trust svg { width: 18px; height: 18px; color: var(--h-mint); flex: none; }

/* ---------- Art column: moon, stickers, painted tree + owl ---------- */
/* The tree is the oil-painted branch from Fable Wings (/assets/v2/paint/branch-perch.webp), drawn inside
   .h-hero__perch-art at the README rule: feet on the bough, scale = owl box / 134.4, mirrored so the trunk is on
   the right. .h-hero__tree-clip only fades the top of the painting (under the nav on desktop, below the sticker
   shelf on phones and tablets); the fade always ends well above the owl, so the owl is never faded or covered.
   Phones and tablets stack: sticker shelf (clear sky) > tree region (fixed height so the owl keeps its size and
   place) . Desktop: copy left, tree right, stickers in a ring of clear sky around the owl. */
body.v2 .h-hero__art {
  --h-box-w: min(116vw, 620px);                        /* perch box width (phones), see .h-hero__perch */
  --h-tree-h: calc(var(--h-box-w) * .855 + 92px);     /* owl top sits .675 of the box height above the bottom */
  position: relative;
  display: flex; flex-direction: column;
  margin-top: var(--h-s-6);
  margin-inline: calc(var(--h-gutter) * -1);
  pointer-events: none;
}
/* scene.js sets --h-art-cut while the page scrolls: everything in the art column above the nav's bottom edge is clipped
   off, so the owl, the tree and the stickers never show over or through the nav glass. Negative insets on the other
   three sides keep the bough, the trunk and the tree base (which run outside this box) untouched. */
body.v2 .h-hero__art.is-cut { clip-path: inset(var(--h-art-cut, 0px) -100vw -100vh -100vw); }
body.v2 .h-hero__moon-wrap { position: absolute; left: 2vw; bottom: calc(var(--h-tree-h) - 44vw); width: 40vw; aspect-ratio: 1; z-index: 0; }
body.v2 .h-hero__moon { width: 100%; height: 100%; overflow: visible; }

body.v2 .h-hero__tree-clip {
  position: relative; z-index: 1;
  height: calc(var(--h-tree-h) + 240px); margin-bottom: -240px;   /* the box runs on under the hero's own clip, so */
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 72px);   /* only the top edge fades */
  mask-image: linear-gradient(180deg, transparent 0, #000 72px);
}
body.v2 .h-hero__perch {
  position: absolute; right: -16%; bottom: 240px;
  width: min(116%, 620px); aspect-ratio: 600 / 760;
  z-index: 1;
}
body.v2 .h-hero__perch-art { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
body.v2 .h-hero__owl {
  position: absolute; left: 14%; top: 32.5%; width: 40%; aspect-ratio: 1;
  z-index: var(--h-z-owl);
  pointer-events: auto;
}
body.v2 .h-hero__owl > :is(svg, img) { display: block; width: 100%; height: 100%; }

body.v2 .h-hero__fireflies { position: absolute; left: -10%; right: 10%; top: 50%; bottom: 8%; }
body.v2 .h-hero__firefly {
  position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: var(--h-mint); box-shadow: 0 0 8px 2px rgba(130, 221, 209, .55);
}
body.v2 .h-hero__firefly--honey { background: var(--h-honey); box-shadow: 0 0 8px 2px rgba(255, 198, 92, .55); }

/* Two real popups (r22): the to-do list behind, a running Pomodoro in front. They move with the tree (same scroll
   parallax and pointer depth) and never cover the owl. Phones and tablets: a shelf of clear sky above the tree that
   overlaps the top of the tree region a little; under 900px only the running popup shows. Desktop: placed from the
   perch box like the old stickers (box %), front popup left of the owl, back popup above its head. */
body.v2 .h-hero__shots { position: relative; z-index: 2; margin-bottom: -72px; }
body.v2 .h-hero__shotbox.h-hero__depth { position: relative; inset: auto; }
body.v2 .h-hero__shotbox { display: flex; justify-content: center; align-items: flex-start; gap: 0; padding: 0 var(--h-gutter); }
body.v2 .h-hero__shot { display: block; flex: none; width: min(240px, 64vw); pointer-events: auto; }
body.v2 .h-hero__shot img {
  display: block; width: 100%; height: auto;
  border-radius: 22px;
  border: 1px solid rgba(207, 216, 255, .16);
  box-shadow: 0 0 0 1px rgba(16, 19, 24, .6), 0 24px 48px -16px rgba(0, 0, 0, .65), 0 0 46px -6px rgba(148, 169, 255, .34);
  background: #12151c;
}
body.v2 .h-hero__shot--front img { transform: rotate(3deg); }
body.v2 .h-hero__shot--back img { transform: rotate(-4deg); }
body.v2 .h-hero__shot--back { display: none; }
html.motion-ready body.v2 .h-hero__shot { animation: h-scene-shot .9s var(--h-ease-out) both; }
html.motion-ready body.v2 .h-hero__shot--back { animation-delay: .5s; }
html.motion-ready body.v2 .h-hero__shot--front { animation-delay: .7s; }
@keyframes h-scene-shot { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }

/* ---------- Foreground (grass) covers the tree base; ends on #101318 ---------- */
body.v2 .h-hero__fg {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--h-land-h);
  z-index: 4; pointer-events: none;
}
body.v2 .h-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--h-bg); z-index: 5; }

/* ---------- Entrances (motion-ready only) ---------- */
html.motion-ready body.v2 .h-hero__copy > * { animation: h-scene-rise var(--h-dur-4) var(--h-ease-out) both; }
html.motion-ready body.v2 .h-hero__copy > :nth-child(1) { animation-delay: .1s; }
html.motion-ready body.v2 .h-hero__copy > :nth-child(2) { animation-delay: .2s; }
html.motion-ready body.v2 .h-hero__copy > :nth-child(3) { animation-delay: .34s; }
html.motion-ready body.v2 .h-hero__copy > :nth-child(4) { animation-delay: .46s; }
html.motion-ready body.v2 .h-hero__copy > :nth-child(5) { animation-delay: .58s; }
html.motion-ready body.v2 .h-hero__title .h-draw { animation: h-scene-ink var(--h-dur-draw) var(--h-ease-in-out) .9s both; }
html.motion-ready body.v2 .h-hero__moon { animation: h-scene-moonrise 1.6s var(--h-ease-out) .15s both; }      /* Moonrise */
/* The painting fades in where it stands (no slide), so the owl's feet are on the bough at every frame.
   The owl itself is not animated here: /assets/owl-web/ pops it in. */
html.motion-ready body.v2 .h-hero__paint { animation: h-scene-paint 1.1s var(--h-ease-out) .2s both; }
html.motion-ready body.v2 .h-hero__layer--far .h-hero__land { animation: h-scene-land 1.4s var(--h-ease-out) both; }
html.motion-ready body.v2 .h-hero__layer--mid .h-hero__land { animation: h-scene-land 1.4s var(--h-ease-out) .08s both; }
html.motion-ready body.v2 .h-hero__layer--near .h-hero__land { animation: h-scene-land 1.4s var(--h-ease-out) .16s both; }
@keyframes h-scene-rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes h-scene-ink { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes h-scene-moonrise { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes h-scene-paint { from { opacity: 0; } to { opacity: 1; } }
@keyframes h-scene-land { from { transform: translateY(28px); } to { transform: none; } }

/* Pause loops off screen (scene.js) and while the tab sleeps (owl-motion.js) */
body.v2 :is(.h-hero, .h-scene-band, .h-band, .h-cta, .h-lower, .h-footer).h-scene-paused *,
html.owl-sleep body.v2 :is(.h-hero, .h-scene-band, .h-band, .h-cta, .h-lower, .h-footer) * { animation-play-state: paused !important; }

/* ---------- Tablet ---------- */
@media (min-width: 600px) {
  body.v2 .h-hero__art { --h-box-w: min(78vw, 600px); }
  body.v2 .h-hero__perch { right: -6%; width: min(78%, 600px); }
  body.v2 .h-hero__moon-wrap { left: 4%; bottom: calc(var(--h-tree-h) - 230px); width: 220px; }
}
@media (min-width: 900px) and (max-width: 1023.98px) {
  body.v2 .h-hero__shot--back { display: block; margin-right: -28px; margin-top: 18px; }
  body.v2 .h-hero__shot { width: 230px; }
}

/* ---------- Desktop: copy left, tree + owl right ---------- */
@media (min-width: 1024px) {
  body.v2 .h-hero {
    min-height: clamp(680px, 100svh, 920px);
    /* the perch box: the same size as before at the hero's own height, and it never grows when the copy makes
       the hero taller, so the owl keeps its approved size */
    --h-box-h: min(.86 * (clamp(680px, 100svh, 920px) + var(--h-nav-h)), 64vw);
  }
  body.v2 .h-hero__inner {
    min-height: inherit; padding-top: clamp(64px, 11vh, 120px);
    padding-bottom: max(120px, calc(var(--h-box-h) * .3 + 24px));   /* the copy always ends above the bough line */
  }
  body.v2 .h-hero__copy { width: min(600px, 50vw - var(--h-gutter) - 24px); }
  body.v2 .h-hero__title { font-size: min(var(--h-fs-display), 6.2vw); }
  body.v2 .h-hero__art {
    position: absolute; left: 50%; right: calc(var(--h-gutter) * -1 - max(0px, (100vw - var(--h-max) - 2 * var(--h-gutter)) / 2));
    top: calc(var(--h-nav-h) * -1); bottom: 0;
    display: block; height: auto; margin: 0;
  }
  /* perch, moon and stickers share one box, so they keep their places around the owl at every width */
  body.v2 :is(.h-hero__perch, .h-hero__moon-wrap, .h-hero__shots) {
    position: absolute; left: auto; top: auto; right: -40px; bottom: 0;
    height: var(--h-box-h); width: auto; aspect-ratio: 600 / 760;
  }
  /* the trunk runs up under the nav: it fades out just below the nav line, so nothing paints behind nav text
     and the nav glass stays readable; the box reaches far left so the bough's own fade is never cut */
  body.v2 .h-hero__tree-clip {
    position: absolute; inset: 0; left: -60vw; height: auto; margin: 0;
    -webkit-mask-image: linear-gradient(180deg, transparent calc(var(--h-nav-h) - 4px), #000 calc(var(--h-nav-h) + 64px));
    mask-image: linear-gradient(180deg, transparent calc(var(--h-nav-h) - 4px), #000 calc(var(--h-nav-h) + 64px));
  }
  body.v2 .h-hero__moon-wrap > .h-hero__depth { inset: auto; left: -1.6%; top: -11.8%; width: 44%; aspect-ratio: 1; }   /* disc centre at 20.4% */
  body.v2 .h-hero__shots { margin: 0; }
  body.v2 .h-hero__shotbox.h-hero__depth { position: absolute; inset: 0; display: block; padding: 0; }
  body.v2 .h-hero__shot { position: absolute; }
  /* 1024-1279: one popup, the running one, in the clear sky above the owl's head (left of the box's leaves) */
  body.v2 .h-hero__shot--front { width: 31%; left: 0; top: -7%; }
}


/* 1280 and up: both popups. Front (running) stands left of the owl, its bottom above the bough; back (to-do list)
   sits above the owl's head, so the moon shows between them. Sizes are % of the perch box width. */
@media (min-width: 1280px) {
  body.v2 .h-hero__shot--front { width: 36.5%; left: -18.5%; top: 10%; }
  body.v2 .h-hero__shot--back { display: block; width: 30%; left: 24%; top: -1%; }
}

/* =====================================================================
   Scene bands (<!-- band:night --> and <!-- band:dawn --> in hero.html)
   base.css gives .h-band its frame; these set the sky and the strokes.
   ===================================================================== */
body.v2 .h-scene-band .h-band__sky { background: var(--h-sky-night); }
body.v2 .h-band--dawn .h-band__sky { background: var(--h-sky-dawn); }
body.v2 .h-scene-band .h-band__art svg { overflow: hidden; }
body.v2 .h-scene-band .h-band__sunglow { transform-box: fill-box; transform-origin: 50% 50%; }
html.motion-ready body.v2 .h-band--dawn .h-band__sunglow { animation: h-glow-pulse 7s var(--h-ease-in-out) infinite; }

/* 1024-1179: the copy column is narrow, so the two hero buttons slim down a little to share one row */
@media (min-width: 1024px) and (max-width: 1179px) {
  body.v2 .h-hero__actions { gap: 10px; }
  body.v2 .h-hero__actions .h-btn--lg { padding-inline: 22px; }
}

/* r22 fix: 1024-1279 shows the to-do list too (smaller pair), so both stars are on the first screen */
@media (min-width: 1024px) and (max-width: 1279.98px) {
  body.v2 .h-hero__shot--front { width: 28%; left: -4%; top: 4%; }
  body.v2 .h-hero__shot--back { display: block; width: 25%; left: 26%; top: -9%; }
}
