/* Armería Gil · catálogo: listados, filtros, búsqueda y ficha de producto.
   Principio: los productos mandan. Cabecera mínima (enlace al padre + título + tira de secciones),
   una barra fina con «Filtrar», recuento y orden; filtros plegados ENCIMA de la rejilla (nunca al lado)
   y el texto para buscadores al pie. */

/* Contenedor ancho, alineado con la cabecera (--shell): la rejilla ocupa casi toda la pantalla, 4 por fila. */
.cat-wrap { max-width: var(--shell, 1520px); }

/* Cabecera del listado ----------------------------------------------------- */
.cat-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding-block: clamp(18px, 2.4vw, 30px) clamp(18px, 2.2vw, 26px); }
.cat-back {
  justify-self: start; display: inline-flex; align-items: center; gap: 4px; margin-left: -2px;
  font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); text-decoration: none;
}
.cat-back:hover { color: var(--text); }
.cat-back svg { transition: transform .15s var(--ease); }
.cat-back:hover svg { transform: translateX(-2px); }
.cat-titlerow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; min-width: 0; }
.cat-title {
  font-family: var(--font-display); font-weight: var(--fw-display); font-variation-settings: "wdth" var(--wdth-display); letter-spacing: var(--ls-display);
  font-size: clamp(2.125rem, 3.8vw, 3.5rem); line-height: 1.02; letter-spacing: -0.03em; overflow-wrap: anywhere;
}
.cat-origin { font-size: var(--fs-sm); color: var(--text-muted); padding-top: 6px; }
.cat-brand-logo { width: auto; height: 44px; max-width: 110px; object-fit: contain; background: var(--surface); border-radius: var(--r-sm); padding: 6px 10px; }
.cat-corrected { font-size: var(--fs-sm); color: var(--text-muted); margin-top: -4px; }

.cat-search { position: relative; display: flex; gap: 8px; flex: 1 1 420px; max-width: 560px; margin-left: auto; }
.cat-search .input { flex: 1; min-width: 0; min-height: 44px; padding-left: 40px; }
.cat-search-icon { position: absolute; left: 13px; top: 13px; color: var(--text-soft); pointer-events: none; }

/* Tira de secciones: píldoras con miniatura redonda y nº de productos. */
.cat-strip-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.cat-pill {
  display: inline-flex; align-items: center; gap: 10px; height: 42px; padding: 3px 14px 3px 3px;
  border-radius: var(--r-pill); background: #dfe1d8; border: 0;
  font-size: var(--fs-sm); font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: border-color .15s var(--ease), background-color .15s var(--ease), color .15s var(--ease);
}
.cat-pill:hover { background: #d3d6cb; }
.cat-pill-img {
  flex: none; width: 34px; height: 34px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; background: var(--monte-100); color: var(--monte-500);
}
.cat-pill-img img { width: 100%; height: 100%; object-fit: cover; }
.cat-pill-n { font-size: 13px; font-weight: 500; color: #59645c; font-variant-numeric: tabular-nums; }
.cat-pill.is-current { background: var(--encina-800); border-color: var(--encina-800); color: var(--hueso); }
.cat-pill.is-current .cat-pill-n { color: var(--monte-300); }

/* Barra de filtros y orden ------------------------------------------------------- */
.cat-results { min-width: 0; }
.cat-toolbar {
  display: flex; align-items: center; gap: 12px 20px; min-height: 60px; padding-block: 18px 22px;
}
.cat-filter-btn {
  display: none; align-items: center; gap: 10px; height: 40px; padding: 0 16px 0 13px;
  border: 1px solid var(--pizarra-400); border-radius: var(--r-sm); background: transparent; cursor: pointer;
  font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--text);
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.has-js .cat-filter-btn { display: inline-flex; }
.cat-filter-btn:hover { border-color: var(--encina-800); background: var(--surface); }
.cat-filter-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cat-filter-btn[aria-expanded="true"] { background: var(--encina-800); border-color: var(--encina-800); color: var(--hueso); }
.cat-filter-n {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: -2px;
  border-radius: var(--r-pill); background: var(--encina-800); color: var(--hueso); font-size: 0.6875rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.cat-filter-btn[aria-expanded="true"] .cat-filter-n { background: var(--laton-300); color: var(--encina-900); }
.cat-count { font-size: var(--fs-sm); font-weight: 400; color: var(--text-muted); margin-right: auto; }
.cat-count .num { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.cat-sort { position: relative; display: flex; align-items: center; gap: 4px; }
.cat-sort label { font-size: var(--fs-sm); color: var(--text-muted); white-space: nowrap; }
.cat-sort-select {
  appearance: none; -webkit-appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--text); padding: 8px 26px 8px 6px; border-radius: var(--r-sm);
  field-sizing: content;
}
.cat-sort-select:hover { background: var(--surface); }
.cat-sort-select:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.cat-sort::after {
  content: ""; position: absolute; right: 9px; top: 50%; width: 6px; height: 6px; pointer-events: none;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: translateY(-70%) rotate(45deg);
}

/* Filtros aplicados: siempre visibles, aunque el panel esté cerrado. */
.cat-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 16px; }
.cat-chips ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.cat-clear, .filters-clear { font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.cat-clear:hover, .filters-clear:hover { color: var(--text); text-decoration-color: currentColor; }
.chip {
  display: inline-flex; align-items: center; gap: 9px; min-height: 32px; padding: 4px 11px 4px 13px;
  border-radius: var(--r-pill); background: var(--surface); color: var(--text); border: 1px solid var(--border);
  font-size: var(--fs-xs); font-weight: 600; text-decoration: none; line-height: 1.2;
  transition: border-color .15s var(--ease);
}
.chip svg { opacity: .55; }
.chip:hover { border-color: var(--encina-800); }
.chip:hover svg { opacity: 1; }
.chip-plain { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.chip-plain:hover { background: var(--surface); border-color: var(--encina-800); }

/* Rejilla: 2 / 3 / 4 columnas a todo el ancho, con aire. */
.cat-grid { margin-top: clamp(24px, 2.6vw, 36px); grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 14px; }
@media (min-width: 721px) { .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 22px; } }
@media (min-width: 1100px) { .cat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 48px clamp(22px, 1.8vw, 32px); } }

.cat-empty { margin-top: 28px; background: var(--surface); border-radius: var(--r-md); }
.cat-empty-title { font-size: var(--fs-md); font-weight: 600; color: var(--text); }

/* Panel de filtros ---------------------------------------------------------------------
   Sin JS: abierto, en el flujo, con su botón de enviar.
   Con JS, escritorio: plegado; se despliega encima de la rejilla, a todo el ancho, con los grupos en columnas.
   Con JS, móvil: hoja a pantalla completa que sube desde abajo. */
.cat-filters { min-width: 0; margin-top: 16px; }
.filters { display: grid; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-lg); }
.filters-head { display: none; }
.filters-title { font-family: var(--font-display); font-weight: var(--fw-display); font-variation-settings: "wdth" var(--wdth-display); letter-spacing: var(--ls-display); font-size: var(--fs-lg); margin-right: auto; }
/* Grupos en columnas equilibradas (los cortos se apilan y el panel queda bajo). */
.filters-body {
  columns: 5 190px; column-gap: clamp(32px, 3.4vw, 60px);
  padding: clamp(24px, 2.4vw, 32px) clamp(22px, 2.6vw, 36px) 4px;
}
.filters-body > .fgroup { break-inside: avoid; margin-bottom: 28px; }
.filters-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px 24px; flex-wrap: wrap;
  padding: 14px clamp(22px, 2.4vw, 34px); border-top: 1px solid var(--border-soft);
}
.filters-submit { min-width: 200px; }

