/* Ludoteca Iberica — mobile / tablet responsive overrides */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

.cabecera__barra,
.contenido,
.pie__rejilla,
.pie__placas,
.pie__edad,
.pie__copyright {
  width: 100%;
  max-width: var(--max-ancho, 1280px);
  margin-left: auto;
  margin-right: auto;
}

.hero {
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: 100%;
  max-width: 100%;
}

.galeria {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)) !important;
}

.tarjeta__pie {
  flex-wrap: wrap;
}

.tarjeta__pie .boton {
  flex: 1 1 auto;
  justify-content: center;
  text-align: center;
}

.carrito-item__info,
.pedido-lista__item > div,
.lista-numerada li > div,
.lista-destacada li,
.bloque-texto,
.aviso-info,
.pie__col,
.tarjeta__cuerpo {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.panel-info,
.tabla-wrap,
.pedido-panel {
  max-width: 100%;
  overflow-x: auto;
}

table.tabla-info,
table.catalogo {
  max-width: 100%;
}

.pie__col a,
.tarjeta-contacto a,
.pedido-ok,
.migas {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.pedido-panel--resumen {
  position: sticky;
  top: 100px;
}

/* —— Tablet / narrow laptop —— */
@media (max-width: 900px) {
  .cabecera__barra {
    padding: .75rem 1rem;
    gap: .6rem;
    flex-wrap: nowrap;
  }

  .cabecera__logo {
    font-size: 1.2rem;
    min-width: 0;
    flex: 1 1 auto;
  }

  .cabecera__logo-icono {
    width: 30px;
    height: 30px;
  }

  .cabecera__nav {
    display: none;
    position: fixed;
    top: 58px;
    left: 0;
    right: 0;
    z-index: 150;
    background: var(--c-teal-900, #0d3b3a);
    flex-direction: column;
    padding: 1rem;
    gap: .2rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .3);
    border-top: 1px solid var(--c-teal-500, #1d756a);
    max-height: calc(100vh - 58px);
    overflow-y: auto;
  }

  .cabecera__nav--visible {
    display: flex !important;
  }

  .cabecera__nav a {
    width: 100%;
    padding: .85rem 1rem;
    border-radius: 6px;
    font-size: 1.05rem;
  }

  .cabecera__btn-menu {
    display: flex !important;
    flex-shrink: 0;
  }

  .cabecera__carrito {
    padding: .5rem .75rem;
    font-size: .88rem;
    flex-shrink: 0;
    white-space: nowrap;
  }

  .hero {
    grid-template-columns: 1fr !important;
    margin: 0 !important;
  }

  .hero__imagen {
    min-height: 220px;
    order: -1;
  }

  .hero__texto {
    padding: 2rem 1.25rem !important;
  }

  .hero h1 {
    font-size: clamp(1.75rem, 6vw, 2.4rem) !important;
  }

  .hero__texto p {
    max-width: 100%;
  }

  .producto-layout,
  .pedido-layout,
  .dos-columnas,
  .dos-columnas--asimetrica {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  .producto-galeria {
    position: static !important;
  }

  .pedido-panel--resumen {
    position: static !important;
    top: auto !important;
  }

  .pie__rejilla {
    grid-template-columns: 1fr 1fr !important;
    gap: 1.5rem !important;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .pie__placas {
    grid-template-columns: 1fr 1fr !important;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .banner-strip {
    grid-template-columns: 1fr 1fr !important;
  }

  .banner-strip__item {
    border-right: none !important;
  }

  .banner-strip__item:nth-child(1),
  .banner-strip__item:nth-child(2) {
    border-bottom: 1px solid rgba(255, 255, 255, .1);
  }

  .campo-fila {
    grid-template-columns: 1fr !important;
  }

  .galeria {
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
  }
}

/* —— Phones —— */
@media (max-width: 640px) {
  html {
    font-size: 16px;
  }

  .cabecera__barra {
    padding: .65rem .85rem;
    gap: .45rem;
  }

  .cabecera__logo {
    font-size: 1.05rem;
  }

  .cabecera__nav {
    top: 54px;
    max-height: calc(100vh - 54px);
  }

  .cabecera__carrito {
    padding: .45rem .65rem;
    font-size: .82rem;
  }

  .banda-info {
    font-size: .82rem;
    padding: .55rem .75rem;
    line-height: 1.4;
  }

  .contenido {
    padding: 1.25rem .85rem !important;
    width: 100%;
  }

  .seccion {
    padding: 2rem 0;
  }

  .seccion--crema {
    margin-left: -.85rem !important;
    margin-right: -.85rem !important;
    padding-left: .85rem !important;
    padding-right: .85rem !important;
  }

  .seccion-titulo,
  h1.seccion-titulo {
    font-size: 1.55rem !important;
    line-height: 1.2;
  }

  .seccion-subtitulo {
    font-size: 1rem !important;
    margin-bottom: 1.5rem;
    max-width: 100%;
  }

  .bloque-texto h2 {
    font-size: 1.35rem !important;
  }

  .bloque-texto h3 {
    font-size: 1.15rem !important;
  }

  .hero__texto {
    padding: 1.5rem 1rem !important;
  }

  .hero h1 {
    font-size: 1.7rem !important;
  }

  .hero__texto p {
    font-size: 1rem !important;
    margin-bottom: 1.25rem;
  }

  .hero__cta {
    flex-direction: column;
    width: 100%;
  }

  .hero__cta .boton,
  .boton {
    max-width: 100%;
    box-sizing: border-box;
  }

  .boton--principal,
  .boton--carrito,
  .boton--secundario {
    white-space: normal;
    text-align: center;
    justify-content: center;
  }

  .hero__cta .boton {
    width: 100%;
    justify-content: center;
  }

  .galeria {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .tarjeta__imagen {
    height: 200px;
  }

  .tarjeta__cuerpo {
    padding: 1.1rem;
  }

  .tarjeta__pie {
    flex-direction: column;
    align-items: stretch;
    gap: .75rem;
  }

  .tarjeta__pie .boton {
    width: 100%;
  }

  .tarjeta__precio {
    font-size: 1.25rem;
  }

  .banner-strip {
    grid-template-columns: 1fr !important;
  }

  .banner-strip__item {
    border-right: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    padding: 1rem;
  }

  .banner-strip__item:last-child {
    border-bottom: none;
  }

  .aviso-info {
    padding: 1.1rem 1rem !important;
    font-size: .98rem !important;
    margin: 1.25rem 0;
  }

  .aviso-info::before {
    width: 28px;
    height: 28px;
    font-size: 1rem;
    margin-right: .4rem;
  }

  .lista-numerada li {
    flex-direction: row;
    gap: .85rem;
    padding: 1rem !important;
  }

  .lista-numerada li::before {
    width: 34px;
    height: 34px;
    font-size: 1.05rem;
  }

  .lista-destacada li {
    padding: .9rem 1rem;
  }

  .producto-detalle h1 {
    font-size: 1.65rem !important;
  }

  .producto-detalle__precio {
    font-size: 1.7rem !important;
  }

  .producto-desc-galeria {
    grid-template-columns: 1fr !important;
  }

  .producto-galeria__thumbs {
    gap: .55rem;
  }

  .producto-galeria__thumb {
    width: 64px;
    height: 64px;
  }

  .producto-detalle__cantidad {
    flex-wrap: wrap;
  }

  .panel-info {
    padding: 1.15rem !important;
  }

  .pedido-panel {
    padding: 1.15rem !important;
  }

  .pedido-lista__item {
    grid-template-columns: 44px 1fr !important;
    gap: .65rem;
  }

  .pedido-lista__item img {
    width: 44px;
    height: 44px;
  }

  .pedido-lista__item strong {
    grid-column: 2;
    justify-self: start;
  }

  .pedido-ok {
    padding: 1.5rem 1rem !important;
  }

  .pedido-ok h2 {
    font-size: 1.45rem !important;
  }

  .pago-opcion {
    padding: .85rem .9rem;
  }

  .campo input,
  .campo textarea,
  .campo select {
    font-size: 16px; /* avoid iOS zoom */
  }

  .tarjeta-contacto {
    padding: 1.35rem !important;
  }

  .tarjeta-contacto h3 {
    font-size: 1.3rem !important;
  }

  .tabla-wrap {
    margin: 1.25rem 0;
    -webkit-overflow-scrolling: touch;
  }

  table.tabla-info,
  table.catalogo {
    font-size: .85rem;
  }

  table.tabla-info th,
  table.tabla-info td,
  table.catalogo th,
  table.catalogo td {
    padding: .65rem .7rem;
  }

  .tabla-miniatura {
    width: 40px;
    height: 40px;
  }

  .tabla-precio,
  .tabla-accion {
    white-space: normal !important;
  }

  .pie {
    padding: 2rem .85rem 1.25rem;
  }

  .pie__rejilla {
    grid-template-columns: 1fr !important;
    gap: 1.35rem !important;
    padding-left: 0;
    padding-right: 0;
  }

  .pie__placas {
    grid-template-columns: 1fr !important;
    gap: .75rem;
    padding-left: 0;
    padding-right: 0;
  }

  .pie__placa {
    font-size: .8rem;
  }

  .pie__edad {
    flex-direction: column;
    gap: .85rem;
    padding: 0 .25rem;
  }

  .carrito-overlay {
    padding: .5rem;
    align-items: flex-end;
  }

  .carrito-modal {
    padding: 1.15rem !important;
    max-height: 92vh;
    border-radius: 12px 12px 0 0;
    width: 100%;
    max-width: 100%;
  }

  .carrito-item {
    gap: .7rem;
  }

  .carrito-item__img {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }

  .toast {
    bottom: 1rem !important;
    left: .75rem !important;
    right: .75rem !important;
    text-align: center;
  }

  .imagen-fig {
    margin: 1.5rem 0;
  }

  .migas {
    font-size: .85rem;
  }
}

/* —— Very small phones —— */
@media (max-width: 380px) {
  .cabecera__logo {
    font-size: .95rem;
  }

  .cabecera__carrito {
    padding: .4rem .5rem;
    font-size: .75rem;
  }

  .contenido {
    padding: 1rem .7rem !important;
  }

  .seccion--crema {
    margin-left: -.7rem !important;
    margin-right: -.7rem !important;
    padding-left: .7rem !important;
    padding-right: .7rem !important;
  }

  .galeria {
    grid-template-columns: 1fr !important;
  }
}
