/* PromoPrint · página de catálogo. Reutiliza tokens, base y menú de hero.css. */

.page-catalogo {
  --edge: clamp(20px, 6vw, 96px);
  --nav-edge: max(var(--edge), calc((100vw - 1360px) / 2));
  --wrap: min(100% - 2 * var(--edge), 1360px);
  --card: #131315;
  --line: rgb(var(--paper-rgb) / 0.08);
  --muted: rgb(var(--paper-rgb) / 0.62);
  --ease-reveal: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Encabezado del catálogo ─────────────────────────────── */

.chero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: var(--nav-h) 1fr;
  min-height: clamp(540px, 46vw, 700px);
  overflow: hidden;
  /* El halo termina en el negro exacto de la página: sin borde al bajar. */
  background:
    radial-gradient(60% 75% at 72% 42%, #19191b 0%, rgba(11, 11, 12, 0) 100%),
    var(--ink);
}
.chero::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 140px;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(11, 11, 12, 0) 0%, rgba(11, 11, 12, 0.6) 55%, var(--ink) 100%);
}

.chero__media {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(64%, 980px);
  z-index: -1;
  /* La foto se funde con el fondo a la izquierda y abajo: no hay borde de imagen. */
  -webkit-mask-image:
    linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.35) 14%, rgba(0, 0, 0, 0.8) 28%, #000 40%),
    linear-gradient(0deg, transparent 0%, rgba(0, 0, 0, 0.6) 16%, #000 32%);
  -webkit-mask-composite: source-in;
          mask-image:
    linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.35) 14%, rgba(0, 0, 0, 0.8) 28%, #000 40%),
    linear-gradient(0deg, transparent 0%, rgba(0, 0, 0, 0.6) 16%, #000 32%);
          mask-composite: intersect;
}
.chero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 45% 40%;
}

.chero__content {
  grid-row: 2;
  align-self: center;
  width: min(620px, 100% - 2 * var(--edge));
  margin-inline-start: var(--nav-edge);
  padding-block: 12px clamp(48px, 7vw, 96px);
}

.chero__eyebrow {
  margin: 0 0 18px;
  font: 600 13px/1.2 var(--font);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgb(var(--paper-rgb) / 0.66);
}
.chero__title {
  margin: 0;
  font-weight: 700;
  font-size: clamp(2.6rem, 1.2rem + 3.6vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--paper);
}
.chero__title span, .chero__title em { display: block; }
.chero__title em { font-style: normal; color: var(--brand); }
.chero__lead {
  margin: 18px 0 0;
  font: 400 clamp(1rem, 0.9rem + 0.35vw, 1.25rem)/1.5 var(--font);
  color: rgb(var(--paper-rgb) / 0.78);
}
.chero__cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  margin-top: 32px;
  padding: 0 24px 0 28px;
  border-radius: 999px;
  background: var(--paper);
  color: #111;
  font: 700 16px/1 var(--font);
  text-decoration: none;
  transition: background-color var(--t-ui) var(--ease-ui), transform 120ms var(--ease-ui);
}
.chero__cta svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.chero__cta:hover { background-color: var(--brand); }
.chero__cta:active { transform: scale(0.98); }

/* ── Cuerpo ──────────────────────────────────────────────── */

.cpage { padding-bottom: clamp(72px, 9vw, 128px); }
.cats, .prods { width: var(--wrap); margin-inline: auto; }
.cats { padding-top: clamp(24px, 3vw, 40px); }
.prods { padding-top: clamp(48px, 5vw, 72px); scroll-margin-top: 24px; }

.cpage__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: clamp(18px, 2vw, 26px);
}
.cpage__title {
  margin: 0;
  font: 700 clamp(1.6rem, 1.1rem + 1.4vw, 2.4rem)/1.1 var(--font);
  letter-spacing: -0.025em;
  color: var(--paper);
}
.cpage__link {
  flex: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font: 600 16px/1 var(--font);
  cursor: pointer;
}
.cpage__link svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 300ms var(--ease-reveal); }
.cpage__link:hover svg { transform: translateX(3px); }