.has-js .cat-filters:not(.is-open) { display: none; }
.has-js .cat-filters.is-open { animation: cat-drop .2s var(--ease); }
@keyframes cat-drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .has-js .cat-filters.is-open { animation: none; } }
.cat-filters-backdrop { display: none; }

.fgroup { border: 0; margin: 0; padding: 0; min-width: 0; width: 100%; }
.fgroup-title { float: left; width: 100%; padding: 0 0 12px; margin: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.fgroup-title + * { clear: both; }

.fopts { display: grid; gap: 1px; }
.fopt {
  position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 11px;
  min-height: 34px; font-size: var(--fs-sm); color: var(--text); cursor: pointer;
}
.fopt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.fopt-box {
  width: 18px; height: 18px; border-radius: var(--r-sm); border: 1.5px solid var(--pizarra-400); background: var(--hueso);
  display: grid; place-items: center; transition: background-color .12s, border-color .12s;
}
.fopt-box::after {
  content: ""; width: 5px; height: 9px; margin-top: -2px; border: solid var(--laton-300); border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0); transition: transform .12s var(--ease);
}
.fopt:hover .fopt-box { border-color: var(--encina-800); }
.fopt input:checked + .fopt-box { background: var(--encina-800); border-color: var(--encina-800); }
.fopt input:checked + .fopt-box::after { transform: rotate(45deg) scale(1); }
.fopt input:focus-visible + .fopt-box { outline: 2px solid var(--focus); outline-offset: 2px; }
.fopt-label { min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.fopt-n { font-size: var(--fs-xs); color: var(--text-soft); font-variant-numeric: tabular-nums; }
.fopt:has(input:checked) .fopt-label { font-weight: 600; }

/* Opciones cortas (calibres, tallas): botones en rejilla. */
.fopts-tiles { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.fopts-tiles .fopt {
  grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 0; min-height: 44px; padding: 4px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--hueso); text-align: center;
}
.fopts-tiles .fopt-box { position: absolute; opacity: 0; }
.fopts-tiles .fopt-label { font-size: var(--fs-xs); font-weight: 600; line-height: 1.15; }
.fopts-tiles .fopt-n { font-size: 0.6875rem; line-height: 1.1; }
.fopts-tiles .fopt:hover { border-color: var(--encina-800); }
.fopts-tiles .fopt:has(input:checked) { background: var(--encina-800); border-color: var(--encina-800); color: var(--hueso); }
.fopts-tiles .fopt:has(input:checked) .fopt-n { color: var(--monte-300); }
.fopts-tiles .fopt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.fopts-tiles .fsearch-empty, .fopts-tiles .fmore-btn { grid-column: 1 / -1; }

/* Grupos largos: buscador interno y «Ver más» (los añade catalogo.js). */
.fsearch { margin-bottom: 8px; }
.fsearch-input {
  width: 100%; height: 36px; padding: 0 10px; font: inherit; font-size: var(--fs-sm);
  background: var(--hueso); border: 1px solid var(--border); border-radius: var(--r-sm);
}
.fsearch-input:focus { outline: none; border-color: var(--laton-500); box-shadow: 0 0 0 3px var(--laton-100); }
.fsearch-empty { font-size: var(--fs-xs); color: var(--text-muted); padding: 6px 0; }
.fopt.is-extra { display: none; }
.fopts.is-expanded .fopt.is-extra, .fopts.is-searching .fopt.is-extra { display: grid; }
.fopts .fopt.is-nomatch { display: none; }
.fmore-btn {
  justify-self: start; margin-top: 6px; padding: 4px 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: var(--fs-xs); font-weight: 600; color: var(--accent-strong);
  text-decoration: underline; text-decoration-color: var(--laton-300); text-underline-offset: 3px;
}
.fmore-btn:hover { text-decoration-color: currentColor; }
.fopts.is-searching .fmore-btn { display: none; }

/* Precio: deslizador doble + campos. */
.frange { position: relative; height: 22px; margin: 6px 9px 14px; }
.frange-track { position: absolute; left: 0; right: 0; top: 50%; height: 3px; margin-top: -1.5px; border-radius: 2px; background: var(--linea); }
.frange-fill { position: absolute; top: 0; bottom: 0; background: var(--encina-800); border-radius: 2px; }
.frange input[type=range] {
  position: absolute; left: -9px; right: -9px; top: 0; width: calc(100% + 18px); height: 22px; margin: 0;
  background: none; pointer-events: none; -webkit-appearance: none; appearance: none;
}
.frange input[type=range]::-webkit-slider-runnable-track { background: none; height: 22px; }
.frange input[type=range]::-moz-range-track { background: none; }
.frange input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; cursor: grab; width: 18px; height: 18px; margin-top: 2px;
  border-radius: 50%; background: var(--hueso); border: 2px solid var(--encina-800); box-shadow: var(--shadow-1);
}
.frange input[type=range]::-moz-range-thumb {
  pointer-events: auto; cursor: grab; width: 14px; height: 14px;
  border-radius: 50%; background: var(--hueso); border: 2px solid var(--encina-800);
}
.frange input[type=range]:focus-visible { outline: none; }
.frange input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--laton-300); }
.fprice-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fprice-field { display: grid; gap: 4px; min-width: 0; }
.fprice-cap { font-size: var(--fs-xs); color: var(--text-muted); }
.fprice-input { position: relative; display: block; }
.fprice-input .input { min-height: 38px; padding: 6px 24px 6px 10px; font-size: var(--fs-sm); background: var(--hueso); font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.fprice-input .input::-webkit-inner-spin-button, .fprice-input .input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.fprice-input > span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--text-soft); font-size: var(--fs-sm); pointer-events: none; }

