/* ------------------------------------------------------------------
   Everhaven immersive hero (v2, Nov 2026)
   Sits on top of hero.css. Same forest, same words, same buttons.

   The moving forest is drawn by hero-immersive.js on .hero-canvas.
   Underneath it is the plain photo, which is what people see if the
   canvas cannot run, on Save-Data, or with "reduce motion" turned on.

   --p is how far the hero has been scrolled (0 to 1), set by the script.
   ------------------------------------------------------------------ */

.hero-immersive {
  --p: 0;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  isolation: isolate;
  background: #eef2ea;            /* the instant before the photo paints */
}

.hero-immersive .hero-bg { overflow: hidden; }

/* The still photo (fallback and first paint). */
.hero-immersive .hero-bg-img {
  background-image: url("assets/forest.jpg");
  background-image: image-set(url("assets/forest.webp") type("image/webp"), url("assets/forest.jpg") type("image/jpeg"));
  background-position: center top;
  background-size: cover;
  background-repeat: no-repeat;
  transform: scale(1.04);
  transform-origin: 50% 66%;
}

/* The living forest. Fades in over the photo once the first frame is drawn. */
.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 1.1s ease;
  /* linger a little as the page scrolls, so the forest feels far away */
  transform: translate3d(0, calc(var(--p) * 26%), 0);
  will-change: transform, opacity;
}
.hero-immersive.is-alive .hero-canvas { opacity: 1; }

/* Morning mist that lifts once, as the page arrives. */
.hero-veil {
  position: absolute;
  inset: 0;
  background: #fafbf9;
  opacity: 0;
  pointer-events: none;
  animation: hero-veil-lift 2.6s cubic-bezier(.3, 0, .2, 1) both;
}
@keyframes hero-veil-lift {
  from { opacity: .72; }
  to   { opacity: 0; }
}

/* Bottom of the forest melts into the page. */
.hero-immersive .hero-bg::after {
  background: linear-gradient(180deg, rgba(250, 251, 249, 0) 62%, rgba(250, 251, 249, .55) 82%, rgba(250, 251, 249, .93) 94%, #fafbf9 100%);
  z-index: 2;
}

/* --- The words ------------------------------------------------------ */
.hero-immersive .hero-content {
  z-index: 3;
  transform: translate3d(0, calc(var(--p) * -46px), 0);
  opacity: clamp(0, calc(1.32 - var(--p) * 1.9), 1);
}
.hero-immersive .hero-tagline { color: #46603c; }             /* 6.4:1 on the light */
.hero-immersive .hero-tagline::before,
.hero-immersive .hero-tagline::after { opacity: .75; transform-origin: 100% 50%; }
.hero-immersive .hero-tagline::after { transform-origin: 0 50%; }
.hero-immersive .hero-subtitle,
.hero-immersive .hero-phone { color: #454944; }                /* stays above 4.5:1 over the trees */
.hero-immersive h1 { text-wrap: balance; }

.hero-immersive .btn { transition: transform .35s var(--ease-out), box-shadow .35s ease, background-color .25s ease, border-color .25s ease; }
.hero-immersive .btn-primary { box-shadow: 0 10px 30px -10px rgba(60, 86, 50, .55), 0 2px 6px rgba(47, 66, 45, .12); }
.hero-immersive .btn-primary:hover { box-shadow: 0 16px 36px -12px rgba(60, 86, 50, .6), 0 3px 8px rgba(47, 66, 45, .14); }
.hero-immersive .btn-outline { background: rgba(255, 255, 255, .78); border-color: var(--sage); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.hero-immersive .btn-outline:hover { background: #fff; transform: translateY(-2px); box-shadow: 0 12px 28px -14px rgba(47, 66, 45, .4); }
.hero-immersive .btn:active { transform: translateY(0) scale(.985); transition-duration: .08s; }

/* One arrival, once: the words come out of the mist, line by line. */
.hero-immersive .hero-tagline,
.hero-immersive .hero-line,
.hero-immersive .hero-subtitle,
.hero-immersive .hero-actions,
.hero-immersive .hero-phone {
  animation: hero-arrive 1.5s var(--ease-out) both;
}
.hero-immersive .hero-tagline  { animation-delay: .25s; }
.hero-immersive .hero-line:nth-child(1) { animation-delay: .45s; }
.hero-immersive .hero-line:nth-child(2) { animation-delay: .68s; }
.hero-immersive .hero-subtitle { animation-delay: .98s; }
.hero-immersive .hero-actions  { animation-delay: 1.18s; }
.hero-immersive .hero-phone    { animation-delay: 1.36s; }
.hero-immersive .hero-tagline::before,
.hero-immersive .hero-tagline::after { animation: hero-rule 1.3s var(--ease-out) .55s both; }

@keyframes hero-arrive {
  from { opacity: 0; transform: translate3d(0, 22px, 0); filter: blur(10px); }
  60%  { filter: blur(0); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes hero-rule {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* --- Scroll cue ----------------------------------------------------- */
.hero-cue {
  position: absolute;
  z-index: 3;
  bottom: 30px;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 48px;
  padding: 8px 14px 0;
  color: #46603c;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  transform: translateX(-50%);
  opacity: clamp(0, calc(1 - var(--p) * 5), 1);
  animation: hero-cue-in 1.2s ease 2.1s backwards;
}
.hero-cue::after {
  content: '';
  width: 1px;
  height: 38px;
  background: linear-gradient(180deg, #5c7a4e, rgba(92, 122, 78, 0));
  transform-origin: 50% 0;
  animation: hero-cue-line 3.2s cubic-bezier(.6, 0, .3, 1) infinite;
}
@keyframes hero-cue-in { from { opacity: 0; } }
@keyframes hero-cue-line {
  0%   { transform: scaleY(0); opacity: 0; }
  35%  { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1) translateY(14px); opacity: 0; }
}

/* --- Phones --------------------------------------------------------- */
@media (max-width: 680px) {
  .hero-immersive .hero-bg-img {
    background-image: url("assets/forest-960.jpg");
    background-image: image-set(url("assets/forest-960.webp") type("image/webp"), url("assets/forest-960.jpg") type("image/jpeg"));
    background-position: 24% top;
  }
  .hero-immersive .hero-tagline { color: #3d5534; }
  .hero-immersive .hero-content { transform: translate3d(0, calc(var(--p) * -28px), 0); }
  .hero-cue { display: none; }
}
@media (max-height: 720px) {
  .hero-cue { display: none; }
}

/* --- Reduced motion: a still forest, nothing hidden ------------------ */
@media (prefers-reduced-motion: reduce) {
  .hero-immersive { --p: 0 !important; }
  .hero-canvas, .hero-veil { display: none; }
  .hero-immersive .hero-content { transform: none; opacity: 1; }
  .hero-immersive .hero-tagline,
  .hero-immersive .hero-line,
  .hero-immersive .hero-subtitle,
  .hero-immersive .hero-actions,
  .hero-immersive .hero-phone,
  .hero-immersive .hero-tagline::before,
  .hero-immersive .hero-tagline::after,
  .hero-cue { animation: none; opacity: 1; transform: none; filter: none; }
  .hero-cue { transform: translateX(-50%); }
  .hero-cue::after { animation: none; }
  .hero-immersive .btn { transition: none; }
}

/* Windows High Contrast and similar: drop the decoration. */
@media (forced-colors: active) {
  .hero-canvas, .hero-veil { display: none; }
}
