/* ============================================================
   HERO — editorial stage. A background-removed cutout fills ~80%
   of the hero and bleeds off its bottom edge; a large script word
   sits behind her head; the name and CTAs overlay the faded dress;
   subhead right. All layers share .hero__inner's
   stacking context.

   Positioning rule: .hero__word / .hero__sub / .hero__ctas get
   inline transforms from the reveal (Anime.js, fadeUp fallback),
   and [data-hero-portrait] from the parallax — never use
   `transform` on them for layout. Use grid placement, margins,
   and insets.
   ============================================================ */

/* -------- Stage budget ------------------------------------ */
/* Everything on the stage derives from three values:
     --hero-portrait-h  portrait height: 80% of the viewport, capped
     --hero-script-fs   script word size: ~78% of viewport width
                        (16vw ≈ 4.9em ink width), capped by a
                        fraction of the portrait so it can't dwarf her
     --hero-cta-zone    space the overlaid CTA row reserves at the
                        bottom of the stage (offset + button height)
   The vh value is the fallback; svh excludes mobile browser chrome. */
.hero {
  --hero-portrait-h: clamp(300px, 80vh, 800px);
  --fs-hero-script: clamp(5rem, 16vw, 18rem);   /* hero-scoped override of the token */
  --hero-script-k: 0.5;
  --hero-script-fs: min(var(--fs-hero-script), calc(var(--hero-portrait-h) * var(--hero-script-k)));
  --hero-cta-bottom: var(--gap-md);
  --hero-cta-zone: calc(var(--hero-cta-bottom) + 3.5rem + var(--gap-md));
}
@supports (height: 100svh) {
  .hero { --hero-portrait-h: clamp(300px, 80svh, 800px); }
}

/* The stage sits on the hero's bottom edge so the figure bleeds off
   it; any spare height collects above the script word. */
.hero {
  min-height: 100vh;    /* fallback */
  min-height: 100svh;   /* excludes mobile browser chrome */
  padding-top: calc(var(--nav-height) + 0.25rem);
  padding-bottom: 0;
  background: linear-gradient(to bottom,
    var(--cream),
    color-mix(in srgb, var(--pink-dusty) 10%, var(--cream)));
  display: flex;
  align-items: flex-end;
  position: relative;
  overflow: hidden;     /* also stops the oversized script word causing h-scroll */
}

/* Three columns: (empty) | stage | subhead. The back word, portrait
   and title all share the stage cell; the CTAs are inset over it. */
.hero__inner {
  width: 100%;
  max-width: var(--container-w);
  margin-inline: auto;
  padding-inline: var(--container-pad);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-rows: auto;
  column-gap: clamp(8px, 2vw, 24px);   /* subhead sits close to the figure */
  align-items: center;
  position: relative;
  z-index: 1;           /* the hero's only stacking root */
}

/* -------- Back layer: script word behind the head --------- */
/* Spans all three columns; the huge negative inline margin makes
   its box wider than any viewport so the centred word never hits
   start-aligned overflow (.hero clips it, so no h-scroll). Ink
   centre (≈0.65em below the line-box top) sits at 22% of the
   portrait — her hairline/forehead. */
.hero__layer-back {
  grid-row: 1;
  grid-column: 1 / -1;
  align-self: start;
  position: relative;
  z-index: var(--z-hero-back);
  font-size: var(--hero-script-fs);
  line-height: 1.1;
  margin-top: calc(var(--hero-portrait-h) * 0.22 - 0.65em);
  margin-inline: -50vw;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}
.hero__script {
  font-family: var(--font-script);
  font-weight: 600;
  color: var(--gold-soft);
}

/* -------- Stage: cutout portrait -------------------------- */
.hero__portrait {
  grid-row: 1;
  grid-column: 2;
  justify-self: center;
  position: relative;
  z-index: var(--z-hero-stage);
  height: var(--hero-portrait-h);
  aspect-ratio: 620 / 1048;
}
.hero__portrait-frame {
  position: absolute;
  inset: 0;
  will-change: transform;
}
.hero__portrait-frame picture { display: block; height: 100%; }
.hero__portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* The photo's hard mid-dress cut lands on the hero's bottom edge;
     a short fade (half-opacity at the edge) softens it without
     leaving a cream gap under the figure. */
  -webkit-mask-image: linear-gradient(to bottom, black 90%, transparent 110%);
          mask-image: linear-gradient(to bottom, black 90%, transparent 110%);
}