/* Paginación ------------------------------------------------------------------------- */
.pager { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: clamp(36px, 5vw, 56px); flex-wrap: wrap; }
.pager ol { list-style: none; display: flex; gap: 2px; }
.pager-num, .pager-step, .pager-gap {
  display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 10px;
  border-radius: var(--r-pill); text-decoration: none; font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums;
}
.pager-num:hover, .pager-step:hover { background: var(--surface); }
.pager-num.is-current { background: var(--encina-800); color: var(--hueso); }
.pager-step { padding-inline: 16px; }
.pager-step.is-disabled { color: #59645c; }
.pager-step.is-disabled:hover { background: none; }
.pager-gap { min-width: 20px; padding: 0; color: var(--text-soft); }

/* Texto para buscadores, al pie y discreto -------------------------------------------------- */
.cat-about {
  display: grid; gap: 10px; max-width: 70ch;
  margin-top: clamp(96px, 10vw, 160px);
}
.cat-about-title { font-family: var(--font-display); font-weight: var(--fw-display); font-variation-settings: "wdth" var(--wdth-display); letter-spacing: var(--ls-display); font-size: var(--fs-lg); line-height: 1.2; }
.cat-about-text { font-size: 17px; line-height: 1.6; color: var(--text); }
.cat-about-text p + p { margin-top: .8em; }

/* Sugerencias de búsqueda ---------------------------------------------------------------- */
.suggest { display: grid; gap: clamp(28px, 4vw, 44px); padding-top: 4px; }
.suggest-intro { display: grid; gap: 6px; padding: 20px 22px; background: var(--surface); border-radius: var(--r-md); max-width: 760px; }
.suggest-title { font-family: var(--font-display); font-weight: var(--fw-display); font-variation-settings: "wdth" var(--wdth-display); letter-spacing: var(--ls-display); font-size: var(--fs-xl); margin-bottom: 14px; }
.suggest-terms { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.suggest-terms .chip { min-height: 38px; padding-inline: 14px; font-size: var(--fs-sm); }
.suggest-cats { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 28px; }
.suggest-cats a { display: block; padding: 11px 0; border-bottom: 1px solid var(--border); text-decoration: none; font-weight: 600; }
.suggest-cats a:hover { color: var(--accent-strong); }
.suggest .product-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }

/* Ficha de producto ------------------------------------------------------------------------
   Bloque de compra en la primera pantalla: galería a la izquierda; a la derecha marca, nombre, insignias de
   estado (color con significado), etiquetas enlazadas y la caja de compra. Debajo, pestañas. */
.ficha { padding-top: clamp(12px, 1.6vw, 20px); }
.ficha > .cat-back { margin-bottom: 2px; }
.ficha-top {
  display: grid; grid-template-columns: minmax(0, .95fr) minmax(380px, 1fr);
  gap: clamp(24px, 3.6vw, 56px); margin-top: 10px; align-items: start;
}
.gal { display: grid; gap: 10px; position: sticky; top: calc(var(--header-h) + 16px); min-width: 0; }
/* La foto va «montada» en un marco claro con sombra suave: da profundidad sin recargar. */
.gal-main {
  position: relative; margin: 0; aspect-ratio: 3 / 2; padding: 10px;
  background: var(--surface); border-radius: calc(var(--r-lg) + 4px); overflow: hidden;
  box-shadow: 0 1px 2px rgba(20, 29, 23, .06), 0 18px 40px -22px rgba(20, 29, 23, .45);
}
.gal-main img {
  width: 100%; height: 100%; object-fit: cover; border-radius: var(--r-md);
  box-shadow: inset 0 0 0 1px rgba(20, 29, 23, .06);
}
.gal-main::after {
  content: ""; position: absolute; inset: 10px; border-radius: var(--r-md); pointer-events: none;
  background: radial-gradient(120% 90% at 50% 40%, transparent 60%, rgba(20, 29, 23, .18));
}
.gal-noimg {
  display: grid; place-items: center; align-content: center; gap: 10px; height: 100%; font-size: var(--fs-sm);
  background: radial-gradient(120% 90% at 50% 40%, var(--piedra-100) 0%, var(--monte-100) 100%); color: var(--monte-500);
}
.gal-thumbs { list-style: none; display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-width: thin; }
.gal-thumb {
  display: block; width: 68px; height: 68px; flex: none; border-radius: var(--r-md); overflow: hidden;
  background: var(--surface); border: 2px solid transparent; opacity: .7; transition: opacity .15s, border-color .15s;
}
.gal-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gal-thumb:hover { opacity: 1; }
.gal-thumb[aria-current="true"] { border-color: var(--laton-500); opacity: 1; }

.buy { display: grid; gap: 12px; align-content: start; min-width: 0; max-width: 580px; }
.buy-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 30px; }
.buy-brand {
  display: inline-flex; align-items: center; font-size: var(--fs-sm); font-weight: 700; color: var(--accent-strong);
  text-decoration: none; border-radius: var(--r-sm);
}
/* Logo de la marca con peso parecido sea alargado o compacto: los alargados topan con el ancho,
   los compactos (Swarovski, Riserva…) con el alto. */
