/* The hero portrait and its three decorative interface vignettes. */
.hero79-stage .hero-work[data-portrait-look="flow"] {
  --portrait-ink: #526d9f;
  --portrait-accent: #3157d3;
  --portrait-step: var(--portrait-progress, 0);
  --portrait-travel: -12px;
  --portrait-tilt: 1deg;
}

body.sober-home .hero79-stage .hero-work[data-portrait-look="flow"] .hero-work-portrait {
  isolation: isolate;
  transform: none;
  background: transparent;
}

body.sober-home .hero79-stage .hero-work[data-portrait-look="flow"] .hero-work-portrait::before {
  content: none;
}

body.sober-home .hero79-stage .hero-work[data-portrait-look="flow"] .hero-work-portrait > img {
  z-index: 1;
  transform: translate(calc(var(--portrait-travel) * var(--portrait-step)), calc(10px * var(--portrait-step)))
    rotate(calc(var(--portrait-tilt) * var(--portrait-step))) scale(calc(1.025 + .082 * var(--portrait-step)));
  transform-origin: 52% 23%;
}

.hero-work[data-portrait-look="flow"] :is(.portrait-art, .portrait-flow) {
  position: absolute;
  inset: 0;
}

.hero-work[data-portrait-look="flow"] .portrait-art {
  z-index: 0;
  pointer-events: none;
}

/* Parcours: opening, selection and confirmation share one scroll position. */
.portrait-flow {
  --flow-story: min(1, calc(var(--portrait-step) * var(--flow-layout-tempo, var(--flow-tempo, 2.3))));
  --flow-start: clamp(0, calc(var(--flow-story) * 4.8), 1);
  --flow-across: clamp(0, calc((var(--flow-story) - .06) * 3), 1);
  --flow-choice: clamp(0, calc((var(--flow-story) - .32) * 5), 1);
  --flow-down: clamp(0, calc((var(--flow-story) - .47) * 2.85), 1);
  --flow-confirm: clamp(0, calc((var(--flow-story) - .83) * 5.89), 1);
  --flow-track: #9bb1dc;
  transform: translateY(calc(-8px * var(--portrait-step)));
}

.portrait-flow-route {
  position: absolute;
  z-index: 0;
  inset: 38% 12% auto 15%;
  height: calc(19% + 6px * var(--portrait-step) + 1px);
}

.portrait-flow-route::before,
.portrait-flow-route::after,
.portrait-flow-route span {
  position: absolute;
  background: var(--flow-track);
  content: "";
}

.portrait-flow-route::before,
.portrait-flow-across {
  inset: 0 0 auto;
  height: 1px;
}

.portrait-flow-route::after,
.portrait-flow-down {
  inset: 0 0 0 auto;
  width: 1px;
}

.portrait-flow-route span {
  z-index: 1;
  background: var(--portrait-accent);
}

.portrait-flow-across {
  transform: scaleX(var(--flow-across));
  transform-origin: left;
}

.portrait-flow-down {
  transform: scaleY(var(--flow-down));
  transform-origin: top;
}

.portrait-flow-screen {
  position: absolute;
  inline-size: 25%;
  box-sizing: border-box;
  padding: 4% 3%;
  border: 1px solid #a8bbdf;
  border-radius: 7px;
  background: #f5f8ff;
  box-shadow: 0 5px 13px rgb(54 83 142 / .08);
}

.portrait-flow-screen i {
  display: block;
  background: #9badcf;
  height: 3px;
  border-radius: 1px;
}

.portrait-flow-start {
  top: 25%;
  left: 3%;
  transform: translateX(calc(5px * var(--portrait-step)));
}

.portrait-flow-start > i:first-child {
  width: 55%;
  margin-block-end: 6px;
  background: var(--portrait-ink);
}

.portrait-flow-start > i:nth-child(2) {
  width: 92%;
}

.portrait-flow-trigger {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 75%;
  height: 9px;
  margin-block-start: 12px;
  padding-inline-end: 3px;
  border-radius: 2px;
  color: #536d9d;
  background: #d5e2fb;
  background: color-mix(in srgb, #d5e2fb, #afc7ed calc(100% * var(--flow-start)));
}

.portrait-flow-trigger svg {
  width: 8px;
  height: 8px;
  transform: translateX(calc(1px * var(--flow-start)));
}

.portrait-flow-form {
  top: 29%;
  right: 1%;
  transform: translateY(calc(-5px * var(--portrait-step)));
}

.portrait-flow-form > i {
  width: 68%;
  margin-block-end: 8px;
  background: var(--portrait-ink);
}

.portrait-flow-field {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 9px;
  padding-inline: 3px;
  border: 1px solid #c2d1ef;
  border-radius: 2px;
  background: #edf3ff;
}

.portrait-flow-field::before {
  content: "";
  box-sizing: border-box;
  flex: 0 0 5px;
  height: 5px;
  border: 1px solid #92a9d3;
  border-radius: 50%;
  background: #f9fbff;
}

.portrait-flow-field i {
  width: 53%;
  height: 2px;
}

.portrait-flow-field--selected {
  margin-block-start: 3px;
  border-color: color-mix(in srgb, #c2d1ef, #7596d3 calc(100% * var(--flow-choice)));
  background: color-mix(in srgb, #edf3ff, #dce8fc calc(100% * var(--flow-choice)));
}

.portrait-flow-field--selected::before {
  border-color: color-mix(in srgb, #92a9d3, var(--portrait-accent) calc(100% * var(--flow-choice)));
  background: color-mix(in srgb, #f9fbff, var(--portrait-accent) calc(100% * var(--flow-choice)));
}

.portrait-flow-done {
  top: 57%;
  right: 1%;
  inline-size: 22%;
  display: grid;
  justify-items: center;
  gap: 4px;
  background: #f4f7fe;
  background: color-mix(in srgb, #f4f7fe, #e8f0ff calc(100% * var(--flow-confirm)));
  border-color: color-mix(in srgb, #a8bbdf, #7697d6 calc(100% * var(--flow-confirm)));
  transform: translateY(calc(6px * var(--portrait-step)));
}

.portrait-flow-done svg {
  width: 16px;
  color: #7189af;
  color: color-mix(in srgb, #7189af, var(--portrait-accent) calc(100% * var(--flow-confirm)));
  transform: scale(calc(.96 + .04 * var(--flow-confirm)));
}

.portrait-flow-done i {
  width: 60%;
}

@media (prefers-reduced-motion: reduce) {
  .hero79-stage .hero-work[data-portrait-look="flow"] {
    --portrait-step: 0;
  }

  .portrait-flow {
    --flow-story: 1;
  }
}

html:is(.motion-reduced, .gn93-reading) .hero-work[data-portrait-look="flow"] {
  --portrait-step: 0;
}

html:is(.motion-reduced, .gn93-reading) .portrait-flow {
  --flow-story: 1;
}

@media (max-width: 700px) {
  .hero79-stage .hero-work[data-portrait-look="flow"] {
    --portrait-travel: -7px;
    --portrait-tilt: .7deg;
  }

  .portrait-flow {
    --flow-tempo: 1.3;
  }

  .portrait-flow-done {
    inline-size: 24%;
  }
}
