/* Homepage-only motion: 3D particle scene, orbits, simplified platforms, scroll story.
   Paired with home-motion.js. Every effect falls back to the plain layout in style.css. */

/* Particle canvas sits behind the page; opaque sections and cards cover it */
#scene-canvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: -1; pointer-events: none; display: none;
}
body.has-3d #scene-canvas { display: block; animation: scene-in 0.8s ease-out; }
@keyframes scene-in { from { opacity: 0; } }

/* Hero layout */
.orbits { display: none; }
.hero-split { display: block; }

/* Rotating light around the video */
.vsl-frame { position: relative; padding: 3px; border: 0; }
.vsl-frame::before {
  content: ''; position: absolute; inset: -60%; pointer-events: none;
  background: conic-gradient(rgba(255,216,77,0.95), rgba(255,216,77,0.35) 50deg, rgba(22,52,85,0.12) 110deg 290deg, rgba(255,216,77,0.35) 330deg, rgba(255,216,77,0.95));
  animation: rim-spin 7s linear infinite;
}
.vsl-frame > * { position: relative; z-index: 1; border-radius: 9px; overflow: hidden; }
@keyframes rim-spin { to { transform: rotate(1turn); } }

/* ---------- Platforms: phone walking down a Google results page ----------
   Base = phone beside a plain list (small screens, reduced motion, no JS).
   body.plat-story (set by home-motion.js on big screens) = pinned scroll story. */
/* Dark band: separates the story from the page and covers the particles behind it.
   overflow-x: clip stops the glow widening the page without breaking sticky. */
#platforms {
  overflow-x: clip; color: #fff;
  background:
    radial-gradient(ellipse 60% 70% at 72% 50%, rgba(31,69,115,0.9), transparent 70%),
    linear-gradient(180deg, #0b1626, #102238 50%, #0b1626);
  box-shadow: inset 0 40px 60px -40px rgba(0,0,0,0.5), inset 0 -40px 60px -40px rgba(0,0,0,0.5);
}
#platforms .section-label { color: var(--gold); }
#platforms .section-title { color: #fff; }
#platforms .section-sub { color: rgba(255,255,255,0.68); }
#platforms .opp-card h3 { color: #fff; }
#platforms .opp-card p { color: rgba(255,255,255,0.7); }
#platforms .opp-card .svc-cta { color: var(--gold); }
#platforms .opp-card .svc-cta:hover { color: #fff; }
#platforms .opp-num { background: rgba(255,216,77,0.16); color: var(--gold); }
#platforms .opp-cta { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12); box-shadow: none; }
#platforms .opp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 48px; align-items: center; }
#platforms .plat-copy .section-label,
#platforms .plat-copy .section-title,
#platforms .plat-copy .section-sub { text-align: left; margin-left: 0; }
#platforms .plat-copy .section-sub { margin-bottom: 26px; }
#platforms .plat-steps { display: none; }
#platforms .opp-list {
  gap: 0; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); border-radius: 10px;
  padding: 4px 24px;
}
#platforms .opp-card {
  background: none; border: 0; border-bottom: 1px solid rgba(255,255,255,0.1); border-radius: 0;
  box-shadow: none; padding: 16px 0; transform: none;
}
#platforms .opp-card:last-child { border-bottom: 0; }
#platforms .opp-card.is-active { box-shadow: none; transform: none; }
#platforms .opp-card h3 { font-size: 15.5px; margin-bottom: 3px; }
#platforms .opp-card h3 span { display: inline; }
#platforms .opp-card p { font-size: 14px; margin-bottom: 3px; }

@media (max-width: 899px) {
  #platforms .opp-grid { grid-template-columns: 1fr; gap: 0; }
  #platforms .plat-copy { display: contents; }
  #platforms .plat-copy .section-label,
  #platforms .plat-copy .section-title,
  #platforms .plat-copy .section-sub { text-align: center; margin-left: auto; margin-right: auto; }
  #platforms .plat-visual { order: 1; margin-bottom: 30px; }
  #platforms .opp-list { order: 2; }
}