.buy-brand img { width: auto; height: auto; max-width: 180px; max-height: 68px; object-fit: contain; object-position: left center; }
.buy-brand img[src$=".svg"] { height: 44px; }
.buy-brand:hover { text-decoration: underline; }
.buy-brand:has(img):hover { text-decoration: none; opacity: .75; }
.buy-ref { margin: -4px 0 0; font-size: 0.6875rem; color: var(--text-soft); }
.buy-name {
  font-family: var(--font-display); font-weight: var(--fw-display); font-variation-settings: "wdth" var(--wdth-display); letter-spacing: var(--ls-display); font-size: clamp(1.75rem, 2.5vw, 2.375rem);
  line-height: 1.1; overflow-wrap: anywhere; margin: 0;
}

/* Insignias: fondo suave y texto oscuro del mismo tono. El punto marca las de existencias. */
.fbadges, .ftags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.fbadge {
  display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 3px 10px;
  border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; line-height: 1.2;
  background: var(--surface-2); color: var(--text);
}
.fbadge-ok, .fbadge-last, .fbadge-out { padding-left: 9px; }
.fbadge-ok::before, .fbadge-last::before, .fbadge-out::before {
  content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}
.fbadge-ok { background: var(--ok-bg); color: var(--ok); }
.fbadge-last { background: var(--sale-bg); color: var(--sale-strong); }
.fbadge-out { background: var(--danger-bg); color: var(--danger); }
.fbadge-sale { background: var(--sale-bg); color: var(--sale-strong); font-weight: 700; font-variant-numeric: tabular-nums; }
.fbadge-license { background: var(--laton-100); color: var(--encina-800); box-shadow: inset 0 0 0 1px var(--laton-300); }
.fbadge-info { background: var(--info-bg); color: var(--info); }
.fbadge-adult { background: var(--warn-bg); color: var(--warn); font-weight: 700; }
.fbadge-new { background: var(--monte-100); color: var(--monte-600); }

