/* =========================================================
   Story: hero → signature styles (one scene, no dividing lines)
   Base layout = what reduced-motion and no-JS visitors see:
   the profile is sticky and switches style as each step reaches the middle.
   ========================================================= */
.story {
  --ch: min(78svh, 58vw, 820px);                 /* conductor (profile) height */
  position: relative; overflow: clip;
  background: var(--bg);                        /* same dark as the rest of the site */
}

/* hero engraving: fades into the page on the left and at the bottom, no frame */
.story-engraving {
  position: absolute; top: 0; right: 0; z-index: 0; opacity: var(--engraving-opacity, 1);
  width: min(72vw, 1500px); height: 100svh; object-fit: cover; object-position: 100% 40%;
  pointer-events: none; user-select: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 40%), linear-gradient(to bottom, #000 62%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent 0, #000 40%), linear-gradient(to bottom, #000 62%, transparent 100%);
  mask-composite: intersect;
}

@media (min-width: 901px) and (max-width: 1240px) {   /* narrower screens: keep the copy clear of the braids */
  .story-engraving {
    -webkit-mask-image: linear-gradient(to right, transparent 0, transparent 22%, #000 66%), linear-gradient(to bottom, #000 62%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, transparent 22%, #000 66%), linear-gradient(to bottom, #000 62%, transparent 100%);
  }
}

.story-grid {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .85fr); column-gap: 40px;
}

/* ---------- hero copy ---------- */
.hero-copy {
  grid-column: 1; grid-row: 1; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: 120px 0 80px;
}

/* ---------- conductor: the gold profile that stays on screen ---------- */
.story-visual { grid-column: 2; grid-row: 1 / span 2; position: relative; }
.conductor {
  position: sticky; top: calc((100svh - var(--ch)) / 2 + 24px);
  height: var(--ch); margin-top: 46svh;          /* in the hero it rises from the bottom edge */
  display: flex; justify-content: center;
}
.conductor::before {                              /* soft gold light behind her */
  content: ''; position: absolute; left: 50%; top: 34%; width: 130%; aspect-ratio: 1; translate: -50% -50%;
  background: radial-gradient(closest-side, rgba(207,165,102,.2), rgba(207,165,102,.06) 55%, transparent 100%);
  pointer-events: none;
}
.conductor-lift { height: 100%; }
.conductor-frame {
  position: relative; height: 100%; aspect-ratio: 848 / 1264;
  /* the drawings sit on black: fade every edge so they melt into the background */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 6%, #000 72%, transparent 97%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 6%, #000 72%, transparent 97%);
  mask-composite: intersect;
}
.profile {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none;
  object-fit: cover; object-position: var(--fx, 50%) var(--fy, 50%);
  opacity: 0; transition: opacity .7s var(--ease-out);
  transform: scaleX(var(--flip, 1));               /* data-flip="1": she faces the text (set in js/story.js) */
}
.profile.is-active { opacity: 1; }


/* ---------- steps ---------- */
.steps { grid-column: 1; grid-row: 2; padding-bottom: 12svh; }
.steps-head { padding-top: 10svh; }
.step {
  min-height: 100svh; max-width: 540px;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  opacity: .32; transition: opacity .6s var(--ease-out);
}
.step.is-active { opacity: 1; }
.step h3 { margin: 18px 0 0; font: 300 clamp(48px, 6vw, 92px)/1 var(--serif); letter-spacing: -.01em; }
.step h3 em { font-style: italic; }
.step p { margin: 20px 0 0; color: var(--muted); max-width: 440px; }