/* -------- Front layer: name over the lower portrait ------- */
/* Spans all columns so its width doesn't size column 2. Sits just
   above the overlaid CTA row. */
.hero__title {
  grid-row: 1;
  grid-column: 1 / -1;
  align-self: end;
  justify-self: center;
  position: relative;
  z-index: var(--z-hero-front);
  margin-bottom: var(--hero-cta-zone);
  text-align: center;
  white-space: nowrap;
}

.hero__headline {
  font-family: var(--font-display);
  font-size: var(--fs-hero);
  font-weight: 500;
  line-height: 1.05;
  color: var(--brown-warm);
  letter-spacing: -0.015em;
  text-shadow: 0 1px 18px var(--hero-text-halo);
}

.hero__roles {
  margin-top: var(--gap-xs);
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brown-warm);
  text-shadow: 0 1px 12px var(--hero-text-halo);
}
.hero__roles .dot {
  color: var(--gold-soft);
  margin-inline: 0.35rem;
}

/* Per-word reveal units — Anime.js targets these.
   The delayed fadeUp is a safety net (see motion.css): Anime.js
   finishes by ~2 s, so it only shows if Anime.js never ran. */
.hero__word {
  display: inline-block;
  opacity: 0;
  transform: translateY(24px);
  will-change: transform, opacity;
  animation: fadeUp 700ms var(--ease-out) 3000ms forwards;
}

/* -------- Front layer: subhead (right) ------------------- */
/* Top edge just below the script word's ink (ink centre at 0.22H,
   half its height ≈ 0.51em), so it rides the chest line and can't
   collide with the word however large it gets. */
.hero__sub {
  grid-row: 1;
  align-self: start;
  position: relative;
  z-index: var(--z-hero-front);
  margin-top: calc(var(--hero-portrait-h) * 0.22 + var(--hero-script-fs) * 0.51 + var(--gap-sm));
}

.hero__sub {
  grid-column: 3;
  justify-self: start;
  max-width: 20rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--fs-lg);
  line-height: 1.5;
  color: var(--slate);
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 700ms var(--ease-out) 3200ms forwards;
}

/* -------- CTAs overlaid on the faded dress ---------------- */
/* Out of flow, inset across .hero__inner's padding box and centred
   by flex — no transform (the reveal owns it). */
.hero__ctas {
  position: absolute;
  inset-inline: 0;
  bottom: var(--hero-cta-bottom);
  z-index: var(--z-hero-front);
  display: flex;
  justify-content: center;
  gap: var(--gap-sm);
  flex-wrap: wrap;
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 700ms var(--ease-out) 3400ms forwards;
}

/* -------- CTA flourish: drifting petals ------------------- */
/* Injected by js/modules/cta-flourish.js around "Let's Connect".
   Anime.js owns their transform; the resting angle uses the
   separate `rotate` property so the two compose. */
.hero__ctas .btn-ghost { position: relative; }
.hero__petal {
  position: absolute;
  width: 12px;
  height: 16px;
  color: var(--pink-dusty);
  fill: currentColor;
  opacity: 0.38;
  pointer-events: none;
}

/* -------- Background line-art ----------------------------- */
/* Direct .hero children: they paint above the section gradient and
   below .hero__inner's stacking context (z-index 1) with no z-index
   of their own — auto already sits in that slot. Static from first
   paint; no JS touches them. Strokes scale with the box exactly as
   in the approved full-opacity preview (no vector-effect). */
.hero__motif {
  position: absolute;
  width: clamp(200px, 25vw, 400px);
  height: auto;
  opacity: var(--opacity-silhouette);
  pointer-events: none;
}
.hero__motif--music      { color: var(--green-primary); top: 8%; left: 6%;  rotate: -8deg; }
.hero__motif--nutrition  { color: var(--pink-dusty);     top: 8%; right: 6%; rotate: 7deg;  }
/* Centred via auto margins (width is a resolving clamp, so this
   centres without transform — which must stay free of layout use).
   Sits behind the portrait: arch peeks above her head, body edges
   flank her shoulders. */
.hero__motif--organizing { color: var(--gold-soft); top: 8%; left: 0; right: 0; margin-inline: auto; rotate: -5deg; }

/* -------- Responsive -------------------------------------- */

/* Short-wide laptops (e.g. 1366×657, 1536×730): smaller name and a
   tighter cap on the script word relative to the portrait, so the
   three bands (word / sub / name) stay clear. Scoped to .hero
   so the global tokens are untouched. */
