/* 06 · The Touchette Team
   Cream band between the forest estimator and the paper About section.
   The oversized "9" straddles the top boundary (type-as-image break); a clay
   progress line draws through the three stages as the reader scrolls
   (team.js sets --team-progress and .is-reached; without JS or with reduced
   motion the line and nodes render complete). */

.team {
  --team-line: rgba(23, 53, 46, .18);
  --team-mono-border: rgba(23, 53, 46, .3);
  position: relative;
  /* Above .estimate (z-index: 2) so the numeral can paint across the boundary. */
  z-index: 3;
  padding: clamp(112px, 12vw, 180px) var(--page-x) clamp(96px, 11vw, 168px);
  color: var(--ink);
  background: var(--cream);
  isolation: isolate;
}

/* Type-as-image numeral */

.team-numeral {
  position: absolute;
  top: 0;
  right: var(--page-x);
  z-index: 1;
  margin: 0;
  color: var(--clay);
  font: 400 clamp(220px, 27vw, 420px)/.74 var(--serif);
  letter-spacing: -.06em;
  pointer-events: none;
  user-select: none;
  /* Lift roughly a third of the glyph above the section edge. */
  translate: 0 -34%;
}

/* Head */

.team-head {
  position: relative;
  z-index: 2;
  display: grid;
  align-items: end;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
  column-gap: clamp(40px, 7vw, 120px);
}

.team-head > :not(.team-lede) {
  grid-column: 1;
  justify-self: start;
}

.team-head > .team-lede {
  grid-column: 2;
  grid-row: 3;
}

.team-head .eyebrow {
  margin: 40px 0 26px;
  color: var(--muted);
}

.team-head h2 {
  max-width: 16ch;
  margin: 0;
  color: var(--forest);
  font-size: clamp(50px, 5.6vw, 86px);
  letter-spacing: -.045em;
  line-height: .94;
}

