/* ============================================================
   GM SHOP — PARRILLA DE PRODUCTOS + PÁGINA DE BÚSQUEDA
   Archivo único: tu-tema/assets/css/gm-shop.css
   (sustituye a gm-shop.css + gm-shop-search.css anteriores)
   ============================================================ */

/* ---- Tokens ---- */
:root {
  --gms-text: #000000;
  --gms-muted: #ece6e2;
  --gms-border: #e7e4de;
  --gms-bg-soft: #f7f5f4;
  --gms-gap-x: 26px;
  --gms-gap-y: 44px;
  --gms-ratio: 4 / 5; /* proporción de las imágenes de producto */
  --gms-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.woocommerce-breadcrumb {
  display: none;
}

.tax-product_cat .ast-shop-toolbar-container {
  display: none;
}
.tax-product_cat #primary {
  margin-top: 0px;
}

/* ============================================================
   PARRILLA (tienda / categorías / búsqueda)
   ============================================================ */

ul.products {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gms-gap-y) var(--gms-gap-x);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Neutralizar floats/anchos de Woo y Astra sobre las columnas */
ul.products li.gm-product {
  float: none !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  border: none !important;
}

.gm-product__link {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-decoration: none;
  color: inherit;
}

.gm-product__link:hover {
  color: #000000;
}

/* ---- Imagen ---- */

.gm-product__link img {
  display: block !important;
  width: 100% !important;
  height: 600px !important;
  object-fit: cover;
}

.gm-product__link:focus-visible {
  outline: 2px solid var(--gms-text);
  outline-offset: 4px;
}
.gm-product__flag {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  padding: 0px 13px;
  background: var(--gms-text);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}

/* ---- Info: título arriba; debajo, meta a la izquierda y precio a la
   derecha alineados en la misma línea, como en el diseño ---- */
.gm-product__info {
  display: flex;
  align-items: flex-end; /* el precio baja a la altura de la línea de meta */
  justify-content: space-between;
  gap: 18px;
}
.gm-product__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.gm-product__meta {
  margin: 4px 0 0;
  font-size: 16px;
  line-height: 20px;
}
.gm-product__price {
  flex: none;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.gm-product__price .woocommerce-Price-amount {
  font-weight: 600;
}
/* Precio tachado si hay oferta */
.gm-product__price del {
  color: var(--gms-muted);
  font-weight: 400;
  margin-right: 6px;
}
.gm-product__price ins {
  text-decoration: none;
}

/* ---- Ocultar elementos que Astra/Woo inyectan por hooks en el loop ---- */
ul.products li.gm-product .astra-shop-summary-wrap,
ul.products li.gm-product .star-rating,
ul.products li.gm-product .button,
ul.products li.gm-product .added_to_cart,
ul.products li.gm-product .onsale {
  display: none !important;
}

/* ============================================================
   PÁGINA DE BÚSQUEDA
   ============================================================ */

.gm-search__head {
  margin-bottom: 38px;
}
.gm-search__title {
  margin: 0;
  font-size: 27px;
  font-weight: 600;
  color: var(--gms-text);
}
.gm-search__count {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--gms-muted);
}

/* Otros resultados (posts, páginas) */
.gm-search__others {
  margin-top: 64px;
}
.gm-search__subtitle {
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 600;
  color: var(--gms-text);
}
.gm-search__item {
  padding: 18px 0;
  border-bottom: 1px solid var(--gms-border);
}
.gm-search__item a {
  text-decoration: none;
  color: inherit;
}
.gm-search__item h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  color: var(--gms-text);
}
.gm-search__item a:hover h3 {
  text-decoration: underline;
}
.gm-search__item p {
  margin: 0;
  font-size: 14px;
  color: var(--gms-muted);
}

/* Sin resultados */
.gm-search__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 64px 0;
  text-align: center;
  color: var(--gms-muted);
}
.gm-search__empty img {
  width: 220px;
}

