/**
 * Auditoría móvil CuidateGratis — correcciones seguras transversales.
 * Paleta: #0F3D2E, #1F6B45, #10231A, #5F6B66, #EAF5EE, #F6F8F6
 */

/* Evitar scroll horizontal por 100vw / full-bleed */
html {
  overflow-x: clip;
}

body {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Tipografía móvil base */
@media (max-width: 820px) {
  body {
    font-size: 16px;
    line-height: 1.55;
  }

  p,
  .section-sub,
  .blog-article-content p,
  .entry-content p {
    line-height: 1.58;
  }

  .section-title,
  .hero-section h1,
  .single-header h1 {
    overflow-wrap: anywhere;
    word-wrap: break-word;
    hyphens: auto;
  }
}

/* Targets táctiles mínimos */
@media (max-width: 820px) {
  .menu-toggle,
  .mobile-toggle,
  .nav-cta,
  .header-cta,
  .cgc-contact-close {
    min-height: 44px !important;
    min-width: 44px;
  }

  .footer-social a,
  .footer-social__link,
  .cgc-premium-footer .footer-social a,
  .cgc-premium-footer .footer-social__link {
    width: 44px !important;
    height: 44px !important;
  }

  .cg-favorite-toggle--card {
    width: 44px !important;
    height: 44px !important;
  }

  .chat-input button {
    width: 44px !important;
    height: 44px !important;
  }

  .cg-plate-row button {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px;
    min-height: 44px;
    display: inline-grid;
    place-items: center;
  }

  .cg-dashboard-dismiss,
  .cg-dashboard-ghost,
  .cg-chip-row button {
    min-height: 44px;
  }
}

/* Inputs ≥16px (evita zoom iOS) */
@media (max-width: 820px) {
  .chat-input input,
  .calc-input,
  .calc-select,
  .email-form input,
  .cgc-contact-form input,
  .cgc-contact-form textarea,
  .cgc-contact-form select,
  .cg-tools-account input,
  .cg-auth-card input,
  .cg-auth-card select,
  .cg-field input,
  .cg-field select,
  .cg-field textarea,
  .path-form input,
  .path-form select,
  .path-form textarea,
  #lead-email,
  [data-cgc-newsletter-email] {
    font-size: 16px !important;
  }
}

/* Header / marca en pantallas estrechas */
@media (max-width: 480px) {
  .brand,
  .site-brand {
    min-width: 0;
    max-width: calc(100vw - 120px);
  }

  .brand__text,
  .site-brand .brand__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Home: bloques demasiado altos en móvil */
@media (max-width: 820px) {
  body.cgc-home-page .calculator-promo {
    min-height: 0 !important;
    align-items: flex-start !important;
  }

  body.cgc-home-page .recipe-showcase-card {
    min-height: clamp(380px, 72vh, 520px) !important;
  }

  body.cgc-home-page .recipe-showcase-note {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  body.cgc-home-page .path-form label {
    min-height: 44px !important;
  }

  body.cgc-home-page .hero-actions {
    gap: 12px !important;
  }

  body.cgc-home-page .hero-actions .btn {
    min-height: 48px !important;
  }
}

@media (max-width: 430px) {
  body.cgc-home-page .recipe-showcase-card {
    min-height: clamp(340px, 68vh, 460px) !important;
    padding-bottom: 72px !important;
  }
}

/* Calculadoras: full-bleed sin desbordar */
@media (max-width: 820px) {
  .cg-calc-page,
  .cg-dashboard {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    left: auto !important;
    right: auto !important;
    padding-left: max(12px, env(safe-area-inset-left)) !important;
    padding-right: max(12px, env(safe-area-inset-right)) !important;
    box-sizing: border-box !important;
  }

  .cg-calc-page {
    overflow-x: clip !important;
  }
}

/* Tablas / grids que desbordan */
@media (max-width: 820px) {
  .blog-article-content table,
  .entry-content table,
  .cg-dashboard-weekly-table,
  .cg-nutrition-table,
  .recipe-nutrition-table,
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .cg-macro-grid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Contraste texto secundario */
@media (max-width: 820px) {
  .section-sub,
  .hero-sub,
  .cg-medical-note,
  .cg-calc-subcopy,
  .recommended-legal,
  .lead-nota {
    color: #5f6b66 !important;
  }

  .proof-item small,
  .metric span {
    color: #5f6b66 !important;
  }
}

/* Home: menú hamburguesa alineado con tema (901px desktop) */
@media (max-width: 900px) {
  body.cgc-home-page .site-nav .nav-links:not(.open) {
    display: none !important;
  }

  body.cgc-home-page .site-nav .mobile-toggle {
    display: flex !important;
  }
}

/* Menú móvil: scroll y separación */
@media (max-width: 900px) {
  .primary-nav.is-open,
  .nav-links.open,
  .recipe-nav .nav-links.is-open {
    max-height: min(78vh, calc(100dvh - 80px));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .primary-nav.is-open .menu a,
  .nav-links.open li a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

/* Blog / lectura */
@media (max-width: 820px) {
  .blog-article-content,
  .entry-content,
  .article-body {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
  }

  .blog-hero-image img,
  .article-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
    object-position: center;
  }
}

/* Newsletter / honeypot */
.cgc-hp,
.cg-hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

[data-cgc-newsletter-form] {
  display: grid;
  gap: 12px;
}

@media (max-width: 820px) {
  .email-form {
    display: grid !important;
    gap: 10px !important;
  }

  .email-form button {
    width: 100%;
    min-height: 48px;
  }
}

/* Cuídate PRO: columnas apiladas y contraste */
@media (max-width: 820px) {
  .cuidate-pro-static .hero,
  body.cgc-static-pro .shell > .hero,
  .product-grid {
    grid-template-columns: 1fr !important;
  }

  body.cgc-static-pro .product-card.featured .status,
  .cuidate-pro-static .product-card.featured .status {
    color: #fff8e5 !important;
    background: rgba(240, 200, 91, 0.22) !important;
  }

  body.cgc-static-pro .btn-gold,
  .cuidate-pro-static .btn-gold {
    min-height: 48px !important;
    color: #173022 !important;
  }

  body.cgc-static-pro .nav-links,
  .cuidate-pro-static .nav-links {
    flex-wrap: wrap;
    gap: 10px;
  }
}

/* Focus visible táctil / teclado */
@media (max-width: 820px) {
  a:focus-visible,
  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible {
    outline: 2px solid #1f6b45;
    outline-offset: 2px;
  }
}
