/*
 * PIT64 2.1.57 — Experiencia de compra (pedido de Mat, 2026-11-09).
 * Se carga después de todas las hojas del tema. Solo presentación: no toca
 * precios, inventario, carrito ni apartados.
 *
 * 1. Portada: «Nuevos ingresos» sube debajo de la portada principal y
 *    «Comprá por marca» pasa a carrusel horizontal en el celular.
 * 2. Tarjetas de las categorías Pokémon más compactas.
 * 3. Barra fija de compra en la ficha (celular).
 * 6. Portada de categoría más legible en el celular.
 * (4 y 5 se resuelven en PHP y en pit64-ux.js.)
 */

/* ---------- 1. Portada ---------- */

/* «Nuevos ingresos» ahora va pegado a la portada principal. */
body.pit64-v2 .pit64-hero-pro + .new-section {
  padding-top: 44px;
}

@media (max-width: 700px) {
  /* Comprá por marca: carrusel horizontal en vez de 8 tarjetas apiladas. */
  body.pit64-v2 .brand-showcase .brand-grid {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 12px;
    margin-inline: -18px;
    padding: 4px 18px 14px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 18px;
    scrollbar-width: none;
  }
  body.pit64-v2 .brand-showcase .brand-grid::-webkit-scrollbar { display: none; }
  body.pit64-v2 .brand-showcase .brand-card {
    flex: 0 0 72%;
    max-width: 280px;
    min-width: 0;
    scroll-snap-align: start;
  }
  body.pit64-v2 .brand-showcase .catalog-heading p { display: none; }
  /* En el carrusel el logo ya dice la marca: el texto se cortaba («Hot …»). */
  body.pit64-v2 .brand-showcase .brand-card-copy { display: none; }
  body.pit64-v2 .brand-showcase .brand-card-footer { grid-template-columns: auto 1fr !important; }
  body.pit64-v2 .brand-showcase .brand-card-label { justify-self: end; }
}

/* 2. Tarjetas: desde 2.2 están en assets/css/pit64-22.css (tarjeta única). */

/* ---------- 3. Barra fija de compra (ficha, celular) ---------- */

.pit64-buybar { display: none; }