/* Paginación nativa de WP */
.gm-search .navigation.pagination {
  margin-top: 52px;
}
.gm-search .nav-links {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.gm-search .page-numbers {
  padding: 8px 15px;
  font-size: 16px;
  color: var(--gms-text);
  background: #fff;
  border: 1px solid var(--gms-border);
  border-radius: 6px;
  text-decoration: none;
  transition:
    background 0.18s ease,
    border-color 0.18s ease;
}
.gm-search .page-numbers:hover {
  background: var(--gms-bg-soft);
}
.gm-search .page-numbers.current {
  background: var(--gms-text);
  color: #fff;
  border-color: var(--gms-text);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
  ul.products {
    grid-template-columns: repeat(2, 1fr);
    gap: 36px 18px;
  }
  .gm-search {
    padding: 36px 16px 64px;
  }
  .gm-search__title {
    font-size: 23px;
  }
}
@media (max-width: 560px) {
  ul.products {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* ============================================================
   FIX DESBORDAMIENTO DE LA PARRILLA
   ============================================================ */

/* El ul nunca más ancho que su contenedor */
ul.products {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

/* Eliminar los clearfix de Woo, que en grid actúan como items fantasma */
ul.products::before,
ul.products::after {
  display: none !important;
  content: none !important;
}

/* Los li pueden encoger por debajo de su contenido (clave del fix) */
ul.products li.gm-product {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

/* Y toda la cadena interna también */
.gm-product__link,
.gm-product__info,
.gm-product__text {
  min-width: 0;
}

/* Textos largos parten línea en vez de empujar */
.gm-product__title,
.gm-product__meta {
  overflow-wrap: break-word;
}

/* ============================================================
   PRODUCTO ESTRELLA (hero de categoría)
   ============================================================ */
.gm-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #ece6e2;
  margin: 0 0 64px;
}
.gm-hero__media {
  display: block;
  overflow: hidden;
}
.gm-hero__media img {
  display: block;
  width: 100%;
  height: 100%;
  height: 900px;
  object-fit: cover;
  transition: transform 0.7s var(--gms-ease);
}
.gm-hero__panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px clamp(28px, 4vw, 64px);
}
.gm-hero__badge {
  align-self: flex-start;
  margin-bottom: 26px;
  padding: 3px 13px;
  background: var(--gms-text);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}
.gm-hero__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}
.gm-hero__title {
  margin: 0 !important;
  max-width: 11ch;
  font-size: clamp(28px, 3.4vw, 44px);
}
.gm-hero__title a {
  color: inherit;
  text-decoration: none;
}
.gm-hero__price {
  flex: none;
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.gm-hero__price small {
  display: block;
  margin-bottom: 2px;
  font-size: 14px;
  font-weight: 400;
  color: var(--gms-text);
}
.gm-hero__price span {
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 500;
}
.gm-hero__desc {
  margin-top: 22px;
  font-size: 16px;
  line-height: 20px;
}
.gm-hero__desc p {
  margin: 0;
}
.gm-hero__cta {
  align-self: flex-start;
  margin-top: 26px;
  color: var(--gms-text);
  font-size: 16px;
  text-decoration: underline;
  font-weight: 600;
}

/* ============================================================
   PARRILLA DE DESTACADOS (2 columnas) + BLOQUE PROMO
   ============================================================ */
ul.products.gm-destacados {
  grid-template-columns: repeat(2, 1fr) !important;
  margin-bottom: var(--gms-gap-y);
  gap: var(--gms-gap-y);
}
ul.products.gm-destacados .gm-product__link img {
  height: 800px !important;
}

/* Bloque promocional */
ul.products li.gm-promo {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 800px;
  padding: 40px;
  margin: 0 !important;
  float: none !important;
  width: auto !important;
  list-style: none;
  background: var(--gm-promo-bg, #d9e0d0);
  color: var(--gm-promo-color, #1a1a18);
  box-sizing: border-box;
}
.gm-promo__title {
  font-family: 'Newsreader', serif;
  margin: 0 0 18px;
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 400;
  color: inherit;
}
.gm-promo__text {
  margin: 0;
  max-width: 34ch;
  font-size: 16px;
  color: inherit;
  opacity: 0.85;
  line-height: 20px;
}
.gm-promo__cta {
  align-self: flex-start;
  color: inherit;
  font-size: 16px;
  text-decoration: underline;
  transition: opacity 0.18s ease;
  font-weight: 600;
}
.gm-promo__cta:hover {
  opacity: 0.7;
}

@media (max-width: 980px) {
  ul.products.gm-destacados .gm-product__link img {
    height: 380px !important;
  }
  ul.products li.gm-promo {
    min-height: 380px;
    padding: 28px;
  }
}
@media (max-width: 560px) {
  ul.products.gm-destacados {
    grid-template-columns: 1fr;
  }
  ul.products li.gm-promo {
    min-height: 260px;
  }
}

/* ============================================================
   CABECERA DE CATEGORÍA
   ============================================================ */
.gm-cat-hero {
  position: relative;
  /* Full-bleed: rompe el contenedor y ocupa todo el ancho */
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  min-height: clamp(320px, 42vw, 560px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #3a332c;
}
.gm-cat-hero__media {
  position: absolute;
  inset: 0;
}
.gm-cat-hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Velo para que el título siempre tenga contraste */
.gm-cat-hero__media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(20, 16, 12, 0.15),
    rgba(20, 16, 12, 0.4)
  );
}
.gm-cat-hero__inner {
  position: relative;
  z-index: 1;
  padding: 40px 20px;
  text-align: center;
}
.gm-cat-hero__title {
  margin: 0;
  color: #fff;
  font-size: clamp(30px, 4.6vw, 58px);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 24px rgba(0, 0, 0, 0.25);
}
.gm-cat-hero--sinimagen {
  min-height: 240px;
  background: var(--gms-bg-soft);
}
.gm-cat-hero--sinimagen .gm-cat-hero__title {
  color: var(--gms-text);
  text-shadow: none;
}

/* ---- Descripción bajo la cabecera ---- */
.gm-cat-intro {
  margin: clamp(40px, 5vw, 72px) 0 clamp(48px, 6vw, 80px);
  max-width: 100ch;
  line-height: 36px;
}
.gm-cat-intro p {
  margin: 0 0 0.6em;
  font-family: 'Newsreader', serif !important;
  font-size: clamp(25px, 6vw, 32px);
  font-weight: 400;
  color: var(--gms-text);
}
.gm-cat-intro p:last-child {
  margin-bottom: 0;
}

@media (max-width: 560px) {
  .gm-cat-hero {
    min-height: 260px;
  }
}

/* ============================================================
   BARRA DE HERRAMIENTAS / BOTÓN DE FILTROS
   ============================================================ */
.gm-cat-tools {
  margin-bottom: 25px;
}

.gm-filtros {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  background: #fff;
  color: var(--gms-text);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}
.gm-filtros__icon {
  width: 17px;
  height: 17px;
  flex: none;
  background-color: currentColor;
  -webkit-mask: url('https://stack.gmedia.es/wp-content/uploads/2026/07/Vector.svg')
    center / contain no-repeat;
  mask: url('https://stack.gmedia.es/wp-content/uploads/2026/07/Vector.svg')
    center / contain no-repeat;
}

/* ============================================================
   SUBCATEGORÍAS
   ============================================================ */
.gm-subcats {
  margin: 0 0 clamp(44px, 5vw, 72px);
}
.gm-subcats__list {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.gm-subcats__item {
  margin: 0;
  min-width: 0;
}
.gm-subcats__link {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-decoration: none;
  color: var(--gms-text);
}
.gm-subcats__link:hover {
  color: #000000;
}
.gm-subcats__media {
  display: block;
  overflow: hidden;
  background: #f5f4f1;
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
}
.gm-subcats__img {
  display: block;
  width: 100%;
  height: 250px !important;
  object-fit: cover;
  transition: transform 0.6s var(--gms-ease);
}
.gm-subcats__link:focus-visible {
  outline: 2px solid var(--gms-text);
  outline-offset: 4px;
}
.gm-subcats__name {
  font-family: 'SF Pro Display' !important;
  font-size: 16px;
  text-align: center;
  line-height: 1.35;
  overflow-wrap: break-word;
}

@media (max-width: 1100px) {
  .gm-subcats__list {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 700px) {
  .gm-subcats__list {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
}
@media (max-width: 460px) {
  .gm-subcats__list {
    grid-template-columns: repeat(2, 1fr);
  }
}
