/**
 * Realprice experience layer · site wide motion + liquid interactions
 * Loaded on every customer facing page via templates/_design_head.html.
 *
 * Design rule: only ever animate transform / opacity so the compositor does
 * the work and scrolling stays at 60fps. Anything that would trigger layout
 * or paint on scroll is avoided. The whole layer is disabled under
 * prefers-reduced-motion (see the block at the very bottom).
 */

/* --- Top scroll progress bar (compositor only: transform scaleX) --------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--brand, #0a6b68), #18a79d 60%, var(--brand, #0a6b68));
  z-index: 2000;
  will-change: transform;
  pointer-events: none;
}

/* --- Liquid buttons ------------------------------------------------------ */
/* Applied to primary CTAs (class added in templates or auto tagged by JS).
   The white highlight wells up from the pointer via --mx / --my set in JS. */
.rp-liquid {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(120deg, var(--brand, #0a6b68) 0%, #0e8a82 48%, var(--brand, #0a6b68) 100%);
  background-size: 220% 100%;
  background-position: 0% 0;
  box-shadow: 0 4px 14px rgba(var(--brand-rgb, 10, 107, 104), 0.26);
  transition: background-position 0.6s ease,
              transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.4s ease;
}
.rp-liquid::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: var(--mx, 50%);
  top: var(--my, 50%);
  width: 0;
  height: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 68%);
  opacity: 0;
  transition: width 0.55s ease, height 0.55s ease, opacity 0.5s ease;
}
.rp-liquid:hover {
  background-position: 100% 0;
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(var(--brand-rgb, 10, 107, 104), 0.4);
}
.rp-liquid:hover::before { width: 420px; height: 420px; opacity: 1; }
.rp-liquid:active { transform: translateY(0) scale(0.98); }
.rp-liquid span { transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); display: inline-block; }
.rp-liquid:hover span { transform: translateX(5px); }

/* --- Scroll reveal ------------------------------------------------------- */
/* The js-reveal class is only added by experience.js, so a no-JS visitor (or
   a JS error) never gets content trapped behind opacity:0. */
.js-reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0s);
}
.js-reveal.reveal-in { opacity: 1; transform: none; }

/* =========================================================================
   LIQUID GLASS
   A frosted, depth-rich material in the Apple vein: translucent fill, a real
   backdrop blur + saturation, a top edge highlight, layered ambient/key
   shadows, and a soft specular sheen. Cards refract the page wide ambient
   mesh behind them (see .rp-ambient), which is what sells the "liquid" feel.
   ========================================================================= */
:root {
  --glass-fill: rgba(255, 255, 255, 0.55);
  --glass-fill-strong: rgba(255, 255, 255, 0.72);
  --glass-blur: 18px;
  --glass-radius: 20px;
  --glass-stroke: rgba(26, 35, 50, 0.07);
  /* Inner top highlight + outer ambient/key shadow stack = readable depth. */
  --glass-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    0 1px 2px rgba(16, 24, 40, 0.04),
    0 18px 40px -14px rgba(16, 24, 40, 0.18),
    0 8px 16px -10px rgba(16, 24, 40, 0.1);
  --glass-shadow-hover:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 0 0 1px rgba(255, 255, 255, 0.25),
    0 1px 2px rgba(16, 24, 40, 0.05),
    0 30px 60px -18px rgba(16, 24, 40, 0.28),
    0 12px 24px -12px rgba(16, 24, 40, 0.14);
}

.rp-glass {
  position: relative;
  background: var(--glass-fill);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.6) brightness(1.02);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.6) brightness(1.02);
  border: 1px solid var(--glass-stroke);
  border-radius: var(--glass-radius);
  box-shadow: var(--glass-shadow);
}
/* Diagonal specular sheen across the top-left corner. */
.rp-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 42%);
  opacity: 0.7;
  z-index: 0;
}
.rp-glass > * { position: relative; z-index: 1; }

/* Interactive glass: subtle 3D tilt toward the pointer + a moving specular
   highlight. The tilt transform itself is written inline by experience.js
   (so it cooperates with the scroll-reveal transform instead of fighting it);
   --mx / --my drive the specular position. */
.rp-glass-tilt {
  transform-style: preserve-3d;
  transition: box-shadow 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.rp-glass-tilt::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, -20%),
              rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 60%);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.rp-glass-tilt:hover {
  box-shadow: var(--glass-shadow-hover);
}
.rp-glass-tilt:hover::after { opacity: 1; }

/* --- Page wide ambient mesh (injected by experience.js as first body child).
   z-index:-1 paints above the body background but below normal flow content,
   so glass backdrop-filters refract these drifting blobs. ----------------- */
.rp-ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.rp-ambient .rp-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  will-change: transform;
}
.rp-ambient .rp-blob-1 {
  width: 46vw; height: 46vw; min-width: 380px; min-height: 380px;
  top: -8vw; left: -6vw;
  background: radial-gradient(circle at 50% 50%, rgba(var(--brand-rgb, 10, 107, 104), 0.3), transparent 70%);
  animation: blobDrift1 26s ease-in-out infinite;
}
.rp-ambient .rp-blob-2 {
  width: 40vw; height: 40vw; min-width: 320px; min-height: 320px;
  top: 18vh; right: -8vw;
  background: radial-gradient(circle at 50% 50%, rgba(120, 170, 255, 0.22), transparent 70%);
  animation: blobDrift2 31s ease-in-out infinite;
}
.rp-ambient .rp-blob-3 {
  width: 38vw; height: 38vw; min-width: 300px; min-height: 300px;
  bottom: -10vw; left: 26vw;
  background: radial-gradient(circle at 50% 50%, rgba(155, 199, 82, 0.2), transparent 70%);
  animation: blobDrift3 36s ease-in-out infinite;
}
.rp-ambient .rp-blob-4 {
  width: 32vw; height: 32vw; min-width: 260px; min-height: 260px;
  top: 52vh; left: 8vw;
  background: radial-gradient(circle at 50% 50%, rgba(201, 160, 0, 0.14), transparent 70%);
  animation: blobDrift4 41s ease-in-out infinite;
}
@keyframes blobDrift1 { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(8vw, 6vh, 0) scale(1.14); } }
@keyframes blobDrift2 { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(-7vw, 5vh, 0) scale(1.1); } }
@keyframes blobDrift3 { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(5vw, -6vh, 0) scale(1.16); } }
@keyframes blobDrift4 { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(6vw, -4vh, 0) scale(1.12); } }

/* --- Reduced motion: keep everything visible, drop the motion ------------ */
@media (prefers-reduced-motion: reduce) {
  .scroll-progress { display: none; }
  .rp-liquid { transition: none; }
  .rp-liquid::before { display: none; }
  .js-reveal { opacity: 1; transform: none; transition: none; }
  .rp-ambient .rp-blob { animation: none; }
  .rp-glass-tilt { transition: none; transform: none; }
}

/* --- Reduced transparency / no backdrop-filter: fall back to solid -------- */
@media (prefers-reduced-transparency: reduce) {
  .rp-ambient { display: none; }
  .rp-glass {
    background: var(--bg-paper, #fff);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
@supports not ((-webkit-backdrop-filter: blur(2px)) or (backdrop-filter: blur(2px))) {
  .rp-glass { background: var(--glass-fill-strong); }
}
