/* ═══════════════════════════════════════════════════════
   GROWING HERO — scroll-driven plant growth
   Prefixed gh- to avoid conflicts. Uses N&K design tokens.
   ═══════════════════════════════════════════════════════ */

/* ── SCROLL WRAPPER ─────────────────────────────────── */
.growing-hero {
  position: relative;
}
.gh-scroll-wrapper {
  height: 350vh;
  height: 350dvh;
  position: relative;
}

/* ── STICKY STAGE ───────────────────────────────────── */
.gh-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  z-index: 1;
  background:
    radial-gradient(70vw 70vh at 72% 38%,
      rgba(200, 169, 110, calc(0.0 + 0.45 * var(--gh-canopy, 0))),
      transparent 70%),
    radial-gradient(120vw 80vh at 50% 100%,
      var(--c-bg-2) 0%, var(--c-bg) 60%);
  background-attachment: fixed;
}

/* fine grain paper noise */
.gh-stage::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(242, 237, 228, 0.025) 1px, transparent 1.2px),
    radial-gradient(rgba(242, 237, 228, 0.015) 1px, transparent 1.2px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1px 2px;
  z-index: 40;
  mix-blend-mode: screen;
}

/* cinema vignette */
.gh-stage::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,0.4) 100%);
  z-index: 41;
}

.gh-scene {
  position: relative;
  width: 100%; height: 100%;
  transform: scale(calc(1 - 0.05 * (1 - var(--gh-cam, 0))));
  transform-origin: 70% 80%;
  transition: transform 80ms linear;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, black 12%);
  mask-image: linear-gradient(to bottom, transparent 0, black 12%);
}

/* ── CHAPTER MARKER ─────────────────────────────────── */
.gh-chapter {
  position: absolute;
  top: 110px;
  left: 60px;
  z-index: 20;
  display: flex;
  align-items: baseline;
  gap: 22px;
}
.gh-roman {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: var(--fw-light);
  font-size: 64px;
  line-height: 1;
  color: var(--c-brand);
  width: 70px;
  position: relative;
  text-shadow: 0 0 24px rgba(200, 169, 110, 0.55);
  flex-shrink: 0;
}
.gh-roman span {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity 500ms ease;
}
.gh-roman span.is-in { opacity: 1; }
.gh-rule {
  width: 36px; height: 1px;
  background: var(--c-brand);
  opacity: 0.7;
  flex-shrink: 0;
  align-self: center;
}
.gh-label {
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--c-text-2);
  position: relative;
  min-width: 200px;
  height: 14px;
}
.gh-label span {
  position: absolute; left: 0; top: 0;
  opacity: 0;
  transition: opacity 500ms ease;
}
.gh-label span.is-in { opacity: 1; }

/* ── CHAPTER RAIL (right side) ──────────────────────── */
.gh-rail {
  position: absolute;
  right: 60px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  display: flex; flex-direction: column; gap: 24px;
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  letter-spacing: 0.22em;
  color: var(--c-text-3);
}
.gh-ch {
  display: flex; align-items: center; gap: 14px;
  transition: color 300ms ease;
}
.gh-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: 0.4;
  transition: transform 300ms ease, opacity 300ms ease,
              background 300ms ease, box-shadow 300ms ease;
}
.gh-ch.is-on { color: var(--c-text); }
.gh-ch.is-on .gh-dot {
  background: var(--c-brand);
  opacity: 1;
  transform: scale(1.7);
  box-shadow: 0 0 12px rgba(200, 169, 110, 0.55);
}

/* ── HORIZON + SOIL ─────────────────────────────────── */
.gh-horizon {
  position: absolute;
  left: 4%; right: 4%;
  bottom: 14vh;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-brand) 30%, var(--c-brand) 70%, transparent);
  opacity: calc(0.18 + 0.55 * var(--gh-p, 0));
  z-index: 2;
}
.gh-soil {
  position: absolute;
  left: 4%; right: 4%;
  bottom: calc(14vh - 80px);
  height: 80px;
  background:
    repeating-linear-gradient(-78deg,
      rgba(200, 169, 110, 0.10) 0 1px,
      transparent 1px 9px);
  mask-image: linear-gradient(180deg, black 0%, transparent 92%);
  -webkit-mask-image: linear-gradient(180deg, black 0%, transparent 92%);
  opacity: calc(0.5 + 0.5 * var(--gh-trunk, 0));
  z-index: 1;
}

