/* Huamantla Core 5.0.12 — auditoría responsive transversal.
 * Objetivos: respetar grids Elementor, evitar compresión/overflow y corregir
 * mapas culturales en tableta/móvil. No oculta desbordamientos con overflow-x.
 */

/* Geometría segura para contenedores Elementor y widgets HD. */
.elementor :is(.elementor-element,.e-con,.e-con-inner,[class*="-grid"],[class*="-copy"],[class*="-card"]) {
  min-width: 0;
}
.elementor :is(img,video,svg,iframe,canvas) {
  max-width: 100%;
}
.elementor iframe {
  width: 100%;
}
.elementor :is(.catalog-card,.hd-visit-map-card,.hd-visit-map-copy) > * {
  min-width: 0;
}
.elementor :is(.catalog-card h3,.catalog-card p,.hd-visit-map-copy h3,.hd-visit-map-copy p) {
  overflow-wrap: break-word;
  word-break: normal;
}

/* Catálogo automático: los valores inline viajan con el HTML del widget.
 * Esta capa los convierte en la columna activa según el viewport aunque el
 * archivo CSS generado por Elementor siga cacheado con el valor de escritorio.
 */
.elementor-widget-hd-catalog-grid .catalog-grid {
  --hd-grid-columns: var(--hd-grid-columns-desktop, 4) !important;
  grid-template-columns: repeat(var(--hd-grid-columns), minmax(0, 1fr)) !important;
}
@media (max-width: 1024px) {
  .elementor-widget-hd-catalog-grid .catalog-grid {
    --hd-grid-columns: var(--hd-grid-columns-tablet, 3) !important;
  }
}
@media (max-width: 767px) {
  .elementor-widget-hd-catalog-grid .catalog-grid {
    --hd-grid-columns: var(--hd-grid-columns-mobile, 2) !important;
    gap: 10px;
  }
  .elementor-widget-hd-catalog-grid .catalog-card {
    min-width: 0;
  }
  .elementor-widget-hd-catalog-grid .catalog-card > div {
    min-width: 0;
    padding: 14px;
  }
  .elementor-widget-hd-catalog-grid .catalog-card h3 {
    font-size: clamp(.9rem, 4.5vw, 1.02rem);
    line-height: 1.18;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
  }
  .elementor-widget-hd-catalog-grid .catalog-card p {
    font-size: clamp(.72rem, 3.5vw, .82rem);
    line-height: 1.5;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
  }
}

/* Mapa compartido: desde tableta la copia y los CTA deben ocupar una fila
 * completa. La versión anterior mantenía 1fr/auto hasta 760px y el CTA largo
 * dejaba el texto reducido a una columna de pocos caracteres. */
@media (max-width: 1024px) {
  .hd-visit-map-card,
  .hd-visit-map-copy,
  .hd-visit-map-copy > div,
  .hd-visit-map-actions {
    min-width: 0;
    max-width: 100%;
  }
  .hd-visit-map-copy {
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: start;
    gap: 18px;
    padding: 20px;
  }
  .hd-visit-map-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: stretch;
    gap: 10px;
  }
  .hd-visit-map-copy .hd-visit-primary-action,
  .hd-visit-map-copy .hd-visit-secondary-action {
    width: auto;
    max-width: 100%;
    min-width: 0;
    white-space: normal !important;
    text-align: center;
    line-height: 1.25;
  }
  .hd-cultural-page--museo .hd-visit-map-stage,
  .hd-cultural-page--templo .hd-visit-map-stage {
    aspect-ratio: 16 / 7 !important;
  }
  .hd-catalog-page .hd-visit-section.hd-visit-map {
    padding: 32px;
  }
}

