/* Two SVG planes share one continuous geometric line. No fades or smoothing. */
.path-loop-module {
  padding-block: 32px 0;
  color: var(--purple);
  background: var(--paper);
}

.path-loop-module > .module-caption {
  padding-inline: var(--gutter);
}

.path-loop-scene {
  position: relative;
}

.path-loop-stage {
  display: grid;
  place-items: center;
  overflow: clip;
}

.path-loop-composition {
  container-type: inline-size;
  width: 100%;
  max-width: 1440px;
  padding-top: 16px;
}

.path-loop-canvas {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  width: 100%;
  max-width: 1440px;
  aspect-ratio: 3 / 2;
  margin-inline: auto;
}

.path-loop-title {
  position: relative;
  z-index: 4;
  width: 92%;
  margin: 0 auto;
  color: var(--purple);
  font: 700 clamp(64px, 9.3cqw, 134px)/var(--leading-heading) Poppins, Arial, sans-serif;
  letter-spacing: -.035em;
  text-align: center;
  text-wrap: balance;
}

.path-loop-line {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.path-loop-line--back { z-index: 1; }
.path-loop-line--front { z-index: 3; }
.path-loop-line--mobile { display: none; }
.path-loop-contact-shadow { pointer-events: none; }

.path-loop-line path {
  fill: none;
  stroke: var(--lilac);
  stroke-width: 104px;
  stroke-linecap: var(--path-linecap);
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

/* Explicit stroke-only mask geometry. Avoid <use> inheritance/default fill in masks.
   Width/caps follow the visible path at every breakpoint; alpha exists only on its band. */
.path-loop-line .path-loop-shadow-mask {
  fill: none;
  stroke: #fff;
}
.path-loop-line .path-loop-contact-shadow { fill: none; }

.path-loop-photo {
  position: absolute;
  z-index: 2;
  top: 22.916667%;
  left: 38.194444%;
  width: 23.611111%;
  height: 53.125%;
  margin: 0;
}

.path-loop-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-photo);
}

.path-loop-scene.is-drawing {
  height: 220svh;
}

.path-loop-scene.is-drawing .path-loop-stage {
  position: sticky;
  top: 0;
  height: 100svh;
}

/* The title owns a row above the unchanged media coordinates. Together they
   fit the sticky stage, including the workshop navigation above it. */
.path-loop-scene.is-drawing:not([data-path-loop-flow]) .path-loop-composition {
  width: min(100%, calc((100svh - var(--path-loop-stage-offset, 0px) - 16px) * 1.3));
}
.path-loop-scene[data-path-loop-flow] .path-loop-composition { width: min(100%, 144svh); }
.path-loop-scene.is-drawing .path-loop-photo { will-change: transform; }

/* A compact finished composition, with no sticky scroll distance. */
@media (max-width: 900px), (max-height: 679px) {
  .path-loop-module { padding-top: 16px; }
  .path-loop-scene.is-drawing { height: auto; }
  .path-loop-scene.is-drawing .path-loop-stage {
    position: relative;
    height: auto;
  }
  .path-loop-scene.is-drawing:not([data-path-loop-flow]) .path-loop-composition,
  .path-loop-scene[data-path-loop-flow] .path-loop-composition { width: 100%; }
  .path-loop-canvas,
  .path-loop-scene.is-drawing .path-loop-canvas {
    width: 100%;
    aspect-ratio: auto;
    min-height: calc(220px + min(87cqw, 510px));
  }
  .path-loop-title {
    width: 70%;
    font-size: var(--type-display);
    line-height: var(--leading-heading);
  }
  .path-loop-photo {
    top: 168px;
    left: 50%;
    width: min(58cqw, 340px);
    height: min(87cqw, 510px);
    transform: translateX(-50%);
  }
  .path-loop-line path { stroke-width: 42px; }
}

/* Separate static geometry for narrow screens. 586.2069px = 340px / .58:
   path and photo therefore share the same scale before and after the photo cap. */
@media (max-width: 900px) {
  .path-loop-canvas,
  .path-loop-scene.is-drawing .path-loop-canvas {
    min-height: calc(52px + min(87cqw, 510px));
    margin-top: 64px;
  }
  .path-loop-photo { top: 0; }
  .path-loop-line--desktop { display: none; }
  .path-loop-line--mobile {
    display: block;
    inset: auto;
    top: 0;
    left: 50%;
    width: min(100%, 586.2069px);
    height: auto;
    aspect-ratio: 390 / 420;
    transform: translateX(-50%);
  }
  .path-loop-line--mobile path { stroke-width: clamp(30px, 10cqw, 42px); }
  .path-loop-photo img { border-radius: var(--radius-photo); }
}

/* CSS also preserves the complete line before the motion observer runs. */
body.motion-off .path-loop-line path {
  stroke-dasharray: none !important;
  stroke-dashoffset: 0 !important;
  visibility: visible !important;
}

@media (prefers-reduced-motion: reduce) {
  .path-loop-line path {
    stroke-dasharray: none !important;
    stroke-dashoffset: 0 !important;
    visibility: visible !important;
  }
}
