/* ============================================================
   Nek Store — tienda.css
   Catálogo, carrito y detalle de producto.
   Se carga DESPUÉS de style.css y reutiliza sus tokens.
   No escribas hex literales aquí: todo sale de tokens.css.
   ============================================================ */

/* ---------- Barra de filtros: se pega bajo el nav ---------- */
.filtros {
  position: sticky;
  top: 0;
  z-index: calc(var(--z-nav) - 1);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  border-bottom: var(--hairline-light);
  padding-block: .9rem;
}
.filtros__fila {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  align-items: center;
}
.filtros__chips {
  display: flex;
  gap: .45rem;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1 1 100%;
  padding-bottom: .15rem;
}
.filtros__chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  border: var(--hairline-light);
  border-radius: var(--r-pill);
  padding: .5rem 1rem;
  font-size: var(--fs-small);
  font-weight: 500;
  letter-spacing: var(--tracking-norm);
  color: var(--t-mid-light);
  background: transparent;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}
.chip:hover { color: var(--t-hi-light); border-color: color-mix(in srgb, var(--t-hi-light) 30%, transparent); }
.chip.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* ---------- Buscador ---------- */
.buscar {
  position: relative;
  flex: 1 1 260px;
}
.buscar input {
  width: 100%;
  font: inherit;
  font-size: var(--fs-body);
  color: var(--t-hi-light);
  background: var(--paper-2);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  padding: .72rem 1rem .72rem 2.6rem;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.buscar input::placeholder { color: var(--t-lo-light); }
.buscar input:focus {
  background: var(--paper);
  border-color: var(--acc-2);
}
.buscar svg {
  position: absolute;
  left: .95rem;
  top: 50%;
  translate: 0 -50%;
  width: 17px;
  height: 17px;
  color: var(--t-lo-light);
  pointer-events: none;
}

.selector {
  font: inherit;
  font-size: var(--fs-small);
  color: var(--t-mid-light);
  background: var(--paper-2);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  padding: .72rem 1rem;
  cursor: pointer;
}
.selector:focus { border-color: var(--acc-2); }

.conteo {
  font-size: var(--fs-small);
  color: var(--t-lo-light);
  margin-left: auto;
  white-space: nowrap;
}

/* ---------- Grilla de producto ---------- */
.grid-prod {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: clamp(1rem, 2.4vw, 1.6rem);
}

.prod {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: var(--hairline-light);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out);
}
.prod:hover {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--acc-2) 45%, transparent);
  box-shadow: 0 26px 54px -30px color-mix(in srgb, var(--ink) 50%, transparent);
}
.prod.is-agotado { opacity: .55; }

.prod__media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--paper-2);
  border: 0;
  padding: 0;
  cursor: zoom-in;
}
.prod__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8%;
  transition: scale var(--dur-slow) var(--ease-out);
}
.prod:hover .prod__media img { scale: 1.045; }

.prod__flag {
  position: absolute;
  top: .7rem;
  left: .7rem;
  background: var(--acc-grad);
  color: var(--sobre-acento);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding: .3rem .6rem;
  border-radius: var(--r-pill);
}

.prod__body {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: 1.1rem 1.15rem 1.25rem;
  flex: 1;
}
.prod__marca {
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--acc-3);
}
.prod__nombre {
  font-size: 1.02rem;
  line-height: 1.32;
  letter-spacing: var(--tracking-norm);
  margin: 0;
}
.prod__resumen {
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--t-mid-light);
  margin: 0;
}
.prod__pie {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  margin-top: auto;
  padding-top: .9rem;
}
.prod__precio {
  font-family: var(--font-num);
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--t-hi-light);
}
.prod__agotado {
  font-size: var(--fs-small);
  color: var(--t-lo-light);
}

.btn--sm { padding: .55rem 1.05rem; font-size: var(--fs-small); }

.vacio {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--t-mid-light);
  padding-block: clamp(3rem, 10vh, 6rem);
}
.link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--acc-3);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ---------- Botón de carrito en el nav ---------- */
.nav__carrito {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--t-hi-dark);
  background: none;
  border: 0;
  cursor: pointer;
  padding: var(--e3);
}
.nav__carrito svg { width: 21px; height: 21px; }
.nav__carrito b {
  position: absolute;
  top: -2px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  background: var(--acc-grad);
  color: var(--sobre-acento);
  font-size: var(--fs-micro);
  font-weight: 800;
  border-radius: var(--r-pill);
  padding-inline: .25rem;
}

/* ---------- Panel del pedido ---------- */
.carrito {
  position: fixed;
  inset: 0;
  z-index: var(--z-menu);
  visibility: hidden;
  pointer-events: none;
}
.carrito.is-open { visibility: visible; pointer-events: auto; }

.carrito__velo {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--ink) 55%, transparent);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.carrito.is-open .carrito__velo { opacity: 1; }

.carrito__panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  translate: 100% 0;
  transition: translate var(--dur) var(--ease-out);
}
.carrito.is-open .carrito__panel { translate: 0 0; }

.carrito__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.3rem var(--gutter);
  border-bottom: var(--hairline-light);
}
.carrito__head h2 { font-size: var(--fs-h3); margin: 0; }
.carrito__x {
  border: 0;
  background: none;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--t-mid-light);
  cursor: pointer;
}