@media (max-width: 767px) {
  .elementor :is(.elementor-element,.e-con,.e-con-inner) {
    max-width: 100%;
  }
  .elementor :is(a,button,.elementor-button) {
    max-width: 100%;
  }
  .hd-visit-map-copy {
    padding: 16px;
  }
  .hd-visit-map-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .hd-visit-map-copy .hd-visit-primary-action,
  .hd-visit-map-copy .hd-visit-secondary-action {
    width: 100%;
  }
  .hd-cultural-page--museo .hd-visit-map-stage,
  .hd-cultural-page--templo .hd-visit-map-stage {
    aspect-ratio: 16 / 9 !important;
  }
  .hd-catalog-page .hd-visit-section.hd-visit-map {
    padding: 24px 18px;
  }
}

@media (max-width: 430px) {
  .hd-catalog-page .hd-visit-section.hd-visit-map {
    padding: 20px 16px;
  }
  .elementor-widget-hd-catalog-grid .catalog-grid {
    gap: 8px;
  }
  .elementor-widget-hd-catalog-grid .catalog-card > div {
    padding: 12px;
  }
}

/* Scroll horizontal solo donde el contenido naturalmente puede necesitarlo;
 * nunca se aplica al body para esconder errores de layout. */
.elementor :is(.hd-data-table-wrap,.hd-document-table-wrap,.hd-sitemap-table-wrap) {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Huamantla Core 5.0.13 — Vida Huamantla / Completa tu visita.
 * Entre 701 y 1000 px la hoja base dejaba cada tarjeta con dos columnas
 * (imagen min. 240px + texto), lo que comprimía la copia hasta una franja.
 * Desde tableta apilamos imagen y contenido y conservamos el grid configurable
 * del widget para escritorio. La regla es del componente compartido, no de una
 * página concreta, por lo que protege Día de Muertos, Corpus y otras celebraciones.
 */
@media (max-width: 1000px) {
  .elementor-widget-hd-celebration-plan .hd-celebration-plan-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .elementor-widget-hd-celebration-plan .hd-celebration-plan-grid > a,
  .hd-celebration-page .hd-celebration-plan-grid > a {
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch;
  }

  .elementor-widget-hd-celebration-plan .hd-celebration-plan-grid > a > img,
  .hd-celebration-page .hd-celebration-plan-grid > a > img {
    width: 100% !important;
    max-width: 100%;
    height: auto !important;
    aspect-ratio: 16 / 9;
    object-fit: cover;
  }

  .elementor-widget-hd-celebration-plan .hd-celebration-plan-grid > a > span,
  .hd-celebration-page .hd-celebration-plan-grid > a > span {
    width: 100%;
    min-width: 0;
    padding: 20px;
  }

  .elementor-widget-hd-celebration-plan .hd-celebration-plan-grid :is(small,strong,em),
  .hd-celebration-page .hd-celebration-plan-grid :is(small,strong,em) {
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
  }
}

@media (max-width: 700px) {
  .elementor-widget-hd-celebration-plan .hd-celebration-plan,
  .hd-celebration-page .hd-celebration-plan {
    padding: 18px;
  }

  .elementor-widget-hd-celebration-plan .hd-celebration-plan-grid,
  .hd-celebration-page .hd-celebration-plan-grid {
    gap: 14px;
  }

  .elementor-widget-hd-celebration-plan .hd-celebration-plan-grid > a > span,
  .hd-celebration-page .hd-celebration-plan-grid > a > span {
    padding: 18px;
  }
}

@media (max-width: 430px) {
  .elementor-widget-hd-celebration-plan .hd-celebration-plan,
  .hd-celebration-page .hd-celebration-plan {
    padding: 16px;
  }

  .elementor-widget-hd-celebration-plan .hd-celebration-plan-grid > a,
  .hd-celebration-page .hd-celebration-plan-grid > a {
    border-radius: 20px;
  }

  .elementor-widget-hd-celebration-plan .hd-celebration-plan-grid > a > span,
  .hd-celebration-page .hd-celebration-plan-grid > a > span {
    padding: 16px;
  }
}

/* Huamantla Core 5.0.15 — segunda auditoría responsive transversal.
 * Se revisaron las familias padre, hija y nieta del portal y se refuerzan aquí
 * los contratos geométricos compartidos. Esta capa no oculta overflow del body:
 * reduce/recorta el elemento que lo provoca y preserva las decisiones de Elementor.
 */
@media (max-width: 1024px) {
  .elementor[data-elementor-type="wp-post"] :is(
    .hd-celebration-shell,
    .hd-history-shell,
    .hd-data-shell,
    .hd-data-page-shell,
    .hd-contact-shell,
    .hd-first-visit-shell,
    .hd-malinche-shell,
    .hd-conoce-shell,
    .hd-disfruta-shell,
    .hd-events-shell,
    .hd-governance-shell,
    .hd-search-shell,
    .hd-cultural-page,
    .hd-catalog-page,
    .hd-imported-page
  ) {
    min-width: 0;
    max-width: 100%;
  }

  .elementor[data-elementor-type="wp-post"] :is(
    .hd-celebration-hero,
    .hd-celebration-hero > div,
    .hd-celebration-hero-image,
    .hd-history-introduction,
    .hd-history-timeline,
    .hd-history-source,
    .hd-city-introduction,
    .hd-city-meaning,
    .hd-city-feature,
    .hd-codex-introduction,
    .hd-codex-section,
    .hd-monuments-introduction,
    .hd-monuments-feature,
    .hd-contact-hero,
    .hd-news-hero,
    .observatory-hero,
    .data-product-hero
  ) {
    min-width: 0;
    max-width: 100%;
  }

  .elementor[data-elementor-type="wp-post"] :is(h1,h2,h3,h4) {
    max-inline-size: 100%;
    min-width: 0;
    word-break: normal;
  }
}

@media (max-width: 700px) {
  /* Los encabezados deben poder reflowar incluso cuando son una sola palabra.
   * break-word permanece como regla ordinaria; anywhere solo actúa si no existe
   * un punto de corte normal y el término rebasaría físicamente el contenedor. */
  .elementor[data-elementor-type="wp-post"] :is(
    .hd-celebration-hero h1,
    .hd-contact-hero h1,
    .hd-news-hero h1,
    .hd-events-hero__title,
    .observatory-hero h1,
    .data-product-hero h1,
    .page-hero h1,
    .catalog-hero h1
  ) {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .elementor[data-elementor-type="wp-post"] :is(
    .hd-celebration-short-answer,
    .short-answer,
    .hd-data-short-answer,
    .hd-news-short-answer,
    .hd-experience-short-answer
  ) {
    min-width: 0;
    max-width: 100%;
  }

  .elementor[data-elementor-type="wp-post"] :is(
    .hd-celebration-hero-actions,
    .hd-data-actions,
    .hd-contact-actions,
    .hd-experience-actions,
    .hd-disfruta-actions
  ) > :is(a,button) {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
  }

  .elementor[data-elementor-type="wp-post"] :is(
    .hd-history-year-row,
    .hd-history-event,
    .hd-history-event-copy,
    .hd-celebration-document-card,
    .hd-celebration-guide-theme,
    .hd-data-product-grid > *,
    .hd-disfruta-service-grid > *,
    .hd-disfruta-news-grid > *,
    .catalog-grid > *,
    .related-grid > *,
    .gallery-grid > *
  ) {
    min-width: 0;
  }
}

@media (max-width: 430px) {
  .elementor[data-elementor-type="wp-post"] :is(h1,h2,h3,h4,p,li,a,strong,span,small) {
    max-width: 100%;
  }

  /* Evita que botones largos conviertan la tarjeta en un viewport más ancho. */
  .elementor[data-elementor-type="wp-post"] :is(
    .hd-celebration-button,
    .hd-data-button,
    .hd-contact-button,
    .hd-experience-button,
    .hd-disfruta-button,
    .catalog-card-button
  ) {
    min-width: 0;
    max-width: 100%;
    white-space: normal !important;
  }
}