/* Categorías: una fila de ocho; en pantallas menores, fila deslizable con el dedo. */
.cats__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: clamp(10px, 1vw, 14px);
}
.tile {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
  color: var(--paper);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color 300ms var(--ease-ui);
}
.tile__media { display: block; overflow: hidden; aspect-ratio: 1 / 1; }
.tile__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--ease-reveal); }
.tile__name {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 8px 6px;
  font: 500 14px/1.25 var(--font);
}
.tile[aria-pressed="true"] { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.tile[aria-pressed="true"] .tile__name { color: var(--brand); }
.tile:focus-visible { outline-offset: 3px; border-radius: 10px; }

/* Herramientas: búsqueda y orden. */
.tools { display: flex; gap: 12px; }
.search, .sort {
  position: relative;
  display: flex;
  align-items: center;
  height: 46px;
  border: 1px solid rgb(var(--paper-rgb) / 0.16);
  border-radius: 8px;
  background: var(--card);
  transition: border-color var(--t-ui) var(--ease-ui);
}
.search { width: clamp(220px, 22vw, 300px); padding-left: 14px; }
.search svg, .sort svg { flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; color: var(--muted); }
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 14px 0 10px;
  border: 0;
  background: none;
  color: var(--paper);
  font: 400 15px/1 var(--font);
  outline: none;
}
.search input::placeholder { color: rgb(var(--paper-rgb) / 0.45); }
.search:focus-within, .sort:focus-within { border-color: var(--paper); }
.sort select {
  appearance: none;
  height: 100%;
  padding: 0 40px 0 16px;
  border: 0;
  background: none;
  color: var(--paper);
  font: 600 15px/1 var(--font);
  cursor: pointer;
  outline: none;
}
.sort select option { background: #17171a; color: var(--paper); }
.sort svg { position: absolute; right: 14px; pointer-events: none; }

.prods__status { margin: 0 0 14px; font: 400 14px/1.4 var(--font); color: var(--muted); min-height: 1.4em; }

.prods__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(14px, 1.4vw, 20px);
}
.product[hidden] { display: none; }

.product__card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
  color: var(--paper);
  text-decoration: none;
  transition: border-color 300ms var(--ease-ui);
}
.product__media { display: block; overflow: hidden; aspect-ratio: 1 / 1; background: #101011; }
.product__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 650ms var(--ease-reveal); }
.product__body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 18px; }
.product__name { font: 700 18px/1.25 var(--font); letter-spacing: -0.01em; }
.product__cat { margin-top: 4px; font: 400 14.5px/1.35 var(--font); color: var(--muted); }
.product__more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
  color: var(--brand);
  font: 700 15.5px/1 var(--font);
}
.product__more svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 400ms var(--ease-reveal); }
.product__card:focus-visible { outline-offset: 3px; border-radius: 10px; }

.prods__empty { padding: 48px 0; text-align: center; color: var(--muted); }
.prods__empty p { margin: 0 0 8px; font: 400 17px/1.5 var(--font); }

@media (hover: hover) and (pointer: fine) {
  .tile:hover { border-color: rgb(var(--paper-rgb) / 0.22); }
  .tile:hover .tile__media img { transform: scale(1.04); }
  .product__card:hover { border-color: rgb(var(--paper-rgb) / 0.2); }
  .product__card:hover .product__media img { transform: scale(1.03); }
  .product__card:hover .product__more svg { transform: translate(2px, -2px); }
}

/* Cambio de filtro: los resultados aparecen con un fundido breve. */
.prods__grid.is-updating .product:not([hidden]) { animation: prods-in 420ms var(--ease-reveal) both; }
@keyframes prods-in { from { opacity: 0; transform: translate3d(0, 8px, 0); } to { opacity: 1; transform: none; } }

/* ── Entradas (las activa catalogo.js; sin JS todo queda visible) ── */

.js-motion [data-intro],
.js-motion [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 16px, 0);
  transition: opacity 800ms var(--ease-reveal) var(--delay, 0ms), transform 800ms var(--ease-reveal) var(--delay, 0ms);
}
.js-motion .chero__media { opacity: 0; transform: scale(1.03); transition: opacity 1400ms var(--ease-reveal), transform 1800ms var(--ease-reveal); }
.js-motion .is-in, .js-motion .chero__media.is-in { opacity: 1; transform: none; }

/* ── Tablet y móvil ──────────────────────────────────────── */

@media (max-width: 1099px) {
  .prods__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cats__list {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 148px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 2px;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgb(var(--paper-rgb) / 0.2) transparent;
  }
  .cats__list > li { scroll-snap-align: start; }
}

@media (max-width: 760px) {
  .chero { min-height: auto; }
  /* En móvil la foto ocupa su propia franja arriba y el texto va debajo, nunca encima del producto. */
  .chero__media {
    inset: 0 0 auto 0;
    width: 100%;
    height: min(78vw, 360px);
    -webkit-mask-image: linear-gradient(0deg, transparent 0%, rgba(0, 0, 0, 0.7) 18%, #000 36%);
            mask-image: linear-gradient(0deg, transparent 0%, rgba(0, 0, 0, 0.7) 18%, #000 36%);
  }
  .chero__media img { object-position: 50% 45%; }
  .chero__content { padding-block: calc(min(78vw, 360px) - 84px) 48px; }
  .cpage__head--tools { flex-direction: column; align-items: stretch; }
  .tools { flex-direction: column; }
  .search { width: 100%; }
  .prods__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product__body { padding: 14px 14px 16px; }
  .product__name { font-size: 16px; }
}

@media (max-width: 479px) {
  .prods__grid { grid-template-columns: minmax(0, 1fr); }
  .cats__list { grid-auto-columns: 132px; }
}

@media (prefers-reduced-motion: reduce) {
  .js-motion [data-intro], .js-motion [data-reveal], .js-motion .chero__media { transform: none; transition-duration: 300ms; transition-delay: 0ms; }
  .prods__grid.is-updating .product:not([hidden]) { animation: none; }
  .tile__media img, .product__media img { transition: none; }
}