@media (max-width: 900px) {
  .pit64-buybar {
    position: fixed;
    inset: auto 0 0;
    z-index: 60;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, .08);
    background: rgba(9, 9, 10, .96);
    color: #fff;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, .28);
    transform: translateY(110%);
    transition: transform .22s ease;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
  .pit64-buybar.is-visible { transform: translateY(0); }
  .pit64-buybar-info { min-width: 0; display: grid; gap: 2px; }
  .pit64-buybar-info small {
    overflow: hidden;
    color: #bdb7ae;
    font: 700 10px/1.2 var(--pit64-sans);
    letter-spacing: .04em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .pit64-buybar-info strong { color: #fff; font: 800 18px/1.1 var(--pit64-sans); }
  .pit64-buybar-info strong del { color: #8d877f; font-size: 12px; font-weight: 600; }
  .pit64-buybar-info strong ins { text-decoration: none; }
  .pit64-buybar-wa {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #1f9d55;
  }
  .pit64-buybar-wa svg { width: 22px; height: 22px; fill: #fff; }
  .pit64-buybar-add {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    border: 0;
    border-radius: 12px;
    background: var(--pit64-red, #e31b23);
    color: #fff;
    font: 850 11px/1 var(--pit64-sans);
    letter-spacing: .05em;
    text-transform: uppercase;
    box-shadow: 0 6px 16px rgba(227, 27, 35, .3);
    cursor: pointer;
  }
  .pit64-buybar-add::before {
    content: "";
    width: 16px;
    height: 16px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='20' r='1.4'/%3E%3Ccircle cx='18' cy='20' r='1.4'/%3E%3Cpath d='M2.5 3h2.6l2.3 11.2a1.6 1.6 0 0 0 1.6 1.3h8.4a1.6 1.6 0 0 0 1.6-1.2L21 7H6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='20' r='1.4'/%3E%3Ccircle cx='18' cy='20' r='1.4'/%3E%3Cpath d='M2.5 3h2.6l2.3 11.2a1.6 1.6 0 0 0 1.6 1.3h8.4a1.6 1.6 0 0 0 1.6-1.2L21 7H6'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  /* Con la barra visible, el WhatsApp flotante se esconde: la barra ya lo trae. */
  body.pit64-buybar-on .pit64-whatsapp-float {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: opacity .2s ease, transform .2s ease;
  }
  body.single-product.pit64-has-buybar .site-footer { padding-bottom: 76px; }
}

/* ---------- 5. «Cargar más» ---------- */

.pit64-load-more-wrap {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: 26px 0 8px;
}
.pit64-load-more {
  min-height: 48px;
  min-width: min(100%, 280px);
  padding: 0 24px;
  border: 1px solid #171410;
  border-radius: 12px;
  background: #171410;
  color: #fff;
  font: 850 12px/1 var(--pit64-sans);
  letter-spacing: .07em;
  text-transform: uppercase;
  cursor: pointer;
}
.pit64-load-more:is(:hover, :focus-visible) { background: #000; }
.pit64-load-more[disabled] { opacity: .6; cursor: progress; }
.pit64-load-more-count { color: #6b655d; font: 700 11px/1.3 var(--pit64-sans); letter-spacing: .04em; }
.pit64-has-load-more .woocommerce-pagination,
.pit64-has-load-more .catalog-product-pagination {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- 6. Portada de categoría en el celular ----------
   Como en las tiendas de TCG: título, cantidad y a las cartas. Sin foto de
   fondo en el celular; la descripción queda (sirve para Google) en 2 líneas. */
@media (max-width: 700px) {
  body.pit64-v2 .catalog-native-hero {
    min-height: 0 !important;
    gap: 0 !important;
    padding: 22px 18px 18px !important;
  }
  body.pit64-v2 .catalog-native-hero > img,
  body.pit64-v2 .catalog-native-hero .catalog-native-brand { display: none !important; }
  body.pit64-v2 .catalog-native-hero .catalog-landing-shade { background: #0b0b0c; }
  body.pit64-v2 .catalog-native-hero-copy > p { margin-bottom: 8px; }
  body.pit64-v2 .catalog-native-hero-copy h1 { font-size: clamp(28px, 8.4vw, 38px); line-height: 1.02; }
  body.pit64-v2 .catalog-native-hero-copy div {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
  /* «Cartas Singles disponibles» repetía el título de arriba. */
  body.pit64-v2 .catalog-native-products-heading { display: none !important; }
  body.pit64-v2 .catalog-native-products { padding-top: 16px !important; }
}

/* =====================================================================
 * 2.1.57 (2.ª parte)
 * ===================================================================== */

/* ---------- Accesos a categorías bajo el menú (celular) ---------- */
.pit64-quicknav { display: none; }
@media (max-width: 900px) {
  .pit64-quicknav {
    display: flex;
    gap: 8px;
    padding: 10px 16px 11px;
    overflow-x: auto;
    background: #0b0b0c;
    border-top: 1px solid rgba(255, 255, 255, .07);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .pit64-quicknav::-webkit-scrollbar { display: none; }
  .pit64-quicknav a {
    flex: 0 0 auto;
    padding: 8px 13px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
    color: #f2eee7;
    font: 700 12px/1 var(--pit64-sans);
    letter-spacing: .02em;
    text-decoration: none;
    white-space: nowrap;
  }
  .pit64-quicknav a[aria-current="page"] { border-color: #e7c866; background: #e7c866; color: #141210; }
}

/* ---------- Resultados de búsqueda en vivo ---------- */
.pit64-live-results {
  display: grid;
  gap: 2px;
  margin: 14px 0 6px;
  max-height: min(56vh, 460px);
  overflow-y: auto;
  border-radius: 12px;
}
.pit64-live-results[hidden] { display: none; }
.pit64-live-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
}
.pit64-live-item:is(:hover, :focus-visible) { background: rgba(231, 200, 102, .12); outline: none; }
.pit64-live-item img, .pit64-live-item i {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}
.pit64-live-item span { min-width: 0; display: grid; gap: 3px; }
.pit64-live-item b {
  overflow: hidden;
  font: 700 14px/1.25 var(--pit64-sans);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.pit64-live-item small { opacity: .7; font: 600 11px/1.2 var(--pit64-sans); }
.pit64-live-item strong { font: 800 14px/1 var(--pit64-sans); white-space: nowrap; }
.pit64-live-all, .pit64-live-empty {
  padding: 12px 10px 4px;
  font: 700 13px/1.3 var(--pit64-sans);
}
.pit64-live-all { color: #e7c866; text-decoration: underline; text-underline-offset: 3px; }
.pit64-live-empty { opacity: .75; }

/* ---------- Filtros a la vista ---------- */
.pit64-quick-filters {
  display: grid;
  gap: 8px;
  margin: 2px 0 18px;
  min-width: 0;
}
.pit64-quick-filters-title {
  color: #6b655d;
  font: 800 10px/1 var(--pit64-sans);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.pit64-quick-filters-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.pit64-quick-filters-track::-webkit-scrollbar { display: none; }
.pit64-quick-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #d8d0c3;
  border-radius: 999px;
  background: #fff;
  color: #171410;
  font: 700 12.5px/1 var(--pit64-sans);
  text-decoration: none;
  white-space: nowrap;
}
.pit64-quick-chip small { color: #8a8378; font-size: 11px; font-weight: 700; }
.pit64-quick-chip:is(:hover, :focus-visible) { border-color: #171410; }
.pit64-quick-chip.is-active { border-color: #171410; background: #171410; color: #fff; }
.pit64-quick-chip.is-active span { font-size: 16px; line-height: 1; opacity: .8; }
.pit64-quick-chip.is-clear { border-style: dashed; color: #6b655d; }

/* ---------- Confianza junto al botón ---------- */
.pit64-trust-row {
  list-style: none;
  margin: 14px 0 4px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  flex: 1 1 100%;
}
.pit64-trust-row li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid #e3dccf;
  border-radius: 10px;
  background: #fffdf8;
}
.pit64-trust-row svg { width: 22px; height: 22px; fill: none; stroke: #a87b12; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.pit64-trust-row span { display: grid; gap: 2px; color: #6b655d; font: 600 11px/1.3 var(--pit64-sans); }
.pit64-trust-row b { color: #171410; font-size: 12px; }
@media (max-width: 520px) {
  .pit64-trust-row { grid-template-columns: 1fr; gap: 6px; }
  .pit64-trust-row li { padding: 9px 10px; align-items: center; }
  .pit64-trust-row span { grid-template-columns: auto 1fr; column-gap: 6px; align-items: baseline; }
}

/* ---------- Carrito: la columna del total se salía de la pantalla ---------- */
@media (max-width: 600px) {
  body.pit64-v2.woocommerce-cart .wc-block-cart-items { width: 100% !important; table-layout: fixed; }
  body.pit64-v2.woocommerce-cart .wc-block-cart-item__image,
  body.pit64-v2.woocommerce-cart .wc-block-cart-items__header-image { width: 76px; min-width: 0 !important; }
  body.pit64-v2.woocommerce-cart .wc-block-cart-item__image { padding-left: 10px !important; padding-right: 8px !important; }
  body.pit64-v2.woocommerce-cart .wc-block-cart-item__total,
  body.pit64-v2.woocommerce-cart .wc-block-cart-items__header-total { width: 78px; min-width: 0 !important; }
  body.pit64-v2.woocommerce-cart .wc-block-cart-item__total { padding-right: 10px !important; white-space: nowrap; }
  body.pit64-v2.woocommerce-cart .wc-block-cart-item__product { min-width: 0; padding-right: 6px !important; overflow-wrap: anywhere; }
}

/* ---------- Portada de categoría en la computadora: se ven cartas al entrar ---------- */
@media (min-width: 981px) {
  body.pit64-v2 .catalog-native-hero {
    min-height: 0;
    padding-top: 46px;
    padding-bottom: 36px;
  }
  body.pit64-v2 .catalog-native-hero-copy h1 { font-size: clamp(40px, 4.2vw, 60px); }
  body.pit64-v2 .catalog-native-hero-copy div { margin-top: 12px; }
}

/* ---------- Páginas de familia (Hot Wheels, Diecast, Pokémon, Gaming) en el celular ----------
   La portada medía 500 px y las tarjetas de subcategoría iban una debajo de
   otra (2.087 px en Hot Wheels): el primer producto quedaba en el píxel 3.515. */
@media (max-width: 700px) {
  body.pit64-v2 .catalog-landing-hero { min-height: 0 !important; }
  body.pit64-v2 .catalog-landing-hero-copy h1 { font-size: clamp(36px, 10.5vw, 52px) !important; }
  body.pit64-v2 .catalog-option-grid {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 12px;
    margin-inline: -18px;
    padding: 4px 18px 14px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 18px;
    scrollbar-width: none;
  }
  body.pit64-v2 .catalog-option-grid::-webkit-scrollbar { display: none; }
  body.pit64-v2 .catalog-option-grid > .catalog-option-card {
    flex: 0 0 64%;
    max-width: 260px;
    min-width: 0;
    scroll-snap-align: start;
    aspect-ratio: 3 / 4 !important;
  }
}

/* =====================================================================
 * 2.1.57 (3.ª parte) — ideas de tiendas de TCG
 * ===================================================================== */

/* Barra de filtrar y ordenar siempre a mano al bajar (celular). */
@media (max-width: 900px) {
  body.pit64-v2 .pit64-catalog-toolbar {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 8px 0;
    background: #f6f2ea;
    box-shadow: 0 10px 12px -12px rgba(20, 18, 16, .3);
  }
  body.pit64-v2 .pit64-filter-result-count {
    display: block !important;
    order: 3;
    grid-column: 1 / -1;
    margin: 6px 0 0 !important;
    color: #6b655d;
    font: 700 11.5px/1.2 var(--pit64-sans);
  }
}

/* Rangos de precio en los filtros a la vista. */
.pit64-quick-chip.is-price { border-style: dashed; }

/* Portada del inicio más corta en el celular (1.370 → ~1.010 px):
   la foto principal baja de 520 a 372 px y las tres garantías van en una fila. */
@media (max-width: 700px) {
  body.pit64-v2 .pit64-hero-stage { min-height: 372px !important; }
  body.pit64-v2 .pit64-hero-copy > .pit64-brand-carousel { margin-top: 18px !important; }
  body.pit64-v2 .pit64-hero-copy > .pit64-hero-proof {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-top: 16px !important;
    padding-top: 14px !important;
  }
  body.pit64-v2 .pit64-hero-proof span { font-size: 0 !important; line-height: 0 !important; gap: 0 !important; }
  body.pit64-v2 .pit64-hero-proof b { font-size: 11.5px !important; line-height: 1.25 !important; margin: 0 !important; }
}

/* Buscador siempre a la vista bajo el encabezado (celular), como en las tiendas de TCG. */
.pit64-mobile-search-row { display: none; }
@media (max-width: 900px) {
  .pit64-mobile-search-row { display: block; padding: 10px 16px 0; background: #0b0b0c; }
  .pit64-mobile-search {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 12px;
    background: #17161a;
    color: #bdb7ae;
    font: 600 14px/1 var(--pit64-sans);
    text-align: left;
    cursor: text;
  }
  .pit64-mobile-search svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: #e7c866; stroke-width: 2; stroke-linecap: round; }
  .pit64-mobile-search span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Safari del iPhone ignoraba la altura del selector de orden y lo dejaba más
   bajo que «Filtrar productos». Se dibuja igual en todos los navegadores. */
body.pit64-v2 .pit64-catalog-ordering select {
  height: 46px;
  -webkit-appearance: none;
  appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23292622' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 14px;
  line-height: 1.2;
}
