/*
 * Huamantla Core 5.0.6 — endurecimiento responsive global.
 * Carga al final del sistema visual. Corrige desbordamientos reales sin ocultarlos
 * con overflow-x:hidden y conserva las reglas de columnas aprobadas por familia.
 */

@media (max-width: 900px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

  .elementor[data-elementor-type="wp-post"],
  .elementor[data-elementor-type="wp-post"] :is(.e-con, .e-con-inner, .elementor-element, .elementor-widget, .elementor-widget-container) {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .elementor[data-elementor-type="wp-post"] :is(img, picture, video, iframe, canvas, svg) {
    max-width: 100%;
    box-sizing: border-box;
  }

  .elementor[data-elementor-type="wp-post"] :is(h1, h2, h3, h4, h5, h6, p, li, dd, dt, blockquote, figcaption, a, strong, span) {
    overflow-wrap: break-word;
    word-break: normal;
  }

  .elementor[data-elementor-type="wp-post"] :is(pre, code) {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .elementor[data-elementor-type="wp-post"] :is(a[class*="button"], button, [role="button"]) {
    max-width: 100%;
    white-space: normal;
  }

  /* Patrones de dos columnas que deben apilarse antes de entrar a móvil. */
  :is(
    .hd-cultural-page .page-hero,
    .hd-cultural-page .editorial-card,
    .hd-cultural-page .editorial-card--left,
    .hd-cultural-page .editorial-card--right,
    .hd-catalog-page .catalog-hero,
    .hd-imported-page .imported-hero--media,
    .hd-imported-page .imported-section--media,
    .hd-imported-page .imported-section--left,
    .hd-first-visit-split,
    .hd-arrival-page .hd-first-visit-split,
    .hd-malinche-page .hd-first-visit-split,
    .hd-city-introduction,
    .hd-city-meaning,
    .hd-city-feature,
    .hd-buy-hero,
    .hd-contact-hero,
    .hd-news-hero,
    .hd-celebration-hero,
    .hd-disfruta-hero,
    .hd-experience-parent-hero,
    .hd-experience-hero,
    .hd-experience-booking,
    .observatory-hero,
    .data-product-hero,
    .tickets-page .page-hero,
    .tickets-hero
  ) {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* Muéganos y el widget HD - Información con imagen: imagen arriba, texto debajo. */
  .hd-cultural-page .editorial-card > :is(figure, div) {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    grid-column: 1 !important;
  }
  .hd-cultural-page .editorial-card > figure {
    order: 0 !important;
    grid-row: auto !important;
  }
  .hd-cultural-page .editorial-card > div {
    order: 1 !important;
  }
  .hd-cultural-page .editorial-card figure :is(img, picture) {
    width: 100%;
    max-width: 100%;
  }
  .hd-cultural-page .hd-editorial-prose {
    width: 100%;
    max-width: 64ch;
    min-width: 0;
  }
}

@media (max-width: 620px) {
  /* Guardia geométrica común. No recorta el body: corrige al elemento causante. */
  .elementor[data-elementor-type="wp-post"] :is(
    .page-hero,
    .catalog-hero,
    .editorial-card,
    .imported-hero,
    .imported-section,
    .hd-cta,
    .structured-quote,
    .structured-video-quote,
    .gallery-section,
    .location-section,
    .hd-structured-faq
  ) {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  /* Muéganos: corrige específicamente el fallo visible de 5.0.5. */
  .hd-cultural-page--gastronomia .editorial-card,
  .hd-cultural-page--gastronomia .editorial-card--left,
  .hd-cultural-page--gastronomia .editorial-card--right {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 20px !important;
    padding: 18px !important;
    border-radius: 24px;
  }
  .hd-cultural-page--gastronomia .editorial-card > :is(figure, div),
  .hd-cultural-page--gastronomia .editorial-card .hd-editorial-prose {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  .hd-cultural-page--gastronomia .editorial-card figure {
    aspect-ratio: 16 / 9;
    border-radius: 18px;
  }
  .hd-cultural-page--gastronomia .editorial-card figure img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    display: block;
    object-fit: cover;
  }
  .hd-cultural-page--gastronomia .editorial-card h2 {
    max-width: 100%;
    font-size: clamp(1.85rem, 9vw, 2.35rem);
    line-height: 1.02;
  }
  .hd-cultural-page--gastronomia .hd-editorial-prose {
    font-size: .95rem;
    line-height: 1.65;
  }

  /* Contenedores base: respiración lateral estable a 320–430 px. */
  :is(.hd-cultural-page, .hd-catalog-page, .hd-imported-page) {
    width: calc(100% - 32px) !important;
    max-width: calc(100% - 32px) !important;
    margin-inline: auto !important;
  }

  /* Medios y embeds nunca fuerzan scroll del documento. */
  .elementor[data-elementor-type="wp-post"] :is(iframe, video, canvas, object, embed) {
    width: 100%;
    max-width: 100%;
  }
  .elementor[data-elementor-type="wp-post"] table {
    max-width: 100%;
  }

  /* Acciones táctiles: se mantienen dentro de la tarjeta. */
  .elementor[data-elementor-type="wp-post"] :is(
    .hd-cta__button,
    .hd-map__button,
    .hd-experience-button,
    .hd-disfruta-primary,
    .hd-disfruta-button,
    .catalog-card-button,
    .tickets-page a[class*="button"]
  ) {
    max-width: 100%;
    white-space: normal !important;
    text-align: center;
  }
}

@media (max-width: 390px) {
  .hd-cultural-page--gastronomia .editorial-card {
    gap: 18px !important;
    padding: 16px !important;
  }
  .hd-cultural-page--gastronomia .editorial-card h2 {
    font-size: clamp(1.7rem, 9vw, 2.05rem);
  }
}