/* ── DRIFTING MOTES ─────────────────────────────────── */
.gh-motes {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 4;
}
.gh-motes i {
  position: absolute;
  width: 3px; height: 3px;
  background: var(--c-brand);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(200, 169, 110, 0.55);
  opacity: calc(0.18 + 0.55 * var(--gh-canopy, 0));
  animation: gh-drift 9s ease-in-out infinite;
}
.gh-motes i:nth-child(2) { animation-duration: 11s; animation-delay: -2s; }
.gh-motes i:nth-child(3) { animation-duration: 13s; animation-delay: -4s; }
.gh-motes i:nth-child(4) { animation-duration: 10s; animation-delay: -1s; }
.gh-motes i:nth-child(5) { animation-duration: 14s; animation-delay: -6s; }
.gh-motes i:nth-child(6) { animation-duration: 12s; animation-delay: -3s; }
.gh-motes i:nth-child(7) { animation-duration: 15s; animation-delay: -5s; }
@keyframes gh-drift {
  0%, 100% { transform: translate(0, 0); }
  50%       { transform: translate(8px, -12px); }
}

/* ── PLANT CONTAINER ────────────────────────────────── */
.gh-plant {
  position: absolute;
  bottom: 14vh;
  left: 72%;
  transform: translateX(-50%) rotate(var(--gh-sway, 0deg));
  transform-origin: bottom center;
  width: 0; height: 0;
  z-index: 3;
}

/* SEED */
.gh-seed {
  position: absolute;
  left: 50%; bottom: -6px;
  width: calc(12px + 30px * var(--gh-seed, 0));
  height: calc(7px + 14px * var(--gh-seed, 0));
  background: var(--c-brand);
  border-radius: 50%;
  transform: translateX(-50%) scaleY(calc(1 - 0.7 * var(--gh-sprout, 0)));
  transform-origin: center bottom;
  opacity: calc(var(--gh-seed, 0) - 0.4 * var(--gh-trunk, 0));
  box-shadow: 0 0 22px rgba(200, 169, 110, 0.55);
}

/* SPROUT */
.gh-sprout {
  position: absolute;
  left: 50%; bottom: 0;
  width: 2px;
  height: calc(2px + 90px * var(--gh-sprout, 0));
  background: var(--c-brand);
  transform: translateX(-50%);
  transform-origin: bottom;
  opacity: calc(var(--gh-sprout, 0) - var(--gh-trunk, 0));
  box-shadow: 0 0 14px rgba(200, 169, 110, 0.55);
}

/* LEAFLETS */
.gh-leaflet {
  position: absolute;
  left: 50%;
  bottom: calc(2px + 78px * var(--gh-sprout, 0));
  width: calc(18px * var(--gh-sprout, 0));
  height: calc(7px * var(--gh-sprout, 0));
  background: var(--c-brand);
  border-radius: 50%;
  opacity: calc(var(--gh-sprout, 0) - var(--gh-trunk, 0));
  box-shadow: 0 0 14px rgba(200, 169, 110, 0.55);
}
.gh-leaflet.l { transform: translate(calc(-50% - 10px), 0) rotate(-28deg); }
.gh-leaflet.r { transform: translate(calc(-50% + 10px), 0) rotate(28deg); }

/* TRUNK */
.gh-trunk {
  position: absolute;
  left: 50%; bottom: 0;
  width: calc(3px + 36px * var(--gh-trunk, 0) * var(--gh-trunk, 0));
  height: calc(2px + 520px * var(--gh-trunk, 0));
  background: linear-gradient(180deg, var(--c-brand) 0%, var(--c-brand-2) 100%);
  transform: translateX(-50%);
  transform-origin: bottom;
  clip-path: polygon(8% 100%, 92% 100%, 70% 0%, 30% 0%);
  box-shadow: 0 0 38px var(--c-brand-soft);
}

/* CANOPY */
.gh-canopy {
  position: absolute;
  left: 50%;
  bottom: calc(2px + 520px * var(--gh-trunk, 0) - 30px);
  transform: translateX(-50%);
  width: 0; height: 0;
  z-index: 4;
  opacity: var(--gh-canopy, 0);
  filter: drop-shadow(0 0 28px rgba(200, 169, 110, 0.55));
}
.gh-canopy span {
  position: absolute;
  width: calc(var(--r) * var(--gh-canopy, 0) * 2);
  height: calc(var(--r) * var(--gh-canopy, 0) * 2);
  left: calc(var(--x) * var(--gh-canopy, 0));
  top: calc(var(--y) * var(--gh-canopy, 0));
  margin-left: calc(var(--r) * var(--gh-canopy, 0) * -1);
  margin-top: calc(var(--r) * var(--gh-canopy, 0) * -1);
  border-radius: 50%;
  background: var(--c-brand);
}
.gh-canopy span:nth-child(1) { background: var(--c-brand-3); }
.gh-canopy span:nth-child(4),
.gh-canopy span:nth-child(5) { background: var(--c-brand); }

