/* RPM Services — motion layer (GSAP + ScrollTrigger + Three.js). Loaded by the "RPM motion" snippet
   (19-motion.php). Everything here is inert unless <html> has .rpm-m, which the inline head flag only
   sets when the visitor has not asked for reduced motion. .rpm-m-ok is added once rpm-motion.js runs;
   if it never does, the flag removes .rpm-m and the page shows as built. */

/* Hold the hero copy for the first frame so it can reveal instead of flashing. */
html.rpm-m:not(.rpm-m-ok) :is(.rpm-hero__copy, .rpm-hero__bottom, .rpm-hero__svc, .rpm-hero__card) { visibility: hidden; }

.rpm-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.rpm-line { padding-bottom: 0.04em; margin-bottom: -0.04em; } /* SplitText line masks: keep descenders */

/* Page progress: a painted stripe along the top edge. */
.rpm-progress { position: fixed; left: 0; top: 0; width: 100%; height: 3px; z-index: 10000; pointer-events: none; background: linear-gradient(90deg, var(--rpm-garnet), var(--rpm-paint)); transform: scaleX(0); transform-origin: left; }

/* Hero: lane stripe that paints across, and the rail filling in. */
.rpm-stripe { position: absolute; left: 0; right: 0; top: var(--rpm-stripe-y, auto); bottom: clamp(14px, 3vh, 30px); height: 7px; z-index: 1; pointer-events: none; display: flex; gap: 3.4vw; padding-left: calc(var(--rpm-rail) + 2vw); }
.rpm-stripe i { flex: 0 0 7.5vw; height: 100%; background: rgba(255, 255, 255, 0.9); transform: scaleX(0); transform-origin: left; box-shadow: 0 0 14px rgba(255, 255, 255, 0.28); }
.rpm-stripe b { position: absolute; top: -9px; left: 0; width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 18%, rgba(255, 255, 255, 0.35) 40%, rgba(255, 255, 255, 0) 70%); opacity: 0; }
@media (max-width: 640px) { .rpm-stripe { display: none; } }
.rpm-rail-fill { position: absolute; top: 0; right: -1px; width: 2px; height: 100%; background: linear-gradient(var(--rpm-paint), var(--rpm-garnet) 60%, rgba(137, 0, 19, 0)); transform: scaleY(0); transform-origin: top; pointer-events: none; }

/* Dark bands: the stall pattern drifts with scroll. */
html.rpm-m :is(.rpm-band, .rpm-close)::before { transform: translate3d(0, var(--rpm-par, 0px), 0); will-change: transform; }

/* Odometer digits on the facts row. */
.rpm-odo { display: inline-block; height: 1em; overflow: hidden; vertical-align: top; line-height: 1; }
.rpm-odo > span { display: block; }
.rpm-odo > span > span { display: block; height: 1em; }

/* Photo tiles and cards: painted wipe on reveal, 3D tilt and a light sweep under the cursor. */
.rpm-wipe { position: absolute; inset: 0; z-index: 3; background: var(--rpm-garnet); transform: scaleX(0); transform-origin: left; pointer-events: none; }
.rpm-shine { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; transition: opacity 0.35s; background: radial-gradient(520px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0) 42%); }
html.rpm-m .rpm-tile__tag { z-index: 4; }
html.rpm-m :is(.rpm-tile, .rpm-card):hover .rpm-shine { opacity: 1; }
html.rpm-m :is(.rpm-tile, .rpm-card) { transform-style: preserve-3d; will-change: transform; }