/* Etiquetas del producto: enlaces al catálogo filtrado, con un tinte por grupo. */
.ftag {
  display: inline-flex; align-items: center; min-height: 28px; padding: 3px 10px; border-radius: var(--r-sm);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.2; text-decoration: none;
  background: var(--surface); color: var(--text-muted); border: 1px solid var(--border);
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
}
.ftag:hover { border-color: var(--encina-800); color: var(--text); }
.ftag-laton { color: var(--laton-700); border-color: var(--laton-300); }
.ftag-laton:hover { background: var(--laton-100); border-color: var(--laton-500); color: var(--laton-700); }
.ftag-monte { color: var(--monte-600); border-color: var(--monte-300); }
.ftag-monte:hover { background: var(--monte-100); border-color: var(--monte-500); color: var(--monte-600); }

.buy-summary { color: var(--text-muted); font-size: var(--fs-sm); max-width: 60ch; }

/* Caja de compra: precio, datos clave, cantidad y botón, y una línea de servicio. */
.buy-box {
  display: grid; gap: 14px; margin-top: 4px; padding: 18px 20px 16px;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-lg);
}
.buy-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.buy-price .price { font-size: clamp(1.75rem, 2.2vw, 2.125rem); line-height: 1.1; }
.buy-price .price-old { font-size: var(--fs-md); }
.buy-vat { font-size: var(--fs-xs); color: var(--text-soft); }
.buy-keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 6px; margin: 0; }
.buy-keys > div { min-width: 0; padding: 8px 10px; background: var(--surface-2); border-radius: var(--r-sm); }
.buy-keys dt { font-size: 0.6875rem; color: var(--text-muted); line-height: 1.3; }
.buy-keys dd { margin: 2px 0 0; font-size: var(--fs-sm); font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.buy-form { display: flex; gap: 10px; flex-wrap: wrap; }
.buy-submit { flex: 1 1 220px; }
.qty { display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); height: 52px; }
.qty-btn { width: 44px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--text); }
.qty-btn:hover { background: var(--surface-2); }
.qty-btn:disabled { color: var(--text-soft); cursor: default; background: transparent; }
.qty-input {
  width: 48px; border: 0; background: transparent; text-align: center; font-weight: 700;
  font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.qty-input::-webkit-inner-spin-button, .qty-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.qty-input:focus { outline: none; }
.qty:focus-within { border-color: var(--laton-500); box-shadow: 0 0 0 3px var(--laton-100); }
.buy-perks {
  list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 0;
  font-size: var(--fs-xs); color: var(--text-muted);
}
.buy-perks li { display: inline-flex; gap: 6px; align-items: center; }
.buy-perks svg { flex: none; color: var(--monte-500); }
.buy-perks a { color: var(--text); font-weight: 600; text-decoration: none; }
.buy-perks a:hover { text-decoration: underline; }

/* Avisos legales: breves y sin alarma. */
.buy-note { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--r-md); font-size: var(--fs-sm); line-height: 1.45; }
.buy-note svg { flex: none; margin-top: 1px; }
.buy-note-license { background: var(--encina-800); color: var(--piedra-100); }
.buy-note-license svg { color: var(--laton-300); }
.buy-note-license a { color: var(--laton-300); font-weight: 600; white-space: nowrap; }
.buy-note-adult { background: var(--warn-bg); color: var(--warn); }

/* Agotado: el formulario «Avísame» ocupa el sitio del botón de compra. */
.buy-order { display: grid; gap: 10px; }
.buy-order .stock-req { gap: 12px; padding: 0; background: none; border: 0; }
.buy-order .stock-req-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.buy-order .stock-req .input { height: 46px; }
.buy-order .stock-req .btn { height: 50px; font-size: var(--fs-base); }
.buy-order .stock-req-done { font-size: var(--fs-base); }
.buy-order-note { font-size: var(--fs-xs); color: var(--text-muted); }
.buy-order-note a { color: var(--text); font-weight: 600; }

/* Descripción y ficha técnica: pestañas (sin JS, una debajo de otra con su título). */
.ftabs { margin-top: clamp(32px, 4vw, 52px); }
.ftab-list { display: flex; gap: 28px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.ftab-list[hidden] { display: none; }
.ftab {
  position: relative; flex: none; height: 46px; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--text-muted);
}
.ftab::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: transparent; }
.ftab:hover { color: var(--text); }
.ftab[aria-selected="true"] { color: var(--text); }
.ftab[aria-selected="true"]::after { background: var(--laton-500); }
.ftab:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
.ftab-panel { max-width: 760px; }
.ftab-panel + .ftab-panel { margin-top: 32px; }
.ftabs.is-tabbed .ftab-panel + .ftab-panel { margin-top: 0; }
.ftab-h { font-family: var(--font-display); font-weight: var(--fw-display); font-variation-settings: "wdth" var(--wdth-display); letter-spacing: var(--ls-display); font-size: var(--fs-xl); margin: 0 0 12px; }
.ftabs.is-tabbed .ftab-h { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ftab-panel.prose { max-width: 68ch; }
.specs { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); background: var(--surface); border-radius: var(--r-md); overflow: hidden; }
.specs th, .specs td { text-align: left; padding: 10px 16px; vertical-align: top; border-bottom: 1px solid var(--border-soft); }
.specs tr:last-child th, .specs tr:last-child td { border-bottom: 0; }
.specs th { width: 40%; font-weight: 500; color: var(--text-muted); }
.specs td { font-weight: 600; overflow-wrap: anywhere; }
.specs a { color: inherit; }

