/* Scroll choreography is opt-in. Without its controller, all content stays visible. */
@media (prefers-reduced-motion: no-preference) {
  #inicio.byc-scroll-enabled .kontable-hero-inner {
    transform: translate3d(0, var(--byc-hero-drift, 0px), 0) scale(var(--byc-hero-scale, 1));
    opacity: var(--byc-hero-opacity, 1);
    transform-origin: 50% 80%;
  }

  #soluciones.byc-scroll-enabled { position: relative; }
  #soluciones.byc-scroll-enabled > .kontable-heading,
  #soluciones.byc-scroll-enabled > .kontable-grid,
  #soluciones.byc-scroll-enabled > .kontable-help { position: relative; z-index: 1; }

  #soluciones.byc-scroll-enabled > .kontable-heading {
    transform: translate3d(0, var(--byc-heading-y, 0px), 0);
  }

  /* A quiet horizon opens from the centre, connecting the union to its three plans. */
  #soluciones > .byc-scroll-bridge {
    position: absolute;
    z-index: 0;
    inset: 0 0 auto;
    height: 230px;
    overflow: hidden;
    pointer-events: none;
    opacity: var(--byc-bridge-opacity, 0);
  }
  #soluciones > .byc-scroll-bridge::before {
    content: '';
    position: absolute;
    top: 0;
    left: 4%;
    width: 92%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #8196e7 25%, #e5eaff 50%, #8196e7 75%, transparent);
    box-shadow: 0 0 18px #b7c6ff80;
    transform: scaleX(var(--byc-bridge-width, 0));
    transform-origin: center;
  }
  #soluciones > .byc-scroll-bridge::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, #758ce12b, #596ed10b 46%, transparent 72%);
    transform: scaleX(var(--byc-bridge-width, 0));
    transform-origin: 50% 0;
  }

  /* Scope transforms to source cards: the modal's cloned card is deliberately excluded. */
  #soluciones .kontable-grid > .kontable-card.byc-scroll-card {
    transform: perspective(1100px)
      translate3d(var(--byc-card-x, 0px), var(--byc-card-y, 0px), 0)
      rotateX(var(--byc-card-tilt, 0deg)) rotateZ(var(--byc-card-angle, 0deg))
      scale(var(--byc-card-scale, 1));
    transform-origin: 50% 100%;
    transition: border-color .22s, box-shadow .22s;
    will-change: transform;
  }
  #soluciones .kontable-grid > .kontable-card.byc-scroll-settled {
    transform: none;
    will-change: auto;
  }
  #soluciones .kontable-grid > .kontable-card[data-scroll-state="armed"] { will-change: auto; }

  @media (max-width: 760px) {
    #soluciones > .byc-scroll-bridge { height: 160px; }
    #soluciones .kontable-grid > .kontable-card.byc-scroll-card { transform-origin: 50% 50%; }
  }
}

/* Keep the original method/contact groups visible while owning their repeated
   entrance, regardless of when the legacy script adds .reveal/.is-visible. */
#metodo .byc-repeat-reveal,
#contacto .byc-repeat-reveal {
  opacity: 1;
  transform: none;
  transition: none;
}
@media (prefers-reduced-motion: no-preference) {
  #metodo .byc-repeat-entering,
  #contacto .byc-repeat-entering { animation: byc-repeat-section 900ms cubic-bezier(.16, 1, .3, 1) both; }
  #metodo .byc-repeat-pressed,
  #contacto .byc-repeat-pressed { animation-play-state: paused !important; }
}
@keyframes byc-repeat-section {
  from { opacity: .55; transform: translate3d(0, calc(var(--byc-enter-direction, 1) * 28px), 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  #soluciones > .byc-scroll-bridge { display: none; }
}