.team-lede {
  max-width: 440px;
  margin: 0;
  padding-bottom: 6px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

/* Shared micro-label */

.team-label {
  margin: 0;
  color: var(--muted);
  font: 400 11px/1.4 var(--mono);
  letter-spacing: .13em;
  text-transform: uppercase;
}

/* People + monograms */

.team-people {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.team-person {
  display: grid;
  align-items: center;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 14px;
}

.team-mono {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  grid-row: span 2;
  color: var(--forest);
  border: 1px solid var(--team-mono-border);
  font: 400 18px/1 var(--serif);
  letter-spacing: .02em;
  transition: border-color .5s var(--ease), background-color .5s var(--ease);
}

.team-person__name {
  align-self: end;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.team-person__role {
  align-self: start;
  text-wrap: balance;
  margin-top: 3px;
  color: var(--muted);
  font: 400 11px/1.4 var(--mono);
  letter-spacing: .09em;
  text-transform: uppercase;
}

/* Leadership band: sits directly on the full-width track, so it reads as spanning every stage */

.team-lead {
  position: relative;
  display: grid;
  align-items: center;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: clamp(24px, 4vw, 64px);
  margin-top: clamp(72px, 9vw, 128px);
  padding: 30px 0 44px;
  border-top: 1px solid var(--team-line);
}

.team-people--lead {
  grid-auto-flow: column;
  justify-content: start;
  gap: clamp(28px, 5vw, 72px);
}

.team-person--primary {
  grid-template-columns: 64px minmax(0, 1fr);
  column-gap: 18px;
}

.team-person--primary .team-mono {
  width: 64px;
  height: 64px;
  color: var(--cream);
  background: var(--forest);
  border-color: var(--forest);
  font-size: 27px;
}

.team-person--primary .team-person__name {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -.02em;
  line-height: 1;
}

.team-lead__link {
  color: var(--forest);
}

/* Stage rail */

.team-rail {
  position: relative;
  --team-progress: 1;
}

.team-track {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 1px;
  background: var(--team-line);
}

.team-track span {
  position: absolute;
  inset: 0;
  background: var(--clay);
  transform: scaleX(var(--team-progress));
  transform-origin: left center;
  will-change: transform;
}

.team-stages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(28px, 4vw, 72px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.team-stage {
  position: relative;
  padding-top: 46px;
}

.team-node {
  position: absolute;
  top: -5px;
  left: 0;
  width: 11px;
  height: 11px;
  background: var(--clay);
  border: 1px solid var(--clay);
  transition: background-color .45s var(--ease), border-color .45s var(--ease), transform .45s var(--ease);
}

.team-stage__num {
  margin: 0 0 18px;
  color: var(--clay);
  font: 400 11px/1.4 var(--mono);
  letter-spacing: .13em;
  text-transform: uppercase;
  transition: color .45s var(--ease);
}

.team-stage h3 {
  margin: 0 0 16px;
  color: var(--forest);
  font-size: clamp(32px, 3.1vw, 48px);
  letter-spacing: -.03em;
  line-height: 1;
}

.team-stage__copy {
  max-width: 400px;
  margin: 0 0 34px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.team-stage .team-label {
  margin-bottom: 16px;
  padding-top: 18px;
  border-top: 1px solid var(--team-line);
}

/* Live (JS, motion allowed): unreached stages sit quiet until the line arrives */

.team-rail.is-live .team-stage:not(.is-reached) .team-node {
  background: var(--cream);
  border-color: rgba(23, 53, 46, .35);
  transform: scale(.82);
}

.team-rail.is-live .team-stage:not(.is-reached) .team-stage__num {
  color: var(--muted);
}

.team-rail.is-live .team-stage.is-reached .team-mono {
  border-color: rgba(23, 53, 46, .55);
}

/* Reveal choreography (builds on the global [data-reveal] fade/rise) */

.team-stages [data-reveal]:nth-child(2) {
  transition-delay: .1s;
}

.team-stages [data-reveal]:nth-child(3) {
  transition-delay: .2s;
}

.js .team-numeral[data-reveal] {
  transform: translateY(60px);
  transition: opacity 1.1s var(--ease), transform 1.3s var(--ease);
}

.js .team-numeral[data-reveal].is-visible {
  transform: translateY(0);
}

.js .team-stage[data-reveal] .team-person,
.js .team-lead[data-reveal] .team-person {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}

.js .team-stage[data-reveal].is-visible .team-person,
.js .team-lead[data-reveal].is-visible .team-person {
  opacity: 1;
  transform: translateY(0);
  transition-delay: .3s;
}

.js .team-stage[data-reveal].is-visible .team-person:nth-child(2),
.js .team-lead[data-reveal].is-visible .team-person:nth-child(2) {
  transition-delay: .38s;
}

.js .team-stage[data-reveal].is-visible .team-person:nth-child(3) {
  transition-delay: .46s;
}

/* Tablet: two-row lead band */

@media (max-width: 1180px) {
  .team-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .team-head > .team-lede {
    grid-column: 1;
    grid-row: auto;
    max-width: 520px;
    margin-top: 32px;
  }

  .team-lead {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .team-lead > .team-label {
    grid-column: 1 / -1;
  }
}

/* Mobile + tablet portrait: stages stack, the line runs vertically */

@media (max-width: 860px) {
  .team-numeral {
    font-size: clamp(170px, 40vw, 300px);
    translate: 0 -30%;
  }

  .team-head h2 {
    font-size: clamp(46px, 12vw, 70px);
  }

  .team-lead {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .team-people--lead {
    grid-auto-flow: row;
    gap: 20px;
  }

  .team-lead__link {
    justify-self: start;
  }

  .team-rail {
    margin-top: 8px;
  }

  .team-track {
    top: 0;
    bottom: 0;
    left: 5px;
    width: 1px;
    height: auto;
  }

  .team-track span {
    transform: scaleY(var(--team-progress));
    transform-origin: center top;
  }

  .team-stages {
    grid-template-columns: 1fr;
    gap: 56px;
  }

  .team-stage {
    padding-top: 0;
    padding-left: 40px;
  }

  .team-node {
    top: 2px;
    left: 0;
  }

  .team-stage__copy {
    margin-bottom: 26px;
  }
}

/* Tablet portrait: each stacked stage splits into copy | people */

@media (min-width: 561px) and (max-width: 860px) {
  .team-stage {
    display: grid;
    align-content: start;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
    column-gap: clamp(28px, 5vw, 48px);
  }

  /* The node stays out of grid placement so it keeps anchoring to the stage's padding box. */
  .team-stage > :not(.team-node) {
    grid-column: 1;
  }

  .team-stage__copy {
    margin-bottom: 0;
  }

  .team-stage .team-label {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: end;
    margin-bottom: 16px;
  }

  .team-stage .team-people {
    grid-column: 2;
    grid-row: 3;
  }
}

@media (max-width: 380px) {
  .team-person--primary {
    grid-template-columns: 56px minmax(0, 1fr);
    column-gap: 14px;
  }

  .team-person--primary .team-mono {
    width: 56px;
    height: 56px;
    font-size: 23px;
  }

  .team-person--primary .team-person__name {
    font-size: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .js .team-numeral[data-reveal],
  .js .team-stage[data-reveal] .team-person,
  .js .team-lead[data-reveal] .team-person {
    opacity: 1;
    transform: none;
  }

  .team-track span {
    transform: none;
  }
}
