/* Process section — measured at 1440×900 and 390×844. */

.process {
  background: var(--paper);
}

@media (min-width: 851px) {
  .results-chart + .process {
    padding-top: 48px;
  }
}

.process .h2 {
  max-width: 850px;
}

.process-lead {
  max-width: 500px;
  margin-top: 30px;
  color: var(--muted);
}

/* Symbol sprite; `hidden` is not honoured on inline <svg>, so hide it explicitly. */
.process-icons {
  display: none;
}

/* Cards revealed by process.js (110 ms stagger) stay hidden until it has set start states. */
@media (prefers-reduced-motion: no-preference) {
  [data-reveal-stagger]:not([data-stagger-ready]) > * {
    opacity: 0;
  }
}

/* ---------- Phase accordion ---------- */

.process-accordion {
  /* Card widths 635/212 inside a 1300 px content box with 10 px gaps → 3:1. */
  --phase-gap: 10px;
  --phase-active-w: calc((100cqw - 3 * var(--phase-gap)) / 2);
  --phase-inactive-w: calc((100cqw - 3 * var(--phase-gap)) / 6);
  /* Layout spring: ~4% overshoot peaking at ~320 ms, settled by ~600 ms. */
  --spring: cubic-bezier(0.3, 1.25, 0.5, 1);
  --spring-duration: 0.7s;
  --crossfade: 0.3s cubic-bezier(0.44, 0, 0.56, 1);
  container-type: inline-size;
  display: flex;
  gap: var(--phase-gap);
  margin-top: 80px;
  padding: 10px;
  border-radius: var(--r-section);
  background: #f5f5e9;
}

@supports (transition-timing-function: linear(0, 1)) {
  .process-accordion {
    --spring: linear(0, 0.064 4%, 0.21 8%, 0.387 12%, 0.56 16%, 0.712 20%, 0.833 24%, 0.923 28%, 0.983 32%, 1.02 36%, 1.039 40%, 1.046 44%, 1.044 48%, 1.038 52%, 1.03 56%, 1.022 60%, 1.015 64%, 1.009 68%, 1.004 72%, 1.001 76%, 0.999 80%, 0.998 88%, 1);
  }
}

.phase {
  position: relative;
  /* Buttons centre their content vertically; a column flex keeps the top row at the top. */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  isolation: isolate;
  flex: 1 1 0;
  min-width: 0;
  height: 400px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--r-card);
  background: var(--bg);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: flex-grow var(--spring-duration) var(--spring);
}

.phase.is-active {
  flex-grow: 3;
}

/* Dark fill is a separate layer so it can crossfade while the width springs. */
.phase::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  background: var(--ink);
  opacity: 0;
  transition: opacity var(--crossfade);
}

.phase.is-active::before {
  opacity: 1;
}

.phase:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.phase-top {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 50px 50px 0;
}

.phase-meta {
  display: inline-flex;
  align-items: center;
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: -0.03em;
  white-space: nowrap;
  transition: margin-left var(--spring-duration) var(--spring);
}

.phase-meta b {
  font-weight: 600;
  color: var(--ink);
  transition: color var(--crossfade);
}

.phase.is-active .phase-meta b {
  color: rgba(255, 255, 255, 0.75);
}

/* "Fase" collapses to zero width so the number can slide to the centre of the narrow card. */
.phase-label {
  display: grid;
  grid-template-columns: 1fr;
  margin-right: 7px;
  color: var(--bg);
  transition:
    grid-template-columns var(--spring-duration) var(--spring),
    margin-right var(--spring-duration) var(--spring),
    opacity var(--crossfade);
}

.phase-label > span {
  min-width: 0;
  overflow: hidden;
}

.phase:not(.is-active) .phase-label {
  grid-template-columns: 0fr;
  margin-right: 0;
  opacity: 0;
}

/* Inactive: number centred in the card — half card minus padding minus half the digits. */
.phase:not(.is-active) .phase-meta {
  margin-left: calc(var(--phase-inactive-w) / 2 - 50px - 10px);
}

/* Progress dots: 7 px, 5 px apart; dots up to the phase number are accent. */
.phase .dots {
  gap: 5px;
  opacity: 0;
  transition: opacity var(--crossfade);
}

.phase.is-active .dots {
  opacity: 1;
}

.phase .dots i {
  width: 7px;
  height: 7px;
  background: rgba(255, 255, 255, 0.75);
}

.phase[data-phase="1"] .dots i:nth-child(-n + 1),
.phase[data-phase="2"] .dots i:nth-child(-n + 2),
.phase[data-phase="3"] .dots i:nth-child(-n + 3),
.phase[data-phase="4"] .dots i:nth-child(-n + 4) {
  background: var(--accent);
}