.ficha-related { margin-top: clamp(44px, 5vw, 72px); }
.ficha-related .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Tarjeta: el precio tachado baja de línea en vez de cortarse. */
.page-catalogo .pcard-price, .page-ficha .pcard-price { flex-wrap: wrap; row-gap: 0; }

/* Responsive ------------------------------------------------------------------------------------ */
@media (max-width: 1100px) {
  .ficha-related .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ficha-related .pcard:nth-child(4) { display: none; }
}
@media (max-width: 960px) {
  .ficha-top { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .buy { max-width: none; }
  .gal { position: static; }
}
@media (max-width: 720px) {
  /* Con JS: hoja a pantalla completa que sube desde abajo; cabecera y botón fijos. */
  .has-js .cat-filters, .has-js .cat-filters:not(.is-open) {
    display: block; position: fixed; z-index: 85; inset: 0; margin: 0; overflow-y: auto; overscroll-behavior: contain;
    background: var(--bg); transform: translateY(100%); visibility: hidden;
    transition: transform .28s var(--ease), visibility 0s linear .28s;
  }
  .has-js .cat-filters.is-open { animation: none; transform: none; visibility: visible; transition: transform .28s var(--ease); }
  .has-js .filters { min-height: 100%; grid-template-rows: auto 1fr auto; border: 0; border-radius: 0; background: var(--bg); }
  .has-js .filters-head {
    display: flex; align-items: center; position: sticky; top: 0; z-index: 2; min-height: 60px; padding: 8px 8px 8px 20px;
    background: var(--bg); border-bottom: 1px solid var(--border);
  }
  .has-js .filters-body { columns: auto; padding: 0 20px 24px; }
  .has-js .filters-body > .fgroup { margin: 0; padding: 20px 0; border-bottom: 1px solid var(--border-soft); }
  .has-js .fgroup:last-child { border-bottom: 0; }
  .has-js .filters-foot {
    position: sticky; bottom: 0; padding: 12px 20px calc(14px + env(safe-area-inset-bottom));
    background: var(--bg); border-top: 1px solid var(--border); justify-content: space-between; flex-wrap: nowrap;
  }
  .has-js .filters-submit { flex: 1; min-width: 0; }
  @media (prefers-reduced-motion: reduce) { .has-js .cat-filters, .has-js .cat-filters.is-open { transition: none; } }
  .ficha-related .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ficha-related .pcard:nth-child(4) { display: flex; }
}
@media (max-width: 560px) {
  .cat-head { gap: 12px; padding-block: 14px 16px; }
  .cat-strip { margin-inline: calc(var(--gutter) * -1); }
  .cat-strip-list { flex-wrap: nowrap; overflow-x: auto; padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); scroll-snap-type: x proximity; scrollbar-width: none; }
  .cat-strip-list::-webkit-scrollbar { display: none; }
  .cat-strip-list > li { flex: none; scroll-snap-align: start; }
  .cat-pill { height: 38px; padding-right: 12px; gap: 8px; }
  .cat-pill-img { width: 30px; height: 30px; }
  .cat-search { flex-basis: 100%; }
  .cat-search .btn { padding-inline: 14px; }
  .cat-toolbar { gap: 8px; min-height: 56px; }
  .cat-filter-btn { padding: 0 14px 0 11px; }
  .cat-sort-select { padding-right: 22px; }
  .cat-sort label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .pcard-body { padding: 12px 12px 14px; }
  .pager-step { padding-inline: 10px; }
  .pager-num { min-width: 36px; padding: 0 6px; }
  .buy-form .qty { flex: none; }
  .buy-submit { flex: 1 1 0; padding-inline: 12px; }
  .gal-thumb { width: 56px; height: 56px; }
  .gal-main { border-radius: var(--r-md); }
  .buy-box { padding: 14px; gap: 12px; }
  .buy-keys { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ftab-list { gap: 22px; margin-bottom: 16px; }
  .specs th, .specs td { padding: 10px 12px; }
}

/* Ficha en dos columnas: la foto mide lo mismo que el bloque de compra (arriba y abajo a ras). */
@media (min-width: 961px) {
  .ficha-top { align-items: stretch; }
  .gal { position: static; display: flex; flex-direction: column; }
  .gal-main { flex: 1 1 auto; aspect-ratio: auto; min-height: 340px; }
  .gal-main img { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); }
  .gal-main .gal-noimg { height: 100%; }
}

