/* ============================================
   RESPONSIVE — Mobile first overrides
   ============================================ */

/* === TABLET === */
@media (max-width: 1024px) {
  :root {
    --header-height: 64px;
  }

  h1 { font-size: var(--fs-4xl); }
  h2 { font-size: var(--fs-3xl); }

  .section {
    padding: var(--space-16) 0;
  }

  /* Nav: ocultar links, mostrar hamburguesa */
  .site-nav,
  .header-cta .btn {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }

  .header-cta .btn-floating-phone {
    display: flex;
  }

  /* Hero */
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-10);
  }

  .hero-visual {
    max-width: 480px;
    margin: 0 auto;
  }

  /* Grids */
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .services-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .trust-bar-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
  }

  .steps {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-8);
  }

  .steps::before {
    display: none;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .testimonials-grid {
    grid-template-columns: 1fr;
    max-width: 560px;
    margin: 0 auto;
  }

  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
  }

  .service-hero {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .service-content {
    grid-template-columns: 1fr;
  }

  .service-sidebar {
    position: static;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

/* === MOBILE === */
@media (max-width: 640px) {
  :root {
    --header-height: 60px;
  }

  body {
    font-size: 0.95rem;
  }

  h1 { font-size: var(--fs-3xl); }
  h2 { font-size: var(--fs-2xl); }
  h3 { font-size: var(--fs-xl); }

  .container,
  .container-narrow {
    padding: 0 var(--space-4);
  }

  .section {
    padding: var(--space-12) 0;
  }

  .section-header {
    margin-bottom: var(--space-8);
  }

  /* Header simplificado */
  .site-logo img {
    height: 38px;
  }

  .header-cta .btn-floating-phone {
    display: none;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
  }

  .header-cta .btn-floating-phone svg {
    width: 18px;
    height: 18px;
  }

  .header-cta .btn-floating-phone span {
    display: none;
  }

  /* Menú móvil */
  .mobile-menu {
    display: block;
    position: fixed;
    top: calc(var(--header-height) + var(--announcement-offset, 0px));
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 49;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
  }

  .mobile-menu.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu-inner {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 85vw);
    background: #fff;
    padding: var(--space-6) var(--space-5);
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform var(--transition);
    display: flex;
    flex-direction: column;
  }

  .mobile-menu.is-open .mobile-menu-inner {
    transform: translateX(0);
  }

  .mobile-menu .site-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-bottom: var(--space-6);
  }

  .mobile-menu .site-nav a {
    padding: var(--space-4) var(--space-3);
    font-size: var(--fs-base);
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
  }

  .mobile-menu .header-cta {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
  }

  .mobile-menu .header-cta .btn {
    display: flex;
    width: 100%;
  }

  /* Hero */
  .hero {
    padding: var(--space-10) 0 var(--space-12);
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero-lead {
    font-size: var(--fs-base);
  }

  .hero-ctas {
    flex-direction: column;
  }

  .hero-ctas .btn {
    width: 100%;
  }

  .hero-trust {
    gap: var(--space-3);
  }

  .hero-trust-item {
    font-size: var(--fs-xs);
  }

  .hero-visual {
    aspect-ratio: 1;
    max-width: 360px;
  }

  .hero-visual-card {
    font-size: var(--fs-xs);
    padding: var(--space-2) var(--space-3);
  }

  .hero-visual-icon {
    width: 32px;
    height: 32px;
  }

  .hero-visual-icon svg {
    width: 18px;
    height: 18px;
  }

  /* Botones más compactos */
  .btn-lg {
    padding: var(--space-3) var(--space-5);
    font-size: var(--fs-sm);
  }

  .btn-xl {
    padding: var(--space-4) var(--space-6);
    font-size: var(--fs-base);
  }

  /* Trust bar */
  .trust-bar-grid {
    gap: var(--space-3);
  }

  .trust-number {
    font-size: 1.75rem;
  }

  .trust-label {
    font-size: var(--fs-xs);
  }

  /* Grids a una columna */
  .services-grid,
  .services-grid-4,
  .blog-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  /* Tarjetas */
  .service-card,
  .feature-card,
  .blog-card {
    padding: var(--space-5);
  }

  /* Hero servicio */
  .service-hero {
    padding: var(--space-8) 0;
  }

  .service-hero h1 {
    font-size: 1.75rem;
  }

  .service-hero-meta {
    gap: var(--space-2);
  }

  .service-meta-pill {
    padding: 6px 10px;
    font-size: var(--fs-xs);
  }

  .service-hero-ctas {
    flex-direction: column;
  }

  .service-hero-ctas .btn {
    width: 100%;
  }

  /* FAQ */
  .faq-question {
    padding: var(--space-4);
    font-size: var(--fs-sm);
  }

  .faq-answer-inner {
    padding: 0 var(--space-4) var(--space-4);
  }

  /* Form */
  .contact-form {
    padding: var(--space-5);
  }

  /* Testimonials */
  .testimonial {
    padding: var(--space-5);
  }

  /* Page header */
  .page-header {
    padding: var(--space-10) 0 var(--space-8);
  }

  /* CTA section */
  .cta-section {
    padding: var(--space-12) 0;
  }

  .cta-buttons {
    flex-direction: column;
  }

  .cta-buttons .btn {
    width: 100%;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  /* Floating buttons */
  .floating-actions {
    bottom: 16px;
    right: 16px;
  }

  .floating-btn {
    width: 56px;
    height: 56px;
  }

  .floating-btn svg {
    width: 28px;
    height: 28px;
  }

  .scroll-top {
    right: 76px;
    bottom: 80px;
  }

  /* Chat widget */
  .chat-widget {
    right: 12px;
    left: 12px;
    bottom: 80px;
    width: auto;
    max-width: none;
  }

  .chat-body {
    height: 60vh;
  }

  /* Timeline */
  .timeline::before {
    left: 20px;
  }

  .timeline-item {
    padding-left: 56px;
  }

  .timeline-marker {
    width: 44px;
    height: 44px;
    font-size: var(--fs-base);
  }

  .timeline-marker svg {
    width: 22px;
    height: 22px;
  }

  /* Article */
  .article-body {
    font-size: var(--fs-base);
    line-height: 1.7;
  }

  .article h1 {
    font-size: 1.75rem;
  }

  .article-lead {
    font-size: var(--fs-base);
  }

  /* Process timeline (proceso.html) */
  .step-number {
    width: 56px;
    height: 56px;
    font-size: var(--fs-xl);
  }

  /* Cards precio */
  .price-card {
    padding: var(--space-5);
  }

  .price-amount {
    font-size: var(--fs-3xl);
  }

  /* Botones: permitir wrap en mobile */
  .btn {
    white-space: normal;
  }

  /* Carrusel: touch targets más grandes */
  .carousel-prev,
  .carousel-next {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  /* Cerrar chat: touch target más grande */
  .chat-close {
    width: 44px;
    height: 44px;
  }

  /* Grid garantía y acerca-de: 1 columna */
  .garantia-grid,
  .acerca-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  /* Tabla garantía: más compacta en mobile */
  .table-wrapper table {
    font-size: 0.8rem !important;
  }

  .table-wrapper th,
  .table-wrapper td {
    padding: 10px 10px !important;
  }

  /* Separadores de precios: margen reducido */
  .services-grid + .section-header {
    margin-top: 40px;
  }
}

/* === CARRUSEL EN TÁCTIL (sin hover) === */
@media (hover: none) {
  .service-card-img[data-carousel] .carousel-prev,
  .service-card-img[data-carousel] .carousel-next {
    opacity: 0.7;
  }
}

/* === MUY PEQUEÑO === */
@media (max-width: 380px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .testimonials-grid {
    grid-template-columns: 1fr;
  }
}

/* === ESCRITORIO GRANDE === */
@media (min-width: 1280px) {
  .container {
    padding: 0 var(--space-6);
  }

  .section {
    padding: var(--space-24) 0;
  }
}

/* === LANDSCAPE MÓVIL === */
@media (max-height: 500px) and (orientation: landscape) {
  .chat-body {
    height: 70vh;
  }
}

/* === PREFERENCIAS DE MOVIMIENTO === */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
