/* ═══════════════════════════════════════════════════════════════════════════
   MEDIA QUERIES — Refinamientos responsive específicos
   Mobile-first: el CSS base ya soporta mobile. Aquí añadimos overrides.
   ═══════════════════════════════════════════════════════════════════════════ */

/* === TABLET — 640px+ === */
@media (min-width: 640px) {
  .hero__stats { grid-template-columns: repeat(4, 1fr); }
}

/* === DESKTOP — 1024px+ === */
@media (min-width: 1024px) {
  .section { padding: var(--space-2xl) 0; }
}

/* === TABLET / MÓVIL ≤900px — hero apilado y ajustado a la pantalla === */
@media (max-width: 900px) {
  .hero { min-height: calc(100vh - var(--topbar-h, 110px)); min-height: calc(100svh - var(--topbar-h, 110px)); padding: var(--space-md) 0; }
  .hero__container { grid-template-columns: 1fr; gap: var(--space-md); text-align: center; }
  .hero__visual { display: none; }                 /* minimalista: foco en el mensaje */
  .hero__subtitle { margin-left: auto; margin-right: auto; }
  .hero__ctas { justify-content: center; margin-bottom: var(--space-lg); }
  .hero__stats { max-width: 440px; margin-inline: auto; }
  .hero__stat { text-align: center; }
}

/* === MOBILE FINE-TUNING — <640px === */
@media (max-width: 640px) {
  .urgency-bar { font-size: 10px; gap: var(--space-2xs); padding: var(--space-2xs) var(--space-sm); }
  .urgency-bar a { font-size: 9px; padding: 3px 8px; }
  .hero { min-height: calc(100vh - var(--topbar-h, 120px)); min-height: calc(100svh - var(--topbar-h, 120px)); padding: var(--space-sm) 0; }
  .hero__title { font-size: clamp(2rem, 8.5vw, 3rem); margin-bottom: var(--space-sm); }
  .hero__subtitle { font-size: var(--fs-md); line-height: var(--lh-normal); margin-bottom: var(--space-md); }
  .hero__ctas { margin-bottom: var(--space-md); gap: var(--space-2xs); }
  .hero__stat-num { font-size: var(--fs-2xl); }
  .hero__stats { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); padding-top: var(--space-sm); }
  .hero__floating-card { padding: var(--space-2xs) var(--space-sm); }
  .hero__floating-card strong { font-size: var(--fs-md); }
  .featured-course { padding: var(--space-xl) 0; }
  .featured-course__includes { grid-template-columns: 1fr; }
  .featured-course__pricing .price__new { font-size: var(--fs-3xl); }
  .featured-course__title { font-size: clamp(1.75rem, 7vw, 2.5rem); }
  .what-you-learn { gap: var(--space-sm); }
  .courses-grid { grid-template-columns: 1fr; gap: var(--space-md); }
  .course-card__media { height: 180px; }
  .pillar { padding: var(--space-md); }
  .testimonial-card { padding: var(--space-md); }
  .testimonial-card__quote { font-size: var(--fs-md); padding-left: var(--space-sm); }
  .guarantee__card { padding: var(--space-lg) var(--space-md); }
  .guarantee__icon { width: 72px; height: 72px; font-size: var(--fs-2xl); }
  .faq-item__q { font-size: var(--fs-md); padding: var(--space-sm); }
  .final-cta__title { font-size: clamp(2rem, 8vw, 3rem); }
  .wa-float { width: 52px; height: 52px; font-size: 22px; bottom: 16px; right: 16px; }
  .btn-lg { padding: var(--space-2xs) var(--space-md); font-size: var(--fs-sm); }
  .container { padding: 0 var(--space-sm); }
  /* Botones CTA largos: que envuelvan y no desborden en ningún teléfono ≤640 */
  .courses-teaser__cta .btn,
  .courses-teaser__ctas .btn,
  .benefits__cta-btns .btn,
  .facilities__cta-btns .btn,
  .final-cta__ctas .btn {
    max-width: 100%;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
  }
}

@media (max-width: 380px) {
  .nav__logo-main { font-size: var(--fs-xl); }
  .hero__ctas .btn { flex: 1; min-width: 100%; }
  .featured-course__ctas .btn { flex: 1; min-width: 100%; }
}