/* Móvil: la ficha se lee centrada (título, insignias, precio y datos clave). */
@media (max-width: 720px) {
  .buy { justify-items: center; text-align: center; }
  .buy-top, .fbadges, .ftags, .buy-price, .buy-perks { justify-content: center; }
  .buy-summary { margin-inline: auto; }
  .buy-box { justify-self: stretch; }
  .buy-keys > div { text-align: center; }
  .buy-note { text-align: left; justify-self: stretch; }
}

/* Móvil: cabecera de listado centrada y secciones en chips que bajan de línea (nada de deslizar en horizontal). */
@media (max-width: 560px) {
  .cat-head { justify-items: center; text-align: center; }
  .cat-back { justify-self: center; }
  .cat-titlerow { justify-content: center; }
  .cat-strip { margin-inline: 0; width: 100%; }
  .cat-strip-list {
    flex-wrap: wrap; justify-content: center; overflow: visible; padding-inline: 0;
    scroll-snap-type: none; gap: 6px;
  }
  .cat-strip-list > li { flex: 0 1 auto; }
  .cat-pill { height: 36px; padding: 2px 12px 2px 2px; gap: 7px; font-size: var(--fs-xs); border-color: var(--monte-500); }
  .cat-pill-img { width: 30px; height: 30px; }
}

