/* ============================================================
   BIZMUTH — THE BIZMUTH TREE
   Scroll-driven "How we work" section. A living architectural
   crystal grown from a geometric foundation. Cream + drafting +
   aurora, matching the studio's editorial language.
   ============================================================ */

.tree-sec{
  position:relative;
  background:var(--cream-2);
  border-top:1px solid var(--line-cream);
  border-bottom:1px solid var(--line-cream);
}

/* the tall rail defines how long the growth scroll lasts */
.tree-rail{ position:relative; height:520vh; }

/* pinned viewport */
.tree-sticky{
  position:sticky; top:0; height:100vh; min-height:640px;
  overflow:hidden;
  display:block;
}

/* drafting marks washed across the cream */
.tree-draft{ position:absolute; inset:0; z-index:1; pointer-events:none; opacity:.7; }
.tree-draft .draft-svg{ position:absolute; inset:0; width:100%; height:100%; }

/* faint aurora pools behind the crystal */
.tree-field{
  position:absolute; inset:0; z-index:0; pointer-events:none; opacity:.55;
  background:
    radial-gradient(38% 46% at 50% 66%, color-mix(in srgb,var(--lav) 26%, transparent), transparent 72%),
    radial-gradient(42% 40% at 76% 30%, color-mix(in srgb,var(--turq) 14%, transparent), transparent 74%);
  transition:opacity 1.2s ease;
}

/* ---------- header (top, pinned) ---------- */
.tree-head{
  position:absolute; z-index:6; top:clamp(10px,1.8vh,24px); left:var(--pad); right:var(--pad);
  display:flex; justify-content:space-between; align-items:flex-start; gap:30px;
  pointer-events:none;
}
.tree-head h2{
  font-family:var(--exp); font-weight:700; font-size:clamp(24px,3.0vw,46px);
  line-height:1.14; letter-spacing:-.028em; margin-top:8px; max-width:17ch;
  pointer-events:auto;
}
.tree-head h2 em{ font-style:normal; color:var(--violet); }
.tree-head .th-readout{
  text-align:right; flex:0 0 auto; padding-top:2px;
  font-family:var(--mono); font-size:11px; letter-spacing:.2em; text-transform:uppercase; color:var(--ink-soft);
}
.tree-head .th-readout .pct{
  display:block; font-size:clamp(26px,2.4vw,38px); letter-spacing:-.01em; color:var(--ink); margin-top:6px;
  font-variant-numeric:tabular-nums;
}

/* ---------- the crystal stage (center) ---------- */
.tree-stage{ position:absolute; inset:0; z-index:3; }
.tree-stage .tree-svg{ width:100%; height:100%; overflow:visible; display:block; }

/* ---------- phase rail (right, vertically centered) ---------- */
.phase-rail{
  position:absolute; z-index:6; right:var(--pad); top:50%; transform:translateY(-50%);
  width:min(360px, 33vw);
  display:flex; flex-direction:column; gap:0;
  pointer-events:none;
}
.phase{
  position:relative; padding:24px 0 24px 38px;
  border-left:1px solid var(--line-cream);
  transition:border-color .6s ease;
}
.phase::before{
  content:""; position:absolute; left:-5px; top:32px; width:9px; height:9px;
  transform:rotate(45deg); background:var(--cream-2);
  border:1.5px solid var(--line-cream);
  transition:border-color .5s ease, background .5s ease, box-shadow .5s ease;
}
.phase .ph-num{
  font-family:var(--mono); font-size:11px; letter-spacing:.24em; color:var(--ink-soft);
  transition:color .5s ease;
}
.phase .ph-title{
  font-family:var(--exp); font-weight:700; font-size:clamp(17px,1.5vw,22px);
  letter-spacing:.01em; text-transform:uppercase; margin-top:11px; color:var(--ink-soft);
  opacity:.5; transition:opacity .5s ease, color .5s ease;
}
.phase .ph-keys{
  display:grid; grid-template-rows:0fr; opacity:0;
  transition:grid-template-rows .6s cubic-bezier(.2,.8,.2,1), opacity .5s ease, margin .6s ease;
  margin-top:0;
}
.phase .ph-keys > span{ overflow:hidden; min-height:0; }
.phase .ph-keys .ph-desc{
  font-family:var(--sans); font-size:13.5px; line-height:1.6; color:var(--ink-soft);
  max-width:32ch; padding-top:5px;
}
.phase .ph-keys b{
  display:block; font-family:var(--mono); font-weight:400; font-size:12px; letter-spacing:.06em;
  color:var(--ink-soft); line-height:1.9;
}
.phase .ph-keys b::before{
  content:""; display:inline-block; width:14px; height:1px; background:var(--violet);
  vertical-align:middle; margin-right:11px; opacity:.7;
}

