/* ============================================================
   Capa móvil TNDR — linealiza el layout mesh de Wix (<980px)
   El diseño original es de ancho fijo 980px; esta hoja apila
   los componentes en una columna fluida en pantallas pequeñas.
   ============================================================ */
@media (max-width: 979px) {

  /* --- Raíz: fuera el ancho mínimo fijo --- */
  html { --site-width: 100vw !important; }
  body:not(.responsive) #site-root {
    min-width: 0 !important;
    width: 100% !important;
    overflow-x: clip;
  }
  body { overflow-x: hidden !important; }
  #masterPage.mesh-layout { grid-template-columns: 100% !important; }
  #masterPage.mesh-layout > * { max-width: 100vw !important; }

  /* --- Contenedores mesh: de rejilla posicionada a columna --- */
  [data-mesh-id$="-gridContainer"] {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
  }
  [data-mesh-id$="-gridContainer"] > * {
    position: relative !important;
    inset: auto !important;
    left: auto !important;
    top: auto !important;
    margin: 10px auto !important;
    grid-area: auto !important;
    max-width: calc(100vw - 24px) !important;
    min-width: 0 !important;
    align-self: center !important;
    flex: none !important;
  }
  /* Alto libre para todo salvo los componentes que rellenan por absoluto */
  [data-mesh-id$="-gridContainer"] > *:not(.wixui-vector-image):not(.wixui-video-box):not(.wixui-google-map) {
    height: auto !important;
    min-height: 0 !important;
  }
  [data-mesh-id$="inlineContent"],
  [data-mesh-id$="centeredContent"] {
    height: auto !important;
    min-height: 0 !important;
    width: 100% !important;
    margin: 0 !important;
  }

  /* Reproductores de vídeo */
  .wixui-video-player {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
  }
  .wixui-video-player video,
  .wixui-video-player iframe {
    width: 100% !important;
    height: 100% !important;
  }

  /* Mapas de Google */
  .wixui-google-map {
    width: 100% !important;
    height: 60vw !important;
    min-height: 240px !important;
  }
  .wixui-google-map iframe { height: 100% !important; }

  /* Los envoltorios de sección/strip ocupan todo el ancho */
  [data-mesh-id$="-gridContainer"] > section,
  [data-mesh-id$="-gridContainer"] > .wixui-section,
  [data-mesh-id$="-gridContainer"] > [data-testid="section"],
  section.wixui-section, .wixui-column-strip {
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    margin: 0 auto !important;
  }
  /* Fondos y rellenos internos de sección: al ancho del viewport */
  #site-root [data-hook="bgLayers"],
  #site-root [data-hook="bgLayers"] > *,
  #site-root [id^="bgMedia"],
  #site-root [id^="bgMedia"] > * {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100vw !important;
  }

  /* --- Texto: alto libre y sin desbordes --- */
  .wixui-rich-text {
    width: auto !important;
    max-width: calc(100vw - 32px) !important;
    height: auto !important;
    overflow-wrap: break-word;
  }
  .wixui-rich-text * { white-space: normal !important; }

  /* --- Imágenes fluidas (excepto fondos y galerías, que rellenan) --- */
  #site-root img {
    max-width: 100% !important;
  }
  #site-root img:not([id^="bgMedia"] img):not(.tndr-gallery img):not([data-hook="bgLayers"] img) {
    height: auto !important;
  }
  /* Contenedores de imagen de Wix (el envoltorio rellenaba por absoluto) */
  .wixui-image, [data-testid="imageX"] {
    width: 100% !important;
    height: auto !important;
    max-width: calc(100vw - 24px) !important;
  }
  .wixui-image img { margin: 0 auto; max-width: 100% !important; height: auto !important; }
  .wixui-image > a,
  .wixui-image > div {
    position: relative !important;
    inset: auto !important;
    display: block;
    width: 100% !important;
    height: auto !important;
  }
  .wixui-image img {
    position: relative !important;
    inset: auto !important;
    display: block;
  }

  /* Botones-imagen (p.ej. descargas de PDF) */
  .wixui-image-button > a {
    position: relative !important;
    inset: auto !important;
    display: block;
    width: 100% !important;
    height: auto !important;
  }
  /* El primer estado (normal) entra en flujo y da alto; hover/active quedan superpuestos */
  .wixui-image-button a > div > div:first-child {
    position: relative !important;
    inset: auto !important;
    height: auto !important;
  }
  .wixui-image-button a > div > div:first-child img {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
  }

  /* Columnas cuya única función es mostrar una foto de fondo */
  #site-root .wixui-column-strip__column:has([data-hook="bgLayers"] img):not(:has([data-mesh-id$="-gridContainer"] > *)) {
    min-height: 55vw !important;
  }

  /* --- Galerías propias (carousel.css): alto por proporción --- */
  .tndr-gallery {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 4 / 3;
  }
  [id^="comp-"]:has(> .tndr-gallery) { width: 100% !important; }

  /* --- Vectores / SVG proporcionales --- */
  .wixui-vector-image svg { width: 100%; height: auto; }

  /* --- Columnas: apiladas --- */
  section.wixui-column-strip {
    height: auto !important;
    min-height: 0 !important;
  }
  .wixui-column-strip > [data-testid="columns"] {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
  }
  .wixui-column-strip__column {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    left: auto !important;
    height: auto !important;
    min-height: 0 !important;
    flex: none !important;
  }

  /* Franjas decorativas (imagen de fondo sin contenido): alto proporcional */
  #site-root section.wixui-column-strip:not(:has([data-mesh-id$="-gridContainer"] > *)) {
    min-height: 55vw !important;
  }
  .wixui-column-strip__column [data-hook="bgLayers"],
  section.wixui-column-strip [data-hook="bgLayers"] {
    height: 100% !important;
  }

  /* --- Slideshow (testimonios): a flujo normal --- */
  .wixui-slideshow {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
  }
  .wixui-slideshow [data-testid="slidesWrapper"] {
    position: relative !important;
    inset: auto !important;
    height: auto !important;
    width: 100% !important;
  }
  .wixui-slideshow [data-testid="slidesWrapper"] > * {
    position: relative !important;
    inset: auto !important;
    height: auto !important;
    min-height: 0 !important;
    width: 100% !important;
  }

  /* --- Repetidores (tarjetas): una por fila --- */
  .wixui-repeater,
  .wixui-repeater [data-testid="responsive-container-content"] {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    gap: 16px;
  }
  .wixui-repeater > * {
    position: relative !important;
    inset: auto !important;
    left: auto !important;
    top: auto !important;
    margin: 0 auto !important;
    max-width: calc(100vw - 24px) !important;
    height: auto !important;
  }

  /* --- Iframes (mapas, vídeos) --- */
  #site-root iframe {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* --- Menú de escritorio fuera; el móvil lo pinta mobile.js --- */
  .wixui-header wix-dropdown-menu,
  #SITE_HEADER nav[class*="StylableHorizontalMenu"] { display: none !important; }
  .wixui-header { height: auto !important; }

  /* Imagenes dentro de la cabecera: compactas */
  .wixui-header .wixui-image img {
    width: auto !important;
    max-width: 100% !important;
    max-height: 36vw;
    margin: 0 auto;
  }

  /* Botones cómodos de pulsar (el ancla rellenaba por absoluto) */
  [id^="comp-"] > .wixui-button {
    position: relative !important;
    inset: auto !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: auto !important;
    min-height: 44px;
    max-width: calc(100vw - 32px) !important;
  }
  a.wixui-button .wixui-button__label { position: relative; }

  /* Reproductores de audio (testimonios): alto fijo, contenido absoluto */
  #site-root [id^="comp-"]:has([class*="TrackName"]):not(:has([data-mesh-id])) {
    height: 72px !important;
    width: 100% !important;
    max-width: calc(100vw - 24px) !important;
  }

  /* Reproductores nativos: alto libre en móvil */
  #site-root [id^="comp-"]:has(> .tndr-player) {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    width: 100% !important;
    max-width: calc(100vw - 24px) !important;
  }

  /* Barras de iconos sociales (ul rellenaba por absoluto) */
  [id^="comp-"] > ul {
    position: relative !important;
    inset: auto !important;
    height: auto !important;
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }
  [id^="comp-"] > ul > li {
    position: relative !important;
    inset: auto !important;
  }

  /* Barras sociales compactas */
  .wixui-login-social-bar { height: auto !important; }
}

/* ============================================================
   Menú móvil (hamburguesa) — lo inyecta assets/mobile.js
   ============================================================ */
.tndr-burger {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 90;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, .25);
  cursor: pointer;
  padding: 10px;
}
.tndr-burger span {
  display: block;
  height: 3px;
  margin: 4px 0;
  border-radius: 2px;
  background: #f7f5e1;
}
@media (max-width: 979px) {
  .tndr-burger { display: block; }
}
.tndr-mnav {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(56, 66, 53, .97);
  overflow-y: auto;
  padding: 64px 24px 40px;
}
.tndr-mnav.open { display: block; }
.tndr-mnav a {
  display: block;
  padding: 14px 8px;
  font: normal 20px/1.3 'open sans', sans-serif;
  color: #f7f5e1;
  text-decoration: none;
  border-bottom: 1px solid rgba(247, 245, 225, .15);
}
.tndr-mnav a.tndr-sub { padding-left: 28px; font-size: 17px; opacity: .9; }
.tndr-mnav .tndr-close {
  position: fixed;
  top: 12px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: #f7f5e1;
  font-size: 32px;
  line-height: 44px;
  cursor: pointer;
}