/* Variantes en la ficha (calibre, talla…) */
.fvariants { margin: 0 0 16px; }
.fvariants-t { margin: 0 0 8px; font-size: var(--fs-sm); color: var(--text-muted); }
.fvariants-t strong { color: var(--text); }
.fvariants-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.fvariant { display: inline-block; min-width: 56px; text-align: center; padding: 8px 14px; border: 1.5px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: var(--fs-sm); background: var(--surface, #fff); }
.fvariant:hover { border-color: var(--laton-500); }
.fvariant.is-current { border-color: var(--encina-800); background: var(--encina-800); color: #fff; }
.fvariant.is-out { color: var(--text-muted); text-decoration: line-through; }
.fvariant.is-current.is-out { color: #fff; }

/* Ficha: artículos del blog que hablan del producto */
.ficha-blog-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.ficha-blog-list a { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--s-3); align-items: center; color: inherit; text-decoration: none; font-weight: 600; line-height: 1.3; }
.ficha-blog-list img { width: 120px; aspect-ratio: 3 / 2; height: auto; object-fit: cover; border-radius: var(--r-sm); }
.ficha-blog-list a:hover span { color: var(--accent-text); text-decoration: underline; }
@media (max-width: 900px) { .ficha-blog-list { grid-template-columns: minmax(0, 1fr); } }

/* Al entrar en la tienda: las tarjetas suben escalonadas, una detrás de otra */
@media (prefers-reduced-motion: no-preference) {
  .cat-results .product-grid > .pcard { animation: pcard-in .75s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(.12s + var(--n, 0) * 70ms); }
  .cat-results .product-grid > .pcard:nth-child(2) { --n: 1; } .cat-results .product-grid > .pcard:nth-child(3) { --n: 2; }
  .cat-results .product-grid > .pcard:nth-child(4) { --n: 3; } .cat-results .product-grid > .pcard:nth-child(5) { --n: 4; }
  .cat-results .product-grid > .pcard:nth-child(6) { --n: 5; } .cat-results .product-grid > .pcard:nth-child(7) { --n: 6; }
  .cat-results .product-grid > .pcard:nth-child(8) { --n: 7; } .cat-results .product-grid > .pcard:nth-child(9) { --n: 8; }
  .cat-results .product-grid > .pcard:nth-child(10) { --n: 9; } .cat-results .product-grid > .pcard:nth-child(n+11) { --n: 10; }
  .cat-toolbar { animation: shop-bar .5s cubic-bezier(.2, .7, .2, 1) .1s both; }
}
@keyframes pcard-in { from { opacity: 0; transform: translateY(44px) scale(.96); } }

/* Escritorio: filtros siempre a la izquierda y la rejilla a la derecha (como en cualquier tienda) ----- */
@media (min-width: 1100px) {
  .cat-results { display: grid; grid-template-columns: 270px minmax(0, 1fr); column-gap: 32px; align-items: start; }
  .cat-results > * { grid-column: 2; }
  .cat-results > .cat-filters { grid-column: 1; grid-row: 1 / span 20; margin-top: 0; position: sticky; top: calc(var(--header-h) + 16px);
    max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto; overscroll-behavior: contain; }
  .cat-results.has-js > .cat-filters:not(.is-open) { display: block; }
  .cat-filter-btn { display: none !important; }
  .cat-results .filters { background: #ffffff; border: 0; border-radius: 8px; }
  .cat-results .filters-body { columns: 1; padding: 22px 22px 4px; }
  .cat-results .filters-body > .fgroup { margin-bottom: 22px; }
  .cat-results .filters-foot { border-top: 0; padding: 0 22px 22px; justify-content: stretch; }
  .cat-results .filters-submit { min-width: 0; width: 100%; }
  .cat-toolbar { padding-top: 0; }
  .cat-grid { margin-top: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
}
@media (min-width: 1500px) { .cat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* La tienda usa todo el ancho de la cabecera; en «Tienda» no hay título ni píldoras (ya están arriba) */
.page-catalogo .cat-wrap { max-width: var(--shell); }
@media (min-width: 1100px) {
  .cat-results { grid-template-columns: 248px minmax(0, 1fr); column-gap: 28px; }
  .cat-results .filters-body { padding: 18px 18px 2px; }
  .cat-results .filters-body > .fgroup { margin-bottom: 16px; }
  .cat-results .fgroup-title { font-size: 14px; padding-bottom: 8px; }
  .cat-results .fopt { min-height: 30px; font-size: 14px; }
  .cat-results .filters-foot { padding: 0 18px 18px; }
  .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
}
@media (min-width: 1360px) { .cat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Barra de la tienda: título, apartados y vuelta atrás en una sola línea fina ------------------------- */
.cat-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; padding-block: 18px 4px; }
.cat-head .cat-back { order: -1; }
.cat-titlerow { flex: none; gap: 8px 12px; }
.cat-title { font-size: clamp(24px, 2.1vw, 30px); letter-spacing: -0.02em; }
.cat-brand-logo { height: 34px; padding: 4px 8px; }
.cat-strip { flex: 1 1 0; min-width: 0; }
.cat-strip-list { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-block: 2px; }
.cat-strip-list::-webkit-scrollbar { display: none; }
.cat-pill { height: 36px; padding: 0 14px; gap: 8px; background: #ffffff; font-size: 14px; }
.cat-pill:hover { background: #ffffff; box-shadow: inset 0 0 0 2px var(--laton-500); }
.cat-pill-img { display: none; }
.cat-pill-n { font-size: 12.5px; }
.cat-pill.is-current { background: var(--encina-800); color: #fff; box-shadow: none; }
.cat-corrected, .cat-search { flex-basis: 100%; }
@media (max-width: 720px) {
  .cat-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .cat-strip { flex: none; margin-inline: calc(var(--gutter) * -1); }
}

/* Al entrar en la tienda: los filtros llegan desde la izquierda y la barra baja un poco */
@media (prefers-reduced-motion: no-preference) {
  @media (min-width: 1100px) { .cat-results > .cat-filters { animation: shop-filters .55s cubic-bezier(.2, .7, .2, 1) .08s both; } }
}
@keyframes shop-bar { from { opacity: 0; transform: translateY(-10px); } }
@keyframes shop-filters { from { opacity: 0; transform: translateX(-48px); } }

/* Pantallas grandes: cinco productos por fila; la barra de apartados, fina y sin hueco si no hay nada */
@media (min-width: 1700px) { .cat-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.cat-head:not(:has(*:not(.cat-titlerow))) .cat-titlerow:empty { display: none; }
.cat-head { padding-block: 14px 0; min-height: 0; }
.page-catalog .cat-head { padding-block: 6px 0; }


/* Filtros que se aplican al momento (escritorio ancho, con JS): sin botón, carga suave y sin repetir la
   entrada de la barra lateral; solo las tarjetas nuevas suben, más rápido. */
@media (min-width: 1100px) {
  .cat-results.has-js .filters-foot { display: none; }
  .cat-results.has-js .filters-body { padding-bottom: 8px; }
}
.cat-results.is-loading .product-grid, .cat-results.is-loading .cat-count { opacity: .45; transition: opacity .15s; }
.cat-results.is-loading { cursor: progress; }
.cat-results.is-swapped > .cat-filters, .cat-results.is-swapped .cat-toolbar { animation: none; }
.cat-results.is-swapped .product-grid > .pcard { animation-duration: .45s; animation-delay: calc(var(--n, 0) * 35ms); }

/* Apartados de la sección en la barra lateral (escritorio), encima de los filtros; en pantallas
   estrechas siguen como tira deslizable arriba. */
.cat-side { display: none; }
@media (min-width: 1100px) {
  .cat-strip { display: none; }
  .cat-head:not(:has(.cat-search, .cat-corrected, .cat-brand-logo, .cat-origin)) { display: none; }
  .page-catalogo .cat-results { padding-top: 22px; }
  .cat-side { display: block; margin-bottom: 14px; padding: 16px 12px 12px; background: #ffffff; border-radius: 8px; }
  .cat-side-title { margin: 0 6px 8px; font-size: 14px; font-weight: 700; color: var(--text); }
  .cat-side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
  .cat-side-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; padding: 0 10px;
    border-radius: 6px; color: var(--text); text-decoration: none; font-size: 14.5px; font-weight: 600; }
  .cat-side-link:hover { background: var(--surface-2); }
  .cat-side-link.is-current { background: var(--encina-800); color: #fff; }
  .cat-side-n { font-size: 12.5px; font-weight: 500; color: var(--text-soft); }
  .cat-side-link.is-current .cat-side-n { color: rgba(255, 255, 255, .7); }
}

