/*
  peakops.css
  The film stays pinned. The four steps on the right fill a vertical rule as
  the story scrolls. The 12-week timeline follows that story in the document,
  so it is not on screen until the last step has completed.

  The rule is decorative. Each step's number, title, and sentence carry the
  meaning (1.4.1 Use of Color). Reduced motion and narrow screens show every
  step at full strength without the pinned scroll (1.4.10, 2.3.3).
*/

.peak {
  justify-content: flex-start;
  gap: 0;
  padding-top: 0;
  padding-bottom: 0;
  scroll-snap-align: none;
}

.peak-story {
  position: relative;
  height: 580vh;
}

.peak-sticky {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  align-items: center;
  padding-top: var(--header-offset);
  box-sizing: border-box;
}

.peak-frame {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.25rem;
}

.peak-split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(16rem, 0.8fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
}

.peak-video {
  margin: 0;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--gray-100) center / cover no-repeat;
  background-image: url("../Assets/landing/46792.png");
  overflow: hidden;
  position: relative;
}

.peak-video video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: transparent;
}

.peak-steps {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin: 0;
  padding: 0.15rem 0 0;
  list-style: none;
  min-height: 100%;
}

.peak-step {
  --fill: 0;
  display: grid;
  grid-template-columns: 2.35rem 1.15rem minmax(0, 1fr);
  grid-template-rows: 1fr;
  flex: 1 1 auto;
  align-items: stretch;
  opacity: 0.42;
}

.peak-step.is-active {
  opacity: 1;
}

.peak-step:last-child {
  padding-bottom: 0;
}

.peak-num {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  justify-self: end;
  font-weight: 500;
  font-size: 1.25rem;
  line-height: 1;
  letter-spacing: -0.03em;
  padding-right: 0.55rem;
}

.peak-rail {
  grid-column: 2;
  grid-row: 1 / -1;
  position: relative;
  width: 2px;
  justify-self: center;
  min-height: 100%;
  background: color-mix(in srgb, var(--text) 16%, transparent);
}

.peak-rail-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(var(--fill) * 100%);
  background: var(--text);
}

.peak-copy {
  grid-column: 3;
  grid-row: 1;
  align-self: center;
}

.peak-step h3 {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.2;
}

.peak-step p {
  margin: 0.3rem 0 0;
  color: var(--text-soft);
  font-size: 0.98rem;
  line-height: 1.35;
}

.timeline-reveal {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: 0;
  transition:
    grid-template-rows 1.6s cubic-bezier(0.22, 0.7, 0.3, 1),
    margin-top 1.6s cubic-bezier(0.22, 0.7, 0.3, 1);
}

.timeline-reveal.is-revealed {
  grid-template-rows: 1fr;
  margin-top: 1.25rem;
}

.timeline {
  --bar: 0;
  position: static;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(2.75rem);
  transition:
    opacity 1.4s ease,
    transform 1.6s cubic-bezier(0.22, 0.7, 0.3, 1);
}

.timeline-reveal.is-revealed .timeline {
  opacity: 1;
  transform: translateY(0);
}

.timeline h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.75rem;
}

.timeline .text-link {
  align-self: flex-end;
  margin-top: 0.5rem;
}

