/* Independent trials: page-loader.js controls the loading reveal; motion.js controls sections.
   The loading overlay sits at 1400, above the navigation and mobile contact bar. */

/* 1. A full-viewport roller reveal, once per page load. Hidden unless JS opts in. */
.page-paint-loader {
  display: none;
  position: fixed;
  z-index: 1400;
  inset: 0;
  overflow: hidden;
  pointer-events: auto;
  animation: ap-loader-failsafe 0s 5.2s forwards;
}
.ap-loading .page-paint-loader { display: block; }
@keyframes ap-loader-failsafe { to { visibility: hidden; pointer-events: none; } }
.paint-loader-brand { position: absolute; top: 50%; left: 50%; width: 260px; max-width: 65%; transform: translate(-50%, -50%); }
.paint-loader-brand img { width: 100%; height: auto; mix-blend-mode: multiply; }
.is-rolling .paint-loader-brand { opacity: 0; transition: opacity 250ms ease; }
.paint-reveal-cover {
  position: absolute;
  inset: 0;
  background: #f6f5f0;
}
.paint-roller-track { position: absolute; inset: 0; }
.paint-roller {
  position: absolute;
  left: -28px;
  top: calc(50% - 120px);
  width: 58px;
  height: 240px;
  transform: rotate(-7deg);
  filter: drop-shadow(10px 12px 9px rgb(8 34 32 / .2));
}
.paint-roller-head {
  position: absolute;
  inset: 0;
  z-index: 1;
  border: 1px solid rgb(4 94 89 / .2);
  border-radius: 19px / 11px;
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, rgb(255 255 255 / .12) 3px 4px),
    linear-gradient(90deg, #078780, #26c9be 28%, #64ded4 51%, #0eb7ae 79%, #087e78);
  box-shadow: inset 4px 0 9px rgb(255 255 255 / .3), inset -5px 0 9px rgb(0 42 38 / .17);
}
.paint-roller-arm {
  position: absolute;
  left: 27px;
  top: 110px;
  width: 100px;
  height: 90px;
  border: 7px solid #adbdbb;
  border-left: 0;
  border-top: 0;
  border-radius: 0 0 24px 0;
  transform: rotate(-18deg);
  box-shadow: 2px 2px 0 rgb(255 255 255 / .65);
}
.paint-roller-grip {
  position: absolute;
  left: 94px;
  top: 100px;
  width: 105px;
  height: 30px;
  border: 2px solid #073c38;
  border-radius: 10px 18px 18px 10px;
  background: linear-gradient(#234743, #102522);
  transform: rotate(-18deg);
  transform-origin: left center;
}
.page-paint-loader.is-rolling .paint-reveal-cover,
.page-paint-loader.is-rolling .paint-roller-track {
  animation: ap-roller-pass 2.4s cubic-bezier(.42, 0, .2, 1) both;
}
.page-paint-loader .paint-roller { opacity: 0; }
.page-paint-loader.is-rolling .paint-roller { animation: ap-roller-pressure 2.4s ease-in-out both; }
@keyframes ap-roller-pass { from { transform: translateX(0); } to { transform: translateX(115%); } }
@keyframes ap-roller-pressure {
  0% { opacity: 0; transform: rotate(-12deg); }
  12%, 85% { opacity: 1; }
  50% { transform: rotate(3deg); }
  100% { opacity: 0; transform: rotate(-5deg); }
}

/* 2. A rough-edged underline, with no text reveal or layout shift. */
.paint-phrase { position: relative; display: inline-block; isolation: isolate; }
.motion-headings .paint-phrase::after {
  content: '';
  position: absolute;
  z-index: -1;
  left: -.02em;
  right: -.02em;
  bottom: -.02em;
  height: .25em;
  background: #61d7cb;
  clip-path: polygon(0 25%, 6% 12%, 19% 19%, 33% 4%, 48% 14%, 64% 0, 83% 12%, 98% 6%, 96% 40%, 100% 62%, 97% 87%, 81% 83%, 66% 100%, 48% 87%, 29% 96%, 11% 83%, 0 94%, 2% 64%);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 850ms cubic-bezier(.2,.7,.15,1);
}
.motion-headings .paint-phrase.is-painted::after { transform: scaleX(1); }

/* 3. Service-card feedback. The text and photos are never masked. */
.motion-services .service-band::after {
  content: '';
  position: absolute;
  z-index: 3;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 13px;
  pointer-events: none;
  background: var(--aqua);
  clip-path: polygon(0 20%, 14% 31%, 29% 12%, 47% 28%, 68% 4%, 86% 20%, 100% 0, 100% 100%, 0 100%);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 650ms cubic-bezier(.2,.7,.15,1);
}
.motion-services .service-content { background-color: #fff; transition: background-color 450ms ease; }
.motion-services .service-band:is(:hover, :focus-within, .is-painted)::after { transform: scaleX(1); }
.motion-services .service-band:is(:hover, :focus-within) .service-content { background-color: #e5f7f3; }

/* 4. The paint follows the existing connected line, including responsive turns. */
.motion-process .process-step { --paint-delay: 0ms; }
.motion-process .process-step:nth-child(2) { --paint-delay: 220ms; }
.motion-process .process-step:nth-child(3) { --paint-delay: 440ms; }
.motion-process .process-step:nth-child(4) { --paint-delay: 660ms; }
.motion-process .process-step:not(:last-child)::before {
  content: '';
  position: absolute;
  z-index: 1;
  top: 27px;
  right: -28px;
  left: 84px;
  height: 2px;
  background: var(--aqua);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 850ms cubic-bezier(.2,.7,.15,1) var(--paint-delay);
}
.motion-process .process-step:first-child::before { left: 56px; }
.motion-process .process-step.is-painted::before { transform: scaleX(1); }
.motion-process .process-step.is-painted .step-num { background: var(--aqua); color: #042c29; border-color: var(--aqua); transition-delay: var(--paint-delay); }
@media (max-width: 1060px) {
  .paint-roller { top: calc(50% - 95px); width: 46px; height: 190px; left: -23px; }
  .motion-process .process-step:nth-child(2)::before { display: none; }
  .motion-process .process-step:nth-child(3)::before { left: 56px; }
}
@media (max-width: 720px) {
  .paint-roller { top: calc(50% - 70px); width: 34px; height: 140px; left: -17px; }
  .paint-roller-arm { top: 62px; left: 15px; width: 64px; height: 60px; border-width: 5px; }
  .paint-roller-grip { left: 60px; top: 54px; width: 75px; height: 23px; }
  .page-paint-loader.is-rolling .paint-reveal-cover,
  .page-paint-loader.is-rolling .paint-roller-track,
  .page-paint-loader.is-rolling .paint-roller { animation-duration: 1.7s; }
  .motion-process .process-step { --paint-delay: 0ms; }
  .motion-process .process-step:not(:last-child)::before {
    display: block;
    top: 55px;
    right: auto;
    left: 27px;
    width: 2px;
    height: calc(100% - 55px);
    transform: scaleY(0);
    transform-origin: center top;
  }
  .motion-process .process-step.is-painted::before { transform: scaleY(1); }
}
@media (prefers-reduced-motion: reduce) {
  .ap-loading .page-paint-loader { display: none; }
  .motion-headings .paint-phrase::after { transform: none; }
  .motion-process .process-step::before { transition: none; }
}
