/* =====================================================================
   RESPONSIVE — SERVICIOS (.services-page)
   ---------------------------------------------------------------------
   Móvil:  < 768px
   Tablet: 768px – 1199.98px
   Desktop ≥ 1200px: intacto (todo dentro de media queries).

   Scope: .rsp .services-page:not(.seguros-page)
   La página Seguros reutiliza las clases sv- y también lleva
   .services-page en el <main>, por eso se excluye explícitamente
   con :not(.seguros-page) para no afectar su adaptación propia.

   Principio: ADAPTAR, no redimensionar. Cada sección pasa a flujo
   normal (flex apilado) manteniendo colores, tipografías, imágenes
   y el mismo orden de secciones que en desktop.

   Nota: el orden del DOM ya coincide con el orden visual deseado
   (subtítulo → título → imagen overlay → descripción → marquesina →
   pill → título pasos → subtítulo → lista → slider → footer),
   por lo que no se necesita reordenar con `order`.
   ===================================================================== */

/* ═══════════════════════════════════════════════════════════
   BASE COMPARTIDA (móvil + tablet)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1199.98px) {

  /* ── Lienzo: la página pasa a columna en flujo normal ── */
  .rsp .services-page:not(.seguros-page) {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: relative;
    width: 100%;
    height: auto;
    min-height: 100vh;
    background: #ffffff;
  }

  /* ── Decorativos anclados a coordenadas del lienzo 1440px ──
     Banda blanca auxiliar y vector curvo de fondo de la sección de
     pasos: dependen de posiciones absolutas del diseño fijo y no
     re-anclan en flujo → ocultos. */
  .rsp .services-page:not(.seguros-page) .sv-white-band,
  .rsp .services-page:not(.seguros-page) .sv-steps-bg {
    display: none;
  }

  /* ════════ SECCIÓN: HERO ════════ */

  /* Fondo hero: imagen cover anclada al tope de la página */
  .rsp .services-page:not(.seguros-page) .sv-hero-bg {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    z-index: 0;
    pointer-events: none;
  }

  .rsp .services-page:not(.seguros-page) .sv-hero-bg picture {
    display: block;
    width: 100%;
    height: 100%;
  }

  .rsp .services-page:not(.seguros-page) .sv-hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
  }

  /* Subtítulo "Paga todo desde" */
  .rsp .services-page:not(.seguros-page) .sv-hero-subtitle {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    width: auto;
    text-align: center;
    z-index: 2;
  }

  /* Título "PagoDirecto" */
  .rsp .services-page:not(.seguros-page) .sv-hero-title {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    width: auto;
    text-align: center;
    z-index: 2;
  }

  /* Imagen overlay del hero (collage de servicios).
     Igual que en desktop, puede colgar ligeramente por debajo del
     borde inferior del fondo hero. */
  .rsp .services-page:not(.seguros-page) .sv-hero-overlay-image {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    height: auto;
    align-self: center;
    z-index: 2;
  }

  .rsp .services-page:not(.seguros-page) .sv-hero-overlay-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
  }

  /* ════════ SECCIÓN: DESCRIPCIÓN ════════ */
  .rsp .services-page:not(.seguros-page) .sv-description {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    align-self: center;
    text-align: center;
    z-index: 2;
  }

  /* ════════ SECCIÓN: MARQUESINA DE SERVICIOS ════════
     Se mantiene la animación infinita; solo se compactan las
     tarjetas de logos. */
  .rsp .services-page:not(.seguros-page) .sv-marquee {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    width: 100%;
    height: auto;
    padding: 20px 0;
    z-index: 2;
  }

  /* ════════ SECCIÓN: ¿CÓMO USAR? (pill + títulos) ════════ */
  .rsp .services-page:not(.seguros-page) .sv-pill {
    position: relative;
    left: auto;
    top: auto;
    align-self: flex-start;
    z-index: 2;
  }

  .rsp .services-page:not(.seguros-page) .sv-steps-title,
  .rsp .services-page:not(.seguros-page) .sv-steps-subtitle {
    position: relative;
    left: auto;
    top: auto;
    z-index: 2;
  }

  /* ════════ SECCIÓN: PASOS — lista índice ════════
     Se mantiene como índice de los 3 pasos (contiene los nombres
     de cada paso). Conserva la animación de entrada escalonada
     (.sv-steps-list.is-in), disparada por el IntersectionObserver
     del slider con threshold reducido en móvil (ver Servicios.jsx). */
  .rsp .services-page:not(.seguros-page) .sv-steps-list {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    z-index: 2;
  }

  .rsp .services-page:not(.seguros-page) .sv-steps-list .sv-step-item {
    min-height: 44px; /* área táctil mínima */
  }

  /* ════════ SECCIÓN: PASOS — slider crossfade como en desktop ════════
     Solo la tarjeta ACTIVA es visible; cambia por clic en la lista o
     por el autoplay del JS. Patrón grid: todas las tarjetas en la misma
     celda (alto automático) sin apilarse hacia abajo. */
  .rsp .services-page:not(.seguros-page) .sv-slider {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    height: auto;
    overflow: hidden;
    border-radius: 34px;
    display: grid;
    z-index: 2;
  }

  .rsp .services-page:not(.seguros-page) .sv-slider .sv-step-card {
    grid-area: 1 / 1;
    position: relative;
    inset: auto;
    height: auto;
    /* opacity/transform/transition del desktop intactos:
       el crossfade .is-active del JS sigue funcionando */
  }

  .rsp .services-page:not(.seguros-page) .sv-step-card-text {
    width: auto;
    min-width: 0;
  }

  .rsp .services-page:not(.seguros-page) .sv-step-card-img {
    width: 100%;
    flex-shrink: 0;
  }

  /* Badges superpuestos en la imagen del paso 1 */
  .rsp .services-page:not(.seguros-page) .sv-downloads-overlay {
    bottom: 18px;
  }

  .rsp .services-page:not(.seguros-page) .sv-downloads-overlay a {
    display: flex;
    align-items: center;
    min-height: 44px; /* área táctil mínima */
  }

  /* ════════ SECCIÓN: FOOTER ════════
     (el layout interno lo resuelve core.css) */
  .rsp .services-page:not(.seguros-page) #global-footer {
    width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════
   MÓVIL  (< 768px)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 767.98px) {

  /* ── HERO ── */
  .rsp .services-page:not(.seguros-page) .sv-hero-bg {
    height: 555px;
  }

  .rsp .services-page:not(.seguros-page) .sv-hero-subtitle {
    margin: 128px 24px 0;
    font-size: clamp(20px, 5.5vw, 26px);
    line-height: 1.3;
  }

  .rsp .services-page:not(.seguros-page) .sv-hero-title {
    margin: 8px 24px 0;
    font-size: clamp(38px, 11vw, 50px);
    line-height: 1.05;
  }

  .rsp .services-page:not(.seguros-page) .sv-hero-overlay-image {
    width: min(350px, 80vw);
    margin-top: 58px;
  }

  /* ── DESCRIPCIÓN ── */
  .rsp .services-page:not(.seguros-page) .sv-description {
    width: min(640px, calc(100% - 48px));
    font-size: clamp(18px, 5vw, 22px);
    line-height: 1.4;
    margin: 64px auto 0;
  }

  /* ── MARQUESINA ── */
  .rsp .services-page:not(.seguros-page) .sv-marquee {
    margin-top: 48px;
  }

  .rsp .services-page:not(.seguros-page) .sv-marquee-group {
    gap: 20px;
  }

  .rsp .services-page:not(.seguros-page) .sv-marquee-item {
    width: 150px;
    height: 84px;
    border-radius: 22px;
    padding: 0 14px;
  }

  .rsp .services-page:not(.seguros-page) .sv-marquee-item-leading {
    margin-left: 20px;
  }

  .rsp .services-page:not(.seguros-page) .sv-marquee-logo {
    max-width: 118px;
    max-height: 44px;
  }

  /* ── ¿CÓMO USAR? ── */
  .rsp .services-page:not(.seguros-page) .sv-pill {
    margin: 64px 24px 0;
  }

  .rsp .services-page:not(.seguros-page) .sv-pill span {
    font-size: 17px;
    line-height: 1.4;
  }

  .rsp .services-page:not(.seguros-page) .sv-steps-title {
    margin: 20px 24px 0;
    width: auto;
    max-width: 560px;
    font-size: clamp(22px, 6.4vw, 27px);
    line-height: 1.25;
  }

  .rsp .services-page:not(.seguros-page) .sv-steps-subtitle {
    margin: 12px 24px 0;
    width: auto;
    max-width: 560px;
    font-size: 16px;
    line-height: 1.45;
  }

  /* ── PASOS: lista índice ── */
  .rsp .services-page:not(.seguros-page) .sv-steps-list {
    margin: 24px 24px 0;
  }

  /* ── PASOS: pila de tarjetas ── */
  .rsp .services-page:not(.seguros-page) .sv-slider {
    margin: 34px 24px 20px;
    gap: 24px;
  }

  .rsp .services-page:not(.seguros-page) .sv-slider .sv-step-card {
    padding: 20px;
    border-radius: 28px;
    gap: 16px;
  }

  .rsp .services-page:not(.seguros-page) .sv-step-card-text {
    font-size: 16px;
    line-height: 1.45;
  }

  .rsp .services-page:not(.seguros-page) .sv-step-card-img {
    height: min(360px, 95vw);
    border-radius: 22px;
  }

  /* ── FOOTER ── */
  .rsp .services-page:not(.seguros-page) #global-footer {
    margin-top: 64px;
  }
}