/* Phone */
.plat-visual { position: relative; display: flex; justify-content: center; }
.plat-visual::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 170%; aspect-ratio: 1; translate: -50% -50%;
  pointer-events: none; z-index: 0;
  background: radial-gradient(closest-side, rgba(255,216,77,0.22), rgba(255,216,77,0.06) 55%, transparent);
}
.phone {
  position: relative; z-index: 1; width: 300px; aspect-ratio: 300 / 610; padding: 10px;
  background: #050b15; border-radius: 46px;
  box-shadow: 0 0 0 1.5px rgba(255,255,255,0.14), 0 40px 90px rgba(0,0,0,0.55), 0 0 60px rgba(255,216,77,0.12);
}
.phone-notch {
  position: absolute; z-index: 4; left: 50%; top: 20px; width: 88px; height: 24px; translate: -50% 0;
  background: #050b15; border-radius: 14px;
}
.phone-tag {
  position: absolute; z-index: 4; right: 22px; top: 23px; padding: 3px 7px; border-radius: 6px;
  font: 800 8.5px/1 ui-monospace, Consolas, monospace; letter-spacing: 1.2px;
  color: var(--gold-dark); background: #fff; border: 1px solid rgba(255,216,77,0.6);
}
.phone-screen {
  position: relative; height: 100%; overflow: hidden; border-radius: 37px; background: #fff;
  font-size: 11.5px; color: var(--text); line-height: 1.35;
}