/* ============ The 3D lot: "Four steps" on the home page, pinned while the lot stripes itself. ============ */
.rpm-lot3d-on { padding-block: 0 !important; }
.rpm-lot3d-on > .rpm-wrap {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: auto auto minmax(0, 1fr); align-content: start;
  column-gap: clamp(28px, 4vw, 64px); height: 100vh; height: 100svh; padding-block: clamp(56px, 9vh, 104px) clamp(28px, 6vh, 64px);
}
.rpm-lot3d-on > .rpm-wrap > * { grid-column: 1; }
.rpm-lot3d-on .rpm-h2 { margin: 0; }
.rpm-lot3d-on .rpm-steps { grid-column: 1; grid-row: 3; grid-template-columns: 1fr; gap: 0; margin-top: 30px; border-top: 0; align-self: start; }
.rpm-lot3d-on .rpm-step { display: grid; grid-template-columns: 58px minmax(0, 1fr); column-gap: 14px; align-items: baseline; padding: 15px 0; border-top: 1px solid var(--rpm-line); opacity: 0.34; transition: opacity 0.45s ease; }
.rpm-lot3d-on .rpm-step:last-child { border-bottom: 1px solid var(--rpm-line); }
.rpm-lot3d-on .rpm-step__n { grid-row: span 2; font-size: 38px; color: var(--rpm-ink); transition: color 0.45s ease; }
.rpm-lot3d-on .rpm-step__title { margin: 0 0 6px; }
.rpm-lot3d-on .rpm-step { position: relative; cursor: pointer; &:hover { opacity: 0.75; } &:focus-visible { outline: 3px solid var(--rpm-paint); outline-offset: 4px; } }
.rpm-lot3d-on .rpm-step.is-on { opacity: 1; }
.rpm-step__fill { position: absolute; left: 0; bottom: -1px; width: 100%; height: 2px; background: var(--rpm-garnet); transform: scaleX(0); transform-origin: left; pointer-events: none; }
.rpm-lot3d__cue { position: absolute; z-index: 2; right: 20px; bottom: 22px; display: flex; flex-direction: row; align-items: center; gap: 12px; padding: 11px 14px; background: var(--rpm-garnet); color: #fff; font: 700 15px/1 var(--rpm-font-display); letter-spacing: 0.06em; text-transform: uppercase; pointer-events: none; transition: opacity 0.4s, transform 0.4s;
  & i { position: relative; width: 12px; height: 18px; border: 2px solid #fff; border-radius: 7px; }
  & i::after { content: ""; position: absolute; left: 50%; top: 3px; width: 2px; height: 4px; margin-left: -1px; background: #fff; border-radius: 1px; animation: rpm-cue 1.4s ease-in-out infinite; }
  &.is-gone { opacity: 0; transform: translateY(8px); }
}
@keyframes rpm-cue { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(7px); opacity: 0; } 100% { transform: translateY(0); opacity: 0; } }
.rpm-lot3d-on .rpm-step.is-on .rpm-step__n { color: var(--rpm-garnet); }
.rpm-lot3d__stage {
  grid-column: 2 !important; grid-row: 1 / -1; position: relative; min-height: 420px; overflow: hidden; touch-action: pan-y;
  background: radial-gradient(130% 95% at 25% 0%, #2d2935 0%, #16141b 52%, #0b0b0e 100%); color: #fff; cursor: grab;
  &.is-drag { cursor: grabbing; }
  & canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; }
  &::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; box-shadow: inset 0 0 140px rgba(0, 0, 0, 0.6); }
}
.rpm-lot3d__hud { position: absolute; inset: 0; z-index: 2; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; padding: 18px 20px; font: 600 11px/1.2 var(--rpm-font-body); letter-spacing: 0.16em; text-transform: uppercase; }
.rpm-lot3d__row { display: flex; flex-direction: row; justify-content: space-between; align-items: flex-start; gap: 12px; }
.rpm-lot3d__chip { display: inline-flex; white-space: nowrap; align-items: center; gap: 10px; padding: 9px 12px; background: rgba(10, 9, 14, 0.62); border: 1px solid rgba(255, 255, 255, 0.16); backdrop-filter: blur(6px); & b { color: var(--rpm-paint); font-weight: 700; } }
.rpm-lot3d__hint { opacity: 0.7; padding-top: 9px; @media (hover: none), (max-width: 520px) { display: none; } }
.rpm-lot3d__count { font: 500 44px/1 var(--rpm-font-display); letter-spacing: -0.01em; text-transform: none; font-variant-numeric: tabular-nums; & small { display: block; margin-top: 6px; font: 600 11px/1 var(--rpm-font-body); letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.7; } }
.rpm-lot3d__bar { position: absolute; z-index: 2; left: 0; bottom: 0; height: 3px; width: 100%; background: linear-gradient(90deg, var(--rpm-garnet), var(--rpm-paint)); transform: scaleX(0); transform-origin: left; }
@media (max-width: 900px) {
  .rpm-lot3d-on > .rpm-wrap { grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0, 1fr) auto; padding-block: 48px 18px; }
  .rpm-lot3d-on .rpm-h2 { font-size: clamp(28px, 7.4vw, 40px); }
  .rpm-lot3d__stage { grid-column: 1 !important; grid-row: 3; margin-top: 16px; min-height: 0; }
  .rpm-lot3d-on .rpm-steps { grid-row: 4; position: relative; min-height: 132px; margin-top: 14px; }
  .rpm-lot3d-on .rpm-step { position: absolute; left: 0; top: 0; width: 100%; padding: 0; border: 0 !important; opacity: 0; visibility: hidden; transition: opacity 0.35s ease, visibility 0s linear 0.35s; }
  .rpm-lot3d-on .rpm-step.is-on { opacity: 1; visibility: visible; transition: opacity 0.35s ease; }
  .rpm-step__fill { display: none; }
  .rpm-lot3d__cue { right: 12px; bottom: 12px; font-size: 13px; padding: 9px 11px; }
  .rpm-lot3d__count { font-size: 34px; }
}

/* Closing band: the stall pattern is drawn by rpm-motion.js instead of the static background. */
.rpm-close--paint::before { display: none; }
.rpm-close__lot { position: absolute; right: 0; top: 0; width: 64%; height: 100%; pointer-events: none;
  & line, & path { fill: none; stroke: rgba(255, 255, 255, 0.24); stroke-width: 5; stroke-linecap: square; }
  & path { stroke: rgba(241, 194, 50, 0.45); stroke-width: 7; }
  @media (max-width: 900px) { width: 100%; opacity: 0.55; }
}
.rpm-close__glow { fill: rgba(255, 255, 255, 0.9); opacity: 0; filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 22px rgba(241, 194, 50, 0.6)); }
.rpm-close__wrap { z-index: 1; }