/* ═══════════════════════════════════════════════════════════
   TABLET  (768px – 1199.98px)
   ═══════════════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1199.98px) {

  /* ── HERO ── */
  .rsp .services-page:not(.seguros-page) .sv-hero-bg {
    height: 640px;
  }

  .rsp .services-page:not(.seguros-page) .sv-hero-subtitle {
    margin: 150px 48px 0;
    font-size: clamp(26px, 3.2vw, 32px);
    line-height: 1.3;
  }

  .rsp .services-page:not(.seguros-page) .sv-hero-title {
    margin: 10px 48px 0;
    font-size: clamp(48px, 6.5vw, 62px);
    line-height: 1.05;
  }

  .rsp .services-page:not(.seguros-page) .sv-hero-overlay-image {
    width: min(440px, 52vw);
    margin-top: 24px;
  }

  /* ── DESCRIPCIÓN ── */
  .rsp .services-page:not(.seguros-page) .sv-description {
    width: min(700px, calc(100% - 96px));
    font-size: clamp(22px, 2.6vw, 26px);
    line-height: 1.4;
    margin: 72px auto 0;
  }

  /* ── MARQUESINA ── */
  .rsp .services-page:not(.seguros-page) .sv-marquee {
    margin-top: 64px;
  }

  .rsp .services-page:not(.seguros-page) .sv-marquee-group {
    gap: 26px;
  }

  .rsp .services-page:not(.seguros-page) .sv-marquee-item {
    width: 176px;
    height: 96px;
    padding: 0 16px;
  }

  .rsp .services-page:not(.seguros-page) .sv-marquee-item-leading {
    margin-left: 26px;
  }

  .rsp .services-page:not(.seguros-page) .sv-marquee-logo {
    max-width: 140px;
    max-height: 52px;
  }

  /* ── ¿CÓMO USAR? ── */
  .rsp .services-page:not(.seguros-page) .sv-pill {
    margin: 80px 48px 0;
  }

  .rsp .services-page:not(.seguros-page) .sv-steps-title {
    margin: 20px 48px 0;
    width: auto;
    max-width: 640px;
    font-size: 30px;
    line-height: 1.25;
  }

  .rsp .services-page:not(.seguros-page) .sv-steps-subtitle {
    margin: 12px 48px 0;
    width: auto;
    max-width: 620px;
    font-size: 18px;
    line-height: 1.45;
  }

  /* ── PASOS: lista índice ── */
  .rsp .services-page:not(.seguros-page) .sv-steps-list {
    margin: 32px 48px 0;
    max-width: 560px;
  }

  /* ── PASOS: tarjetas en 2 columnas alternadas ── */
  .rsp .services-page:not(.seguros-page) .sv-slider {
    margin: 32px 48px 0;
    gap: 28px;
  }

  .rsp .services-page:not(.seguros-page) .sv-slider .sv-step-card {
    flex-direction: row;
    align-items: center;
    gap: 28px;
    padding: 28px;
  }

  /* Alterna texto/imagen en pasos pares */
  .rsp .services-page:not(.seguros-page) .sv-slider .sv-step-card:nth-child(even) {
    flex-direction: row-reverse;
  }

  .rsp .services-page:not(.seguros-page) .sv-step-card-text {
    flex: 1 1 42%;
    font-size: 18px;
    line-height: 1.45;
  }

  .rsp .services-page:not(.seguros-page) .sv-step-card-img {
    flex: 1 1 58%;
    width: auto;
    height: 340px;
  }

  /* ── FOOTER ── */
  .rsp .services-page:not(.seguros-page) #global-footer {
    margin-top: 80px;
  }
}