.phase-names,
.phase-notes {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.phase-names {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.phase-names > span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  opacity: 0.4;
}

.phase-names > span.is-on {
  opacity: 1;
  color: var(--text);
}

/* Green is not on the written KOM ramps. This tick is the completion mark asked for on the timeline. */
.phase-tick {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: #178a45;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  opacity: 0;
  transform: scale(0.4);
  transition:
    opacity 0.45s ease,
    transform 0.45s cubic-bezier(0.22, 0.7, 0.3, 1);
}

.phase-names > span.is-on .phase-tick {
  opacity: 1;
  transform: scale(1);
}

.phase-tick::after {
  content: "";
  width: 0.22rem;
  height: 0.42rem;
  margin-top: -0.12rem;
  border: solid var(--white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.phase-notes {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.phase-notes strong {
  color: var(--text-faint);
}

.track {
  position: relative;
  height: 1.5rem;
  border-radius: var(--radius-pill);
  background: var(--track);
  overflow: hidden;
}

.track-bars {
  position: absolute;
  inset: 0;
  clip-path: inset(0 calc((1 - var(--bar)) * 100%) 0 0);
}

.track span {
  position: absolute;
  top: 0;
  height: 100%;
}

.track .pinpoint {
  left: 0;
  width: 16.666%;
  background: var(--gray-800);
  border-radius: var(--radius-pill) 0 0 var(--radius-pill);
}

.track .engineer {
  left: 16.666%;
  width: 33.334%;
  background: var(--gray-600);
}

.track .activate {
  left: 50%;
  width: 33.333%;
  background: var(--gray-400);
}

.track .keep {
  left: 83.333%;
  width: 16.667%;
  background: var(--accent);
  border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
}

@media (max-width: 860px) {
  .peak-story {
    height: auto;
  }

  .peak-sticky {
    position: static;
    height: auto;
    padding-top: 9.5rem;
    padding-bottom: 2rem;
  }

  .peak-split {
    grid-template-columns: 1fr;
  }

  .peak-video {
    max-height: none;
    aspect-ratio: 16 / 9;
  }

  .peak-step,
  .peak-step.is-active {
    opacity: 1;
  }

  .peak-rail-fill {
    height: 100%;
  }

  .phase-names,
  .phase-notes {
    flex-direction: column;
  }

  .timeline {
    position: static;
  }
}

@media (prefers-reduced-motion: reduce) {
  .peak-story {
    height: auto;
  }

  .peak-sticky {
    position: static;
    height: auto;
    padding-top: calc(var(--header-offset) + 1.5rem);
  }

  .peak-step {
    opacity: 1;
  }

  .peak-rail-fill {
    height: 100%;
  }

  .timeline-reveal,
  .timeline {
    transition: none;
  }

  .timeline {
    --bar: 1;
    position: static;
  }

  .track-bars {
    clip-path: none;
  }

  .phase-names > span {
    opacity: 1;
    color: var(--text);
  }

  .phase-tick {
    transition: none;
  }
}

@media (max-width: 860px) and (prefers-reduced-motion: reduce) {
  .peak-sticky {
    padding-top: 9.5rem;
  }
}

@media (max-width: 640px) {
  .peak-steps {
    gap: 0.65rem;
  }

  .peak-step {
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 0.85rem;
    padding: 1.35rem 1.4rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
  }

  .peak-step:last-child {
    padding-bottom: 1.35rem;
  }

  .peak-rail {
    display: none;
  }

  .peak-num {
    align-self: start;
    padding-top: 0.12rem;
    padding-right: 0;
  }

  .peak-copy {
    grid-column: 2;
  }

  .timeline {
    display: grid;
    grid-template-columns: 1.15rem minmax(0, 1fr);
    column-gap: 0.9rem;
    row-gap: 0;
    align-items: stretch;
  }

  .timeline > h3,
  .timeline > .lede,
  .timeline > .phase-notes,
  .timeline > .text-link {
    grid-column: 1 / -1;
  }

  .timeline > h3 {
    grid-row: 1;
    margin-bottom: 0.7rem;
  }

  .timeline > .lede {
    grid-row: 2;
    margin-bottom: 1.15rem;
  }

  .phase-names,
  .track,
  .track-bars {
    display: contents;
  }

  .phase-names > span:nth-child(1) { grid-column: 2; grid-row: 3; }
  .phase-names > span:nth-child(2) { grid-column: 2; grid-row: 4; }
  .phase-names > span:nth-child(3) { grid-column: 2; grid-row: 5; }
  .phase-names > span:nth-child(4) { grid-column: 2; grid-row: 6; }

  .phase-names > span {
    align-self: center;
  }

  .track span {
    position: relative;
    top: auto;
    height: auto;
    align-self: stretch;
  }

  .track .pinpoint,
  .track .engineer,
  .track .activate,
  .track .keep {
    grid-column: 1;
    left: auto;
    width: auto;
  }

  .track .pinpoint {
    grid-row: 3;
    min-height: 2.6rem;
    border-radius: var(--radius-pill) var(--radius-pill) 0 0;
  }

  .track .engineer {
    grid-row: 4;
    min-height: 5.2rem;
    border-radius: 0;
  }

  .track .activate {
    grid-row: 5;
    min-height: 5.2rem;
    border-radius: 0;
  }

  .track .keep {
    grid-row: 6;
    min-height: 2.6rem;
    border-radius: 0 0 var(--radius-pill) var(--radius-pill);
  }

  .timeline > .phase-notes {
    grid-row: 7;
    margin-top: 1.15rem;
  }

  .timeline > .text-link {
    grid-row: 8;
    justify-self: end;
    margin-top: 1rem;
  }
}