.carrito__items {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: .6rem var(--gutter);
}
.ci {
  display: grid;
  grid-template-columns: 56px 1fr auto auto;
  gap: .8rem;
  align-items: center;
  padding-block: .95rem;
  border-bottom: var(--hairline-light);
}
.ci__img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: var(--paper-2);
  border-radius: var(--r-sm);
  padding: 5px;
}
.ci__txt { display: flex; flex-direction: column; gap: .18rem; min-width: 0; }
.ci__txt b { font-size: var(--fs-small); font-weight: 600; line-height: 1.35; }
.ci__txt span { font-size: var(--fs-small); color: var(--t-mid-light); font-family: var(--font-num); }

.ci__cant {
  display: flex;
  align-items: center;
  gap: .1rem;
  border: var(--hairline-light);
  border-radius: var(--r-pill);
  padding: .15rem;
}
.ci__cant button {
  width: 28px;
  height: 28px;
  border: 0;
  background: none;
  border-radius: var(--r-pill);
  color: var(--t-mid-light);
  font-size: var(--fs-body);
  cursor: pointer;
  position: relative;
}
.ci__cant button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: var(--toque);
  height: var(--toque);
}

.ci__cant button:hover { background: var(--paper-2); color: var(--t-hi-light); }
.ci__cant span {
  min-width: 22px;
  text-align: center;
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
}
.ci__x {
  border: 0;
  background: none;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--t-lo-light);
  cursor: pointer;
}
.ci__x:hover { color: var(--alert); }

.carrito__pie {
  border-top: var(--hairline-light);
  padding: 1.2rem var(--gutter) calc(1.2rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: .85rem;
}
.carrito__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.carrito__total span:first-child { color: var(--t-mid-light); font-size: var(--fs-small); }
.carrito__total span:last-child {
  font-family: var(--font-num);
  font-size: var(--fs-h3);
  font-weight: 600;
}
.carrito__pie .btn { justify-content: center; width: 100%; }
.carrito__pie .btn.is-off { opacity: .4; pointer-events: none; }
.carrito__nota {
  font-size: var(--fs-micro);
  color: var(--t-lo-light);
  text-align: center;
  line-height: 1.5;
}

/* ---------- Detalle de producto ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-menu) + 10);
  display: grid;
  place-items: center;
  padding: var(--gutter);
  visibility: hidden;
  pointer-events: none;
}
.modal.is-open { visibility: visible; pointer-events: auto; }
.modal__velo {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--ink) 62%, transparent);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.modal.is-open .modal__velo { opacity: 1; }

.modal__caja {
  position: relative;
  width: min(880px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--paper);
  border-radius: var(--r-lg);
  opacity: 0;
  scale: .97;
  transition: opacity var(--dur) var(--ease-out), scale var(--dur) var(--ease-out);
}
.modal.is-open .modal__caja { opacity: 1; scale: 1; }

.modal__x {
  position: absolute;
  top: .8rem;
  right: 1rem;
  z-index: 2;
  border: 0;
  background: var(--paper);
  border-radius: var(--r-pill);
  width: 34px;
  height: 34px;
  font-size: var(--fs-h3);
  line-height: 1;
  color: var(--t-mid-light);
  cursor: pointer;
}
.modal__x::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: var(--toque);
  height: var(--toque);
}

.det {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.det__img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: var(--paper-2);
  padding: 9%;
}
.det__txt {
  padding: clamp(1.5rem, 3.5vw, 2.6rem);
  display: flex;
  flex-direction: column;
  gap: .7rem;
}
.det__txt h2 { font-size: var(--fs-h3); margin: .15rem 0 0; }
.det__txt .lead { font-size: var(--fs-body); color: var(--t-mid-light); }

.det__specs { width: 100%; border-collapse: collapse; margin-top: .4rem; }
.det__specs tr { border-bottom: var(--hairline-light); }
.det__specs th,
.det__specs td {
  text-align: left;
  padding: .6rem 0;
  font-size: var(--fs-small);
  vertical-align: top;
}
.det__specs th { color: var(--t-lo-light); font-weight: 500; width: 42%; }
.det__specs td { color: var(--t-hi-light); }

.det__pie {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 1.1rem;
}

@media (max-width: 720px) {
  .det { grid-template-columns: 1fr; }
  .det__img { aspect-ratio: 4 / 3; }
}

/* ---------- Aviso efímero ---------- */
.aviso {
  position: fixed;
  left: 50%;
  bottom: calc(1.4rem + env(safe-area-inset-bottom));
  translate: -50% 12px;
  z-index: calc(var(--z-menu) + 20);
  background: var(--ink);
  color: var(--t-hi-dark);
  font-size: var(--fs-small);
  padding: .8rem 1.3rem;
  border-radius: var(--r-pill);
  box-shadow: 0 20px 44px -20px color-mix(in srgb, var(--ink) 80%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), translate var(--dur) var(--ease-out);
}
.aviso.is-on { opacity: 1; translate: -50% 0; }

@media (prefers-reduced-motion: reduce) {
  .prod,
  .prod__media img,
  .carrito__panel,
  .modal__caja,
  .aviso { transition-duration: .01ms; }
  .prod:hover { transform: none; }
}

/* ---------- Ajustes de página del catálogo ---------- */
.cat-head { padding-block: clamp(4.5rem, 11vh, 7rem) clamp(2.5rem, 5vh, 3.5rem); }
.cat-head .sec__head { margin-bottom: 0; }

.nav__carrito--movil { display: none; }
@media (max-width: 900px) {
  .nav__carrito--movil { display: inline-flex; }
  .filtros__fila .conteo { display: none; }
  .buscar { flex: 1 1 100%; }
}
