/* =========================================================
   Raymelz — extra home page motion
   Word-by-word headline reveals, scroll progress, hero
   parallax/tilt, directional reveals and the animated
   illustrations. Loaded only on the home page.
   ========================================================= */

/* ---- Scroll progress bar ---- */
.scroll-prog { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1001; pointer-events: none;
  background: linear-gradient(90deg, var(--primary), var(--accent)); transform: scaleX(0); transform-origin: left; }

/* ---- Word-by-word headline reveals (home.js splits the words) ---- */
.split-words .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .12em; margin-bottom: -.12em; }
.split-words .w > span { display: inline-block; will-change: transform; }

.js .hero-copy > h1.split-words { animation: none; opacity: 1; }
.hero h1.split-words .w > span { transform: translateY(110%); animation: wordUp .9s cubic-bezier(.2,.7,.2,1) forwards; animation-delay: calc(.15s + var(--i) * .07s); }
@keyframes wordUp { to { transform: none; } }

.reveal .split-words .w > span { transform: translateY(110%); transition: transform .8s cubic-bezier(.2,.7,.2,1); transition-delay: calc(.12s + var(--i) * .05s); }
.reveal.in .split-words .w > span { transform: none; }

/* ---- Hero: parallax copy + tilting visual ---- */
.hero-visual.hx { transition: transform .25s ease-out; will-change: transform; }

/* ---- Directional reveals ---- */
.js .pillar.dev.reveal:not(.in) { transform: translateX(-40px); }
.js .pillar.mkt.reveal:not(.in) { transform: translateX(40px); }
.js .include.reveal:not(.in) { transform: translateY(30px) scale(.92); }
.js .split > .reveal:first-child:not(.in) { transform: translateX(-40px); }
.js .split > .split-visual.reveal:not(.in) { transform: translateX(40px) scale(.97); }

/* =========================================================
   Animated illustrations
   ========================================================= */
.ill { width: 100%; height: auto; overflow: visible; }
.ill * { transform-box: fill-box; }

/* Hero: shield (top right) and businessman (bottom right) */
.ill-wrap { position: absolute; z-index: 3; pointer-events: none; opacity: 0; animation: hxToast .8s cubic-bezier(.2,.7,.2,1) forwards; }
.ill-shield-wrap { width: 96px; top: -40px; right: -14px; animation-delay: 2.4s; }
.ill-man-wrap { width: 124px; right: -48px; bottom: -44px; animation-delay: 1.6s; }
.ill-shield { animation: illBob 5s 3.2s ease-in-out infinite; }
.ill-man { animation: illBob 6s 2.4s ease-in-out infinite reverse; }
@keyframes illBob { 50% { transform: translateY(-10px); } }