/* ROOTS */
.gh-roots {
  position: absolute;
  left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: 0; height: 0;
  z-index: 2;
  opacity: calc(0.7 * var(--gh-roots, 0));
}
.gh-roots span {
  position: absolute;
  width: calc(var(--r) * var(--gh-roots, 0) * 2);
  height: calc(var(--r) * var(--gh-roots, 0) * 2);
  left: calc(var(--x) * var(--gh-roots, 0));
  top: calc(var(--y) * var(--gh-roots, 0));
  margin-left: calc(var(--r) * var(--gh-roots, 0) * -1);
  margin-top: calc(var(--r) * var(--gh-roots, 0) * -1);
  border-radius: 50%;
  background: var(--c-brand-2);
}

/* ── COPY BLOCK ─────────────────────────────────────── */
.gh-copy {
  position: absolute;
  left: 60px;
  top: 195px;
  bottom: 130px;
  width: min(55vw, 860px);
  z-index: 15;
  display: flex;
  flex-direction: column;
}
.gh-headline-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}
.gh-h {
  position: absolute;
  left: 0; bottom: 0;
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--fw-light);
  font-size: clamp(52px, 8.8vw, 160px);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--c-text);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 700ms ease, transform 900ms cubic-bezier(.2,.6,.15,1);
  text-wrap: balance;
  max-width: 900px;
}
.gh-h em {
  font-style: italic;
  color: var(--c-brand);
  font-weight: var(--fw-regular);
  text-shadow: 0 0 32px rgba(200, 169, 110, 0.55);
}
.gh-h.is-in { opacity: 1; transform: translateY(0); }

.gh-caption {
  margin-top: 28px;
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--c-text-2);
  position: relative;
  height: 14px;
}
.gh-caption span {
  position: absolute; left: 0; top: 0;
  opacity: 0;
  transition: opacity 500ms ease;
}
.gh-caption span.is-in { opacity: 1; }

/* ── CTA ROW ─────────────────────────────────────────── */
.gh-cta-row {
  margin-top: 36px;
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  opacity: var(--gh-reveal, 0);
  transform: translateY(calc(18px - 18px * var(--gh-reveal, 0)));
  transition: transform 400ms ease;
}
.gh-cta-aside {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--fs-lg);
  color: var(--c-text-2);
  max-width: 320px;
  line-height: var(--lh-snug);
}

/* ── BRAND LABEL ─────────────────────────────────────── */
.gh-brand-label {
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--c-brand);
  opacity: 0.75;
  margin-bottom: 20px;
  flex-shrink: 0;
}

/* ── SCROLL HINT ─────────────────────────────────────── */
.gh-scroll-hint {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: calc(1 - min(var(--gh-p, 0) * 12, 1));
  z-index: 20;
  pointer-events: none;
}
.gh-scroll-text {
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--c-text-3);
}
.gh-scroll-line {
  width: 1px;
  height: 36px;
  background: linear-gradient(to bottom, var(--c-brand), transparent);
  transform-origin: top;
  animation: gh-scroll-drop 1.8s ease-in-out infinite;
}
@keyframes gh-scroll-drop {
  0%   { transform: scaleY(0); transform-origin: top; opacity: 0; }
  20%  { opacity: 1; }
  50%  { transform: scaleY(1); transform-origin: top; }
  51%  { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

/* ── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 900px) {
  .gh-copy { left: 24px; right: 24px; width: auto; bottom: 100px; top: 145px; }
  .gh-h { font-size: clamp(38px, 10vw, 80px); }
  .gh-chapter { top: 80px; left: 24px; }
  .gh-roman { font-size: 44px; width: 50px; }
  .gh-rail { display: none; }
  .gh-plant { left: 82%; opacity: 0.55; }
  .gh-scroll-wrapper { height: 280vh; height: 280dvh; }
  .gh-headline-wrap { min-height: 40vh; }
}
@media (max-width: 480px) {
  .gh-cta-row { flex-direction: column; align-items: flex-start; }
  .gh-cta-aside { max-width: 100%; }
}

/* ── REDUCED MOTION ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .gh-motes i { animation: none; }
  .gh-scroll-line { animation: none; }
  .gh-h { transition: none; opacity: 1; transform: none; }
  .gh-h:not(.gh-h-1) { display: none; }
  .gh-roman span, .gh-label span, .gh-caption span { transition: none; }
  .gh-cta-row { opacity: 1; transform: none; transition: none; }
  .gh-scene { transition: none; transform: none; }
}