/* === PRINT === */
@media print {
  .urgency-bar, .wa-float, .site-header, .final-cta, .site-footer { display: none; }
  .section { padding: var(--space-md) 0; break-inside: avoid; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   FIX RESPONSIVE MÓVIL — ajuste 100% a pantalla (iPhone y Android)
   Garantiza que nada desborde horizontalmente y que los textos largos quepan.
   ═══════════════════════════════════════════════════════════════════════════ */
/* SIN overflow-x en html/body: cualquier valor (hidden/clip) rompe o fragiliza
   `position: sticky` del header en iOS Safari (crea contenedor de scroll y causa
   saltos al tope al abrir el menú). El desborde lateral se contiene POR SECCIÓN
   (blobs con overflow:hidden) y el drawer del menú es off-canvas con transform. */
body { max-width: 100%; }
img, video, iframe, svg { max-width: 100%; }

/* Títulos/eyebrows/leads: parten solo si una palabra no cabe (evita corte) */
h1, h2, h3, .hero__title, .hero__eyebrow, .eyebrow, .hero__subtitle,
.section-title, .section-lead, .page-hero__title, .featured-course__title {
  overflow-wrap: anywhere;
}

/* Secciones con blobs decorativos: que nunca desborden el ancho */
.hero, .courses-teaser, .video-testimonial, .benefits, .final-cta,
.contact, .featured-course, .facilities { overflow: hidden; }

@media (max-width: 480px) {
  .container { padding-left: 16px; padding-right: 16px; }
  /* Hero cabe sí o sí (valores conservadores para el iPhone más angosto) */
  .hero__eyebrow { font-size: 9px; letter-spacing: 0.04em; line-height: 1.5; padding: 0; }
  .hero__title { font-size: clamp(1.5rem, 6.2vw, 1.95rem); line-height: 1.1; }
  .hero__subtitle { font-size: 0.9rem; }
  /* Barra de urgencia: que envuelva y nunca corte */
  .urgency-bar { flex-wrap: wrap; justify-content: center; text-align: center; row-gap: 2px; }
  .urgency-bar span { overflow-wrap: anywhere; }
  /* Grids nuevos → 1 columna en móvil */
  .courses-teaser__grid, .benefits__grid { grid-template-columns: 1fr; }
  .facilities__mosaic { grid-template-columns: 1fr; }
  .facility.is-featured { grid-column: auto; grid-row: auto; aspect-ratio: 16 / 10; }
  /* CTAs de las secciones al 100% y que ENVUELVAN si el texto es largo
     (fix: el contenedor real es .courses-teaser__cta singular; .btn trae
      white-space:nowrap y por eso un botón largo desbordaba la pantalla) */
  .courses-teaser__cta .btn,
  .courses-teaser__ctas .btn,
  .benefits__cta-btns .btn,
  .facilities__cta-btns .btn,
  .final-cta__ctas .btn,
  .video-testimonial .btn {
    width: 100%;
    max-width: 100%;
    white-space: normal;     /* permite 2 líneas en pantallas angostas */
    text-align: center;
    line-height: 1.25;
  }
  /* Reveals horizontales → verticales en móvil: evita que un elemento salga
     fuera del viewport durante la animación (mobile-first, sin scroll lateral) */
  .reveal--left, .reveal--right { transform: translateY(40px); }
  .reveal--left.is-visible, .reveal--right.is-visible { transform: translateY(0); }
}

/* Curso destacado: los hijos del grid deben respetar el ancho de la pista.
   Sin esto, min-width:auto (default de grid) deja que el contenido del
   variante --dual desborde ~23px en el iPhone más angosto. */
@media (max-width: 900px) {
  .featured-course__grid > * { min-width: 0; }
  .featured-course__body,
  .featured-course__media { min-width: 0; max-width: 100%; }
}

/* Teaser de cursos (index): baja el encuadre para que se vea la cara del maestro,
   sin distorsión (object-fit sigue en cover). El centro recortaba las caras. */
.course-teaser__media img { object-position: center 22%; }

/* Catálogo de cursos (cursos.html): centrar las cards respecto al ancho de pantalla.
   Con auto-fill quedaban pegadas a la izquierda cuando son pocas. */
@media (min-width: 641px) {
  .courses-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 360px));
    justify-content: center;
  }
}