/* Body keeps the active width so text never reflows while the card springs — it is clipped instead. */
.phase-body {
  position: absolute;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: var(--phase-active-w);
  padding: 50px;
  opacity: 0;
  transition: opacity var(--crossfade);
}

.phase.is-active .phase-body {
  opacity: 1;
}

.phase-body .h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  line-height: 1.35;
  letter-spacing: -0.03em;
  color: var(--bg);
}

.phase-icon {
  flex: none;
  width: 23px;
  height: 23px;
}

.phase-body .body {
  max-width: 400px;
  font-size: 15px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.75);
}

/* ---------- Video card ---------- */

.video-card {
  position: relative;
  isolation: isolate;
  margin: 10px 0 0;
  border-radius: var(--r-section);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--ink);
}

.video-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Light wash plus a bottom fade so the title holds on the bright still. */
.video-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4, 30, 22, 0.12) 42%, rgba(4, 30, 22, 0.48) 100%);
  pointer-events: none;
}

.video-logo {
  position: absolute;
  z-index: 1;
  top: 50px;
  left: 50px;
  pointer-events: none;
}

.video-play {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 80px;
  height: 80px;
  margin: -40px 0 0 -40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--ink);
  cursor: default;
}

.video-play:disabled {
  opacity: 0.85;
  pointer-events: none;
}

.video-play svg {
  width: 40px;
  height: 40px;
  fill: currentColor;
}

.video-card figcaption {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 50px;
  color: var(--bg);
  pointer-events: none;
}

.video-text {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.video-title {
  font-family: var(--font-body);
  font-size: 60px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.video-sub {
  font-size: 15px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.75);
}

/* ---------- Second heading + pillars ---------- */

.process .process-title-2 {
  margin-top: 80px;
  max-width: 650px;
  font-size: 45px;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 50px;
  margin-top: 50px;
  padding: 50px;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: -0.025em;
  color: rgba(255, 255, 255, 0.75);
}

.pillars > div {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-right: 10px;
}

.pillars p {
  max-width: 290px;
}

.pillars b {
  font-weight: 700;
  color: var(--bg);
}

.pillar-icon {
  width: 20px;
  height: 20px;
  color: var(--bg);
}

@media (max-width: 850px) {
  .process {
    padding-block: 60px;
  }

  /* Phone: 35/36.75 heading, 15/20.25 lead. Scoped here; base.css keeps 44px for other sections. */
  .process .h2 {
    font-size: 35px;
    line-height: 1.05;
  }

  .process-lead {
    margin-top: 20px;
    font-size: 15px;
  }

  /* Phone: free horizontal scroller (no snap) bleeding to the screen edges; every card is shown active. */
  .process-accordion {
    margin: 30px calc(-1 * var(--gutter)) 0;
    padding: 0 var(--gutter);
    gap: 10px;
    border-radius: 0;
    background: none;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .process-accordion::-webkit-scrollbar {
    display: none;
  }

  .phase,
  .phase.is-active {
    flex: 0 0 315px;
    height: 380px;
    transition: none;
  }

  .phase::before,
  .phase .dots,
  .phase-body,
  .phase-label {
    opacity: 1;
  }

  .phase-top {
    padding: 30px 30px 0;
  }

  .phase-meta,
  .phase:not(.is-active) .phase-meta {
    margin-left: 0;
    font-size: 14px;
  }

  .phase-meta b,
  .phase:not(.is-active) .phase-meta b {
    color: rgba(255, 255, 255, 0.75);
  }

  .phase:not(.is-active) .phase-label {
    grid-template-columns: 1fr;
    margin-right: 7px;
    opacity: 1;
  }

  .phase-body {
    position: static;
    width: auto;
    margin-top: auto;
    padding: 30px;
  }

  .phase-body .h3 {
    font-size: 17px;
  }

  .phase-body .body {
    font-size: 14px;
  }

  .video-card {
    border-radius: var(--r-card);
  }

  .video-logo {
    top: 15px;
    left: 15px;
    font-size: 14px;
  }

  .video-logo img {
    width: 16px;
    height: 16px;
  }

  .video-play {
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
  }

  .video-play svg {
    width: 20px;
    height: 20px;
  }

  .video-card figcaption {
    padding: 15px;
  }

  .video-text {
    display: none;
  }

  .process .process-title-2 {
    margin-top: 30px;
    font-size: 25px;
  }

  .pillars {
    grid-template-columns: 1fr;
    gap: 50px;
    margin-top: 30px;
    padding: 30px;
  }

  .pillars p {
    max-width: 280px;
  }
}
