/* The motion belongs to the mark, photograph frame and route; text stays present. */
.site-header .header-visit { flex: none; }

[data-motion-focus] {
  position: relative;
  isolation: isolate;
  --focus-inset: clamp(12px, 3.1%, 22px);
}
[data-motion-focus]::before,
[data-motion-focus]::after {
  content: '';
  position: absolute;
  z-index: 1;
  width: clamp(22px, 6%, 40px);
  height: clamp(22px, 6%, 40px);
  border: 0 solid #fff6ed;
  filter: drop-shadow(0 0 2px #132d49a6);
  pointer-events: none;
}
[data-motion-focus]::before {
  inset: var(--focus-inset) auto auto var(--focus-inset);
  border-block-start-width: 2px;
  border-inline-start-width: 2px;
}
[data-motion-focus]::after {
  inset: var(--focus-inset) var(--focus-inset) auto auto;
  border-block-start-width: 2px;
  border-inline-end-width: 2px;
}

[data-motion-chapter]::before,
.page-trattamenti .service-group > h2::after {
  content: '';
  display: block;
  width: 54px;
  height: 9px;
  margin-block-end: 12px;
  background:
    linear-gradient(currentColor, currentColor) left center / 100% 1px no-repeat,
    linear-gradient(currentColor, currentColor) left center / 1px 100% no-repeat,
    linear-gradient(currentColor, currentColor) right center / 1px 100% no-repeat;
  color: #427095;
  transform-origin: left center;
}
.page-home .home-trust-heading[data-motion-chapter]::before { color: #f2bca5; }
.page-trattamenti .service-group > h2::after { margin-block: 10px 0; width: 44px; }
.page-trattamenti .services-index a[aria-current="location"] {
  color: #fff;
  background: #173d60;
  border-color: #173d60;
}

main .visit-journey[data-motion-thread] {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding-inline-start: clamp(19px, 3vw, 28px);
}
main .visit-journey[data-motion-thread]::before,
main .visit-journey[data-motion-thread]::after {
  content: '';
  position: absolute;
  pointer-events: none;
  inset: var(--thread-inset, 16px) auto var(--thread-inset, 16px) 5px;
  width: 2px;
  border-radius: 2px;
}
main .visit-journey[data-motion-thread]::before { background: #c7e0f362; }
main .visit-journey[data-motion-thread]::after {
  background: linear-gradient(#bfe2f5, #fac5a9);
  transform-origin: center top;
  transform: scaleY(var(--thread-position, 1));
}
main .visit-journey[data-motion-thread] > li {
  position: relative;
}
main .visit-journey[data-motion-thread] > li::before {
  content: '';
  position: absolute;
  top: 16px;
  left: calc(1px - clamp(19px, 3vw, 28px));
  width: 10px;
  height: 10px;
  box-sizing: border-box;
  border: 2px solid #9abed5;
  border-radius: 50%;
  background: #224561;
  pointer-events: none;
}
main .visit-journey[data-motion-thread] > li[data-thread-active]::before {
  border-color: #ffe0ce;
  background: #f5bfa5;
  box-shadow: 0 0 0 3px #fac5a945;
}

@media (prefers-reduced-motion: no-preference) {
  html:not(.motion-reduced) .faq-directory details[open] > :not(summary),
  html:not(.motion-reduced) .visit-essentials details[open] > :not(summary) {
    animation: studio-answer 200ms ease-out both;
  }
}

@keyframes studio-answer {
  from { transform: translateY(-5px); opacity: .45; }
  to   { transform: translateY(0); opacity: 1; }
}

@media (max-width: 760px) {
  [data-motion-focus]::before, [data-motion-focus]::after { filter: none; }
}
@media (forced-colors: active) {
  [data-motion-focus]::before, [data-motion-focus]::after { display: none; }
  main .visit-journey[data-motion-thread]::before,
  main .visit-journey[data-motion-thread]::after { background: CanvasText; }
}

/* Marks move with native scroll. The layout and reading order stay fixed. */
@media (max-width: 760px) {
  .home-hero-band .hero-copy h1 > [data-motion-lead] { position: relative; }
  [data-motion-lead]::after {
    content: '';
    position: absolute;
    inset: auto auto -.25em 0;
    width: min(43%, 8.5rem);
    height: 3px;
    border-radius: 10px;
    background: #ffc7a7;
    transform-origin: left center;
    pointer-events: none;
  }
  .home-hero-band .doctor-hero .hero-focus .hero-focus-arc--outer {
    stroke: #bce6ffb0;
    stroke-width: 1.15;
  }
  .home-hero-band .doctor-hero .hero-focus .hero-focus-arc--inner {
    stroke: #ffc7a7;
    stroke-width: 2;
  }
  [data-motion-focus]::before, [data-motion-focus]::after {
    width: 30px;
    height: 30px;
    border-color: #fff2df;
    filter: drop-shadow(0 0 1px #102d4d);
  }
}

@media (prefers-reduced-motion: no-preference) {
  html:not(.motion-reduced) [data-motion-lead]::after {
    transform: scaleX(var(--mark-progress, 1));
  }
  html:not(.motion-reduced) [data-motion-chapter]::before,
  html:not(.motion-reduced) .page-trattamenti .service-group > h2::after {
    transform: scaleX(calc(.3 + .7 * var(--mark-progress, 1)));
  }
  html:not(.motion-reduced) [data-motion-focus] {
    --mark-travel: calc(1 - var(--mark-progress, 1));
  }
  html:not(.motion-reduced) [data-motion-focus]::before,
  html:not(.motion-reduced) [data-motion-focus]::after {
    opacity: calc(.42 + .58 * var(--mark-progress, 1));
    transform: translate(calc(var(--move-x) * var(--mark-travel)), calc(var(--move-y, 17px) * var(--mark-travel))) scale(calc(.68 + .32 * var(--mark-progress, 1)));
  }
  html:not(.motion-reduced) [data-motion-focus]::before { --move-x: var(--mark-distance, 28px); }
  html:not(.motion-reduced) [data-motion-focus]::after { --move-x: calc(-1 * var(--mark-distance, 28px)); }
  html:not(.motion-reduced) [data-motion-hero] .hero-focus-arc {
    stroke-dasharray: 1;
    stroke-dashoffset: calc(.72 * (1 - var(--mark-progress, 1)));
  }
  html:not(.motion-reduced) [data-motion-hero] .hero-focus-brackets {
    opacity: calc(.4 + .6 * var(--mark-progress, 1));
  }
}
@media (forced-colors: active) {
  [data-motion-lead]::after { background: CanvasText; }
  [data-motion-focus]::before, [data-motion-focus]::after { display: none; }
}

@media (min-width: 761px) {
  .home-hero-band .hero-copy h1 > [data-motion-lead] { position: relative; }
  [data-motion-lead]::after {
    content: '';
    position: absolute;
    inset: auto auto -.24em 0;
    width: min(58%, 13.25rem);
    height: 3px;
    border-radius: 10px;
    background: #ffc7a7;
    transform-origin: left center;
    pointer-events: none;
  }
  .home-hero-band .doctor-hero .hero-focus .hero-focus-arc--outer {
    stroke: #bce6ffb0;
    stroke-width: 1.4;
  }
  .home-hero-band .doctor-hero .hero-focus .hero-focus-arc--inner {
    stroke: #ffc7a7;
    stroke-width: 2.2;
  }
  [data-motion-chapter]::before { width: 76px; }
  [data-motion-focus] { --mark-distance: 44px; --move-y: 23px; }
}
@media (min-width: 761px) and (prefers-reduced-motion: no-preference) {
  html:not(.motion-reduced) [data-motion-hero] .hero-focus-arc {
    stroke-dashoffset: calc(.85 * (1 - var(--mark-progress, 1)));
  }
  html:not(.motion-reduced) [data-motion-hero] .hero-focus-brackets {
    transform: translateY(calc(20px * (1 - var(--mark-progress, 1))));
  }
}