@media (min-width: 901px) and (max-height: 800px) {
  .hero {
    --fs-hero: clamp(2.8rem, 6vw, 4.5rem);
    --hero-script-k: 0.45;
  }
}

/* -------- Wide desktop: name/CTA split -------------------- */
/* ≥1280px only: wider stage, name left, CTAs right. The single row
   is portrait-tall; .hero__sub pins to the top of its cell while
   .hero__ctas pins to the bottom — no second row needed, and the
   name keeps its exact current height, just left-aligned. Below
   1280px the centered-overlay layout applies unchanged. */
@media (min-width: 1280px) {
  .hero__inner { max-width: 1550px; }
  .hero { --fs-hero: clamp(3.6rem, calc(-2.5rem + 7.75vw), 5rem); }

  .hero__title {
    grid-column: 1 / 2;
    white-space: normal;
  }
  /* Roles line is ~9px too wide for the 1280px side column at its
     base 0.22em tracking (measured 396px vs ~387px column); the
     tighter tracking fits it on one line. */
  .hero__roles { letter-spacing: 0.16em; }
  .hero__ctas {
    position: relative;
    inset: auto;
    grid-column: 3 / 4;
    grid-row: 1;
    align-self: end;
    justify-self: start;
    margin: 0 0 var(--hero-cta-bottom);
  }
}

/* Stacked, script word first at a small mobile-tuned size, then
   the cutout at ~58svh, then name → roles → sub → CTAs below it.
   CTAs return to normal flow. */
@media (max-width: 900px) {
  .hero {
    --hero-portrait-h: clamp(320px, 58vh, 560px);
    padding-top: calc(var(--nav-height) + 1rem);
    padding-bottom: var(--hero-pad-bottom);
    align-items: flex-start;
  }
  @supports (height: 100svh) {
    .hero { --hero-portrait-h: clamp(320px, 58svh, 560px); }
  }

  .hero__inner {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    text-align: center;
  }
  .hero__petal { display: none; }

  /* Mobile script word: small fixed size in its own leading row.
     Resets the desktop bleed tricks (negative inline margin,
     chest-line offset) that would overflow/clip at 390px. */
  .hero__layer-back {
    grid-row: 1;
    font-size: 2.5rem;
    margin-top: 0;
    margin-inline: 0;
    margin-bottom: var(--gap-sm);
  }

  /* Mobile-only fade: the dress dissolves to true transparent inside
     the box (desktop keeps the 90%→110% base fade so the name/CTAs
     still read against the faded dress). */
  .hero__portrait-frame img {
    -webkit-mask-image: linear-gradient(to bottom, black 65%, transparent 98%);
            mask-image: linear-gradient(to bottom, black 65%, transparent 98%);
  }

  .hero__title,
  .hero__sub,
  .hero__ctas,
  .hero__portrait,
  .hero__layer-back {
    grid-column: 1;
    justify-self: center;
    align-self: auto;
  }
  .hero__portrait { grid-row: 2; margin-top: 0; margin-bottom: var(--gap-sm); }
  .hero__title    { grid-row: 3; margin: 0 0 var(--gap-sm); white-space: normal; }
  .hero__sub      { grid-row: 4; margin: 0 0 var(--gap-md); max-width: 480px; }
  .hero__ctas     { grid-row: 5; margin: 0; position: relative; inset: auto; }

  /* Scroll cue: fixed to the viewport foot (the hero runs past the
     fold, so absolute-to-hero would hide below it). translateY-only
     animation; horizontal centring lives in `left`. z-index beats
     .hero__inner's stacking root (1) at this scope, stays under nav. */
  .hero__scroll-cue {
    position: fixed;
    bottom: 1rem;
    left: calc(50% - 12px);
    width: 24px;
    height: 24px;
    color: var(--brown-warm);
    opacity: 0.7;
    z-index: var(--z-hero-front);
    pointer-events: none;
  }

  /* Line-art redistribution: smaller, spread down the taller mobile
     hero instead of clustered at desktop scatter points. */
  .hero__motif { width: clamp(120px, 38vw, 200px); }
  .hero__motif--music      { top: 1%;  left: 3%;  right: auto; bottom: auto; }
  .hero__motif--nutrition  { top: 36%; right: 2%; left: auto;  bottom: auto; }
  .hero__motif--organizing { top: 62%; left: 4%;  right: auto; bottom: auto; margin-inline: 0; }
}