.ill-ring { transform-origin: center; animation: illSpin 14s linear infinite; }
.ill-pulse { transform-origin: center; animation: illPulse 2.6s ease-out infinite; }
@keyframes illSpin { to { transform: rotate(360deg); } }
@keyframes illPulse { 0% { transform: scale(.7); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }

.ill-shackle { animation: illLock 4s ease-in-out infinite; }
@keyframes illLock { 0%, 22% { transform: translateY(-7px); } 34%, 100% { transform: none; } }
.ill-check { transform-origin: center; animation: illPop 4s ease-in-out infinite; }
@keyframes illPop { 0%, 30% { transform: scale(0); } 40% { transform: scale(1.2); } 46%, 92% { transform: scale(1); } 100% { transform: scale(0); } }

.ill-wave { transform-origin: 0% 100%; animation: illWave 2.4s ease-in-out infinite; }
@keyframes illWave { 0%, 60%, 100% { transform: rotate(0); } 15%, 45% { transform: rotate(-14deg); } 30% { transform: rotate(8deg); } }
.ill-bar { transform-origin: 50% 100%; animation: illGrow 3s ease-in-out infinite; }
.ill-bar:nth-of-type(2) { animation-delay: .15s; } .ill-bar:nth-of-type(3) { animation-delay: .3s; } .ill-bar:nth-of-type(4) { animation-delay: .45s; }
@keyframes illGrow { 0%, 100% { transform: scaleY(.35); } 40%, 75% { transform: scaleY(1); } }

/* Who We Are: tech team */
.split-visual { display: flex; flex-direction: column; gap: 22px; }
.ill-team { max-width: 440px; margin: 0 auto; }
.ill-gear { transform-origin: center; animation: illSpin 8s linear infinite; }
.ill-gear-2 { animation-direction: reverse; animation-duration: 5s; }
.ill-code { transform-origin: 0 50%; animation: illCode 6s ease-out infinite both; }
.ill-code:nth-of-type(2) { animation-delay: .35s; } .ill-code:nth-of-type(3) { animation-delay: .7s; }
.ill-code:nth-of-type(4) { animation-delay: 1.05s; } .ill-code:nth-of-type(5) { animation-delay: 1.4s; } .ill-code:nth-of-type(6) { animation-delay: 1.75s; }
@keyframes illCode { 0% { transform: scaleX(0); opacity: 1; } 10% { transform: scaleX(1); } 85% { transform: scaleX(1); opacity: 1; } 95%, 100% { transform: scaleX(1); opacity: 0; } }
.ill-caret { animation: illBlink 1s steps(1) infinite; }
@keyframes illBlink { 50% { opacity: 0; } }
.ill-type { transform-origin: 0 0; animation: illTap .45s ease-in-out infinite alternate; }
@keyframes illTap { to { transform: rotate(-4deg); } }
.ill-point { transform-origin: 100% 100%; animation: illPoint 3s ease-in-out infinite; }
@keyframes illPoint { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(10deg); } }
.ill-bubble { transform-origin: 40% 100%; animation: illBob 4s ease-in-out infinite; }
.ill-dot { animation: illDot 1.2s ease-in-out infinite; }
.ill-dot:nth-of-type(2) { animation-delay: .15s; } .ill-dot:nth-of-type(3) { animation-delay: .3s; }
@keyframes illDot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-3px); opacity: 1; } }
.ill-tag { animation: illBob 5s 1s ease-in-out infinite; }

/* Every website includes: secured website */
.ill-secure-wrap { max-width: 460px; margin: -18px auto 40px; }
.ill-scan { animation: illScan 3.6s cubic-bezier(.45,0,.55,1) infinite; }
@keyframes illScan { 0% { transform: translateY(0); opacity: 0; } 10% { opacity: 1; } 85% { opacity: 1; } 100% { transform: translateY(136px); opacity: 0; } }
.ill-bigshield { animation: illBob 4.5s ease-in-out infinite; }
.ill-tick { stroke-dasharray: 40; stroke-dashoffset: 40; animation: illTick 3.6s ease-in-out infinite; }
@keyframes illTick { 0%, 55% { stroke-dashoffset: 40; } 75%, 100% { stroke-dashoffset: 0; } }
.ill-padlock { animation: illBob 5s .8s ease-in-out infinite reverse; }
.ill-spark { transform-origin: center; animation: illTwinkle 2.4s ease-in-out infinite; }
.ill-spark.s2 { animation-delay: .8s; } .ill-spark.s3 { animation-delay: 1.6s; }
@keyframes illTwinkle { 0%, 100% { transform: scale(.4) rotate(0); opacity: .3; } 50% { transform: scale(1.1) rotate(45deg); opacity: 1; } }

/* =========================================================
   "Why Raymelz" card deck
   Static grid by default; home.js adds .is-deck on desktop,
   which pins the section and flies the cards into a fan.
   ========================================================= */