.step-cards { list-style: none; margin: 30px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.step-cards li {
  display: grid; gap: 6px; padding: 13px 18px 14px; border-radius: 14px;
  background: rgba(21,16,11,.72); border: 1px solid var(--line-strong);
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
}
.step-cards small { font: 400 10.5px/1 var(--sans); letter-spacing: .24em; text-transform: uppercase; color: var(--muted); }
.step-cards b { font: 400 22px/1.1 var(--serif); color: var(--gold-light); }
.step-cards li:first-child { background: var(--gold-grad); border-color: transparent; }
.step-cards li:first-child small { color: rgba(18,12,5,.7); }
.step-cards li:first-child b { color: #120c05; }

.step-link {
  margin-top: 30px; display: inline-flex; gap: 10px; align-items: center;
  font: 400 12px/1 var(--sans); letter-spacing: .24em; text-transform: uppercase; color: var(--gold);
}
.step-link span { transition: transform .4s var(--ease-out); }
.step-link:hover span { transform: translateX(6px); }

/* ---------- phone & tablet: profile on top, text slides beneath it ---------- */
/* no dividing line where the story hands over to the next section */
.story + .why { border-top: 0; }

/* ---------- phone & tablet: profile on top, text slides beneath it ---------- */
@media (max-width: 900px) {
  .story {
    --ch: min(46svh, 104vw);
    --tint: var(--bg);                             /* flat tone, so the cover behind the profile blends in */
    --engraving-opacity: .72;   /* the real photo is already graded darker than the old engraving */
  }
  .story-engraving {
    width: 100%; height: 56svh; object-position: 74% 30%;
    -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 94%);
    mask-image: linear-gradient(to bottom, #000 30%, transparent 94%);
  }
  .story-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-copy { min-height: 0; padding: 36svh 0 48px; }
  .hero-copy .eyebrow { text-shadow: 0 0 14px #000, 0 0 4px #000; }
  .story-visual { grid-column: 1; grid-row: 2 / span 2; }
  .conductor {
    top: 64px; margin-top: 0; height: calc(var(--ch) + 28px); padding-bottom: 28px;
    /* covers the text that scrolls under the profile */
    background: linear-gradient(to bottom, var(--tint) 88%, transparent);
  }
  .conductor::before { top: 40%; width: 110%; }
    .steps { grid-column: 1; grid-row: 3; position: relative; z-index: -1; padding-top: calc(var(--ch) + 40px); }
  .step { min-height: 72svh; justify-content: flex-end; padding-bottom: 8svh; }
  .step-cards li { padding: 11px 14px 12px; }
  .step-cards b { font-size: 19px; }
}

/* =========================================================
   Motion mode (js/story.js adds .is-motion when GSAP runs and motion is allowed):
   the whole scene is one pinned screen; the scroll timeline moves things inside it.
   ========================================================= */
.story.is-motion .story-grid { height: 100%; grid-template-rows: 100%; }
.story.is-motion .story-visual { grid-row: 1; }
.story.is-motion .conductor {
  position: absolute; left: 0; right: 0; margin: 0;
  top: calc((100svh - var(--ch)) / 2 + 24px);      /* where she settles for the styles */
}
.story.is-motion .steps { grid-column: 1; grid-row: 1; align-self: center; display: grid; padding: 0; }
.story.is-motion .steps-head { padding: 0; margin-bottom: 6px; }
.story.is-motion .steps-head .h-section { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
.story.is-motion .step { grid-area: 2 / 1; min-height: 0; opacity: 1; transition: none; }
.story.is-motion .profile { transition: none; }
/* WebGL morph (js/morph.js): one layer over the whole scene, above the background, under the text.
   It starts from the hero engraving, so the profile frame itself stays empty. */
.morph { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; display: none; opacity: 0; pointer-events: none; }
.story.has-morph .morph { display: block; }
.story.has-morph .profile, .story.has-morph .conductor::before { visibility: hidden; }

@media (max-width: 900px) {
  .story.is-motion { --ch: min(42svh, 96vw); }
  .story.is-motion .story-visual { grid-column: 1; grid-row: 1; }
  .story.is-motion .conductor { top: 72px; height: var(--ch); padding: 0; background: none; }
  .story.is-motion .steps { position: static; z-index: auto; align-self: end; padding: 0 0 5svh; }
  .story.is-motion .step { padding: 0; justify-content: flex-start; }
  .story.is-motion .step h3 { margin-top: 10px; }
  .story.is-motion .step p { margin-top: 12px; }
  .story.is-motion .step-cards { margin-top: 18px; }
  .story.is-motion .step-link { margin-top: 18px; }
}