/* Results page inside the phone */
.ph-serp {
  padding: 58px 12px 16px; translate: 0 var(--shift, 0px);
  transition: translate 0.8s cubic-bezier(0.22, 0.8, 0.2, 1), transform 0.7s cubic-bezier(0.22, 0.8, 0.2, 1), opacity 0.6s;
}
.ph-bar {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 999px;
  border: 1px solid var(--border); box-shadow: 0 2px 8px rgba(30,34,60,0.08); font-size: 12px;
}
.ph-g { color: #4285f4; font-size: 14px; }
.ph-q { flex: 1; color: var(--text); }
.ph-mic { font-size: 10px; }
.ph-tabs { display: flex; gap: 14px; padding: 10px 6px 4px; font-size: 10.5px; color: var(--text3); border-bottom: 1px solid var(--border); }
.ph-tabs .on { color: #1a73e8; font-weight: 700; box-shadow: 0 7px 0 -5px #1a73e8; }
.ph-block {
  margin-top: 10px; padding: 10px; border-radius: 14px; border: 1.5px solid transparent;
  transition: opacity 0.45s, border-color 0.45s, background-color 0.45s, box-shadow 0.45s;
}
.phone-screen.has-active .ph-block { opacity: 0.32; }
.phone-screen.has-active .ph-block.is-active {
  opacity: 1; border-color: var(--gold); background: rgba(255,216,77,0.06);
  box-shadow: 0 8px 24px rgba(255,216,77,0.22);
}
.ph-tag { font-size: 9.5px; font-weight: 700; color: var(--text2); margin-bottom: 6px; }
.ph-lsa { display: grid; gap: 7px; }
.ph-pro { display: flex; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.ph-pro b, .ph-place b { display: block; font-size: 11px; }
.ph-pro em, .ph-place em { display: block; font-style: normal; font-size: 9.5px; color: #b06000; }
.ph-av {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: 10px; font-weight: 800; color: #fff; background: var(--accent);
}
.ph-av2 { background: #2f7d5b; }
.ph-gg { display: inline-block; margin-top: 2px; font-size: 9px; font-weight: 700; color: #188038; }
.ph-url { font-size: 9.5px; color: var(--text2); }
.ph-title { font-size: 12.5px; color: #1a0dab; font-weight: 600; margin: 2px 0 6px; }
.ph-title.ph-dim { color: #5a5fb0; }
.ph-line { height: 6px; border-radius: 3px; background: #e9ecf3; margin-top: 5px; }
.ph-line.short { width: 62%; }
.ph-map {
  position: relative; height: 92px; border-radius: 10px; margin-bottom: 8px; overflow: hidden;
  background:
    linear-gradient(115deg, transparent 46%, #fff 46% 50%, transparent 50%),
    linear-gradient(25deg, transparent 58%, #fff 58% 61%, transparent 61%),
    linear-gradient(#dfeedd, #e8f0e4);
}
.ph-map span { position: absolute; font-size: 15px; translate: -50% -100%; }
.ph-map svg.i-mappin { width: 18px; height: 18px; display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25)); }
.ph-mic { color: #4285f4; display: inline-flex; }
.ph-site-call { display: flex; align-items: center; justify-content: center; gap: 5px; }
/* Yellow is too light on the phone's white screen, so these use a deep yellow-brown */
.ph-toast-ic { color: #9a7600; }
.phone-tag { color: #9a7600 !important; border-color: rgba(242,194,48,0.7) !important; }
.ph-place { padding: 5px 2px; border-top: 1px solid var(--border); }
.ph-paa, .ph-more { margin-top: 10px; padding: 10px; transition: opacity 0.45s; }
.phone-screen.has-active .ph-paa, .phone-screen.has-active .ph-more { opacity: 0.32; }
.ph-q-row { display: flex; justify-content: space-between; padding: 8px 2px; border-top: 1px solid var(--border); font-size: 11px; }
.ph-q-row::after { content: '⌄'; color: var(--text3); }
/* While the page drives the phone, JS moves it every frame, so no CSS easing */
body.plat-story .ph-serp { transition: transform 0.7s cubic-bezier(0.22, 0.8, 0.2, 1), opacity 0.6s; }

/* Website screen that slides in on the last step */
.ph-site {
  position: absolute; inset: 0; background: var(--bg); translate: 100% 0;
  transition: translate 0.75s cubic-bezier(0.22, 0.8, 0.2, 1);
}
.phone-screen.on-site .ph-site { translate: 0 0; }
.phone-screen.on-site .ph-serp { transform: translateX(-30%); opacity: 0.4; }
.ph-site-bar { display: flex; align-items: center; gap: 7px; padding: 50px 14px 10px; background: #fff; border-bottom: 1px solid var(--border); font-size: 11.5px; }
.ph-site-logo { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 8.5px; font-weight: 800; display: grid; place-items: center; }
.ph-burger { margin-left: auto; color: var(--text2); }
.ph-site-hero { margin: 12px; padding: 18px 14px; border-radius: 16px; color: #fff; background: linear-gradient(140deg, var(--accent), var(--accent-light)); }
.ph-site-kicker { font-size: 9px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--gold); }
.ph-site-h { font-size: 19px; font-weight: 800; line-height: 1.15; letter-spacing: -0.4px; margin: 6px 0 14px; }
.ph-site-call, .ph-site-quote { text-align: center; padding: 9px; border-radius: 10px; font-weight: 800; font-size: 11.5px; }
.ph-site-call { background: var(--gold); color: var(--accent); }
.phone-screen.on-site .ph-site-call { animation: ph-pulse 1.8s ease-out 0.9s infinite; }
.ph-site-quote { margin-top: 7px; border: 1px solid rgba(255,255,255,0.35); }
.ph-site-trust { display: flex; justify-content: space-around; margin: 4px 12px; padding: 10px 6px; background: #fff; border-radius: 12px; border: 1px solid var(--border); font-size: 9.5px; font-weight: 700; color: var(--accent); }
.ph-site-list { margin: 10px 12px; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.ph-site-list span { display: flex; justify-content: space-between; padding: 9px 12px; font-size: 11px; font-weight: 600; border-top: 1px solid var(--border); }
.ph-site-list span:first-child { border-top: 0; }
.ph-site-list span::after { content: '›'; color: var(--text3); }
.ph-toast {
  position: absolute; left: 12px; right: 12px; bottom: 16px; display: flex; gap: 9px; align-items: center;
  padding: 10px 12px; border-radius: 14px; background: #fff; box-shadow: 0 10px 30px rgba(22,52,85,0.22);
  opacity: 0; translate: 0 30px; transition: opacity 0.5s, translate 0.6s cubic-bezier(0.22, 0.8, 0.2, 1);
}
.phone-screen.on-site .ph-toast { opacity: 1; translate: 0 0; transition-delay: 1.4s; }
.ph-toast-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,216,77,0.18); }
.ph-toast b { display: block; font-size: 11px; }
.ph-toast em { display: block; font-style: normal; font-size: 9.5px; color: var(--text2); }
@keyframes ph-pulse { 0% { box-shadow: 0 0 0 0 rgba(255,216,77,0.6); } 100% { box-shadow: 0 0 0 12px rgba(255,216,77,0); } }

/* Finger tap */
.ph-tap {
  position: absolute; z-index: 3; left: var(--x, 50%); top: var(--y, 50%); width: 40px; height: 40px;
  margin: -20px 0 0 -20px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: rgba(22,52,85,0.18); border: 2px solid rgba(22,52,85,0.35);
}
.ph-tap.is-on { animation: ph-tap 0.9s ease-out; }
@keyframes ph-tap { 0% { opacity: 0; scale: 0.5; } 25% { opacity: 1; scale: 0.8; } 100% { opacity: 0; scale: 1.6; } }

/* Pinned scroll story on big screens */
@media (min-width: 1000px) and (min-height: 680px) and (prefers-reduced-motion: no-preference) {
  body.plat-story #platforms { padding: 0 0 70px; }
  body.plat-story .plat-track { height: 460vh; }
  body.plat-story .plat-sticky { position: sticky; top: 0; height: 100vh; padding-top: 84px; display: flex; align-items: center; }
  body.plat-story #platforms .opp-grid { width: 100%; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  body.plat-story #platforms .plat-copy .section-title { font-size: 30px; }
  body.plat-story #platforms .plat-copy .section-sub { margin-bottom: 30px; }
  body.plat-story .phone { width: auto; height: min(610px, calc(100vh - 150px)); }

  body.plat-story #platforms .plat-steps { display: flex; gap: 6px; margin-bottom: 22px; }
  .plat-steps button { width: 46px; padding: 8px 0; border: 0; background: none; cursor: pointer; }
  .plat-steps i { display: block; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.16); overflow: hidden; position: relative; }
  .plat-steps i::after {
    content: ''; position: absolute; inset: 0; background: var(--gold);
    transform-origin: 0 50%; transform: scaleX(0); transition: transform 0.25s;
  }
  .plat-steps .is-done i::after { transform: scaleX(1); }
  .plat-steps .is-active i::after { transform: scaleX(var(--p, 0)); transition: none; }

  body.plat-story #platforms .opp-list { position: relative; height: 230px; padding: 0; background: none; border: 0; box-shadow: none; }
  body.plat-story #platforms .opp-card { position: absolute; inset: 0; display: block; padding: 0; border: 0; pointer-events: none; }
  body.plat-story #platforms .opp-num { display: none; }
  body.plat-story #platforms .opp-card h3 {
    font-size: clamp(32px, 3.3vw, 46px); line-height: 1.08; letter-spacing: -1.2px; margin-bottom: 14px;
    overflow: hidden; padding-bottom: 0.1em;
  }
  body.plat-story #platforms .opp-card h3 span {
    display: block; translate: 0 110%; transition: translate 0.75s cubic-bezier(0.22, 0.8, 0.2, 1);
  }
  body.plat-story #platforms .opp-card.is-past h3 span { translate: 0 -110%; }
  body.plat-story #platforms .opp-card p,
  body.plat-story #platforms .opp-card .svc-cta { opacity: 0; translate: 0 14px; transition: opacity 0.35s, translate 0.35s; }
  body.plat-story #platforms .opp-card p { font-size: 17px; max-width: 440px; margin-bottom: 14px; }
  body.plat-story #platforms .opp-card .svc-cta { font-size: 14.5px; }
  body.plat-story #platforms .opp-card.is-active { pointer-events: auto; }
  body.plat-story #platforms .opp-card.is-active h3 span { translate: 0 0; }
  body.plat-story #platforms .opp-card.is-active p,
  body.plat-story #platforms .opp-card.is-active .svc-cta { opacity: 1; translate: 0 0; transition: opacity 0.6s 0.25s, translate 0.6s 0.25s; }
}

@media (min-width: 1000px) {
  .hero { padding-top: 56px; }
  .hero-split {
    display: grid; grid-template-columns: minmax(0, 1fr) 500px; gap: 36px;
    align-items: center; text-align: left; margin-bottom: 44px;
  }
  .hero-split h1 { margin-left: 0; }
  .hero-split p { margin-left: 0; }
  .hero-split .hero-ctas { justify-content: flex-start; margin-bottom: 0; }

  .orbits { display: block; position: relative; width: 500px; height: 500px; }
  .orbit-core {
    position: absolute; left: 50%; top: 50%; width: 96px; height: 96px; margin: -48px 0 0 -48px;
    object-fit: contain;
  }
  .orbit {
    position: absolute; left: 50%; top: 50%; border-radius: 50%;
    border: 1.5px dashed rgba(22,52,85,0.16); translate: -50% -50%;
  }
  .orbit-1 { width: 220px; height: 220px; --r: 110px; --spin: 30s; animation: orbit-spin var(--spin) linear infinite reverse; }
  .orbit-2 { width: 350px; height: 350px; --r: 175px; --spin: 40s; animation: orbit-spin var(--spin) linear infinite; }
  .orbit-3 { width: 480px; height: 480px; --r: 240px; --spin: 50s; animation: orbit-spin var(--spin) linear infinite; }
  .orbit-item {
    position: absolute; left: 50%; top: 50%; width: 0; height: 0;
    transform: rotate(var(--a)) translateY(calc(var(--r) * -1)) rotate(calc(var(--a) * -1));
  }
  .orbit-face {
    position: absolute; translate: -50% -50%; white-space: nowrap;
    background: var(--surface); border: 1.5px solid var(--border); border-radius: 8px;
    padding: 6px 12px; font-size: 12.5px; font-weight: 800; color: var(--accent); box-shadow: var(--shadow);
    animation: orbit-spin var(--spin) linear infinite reverse;
  }
  .orbit-1 .orbit-face { animation-direction: normal; }
  .orbit-face svg { width: 13px; height: 13px; margin-right: 6px; vertical-align: -2px; color: var(--gold-dark); }
  .theme-dark .orbit-face svg { color: var(--gold); }
}
@keyframes orbit-spin { to { transform: rotate(360deg); } }

/* The logo only shows where the particles can't run */
@media (pointer: fine) and (prefers-reduced-motion: no-preference) {
  body:not(.no-3d) .orbit-core { display: none; }
}

/* Scroll story (particles morph beside the steps). Needs height for all three cards. */
.process-visual { display: none; }
@media (min-width: 1000px) and (min-height: 680px) and (prefers-reduced-motion: no-preference) {
  body:not(.no-3d) #process { height: 280vh; padding: 0; }
  body:not(.no-3d) .process-sticky { position: sticky; top: 0; height: 100vh; padding-top: 84px; display: flex; align-items: center; }
  body:not(.no-3d) .process-layout { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
  body:not(.no-3d) .process-copy .section-label,
  body:not(.no-3d) .process-copy .section-title,
  body:not(.no-3d) .process-copy .section-sub { text-align: left; margin-left: 0; }
  body:not(.no-3d) .process-copy .section-sub { margin-bottom: 22px; }
  body:not(.no-3d) .process-visual { display: block; height: 60vh; }
  body:not(.no-3d) .process-grid { grid-template-columns: 1fr; gap: 12px; }
  body:not(.no-3d) .process-card {
    display: grid; grid-template-columns: 46px 1fr; column-gap: 16px; padding: 16px 20px; text-align: left;
    transition: opacity 0.3s, border-color 0.3s, box-shadow 0.3s;
  }
  body:not(.no-3d) .process-num { grid-row: 1 / span 2; margin: 0; }
  body:not(.no-3d) .process-card h3 { margin-bottom: 2px; }
  body.story-ready .process-card { opacity: 0.45; }
  body.story-ready .process-card.is-active { opacity: 1; border-color: var(--gold); box-shadow: var(--shadow-md); }
}

/* Reduced motion: everything holds still */
@media (prefers-reduced-motion: reduce) {
  .vsl-frame::before, .orbit, .orbit-face, .phone-screen.on-site .ph-site-call { animation: none; }
  .ph-tap { display: none; }
}