.why-deck { position: relative; color: #fff; padding: 96px 0;
  background:
    radial-gradient(ellipse 60% 55% at 15% 20%, rgba(0,163,224,.35), transparent 62%),
    radial-gradient(ellipse 55% 50% at 85% 85%, rgba(10,79,214,.55), transparent 60%),
    linear-gradient(160deg, #031538 0%, var(--primary-deep) 55%, #031538 100%); }
.wd-inner { display: grid; grid-template-columns: 1fr; gap: 44px; }
.wd-left .eyebrow { color: #a8e4ff; font-size: .95rem; }
.wd-heading { font-size: clamp(2.4rem, 5vw, 4.4rem); line-height: 1.04; letter-spacing: -.03em; margin: 0 0 22px;
  background: linear-gradient(100deg, #ffffff 0%, #7fd8ff 45%, var(--accent) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.wd-lead { color: rgba(255,255,255,.86); font-size: 1.1rem; max-width: 500px; margin: 0; }
.wd-stack { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.wd-card { display: flex; flex-direction: column; padding: 32px 28px; border-radius: 20px;
  background: linear-gradient(160deg, #ffffff 0%, #ffffff 60%, var(--accent-soft) 100%); border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 30px 60px rgba(1,10,32,.4); }
.wd-num { font-size: .9rem; font-weight: 700; letter-spacing: .1em; color: var(--primary); opacity: .55; margin-bottom: 14px; }
.wd-card h3 { font-size: 1.5rem; line-height: 1.15; margin: 0 0 14px;
  background: linear-gradient(100deg, var(--primary-deep) 0%, var(--primary) 50%, var(--accent) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.wd-card p { color: var(--primary-dark); font-size: 1rem; margin: 0 0 28px; }
.wd-accent { margin-top: auto; width: 46px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--primary), var(--accent)); }

/* Pinned deck (desktop) */
.why-deck.is-deck { height: 520vh; padding: 0 0 80px; }
.is-deck .wd-pin { position: sticky; top: 0; height: 100vh; overflow: hidden; display: flex; align-items: center; padding-top: var(--header-h); }
.is-deck .wd-inner { grid-template-columns: 1fr 1fr; align-items: center; gap: 40px; width: 100%; }
.is-deck .wd-stack { display: block; position: relative; width: 430px; height: min(500px, calc(100vh - var(--header-h) - 80px)); margin-left: auto; margin-right: 30px; }
.is-deck .wd-card { position: absolute; inset: 0; padding: 40px 36px; will-change: transform; }
.is-deck .wd-card h3 { font-size: 2.1rem; }
.is-deck .wd-card p { font-size: 1.08rem; }

/* "How we help you grow": white outline so the laptop and phone stand out from the blue panel */
.gx-browser { box-shadow: 0 0 0 2px #fff, 0 24px 50px rgba(3,18,52,.35); }
.gx-phone { box-shadow: 0 0 0 2px #fff, 0 20px 40px rgba(3,18,52,.4); }

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .wd-stack { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .why-deck { padding: 64px 0; }
  .wd-stack { grid-template-columns: 1fr; gap: 14px; }
  .wd-card { padding: 26px 22px; }
}
@media (max-width: 960px) {
  .ill-man-wrap { right: -10px; }
}
@media (max-width: 640px) {
  .ill-shield-wrap { width: 64px; top: -26px; right: 4px; }
  .ill-man-wrap { width: 82px; right: -4px; bottom: -36px; }
  .ill-secure-wrap { margin: -24px auto 28px; }
  .split-visual { gap: 16px; }
}

/* ---- Reduced motion: show everything, still ---- */
@media (prefers-reduced-motion: reduce) {
  .scroll-prog { display: none; }
  .ill-wrap { opacity: 1 !important; }
  .split-words .w > span, .ill-code, .ill-bar, .ill-check { transform: none !important; opacity: 1 !important; }
  .ill-tick { stroke-dashoffset: 0 !important; }
  .ill-scan { opacity: 0 !important; }
  .js .reveal { transform: none !important; }
}

/* Phones/tablets: keep the floating chips and shield clear of the "100% transparent" link */
@media (max-width: 960px) {
  .hero-visual.hx { margin-top: 34px; }
}
