/* Grey Rock Consulting — bold motion layer.
   Rules under .fx only apply when the motion script is running
   (JavaScript on, reduced-motion off). Everything else is the fallback. */

/* ---------- Structure shared by both modes ---------- */

.hero-sticky {
  display: contents;
}

.ridge {
  transform-origin: 50% 100%;
}

.ridge > svg {
  overflow: visible;
  width: 100%;
  height: 100%;
  max-width: none;
}

.ridge::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 1px);
  height: 180vh;
}

.ridge-back::after {
  background: #202026;
}

.ridge-far::after {
  background: #2c2c33;
}

.ridge-mid::after {
  background: #1f1f24;
}

.ridge-near::after {
  background: #121214;
}

.scene-num,
.confetti {
  display: none;
}

/* ---------- Contact ridges ---------- */

.contact-section {
  padding-bottom: clamp(150px, 22vw, 280px);
}

.contact-ridges {
  position: absolute;
  inset: auto 0 0 0;
  height: min(46%, 320px);
  pointer-events: none;
}

.cr {
  overflow: visible;
  position: absolute;
  left: -3%;
  bottom: -1px;
  width: 106%;
  max-width: none;
  height: 100%;
  will-change: transform;
}

.cr-near {
  height: 78%;
}

/* Once mountains.js has drawn a contact range it repeats to either side, so its
   width can be capped. That stops the mountains growing up behind the contact
   details on very wide screens. */
.cr.is-built {
  left: 50%;
  width: min(106%, 1400px);
  translate: -50% 0;
}

.contact {
  z-index: 1;
}

/* ====================================================
   Motion mode
   ==================================================== */

/* ---------- Hero fly-through ---------- */

.fx .hero {
  display: block;
  height: 220vh;
  min-height: 0;
  padding: 0;
  overflow: visible;
  background: var(--ink);
}

.fx .hero-sticky {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  height: 100vh;
  height: 100svh;
  padding: calc(var(--header-h) + 32px) 0 var(--hero-pad-bottom);
  overflow: hidden;
  background: linear-gradient(180deg, #151518 0%, #1b1b20 60%, #222228 100%);
}

.fx .hero-box,
.fx .hero-frame,
.fx .ridge,
.fx .mist {
  will-change: transform, opacity;
}

/* Short screens (a phone held sideways): the copy is taller than a pinned,
   screen-high hero can hold, so the hero scrolls like a normal section.
   script.js adds the class when the copy would not clear the logo. */
.fx.hero-flat .hero {
  height: auto;
}

.fx.hero-flat .hero-sticky {
  position: relative;
  height: auto;
  min-height: 100vh;
  min-height: 100svh;
}

/* ---------- Stats ---------- */

.fx .stats-band.in-hero {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% + var(--header-h) / 2);
  z-index: 2;
  margin: 0;
  padding: 0;
  background: transparent;
  transform: translateY(-50%);
  pointer-events: none;
}

.fx .in-hero .stat {
  padding-block: clamp(16px, 3vh, 36px);
  opacity: 0;
  will-change: transform, opacity;
}

.fx #platform {
  overflow: hidden;
}

.fx .stat-value {
  font-size: clamp(40px, 5.6vw, 92px);
  white-space: nowrap;
}

/* ---------- Platform cards ---------- */

.fx .collage {
  transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.35s ease-out;
}

.fx .collage .pop {
  opacity: 1;
  scale: 1;
}

/* ---------- Pinned scene ---------- */

.fx .scene-num {
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
}

.fx .scene-num span {
  position: absolute;
  right: -6%;
  top: 50%;
  color: transparent;
  font-family: var(--font-display);
  font-size: clamp(200px, 30vw, 430px);
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 1;
  -webkit-text-stroke: 2px rgba(255, 255, 255, 0.14);
  opacity: 0;
  translate: 0 -10%;
  transition: opacity 0.6s ease, translate 0.9s var(--ease);
}

.fx .scene-stage[data-step="1"] .scene-num span:nth-child(1),
.fx .scene-stage[data-step="2"] .scene-num span:nth-child(2),
.fx .scene-stage[data-step="3"] .scene-num span:nth-child(3) {
  opacity: 1;
  translate: 0 -50%;
}

.fx .scene-stage[data-step="2"] .scene-num span:nth-child(1),
.fx .scene-stage[data-step="3"] .scene-num span:nth-child(1),
.fx .scene-stage[data-step="3"] .scene-num span:nth-child(2) {
  translate: 0 -90%;
}

.fx .scene-stage::after {
  content: "";
  position: absolute;
  width: min(460px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(31, 157, 97, 0.34), transparent);
  opacity: 0;
  scale: 0.8;
  transition: opacity 0.8s ease, scale 0.9s var(--ease);
}

.fx .scene-stage[data-step="3"]::after {
  opacity: 1;
  scale: 1.25;
}

.fx .scene-stage[data-step="3"]::before {
  opacity: 0;
}

.fx .demo-invoice.flip {
  animation: flip 0.7s var(--ease);
}

@keyframes flip {
  0% {
    transform: perspective(900px) rotateY(0deg);
  }
  49.9% {
    transform: perspective(900px) rotateY(90deg);
  }
  50% {
    transform: perspective(900px) rotateY(-90deg);
  }
  100% {
    transform: perspective(900px) rotateY(0deg);
  }
}

.fx .confetti {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: block;
  width: 0;
  height: 0;
  pointer-events: none;
}

.fx .confetti i {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--c, #fff);
  animation: burst 1.1s cubic-bezier(0.1, 0.7, 0.3, 1) forwards;
}

@keyframes burst {
  from {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.4);
  }
}

@media (max-width: 860px) {
  .fx .scene-num span {
    right: -10%;
    font-size: 220px;
  }
}

/* ---------- Pricing ---------- */

.fx #pricing,
.fx #contact {
  will-change: clip-path;
}

.fx #pricing {
  overflow: hidden;
}

/* ---------- Magnetic buttons ---------- */

.fx .btn-primary {
  transition: background-color 0.2s ease, box-shadow 0.25s ease, translate 0.25s var(--ease), transform 0.3s var(--ease);
}
