/* ==================================== Animaciones ==================================== */


  /* ====== GLOBAL MOTION TOKENS (SUBTLE) ====== */
  :root {
    --rs-transition-fast: 0.25s ease-out;
    --rs-transition-med: 0.4s ease-out;
  }

  /* Reserva espacio para la barra de scroll y evita micro saltos al abrir el popup */
  html,
  body {
    scrollbar-gutter: stable both-edges;
  }

  /* ====== SCROLL REVEAL (SECCIONES) ====== */
  .reveal {
    opacity: 0;
    transform: translateY(40px);
    transition:
      opacity var(--rs-transition-med),
      transform var(--rs-transition-med);
    will-change: opacity, transform;
  }

  .reveal.rs-visible {
    opacity: 1;
    transform: translateY(0);
  }

  /* ====== BUTTON MICRO-ANIMATIONS ====== */
  .btn-anim {
    position: relative;
    transition:
      transform var(--rs-transition-fast),
      box-shadow var(--rs-transition-fast),
      background-color var(--rs-transition-fast),
      color var(--rs-transition-fast);
    will-change: transform, box-shadow;
  }

  .btn-anim:hover,
  .btn-anim:focus-visible {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  }

  .btn-anim:active {
    transform: translateY(0) scale(0.99);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  }

  /* ====== CARD HOVER (SERVICIOS) – SOFT & ROUNDED ====== */
  .card-modern {
    background-color: #ffffff;
    border-radius: 26px;
    padding: 2.2rem 2rem 2rem;
    overflow: visible;
    position: relative;
    top: 0;
    transform: translateY(0);
    box-shadow: 0 0 0 rgba(15, 23, 42, 0);
    transition: top 0.25s ease-out, box-shadow 0.35s ease-out;
    will-change: top, box-shadow;

    /* Para que el “Ver detalles” se quede abajo siempre */
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .card-modern:hover {
    top: -8px;
    box-shadow:
      0 24px 60px rgba(15, 23, 42, 0.14),
      0 0 0 1px rgba(15, 23, 42, 0.02);
  }

  /* Levantado un poco más cuando el popup está activo */
  .card-modern.service-popup-active {
    top: -12px;
  }

  .card-modern .item-content {
    flex: 1 1 auto;
  }

  .card-modern .item-wrapper img {
    transition: transform var(--rs-transition-fast);
    will-change: transform;
  }

  .card-modern:hover .item-wrapper img {
    animation: rs-icon-wiggle 0.7s ease-out;
  }

  @keyframes rs-icon-wiggle {
    0% {
      transform: translateY(0) rotate(0deg);
    }
    25% {
      transform: translateY(-4px) rotate(-3deg);
    }
    50% {
      transform: translateY(-2px) rotate(3deg);
    }
    75% {
      transform: translateY(-4px) rotate(-2deg);
    }
    100% {
      transform: translateY(0) rotate(0deg);
    }
  }

  /* “Ver detalles” centrado abajo en todas las tarjetas */
  .card-modern .service-more {
    margin-top: 1.4rem;
    text-align: center;
  }

  .card-modern .service-more-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #72A114;
    text-decoration: underline;
    cursor: pointer;
  }

  .card-modern:hover .service-more-label {
    color: #5c8510;
  }

  /* Extiende el área de hover al slide para evitar el “brinco” en los bordes */
  #features04-25 .embla__slide:hover .card-modern,
  #features04-25 .embla__slide:focus-within .card-modern {
    top: -8px;
    box-shadow:
      0 24px 60px rgba(15, 23, 42, 0.14),
      0 0 0 1px rgba(15, 23, 42, 0.02);
  }

  #features04-25 .embla__slide:hover .card-modern .item-wrapper img {
    animation: rs-icon-wiggle 0.7s ease-out;
  }

  #features04-25 .embla__slide:hover .card-modern .service-more-label {
    color: #5c8510;
  }

  /* ====== SERVICIOS – SMOOTH SLIDE CONTENT ANIMATION ====== */
  .features017 .embla__slide .slide-content {
    opacity: 0;
    transform: translateY(16px);
    transition:
      opacity 700ms ease-out,
      transform 700ms ease-out,
      top 250ms ease-out;
    will-change: opacity, transform, top;
  }

  .features017 .embla__viewport {
    overflow-x: hidden;
    overflow-y: visible;
    padding-top: 3rem;
    padding-bottom: 5rem;
  }

  .features017 .embla__slide.rs-slide-visible .slide-content {
    opacity: 1;
    transform: translateY(0);
  }

  .rs-chip {
    transition:
      transform var(--rs-transition-fast),
      box-shadow var(--rs-transition-fast);
    will-change: transform, box-shadow;
  }

  .rs-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
  }

  /* ====== HERO INTRO ANIMATION (TEXT CARD) ====== */
  .header09 .hero-card {
    opacity: 0;
    transform: translateY(32px) scale(0.97);
  }

  .header09.rs-visible .hero-card {
    animation: rs-hero-intro 0.9s ease-out forwards;
    animation-delay: 0.15s;
  }

  @keyframes rs-hero-intro {
    0% {
      opacity: 0;
      transform: translateY(32px) scale(0.97);
    }
    40% {
      opacity: 1;
      transform: translateY(10px) scale(1.0);
    }
    100% {
      opacity: 1;
      transform: translateY(0) scale(1.0);
    }
  }

  /* ====== QUIÉNES SOMOS & CAPACITACIONES TEXT MOTION ====== */
  .article05 .text-wrapper {
    position: relative;
  }

  .article05.rs-visible .text-wrapper {
    animation: rs-soft-float 1.4s ease-out forwards;
  }

  .article18 .mbr-text {
    opacity: 0;
    transform: translateY(18px);
  }

  .article18.rs-visible .mbr-text {
    animation: rs-text-rise 0.85s ease-out forwards;
    animation-delay: 0.2s;
  }

  @keyframes rs-soft-float {
    0% {
      transform: translateY(10px);
    }
    50% {
      transform: translateY(-4px);
    }
    100% {
      transform: translateY(0);
    }
  }

  @keyframes rs-text-rise {
    0% {
      opacity: 0;
      transform: translateY(18px);
    }
    100% {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* ====== TRAZABILIDAD ICON IDLE MOTION ====== */
  .rs-trazab-focus {
    animation: rs-icon-breathe 10s ease-in-out infinite;
    transform-origin: center center;
  }

  .card-modern:hover .rs-trazab-focus {
    animation: rs-icon-wiggle 0.7s ease-out;
  }

  @keyframes rs-icon-breathe {
    0% {
      transform: translateY(0) scale(1);
    }
    50% {
      transform: translateY(-5px) scale(1.04);
    }
    100% {
      transform: translateY(0) scale(1);
    }
  }

  /* ====== HORARIO & UBICACIÓN – ENTRADA LATERAL ====== */
  .contacts03 .rs-card {
    opacity: 0;
    transform: translateX(-32px);
    transition:
      opacity var(--rs-transition-med),
      transform var(--rs-transition-med);
    will-change: opacity, transform;
  }

  .contacts03 .google-map {
    opacity: 0;
    transform: translateX(32px);
    transition:
      opacity var(--rs-transition-med),
      transform var(--rs-transition-med);
    will-change: opacity, transform;
  }

  .contacts03.rs-visible .rs-card,
  .contacts03.rs-visible .google-map {
    opacity: 1;
    transform: translateX(0);
  }

  /* ====== SCROLL PROGRESS BAR ====== */
  .rs-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: #72A114;
    z-index: 9999;
    pointer-events: none;
    transform-origin: left center;
  }

  /* ====== MOBILE SCROLL HINT (FLECHA) ====== */
  .rs-scroll-hint {
    position: absolute;
    left: 50%;
    bottom: 1.8rem;
    transform: translateX(-50%);
    display: none;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.75rem;
    letter-spacing: .02em;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
    pointer-events: none;
    opacity: 1;
    transition:
      opacity var(--rs-transition-fast),
      transform var(--rs-transition-fast);
  }

  .rs-scroll-hint-text {
    font-weight: 500;
  }

  .rs-scroll-arrow {
    width: 16px;
    height: 16px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    animation: rs-scroll-arrow 1s infinite;
  }

  @keyframes rs-scroll-arrow {
    0% {
      transform: translateY(0) rotate(-45deg);
      opacity: 1;
    }
    50% {
      transform: translateY(6px) rotate(-45deg);
      opacity: 0.7;
    }
    100% {
      transform: translateY(0) rotate(-45deg);
      opacity: 1;
    }
  }

  .rs-scroll-hint--hidden {
    opacity: 0;
    transform: translate(-50%, 10px);
  }

  @media (max-width: 767.98px) {
    .rs-scroll-hint {
      display: flex;
    }

    .card-modern .service-more {
      margin-top: 1rem;
    }
  }

  /* ====== REDUCED MOTION SUPPORT ====== */
  @media (prefers-reduced-motion: reduce) {
    .reveal {
      opacity: 1 !important;
      transform: none !important;
      transition: none !important;
    }

    .header09 .hero-card,
    .article05 .text-wrapper,
    .article18 .mbr-text {
      opacity: 1 !important;
    }

    .btn-anim,
    .card-modern,
    .card-modern .item-wrapper img,
    .rs-trazab-focus,
    .rs-chip,
    .contacts03 .rs-card,
    .contacts03 .google-map {
      transition: none !important;
      transform: none !important;
      box-shadow: none !important;
      animation: none !important;
    }

    .rs-scroll-arrow {
      animation: none !important;
    }

    .rs-scroll-progress {
      display: none !important;
    }
  }

  /* ====== POPUP DETALLE SERVICIOS (OVERLAY + CARD) ====== */
  .service-popup-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;

    background: radial-gradient(circle at top, rgba(255, 255, 255, 0.55), rgba(232, 235, 233, 0.9));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.32s ease-out;
    z-index: 9999;
  }

  .service-popup-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  .service-popup-card {
    position: relative;
    max-width: 440px;
    width: 90%;
    background: rgba(248, 249, 248, 0.97);
    border-radius: 24px;
    padding: 1.9rem 2.1rem 1.8rem;

    box-shadow:
      0 22px 55px rgba(15, 23, 42, 0.30),
      0 0 0 1px rgba(255, 255, 255, 0.55);

    transform: translate3d(0, 18px, 0) scale(0.94);
    opacity: 0;
    transition: transform 0.32s ease-out, opacity 0.32s ease-out;
    will-change: transform, opacity;
    backface-visibility: hidden;
  }

  .service-popup-overlay.is-visible .service-popup-card {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
    animation: rs-popup-breathe 3.4s ease-in-out 0.4s infinite alternate;
    animation-fill-mode: both;
  }

  @keyframes rs-popup-breathe {
    0%   { transform: translateY(0) scale(1); }
    50%  { transform: translateY(-2px) scale(1.006); }
    100% { transform: translateY(0) scale(1); }
  }

  .service-popup-header {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 0.9rem;

    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.28s ease-out, transform 0.28s ease-out;
  }

  .service-popup-overlay.is-visible .service-popup-header {
    opacity: 1;
    transform: translateY(0);
  }

  .service-popup-img {
    width: 58px;
    height: 58px;
    border-radius: 999px;
    padding: 0.32rem;
    object-fit: contain;
    background: linear-gradient(
      135deg,
      rgba(114, 161, 20, 0.18),
      rgba(114, 161, 20, 0.04)
    );
  }

  .service-popup-title-wrap {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .service-popup-title {
    margin: 0;
    font-weight: 700;
  }

  .service-popup-text {
    margin: 0;
    line-height: 1.6;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.3s ease-out 0.05s, transform 0.3s ease-out 0.05s;
  }

  .service-popup-overlay.is-visible .service-popup-text {
    opacity: 1;
    transform: translateY(0);
  }

  .service-popup-close {
    position: absolute;
    top: 0.6rem;
    right: 0.9rem;
    border: none;
    background: transparent;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: rgba(15, 23, 42, 0.45);
    transition: color 0.18s ease, transform 0.18s ease;
  }

  .service-popup-close:hover {
    color: rgba(15, 23, 42, 0.85);
    transform: scale(1.1);
  }

  /* Animación de “subir hacia el popup” */
  #features04-25 .card-modern .item-img,
  #features04-25 .card-modern .item-title {
    transition: transform 0.35s ease, opacity 0.35s ease;
    will-change: transform, opacity;
  }

  #features04-25 .card-modern.service-popup-active .item-img,
  #features04-25 .card-modern.service-popup-active .item-title {
    transform: translateY(-12%) scale(0.96);
    opacity: 0.9;
  }

  @media (max-width: 767.98px) {
    .service-popup-card {
      padding: 1.4rem 1.5rem 1.5rem;
      max-width: 92%;
      border-radius: 20px;
    }

    .service-popup-img {
      width: 50px;
      height: 50px;
    }

    .service-popup-header {
      gap: 0.7rem;
    }
  }