/* active phase */
.phase.is-active{ border-color:transparent; }
.phase.is-active::before{
  border-color:var(--violet); background:var(--violet);
  box-shadow:0 0 0 4px color-mix(in srgb,var(--violet) 22%, transparent), 0 0 16px color-mix(in srgb,var(--violet) 60%, transparent);
}
.phase.is-active .ph-num{ color:var(--violet); }
.phase.is-active .ph-title{
  opacity:1; color:transparent;
  background:linear-gradient(96deg,var(--teal),var(--cyan) 26%,var(--violet) 60%,var(--magenta) 92%);
  -webkit-background-clip:text; background-clip:text; background-size:200% 100%;
  animation:auroraSlide 8s ease-in-out infinite;
}
.phase.is-active .ph-keys{ grid-template-rows:1fr; opacity:1; margin-top:18px; }

/* phase already passed: keep title legible but quiet */
.phase.is-past .ph-title{ opacity:.78; color:var(--ink); }
.phase.is-past::before{ border-color:var(--ink-soft); background:var(--ink-soft); }
.phase.is-past .ph-num{ color:var(--ink); }

/* ---------- scroll cue ---------- */
.tree-cue{
  position:absolute; z-index:6; bottom:24px; left:50%; transform:translateX(-50%);
  display:flex; align-items:center; gap:12px;
  font-family:var(--mono); font-size:11px; letter-spacing:.24em; text-transform:uppercase; color:var(--ink-soft);
  transition:opacity .6s ease;
}
.tree-cue .bar{ width:1px; height:22px; background:currentColor; opacity:.4; position:relative; overflow:hidden; }
.tree-cue .bar::after{ content:""; position:absolute; inset:0; background:var(--violet); animation:cue 2.2s ease-in-out infinite; }

/* ---------- final caption (appears at full growth) ---------- */
.tree-final{
  position:absolute; z-index:6; left:var(--pad); bottom:clamp(56px,11vh,118px);
  width:min(420px, 42vw); text-align:left;
  opacity:0; transform:translateY(18px);
  transition:opacity .8s ease, transform .8s cubic-bezier(.2,.8,.2,1);
  pointer-events:none;
}
.tree-final.show{ opacity:1; transform:none; pointer-events:auto; }
.tree-final p{
  font-family:var(--exp); font-weight:500; font-size:clamp(16px,1.5vw,21px);
  line-height:1.5; letter-spacing:-.01em; color:var(--ink);
}
.tree-final p em{
  font-style:normal; color:transparent;
  background:linear-gradient(96deg,var(--teal),var(--cyan) 26%,var(--violet) 60%,var(--magenta) 92%);
  -webkit-background-clip:text; background-clip:text; background-size:200% 100%;
  animation:auroraSlide 8s ease-in-out infinite;
}
.tree-final .tf-tag{
  display:inline-flex; align-items:center; gap:12px; margin-top:26px;
  font-family:var(--mono); font-size:11px; letter-spacing:.2em; text-transform:uppercase; color:var(--ink-soft);
}
.tree-final .tf-tag::before{ content:""; width:34px; height:1px; background:currentColor; opacity:.5; }

/* ---------- responsive ---------- */
@media (max-width:1080px){
  .phase-rail{ width:min(260px,40vw); }
  .tree-head h2{ font-size:clamp(22px,3.4vw,34px); }
}
@media (max-width:780px){
  .tree-rail{ height:440vh; }
  .phase-rail{
    top:auto; bottom:74px; transform:none; left:var(--pad); right:var(--pad); width:auto;
    flex-direction:row; gap:0; background:color-mix(in srgb,var(--cream-2) 80%, transparent);
    backdrop-filter:blur(8px); border:1px solid var(--line-cream);
  }
  .phase{ flex:1; padding:11px 8px; border-left:1px solid var(--line-cream); border-top:none; }
  .phase:first-child{ border-left:none; }
  .phase::before{ display:none; }
  .phase .ph-keys{ display:none; }
  .phase .ph-title{ font-size:12px; }
  .tree-final{ display:none; }
  .tree-cue{ bottom:auto; top:64px; }
  .tree-head h2{ max-width:14ch; }
}

@media (prefers-reduced-motion: reduce){
  .tree-rail{ height:auto; min-height:100vh; }
}
