/* Hoja de estilos ÚNICA del sitio público (Catálogo nuevo, Etapa 1).
   Diseño aprobado en la maqueta del 2026-08-15: paleta blanco/rojo/negro con modo
   claro Y oscuro (toggle + preferencia del sistema), fuente Archivo self-hosted,
   mobile-first. La sirven todas las páginas (listados dinámicos y fichas estáticas)
   como /sitio/sitio.css — un solo archivo chico cacheado, sin CDNs ni requests
   externos (requisito PageSpeed 100). */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/sitio/archivo.woff2) format('woff2');
}

/* Tokens del tema. El bloque de abajo define TODO el modo claro; el modo oscuro se
   redefine dos veces con los mismos valores (preferencia del sistema sin elección
   guardada, y elección explícita del toggle) — es el patrón estándar de 3 estados. */
:root {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #ececee;
  --ink: #18181b;
  --muted: #6d6d75;
  --line: #e3e3e6;
  --accent: #d92b2b;
  --accent-ink: #ffffff;
  --accent-soft: rgba(217, 43, 43, 0.09);
  --good: #178a4c;
  --good-soft: rgba(23, 138, 76, 0.10);
  --dark-panel: #1a1a1e;
  --dark-panel-ink: #f4f4f5;
  --shadow: 0 1px 2px rgba(24, 24, 27, 0.06), 0 4px 16px rgba(24, 24, 27, 0.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131316;
    --surface: #1c1c21;
    --surface-2: #26262c;
    --ink: #f2f2f4;
    --muted: #9d9da6;
    --line: #2a2a31;
    --accent: #ff5252;
    --accent-ink: #1a0808;
    --accent-soft: rgba(255, 82, 82, 0.13);
    --good: #3ecf80;
    --good-soft: rgba(62, 207, 128, 0.13);
    --dark-panel: #101014;
    --dark-panel-ink: #f2f2f4;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  }
}
:root[data-theme="dark"] {
  --bg: #131316;
  --surface: #1c1c21;
  --surface-2: #26262c;
  --ink: #f2f2f4;
  --muted: #9d9da6;
  --line: #2a2a31;
  --accent: #ff5252;
  --accent-ink: #1a0808;
  --accent-soft: rgba(255, 82, 82, 0.13);
  --good: #3ecf80;
  --good-soft: rgba(62, 207, 128, 0.13);
  --dark-panel: #101014;
  --dark-panel-ink: #f2f2f4;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; }
img { max-width: 100%; }
input, select, textarea { font-family: inherit; }
::placeholder { color: var(--muted); opacity: 1; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 14px; }

/* ---- Barra de beneficios ---- */
.beneficios {
  background: var(--accent); color: var(--accent-ink);
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.01em;
  text-align: center; padding: 7px 12px;
}
.beneficios b { font-weight: 800; }
.beneficios .sep { opacity: 0.6; margin: 0 8px; }
@media (max-width: 560px) { .beneficios .solo-pc { display: none; } .beneficios .sep { display: none; } }

/* ---- Header ---- */
.header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.header-fila { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.logo { display: flex; align-items: center; gap: 9px; text-decoration: none; flex-shrink: 0; }
.logo-img { height: 40px; width: auto; object-fit: contain; display: block; border-radius: 8px; }
.logo-texto { font-weight: 900; font-size: 17px; letter-spacing: -0.02em; line-height: 1.05; }
.logo-texto small { display: block; font-size: 10px; font-weight: 600; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
@media (max-width: 560px) { .logo-texto { display: none; } }
.buscador { flex: 1; position: relative; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 13px; min-width: 0; }
.buscador svg { flex-shrink: 0; color: var(--muted); }
.buscador input { border: 0; background: none; outline: none; width: 100%; font-size: 14px; color: var(--ink); }
/* La cruz de borrar búsqueda es propia — se apaga la nativa de Chrome/Safari para no
   mostrar dos cruces juntas. */
.buscador input::-webkit-search-cancel-button, .buscador input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.buscador-x {
  flex-shrink: 0; width: 22px; height: 22px; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: var(--line); color: var(--ink);
  font-size: 15px; line-height: 1; padding: 0; transition: background 0.15s ease;
}
@media (hover: hover) and (pointer: fine) { .buscador-x:hover { background: var(--accent); color: var(--accent-ink); } }
.buscador-x.oculto { display: none; }
/* Sugerencias EN VIVO del buscador (se llena por JS con /api/sugerencias) */
.buscador-sugerencias {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: var(--surface); border-radius: 12px; padding: 6px;
  max-height: min(420px, 60vh); overflow-y: auto; scrollbar-width: thin;
  box-shadow: 0 4px 42px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--line);
}
.buscador-sugerencias.abierta { display: block; }
.sug-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; text-decoration: none; }
.sug-item:hover { background: var(--accent-soft); }
.sug-item img { width: 42px; height: 42px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; flex-shrink: 0; }
.sug-texto { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sug-titulo {
  font-size: 13px; color: var(--ink); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sug-precio { font-size: 13px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.sug-todos {
  display: block; width: 100%; margin-top: 4px; padding: 9px; border: 0; border-top: 1px solid var(--line);
  background: none; color: var(--accent); font-weight: 700; font-size: 13px; cursor: pointer;
}
.sug-todos:hover { background: var(--accent-soft); }
.hbtn {
  position: relative; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; display: grid; place-items: center; flex-shrink: 0;
}
.hbtn:active { transform: scale(0.96); }
.hbtn:focus-visible, .btn-card:focus-visible, .banner-cta:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* El toggle muestra el ícono del tema al que VA a cambiar: luna en claro, sol en oscuro. */
.hbtn .ico-luna { display: block; }
.hbtn .ico-sol { display: none; }
:root[data-theme="dark"] .hbtn .ico-luna { display: none; }
:root[data-theme="dark"] .hbtn .ico-sol { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hbtn .ico-luna { display: none; }
  :root:not([data-theme="light"]) .hbtn .ico-sol { display: block; }
}

/* ---- Chips de categorías del header ---- */
/* En mobile son una tira con scroll horizontal, con un degradé en el borde derecho que
   avisa que sigue (antes se cortaban en seco y parecía un error). En PC hay lugar:
   se muestran TODAS, en las filas que hagan falta — nada cortado. */
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 10px; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 42px), transparent 100%);
  mask-image: linear-gradient(to right, black calc(100% - 42px), transparent 100%); }
.cats::-webkit-scrollbar { display: none; }
@media (min-width: 768px) {
  .cats { flex-wrap: wrap; overflow-x: visible; -webkit-mask-image: none; mask-image: none; }
}
.cat-chip {
  flex-shrink: 0; font-size: 13px; font-weight: 600; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; color: var(--ink);
}
.cat-chip.activa { background: var(--ink); color: var(--bg); border-color: var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .cat-chip:not(.activa):hover { border-color: var(--accent); color: var(--accent); }
}

/* ---- Vidriera (home) ---- */
.vidriera { display: grid; gap: 12px; margin: 16px 0 6px; }
@media (min-width: 900px) { .vidriera { grid-template-columns: 2fr 1fr; } }
.banner-main {
  background: var(--dark-panel); color: var(--dark-panel-ink);
  border-radius: 16px; padding: 26px 24px; display: flex; align-items: center; gap: 18px;
  justify-content: space-between; min-height: 210px; overflow: hidden;
}
.banner-main h1 { margin: 0 0 6px; font-size: clamp(26px, 4.5vw, 40px); font-weight: 900; letter-spacing: -0.03em; line-height: 1.02; text-wrap: balance; }
.banner-main h1 em { font-style: normal; color: var(--accent); }
:root[data-theme="dark"] .banner-main h1 em { color: #ff6b6b; }
.banner-main p { margin: 0 0 16px; font-size: 14.5px; opacity: 0.85; max-width: 34ch; }
.banner-cta {
  display: inline-block; background: var(--accent); color: var(--accent-ink); text-decoration: none;
  font-weight: 800; font-size: 14px; border-radius: 10px; padding: 11px 20px; border: 0; cursor: pointer;
}
.banner-cta:active { transform: scale(0.97); }
.banner-foto { flex-shrink: 0; position: relative; width: 168px; height: 168px; background: #fff; border-radius: 14px; overflow: hidden; }
.banner-foto img { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); object-fit: contain; }
@media (max-width: 560px) { .banner-foto { width: 118px; height: 118px; } .banner-main { padding: 20px 16px; min-height: 0; } }
.banners-sec { display: grid; gap: 12px; }
.banner-sec {
  border-radius: 16px; padding: 18px 20px; text-decoration: none; display: flex; flex-direction: column; justify-content: center; gap: 3px; min-height: 96px;
}
.banner-sec strong { font-size: 18px; font-weight: 900; letter-spacing: -0.02em; }
.banner-sec span { font-size: 13px; opacity: 0.9; }
.banner-verde { background: var(--good); color: #fff; }
.banner-borde { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); }
@media (max-width: 899px) { .banners-sec { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .banners-sec { grid-template-columns: 1fr; } }

/* ---- Landing de marca (hoy: Landing Bremen) ---- */
/* El azul es el OFICIAL del manual de marca Bremen (#19233e) y va fijo en los dos
   temas: es color de marca, no del sitio. Logo y tagline son SVG de curvas separados
   (regla del instructivo) y se escalan por altura sin deformarse. */
.marca-hero {
  background: #19233e; color: #fff; border-radius: 16px; padding: 30px 26px;
  margin: 16px 0 6px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
}
.marca-hero-logo { height: 52px; width: auto; display: block; }
.marca-hero-tagline { height: 14px; width: auto; display: block; opacity: 0.9; }
.marca-hero-texto { margin: 2px 0 0; font-size: 14.5px; opacity: 0.85; max-width: 52ch; }
.marca-cats { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
@media (max-width: 560px) {
  .marca-hero { padding: 22px 18px; }
  .marca-hero-logo { height: 40px; }
  .marca-hero-tagline { height: 11px; }
}

/* ---- Títulos de sección ---- */
.seccion { margin: 26px 0 8px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.seccion h2, .seccion h1 { margin: 0; font-size: 21px; font-weight: 900; letter-spacing: -0.02em; }
.seccion a { font-size: 13px; font-weight: 700; color: var(--accent); text-decoration: none; white-space: nowrap; }
.subtitle { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.subtitle a { color: var(--accent); }

/* ---- Cards de producto ---- */
.grilla { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .grilla { grid-template-columns: repeat(3, 1fr); gap: 14px; } }
@media (min-width: 1020px) { .grilla { grid-template-columns: repeat(4, 1fr); } }
.fila-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 230px); gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; }
.fila-scroll .card { scroll-snap-align: start; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
  transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.18s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (hover: hover) and (pointer: fine) {
  .card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 10px 26px rgba(0, 0, 0, 0.14); }
}
/* Cuadro IDÉNTICO en todas las tarjetas. La foto va POSICIONADA ABSOLUTA adentro:
   así es imposible que una foto vertical estire el cuadro (con width/height 100%
   el navegador igual agrandaba el cuadro por el mínimo de contenido — bug real
   visto dos veces en capturas del usuario). */
.card-img { position: relative; display: block; background: #fff; aspect-ratio: 1; overflow: hidden; }
.card-img img { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); object-fit: contain; }
.badge-off {
  position: absolute; top: 8px; left: 8px; background: var(--accent); color: var(--accent-ink);
  font-size: 12px; font-weight: 800; border-radius: 7px; padding: 3px 7px;
}
.badge-hot {
  position: absolute; top: 8px; right: 8px; background: #18181b; color: #fff;
  font-size: 11px; font-weight: 800; border-radius: 7px; padding: 3px 7px;
}
.card-body { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; flex: 1; }
.card-brand { font-size: 10.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); text-decoration: none; }
.card-title {
  font-size: 13.5px; font-weight: 600; line-height: 1.3; text-decoration: none; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em;
}
/* REGLA DE GRILLA: todas las tarjetas tienen SIEMPRE los mismos renglones a la misma
   altura. Los renglones opcionales (tachado, cuotas) se RESERVAN con visibility:hidden
   cuando el producto no los tiene — nada de precios "flotando" a alturas distintas. */
.card-precios { display: flex; flex-direction: column; gap: 2px; margin-top: auto; }
.reservado { visibility: hidden; }
.precio-tachado-card { font-size: 11.5px; color: var(--muted); text-decoration: line-through; }
.precio-fila { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.precio-web { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.precio-cuotas { font-size: 12px; color: var(--good); font-weight: 600; }
.precio-cuotas small { font-size: 11px; color: var(--muted); font-weight: 500; }
.precio-fila-abajo { margin-top: 2px; min-height: 18px; }
.envio-gratis { font-size: 12px; font-weight: 700; color: var(--good); }
.stock-out { font-size: 12px; font-weight: 700; color: var(--accent); }
.btn-card {
  margin-top: 8px; border: 0; border-radius: 10px; background: var(--ink); color: var(--bg);
  font-weight: 700; font-size: 13px; padding: 10px; cursor: pointer; text-align: center;
  text-decoration: none; display: block; transition: background 0.15s, color 0.15s;
}
@media (hover: hover) and (pointer: fine) {
  .btn-card:hover { background: var(--accent); color: var(--accent-ink); }
}
.btn-card:active { transform: scale(0.97); }
@media (max-width: 560px) {
  .card-body { padding: 8px 9px 10px; }
  .precio-web { font-size: 16px; }
  .btn-card { font-size: 12px; padding: 9px 6px; }
}

/* ---- Marcas con logo (home y filtro) ---- */
.marcas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (min-width: 700px) { .marcas { grid-template-columns: repeat(8, 1fr); } }
/* Fondo blanco fijo a propósito: los logos oficiales son oscuros y en modo oscuro
   desaparecerían sobre superficie oscura. */
.marca-tile {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; text-decoration: none;
  display: grid; place-items: center; min-height: 58px; padding: 10px 8px; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.marca-tile img { max-height: 26px; max-width: 100%; object-fit: contain; }
.marca-nombre { font-weight: 900; font-size: 14px; letter-spacing: -0.01em; color: #26262a; }
@media (hover: hover) and (pointer: fine) { .marca-tile:hover { border-color: var(--accent); } }
.marca-tile.activa { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
.marca-tile:active { transform: scale(0.97); }
@media (max-width: 699px) {
  /* En el filtro del catálogo (muchas marcas): tira horizontal con scroll, como MELI. */
  .marcas.marcas-filtro { display: flex; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, black calc(100% - 36px), transparent 100%);
    mask-image: linear-gradient(to right, black calc(100% - 36px), transparent 100%); }
  .marcas.marcas-filtro::-webkit-scrollbar { display: none; }
  .marcas.marcas-filtro .marca-tile { flex: 0 0 auto; min-width: 92px; }
}

/* ---- Filtros del catálogo ---- */
.filtros { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 14px 0; box-shadow: var(--shadow); }
.filtros-fila { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filtros-fila + .filtros-fila { margin-top: 10px; }
.filtros .campo { display: flex; flex-direction: column; gap: 4px; flex: 1 1 150px; min-width: 150px; max-width: 260px; }
.filtros .campo > label { font-size: 12px; font-weight: 700; color: var(--muted); }
.filtros .campo.campo-precio { max-width: 220px; }
.filtros .campo.campo-marca { max-width: none; flex-basis: 100%; }
.filtros-fila-buscar .campo { flex: 2 1 220px; max-width: none; }
.filtros input, .filtros select {
  background: var(--bg); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 10px; font-size: 14px; width: 100%;
  transition: border-color 0.15s ease;
}
.filtros input:focus, .filtros select:focus { outline: none; border-color: var(--accent); }
@media (hover: hover) and (pointer: fine) {
  .filtros input:hover, .filtros select:hover { border-color: var(--accent); }
}
.precio-inputs { display: flex; align-items: center; gap: 6px; }
.precio-inputs input { width: 0; flex: 1; min-width: 0; }
.filtros button[type="submit"] {
  background: var(--accent); color: var(--accent-ink); border: none; border-radius: 8px; padding: 10px 18px;
  font-weight: 800; cursor: pointer; font-size: 14px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.filtros button[type="submit"]:active { transform: scale(0.96); }
@media (hover: hover) and (pointer: fine) {
  .filtros button[type="submit"]:hover { filter: brightness(1.08); }
}

/* Dropdown propio de los 4 niveles de categoría (mismo mecanismo que el catálogo
   viejo: botón + menú animado .t-dropdown de la skill transitions-dev). */
.filtro-drop { position: relative; }
.filtro-drop-btn {
  width: 100%; background: var(--bg); color: var(--ink);
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font-size: 14px;
  cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; transition: border-color 0.15s ease; text-align: left;
}
.filtro-drop-btn:focus { outline: none; border-color: var(--accent); }
.filtro-drop-btn:disabled { cursor: not-allowed; opacity: 0.45; }
.filtro-drop-btn svg { flex-shrink: 0; color: var(--muted); transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
.filtro-drop.open .filtro-drop-btn svg { transform: rotate(180deg); }
@media (hover: hover) and (pointer: fine) { .filtro-drop-btn:hover { border-color: var(--accent); } }
.filtro-drop-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20;
  background: var(--surface); border-radius: 12px;
  max-height: 320px; overflow-y: auto; padding: 8px;
  box-shadow: 0 4px 42px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--line);
  scrollbar-width: thin;
}
.filtro-drop-menu a {
  display: block; padding: 8px 10px; border-radius: 8px; font-size: 13px;
  line-height: 1.6; text-decoration: none; color: var(--ink); transition: background 0.12s ease, color 0.12s ease;
}
.filtro-drop-menu a:hover { background: var(--accent-soft); color: var(--accent); }
.filtro-drop-menu a.activa { color: var(--accent); font-weight: 700; background: var(--accent-soft); }
:root {
  --dropdown-open-dur: 250ms;
  --dropdown-close-dur: 150ms;
  --dropdown-pre-scale: 0.97;
  --dropdown-closing-scale: 0.99;
  --dropdown-ease: cubic-bezier(0.22, 1, 0.36, 1);
}
.t-dropdown {
  transform-origin: top left;
  transform: scale(var(--dropdown-pre-scale));
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--dropdown-open-dur) var(--dropdown-ease),
    opacity   var(--dropdown-open-dur) var(--dropdown-ease);
  will-change: transform, opacity;
}
.t-dropdown.is-open { transform: scale(1); opacity: 1; pointer-events: auto; }
.t-dropdown.is-closing {
  transform: scale(var(--dropdown-closing-scale));
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--dropdown-close-dur) var(--dropdown-ease),
    opacity   var(--dropdown-close-dur) var(--dropdown-ease);
}
@media (prefers-reduced-motion: reduce) { .t-dropdown { transition: none !important; } }

/* Chips de filtros activos (cada chip saca UN filtro). El margen de abajo los separa
   de la grilla: antes quedaban pegados sobre las fotos de los productos. En hover el
   chip entero se pinta (nada se mueve ni cambia de tamaño — la cruz que "se movía"
   al acercarse era un defecto reportado por el usuario). */
.chips-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; background: var(--accent-soft);
  border: 1px solid var(--accent); color: var(--accent); border-radius: 999px; padding: 6px 8px 6px 13px;
  font-size: 13px; font-weight: 700; text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.chip .chip-x {
  width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center;
  color: var(--accent-ink); background: var(--accent); font-size: 12px; line-height: 1; flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
@media (hover: hover) and (pointer: fine) {
  .chip:hover { background: var(--accent); color: var(--accent-ink); }
  .chip:hover .chip-x { background: var(--accent-ink); color: var(--accent); }
}
.chip-limpiar {
  background: none; border: 1px dashed var(--line); color: var(--muted); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; text-decoration: none; font-weight: 700;
  transition: border-color 0.15s ease, color 0.15s ease;
}
@media (hover: hover) and (pointer: fine) { .chip-limpiar:hover { border-color: var(--muted); color: var(--ink); } }

/* ---- Paginación / breadcrumb / sin resultados ---- */
.pagination { margin: 32px auto 0; display: flex; justify-content: center; align-items: center; gap: 12px; }
.pagination a, .pagination .disabled {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 8px 14px;
}
.pagination a { color: var(--accent); text-decoration: none; font-weight: 700; }
.pagination .disabled { color: var(--muted); }
.pagination .page-info { color: var(--muted); font-size: 14px; }
.sin-resultados { text-align: center; color: var(--muted); margin-top: 40px; }
.breadcrumb { font-size: 12px; color: var(--muted); margin: 14px 0 0; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 4px; }

/* ---- Ficha de producto ---- */
/* Orden mobile: foto, compra, ficha técnica, descripción.
   En PC: fotos a la izquierda con la ficha técnica DEBAJO; compra a la derecha
   con la descripción debajo (reorganización pedida por el usuario). */
.ficha {
  display: grid; gap: 18px; margin-top: 8px;
  grid-template-areas: "gal" "info" "tec" "desc";
}
@media (min-width: 900px) {
  .ficha {
    grid-template-columns: 1fr 1fr; gap: 22px 30px; align-items: start;
    grid-template-areas: "gal info" "tec desc";
  }
}
.ficha-galeria { grid-area: gal; min-width: 0; }
.ficha-info { grid-area: info; min-width: 0; }
.ficha-area-tec { grid-area: tec; min-width: 0; }
.ficha-area-desc { grid-area: desc; min-width: 0; }
.vista-volver {
  display: inline-flex; align-items: center; gap: 7px; margin: 16px 0 4px;
  font-size: 13.5px; font-weight: 700; color: var(--muted); text-decoration: none;
}
.vista-volver:hover { color: var(--ink); }
/* Galería: carrusel nativo con scroll-snap — en táctil se desliza con el dedo (sin
   flechas ni lightbox: para acercar está el zoom de pellizco); con mouse hay flechas
   y el click agranda (lightbox). */
.ficha-foto {
  position: relative; background: #fff; border: 1px solid var(--line); border-radius: 16px;
  aspect-ratio: 1; box-shadow: var(--shadow); overflow: hidden;
}
.galeria-pista {
  position: absolute; inset: 0; display: flex; overflow-x: auto;
  scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
}
.galeria-pista::-webkit-scrollbar { display: none; }
.galeria-slide { position: relative; flex: 0 0 100%; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; }
.galeria-slide img { position: absolute; inset: 24px; width: calc(100% - 48px); height: calc(100% - 48px); object-fit: contain; }
.ficha-foto .flecha {
  display: none; position: absolute; top: 50%; transform: translateY(-50%); background: rgba(24, 24, 27, 0.55); color: #fff;
  border: none; width: 44px; height: 44px; border-radius: 50%; font-size: 22px; line-height: 1;
  cursor: pointer; z-index: 2;
}
@media (hover: hover) and (pointer: fine) {
  .ficha-foto { cursor: zoom-in; }
  .ficha-foto .flecha { display: block; }
  .ficha-foto .flecha:hover { background: rgba(24, 24, 27, 0.8); }
}
.flecha-prev { left: 10px; }
.flecha-next { right: 10px; }
.ficha-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ficha-thumbs img {
  display: block; width: 62px; height: 62px; object-fit: contain; border-radius: 10px; background: #fff;
  border: 2px solid var(--line); padding: 4px; cursor: pointer;
}
.ficha-thumbs img.activa { border-color: var(--accent); }
.ficha-marca { font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); text-decoration: none; }
.ficha-info h1 {
  font-size: clamp(20px, 3vw, 27px); font-weight: 900; letter-spacing: -0.02em;
  line-height: 1.15; margin: 4px 0 10px; text-wrap: balance;
}
.vendedor-badge {
  display: inline-block; width: fit-content; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px;
  font-size: 12.5px; color: var(--ink); margin: 0 0 6px;
}
.reviews { color: var(--ink); font-weight: 700; font-size: 13.5px; margin: 0 0 4px; }
.reviews .estrella { color: #e8a013; }
.ficha-tachado { font-size: 14px; color: var(--muted); text-decoration: line-through; margin: 0; }
.ficha-precio-fila { display: flex; align-items: center; gap: 10px; margin: 0; }
.ficha-precio { font-size: 32px; font-weight: 900; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.discount-badge { background: var(--good); color: #fff; font-size: 13px; font-weight: 800; padding: 3px 8px; border-radius: 6px; }
.cuota-detalle { display: block; margin: 4px 0 0; font-size: 14px; color: var(--good); font-weight: 600; }
.ficha-envio-gratis { color: var(--good); font-size: 13.5px; font-weight: 700; margin: 6px 0 0; }
.stock { font-size: 14px; font-weight: 600; margin: 6px 0 0; }
.stock.in { color: var(--good); }
.stock.out { color: var(--accent); }
.opciones-pago { display: flex; flex-direction: column; gap: 8px; margin: 16px 0 4px; }
.opciones-pago .op-titulo { margin: 0 0 2px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.opcion-pago {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer;
  background: var(--surface); font: inherit; color: var(--ink); width: 100%;
}
.opcion-pago.activa { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.opcion-pago .op-t { font-weight: 800; font-size: 14.5px; display: block; }
.opcion-pago .op-d { font-size: 12.5px; color: var(--muted); display: block; }
.opcion-pago .op-p { font-weight: 800; font-size: 15.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ficha-acciones { display: flex; flex-direction: column; gap: 9px; margin: 14px 0 10px; }
/* "Agregar al carrito" es la acción principal (roja); "Comprar en MercadoLibre" pasa a
   ser el botón amarillo de MELI (Etapa 2 — Pedidos web). En las fichas viejas todavía
   sin regenerar, el amarillo queda como único CTA y sigue estando bien. */
.btn-agregar-ficha {
  display: block; text-align: center; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-size: 15px; padding: 14px; cursor: pointer; text-decoration: none; width: 100%;
}
.btn-agregar-ficha:active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) { .btn-agregar-ficha:hover { filter: brightness(1.06); } }
.btn-comprar {
  display: block; text-align: center; border: 0; border-radius: 12px; background: #ffe600; color: #333;
  font-weight: 800; font-size: 14.5px; padding: 13px; cursor: pointer; text-decoration: none; width: 100%;
}
.btn-comprar:active { transform: scale(0.98); }
.btn-comprar[aria-disabled="true"] { background: var(--surface-2); color: var(--muted); cursor: not-allowed; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .btn-comprar:hover { filter: brightness(1.04); } }
.ficha-desc h2, .ficha-area-tec h2 { font-size: 16px; font-weight: 900; margin: 0 0 8px; }
.ficha-desc p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--muted); white-space: pre-line; max-width: 70ch; }
.tec-tabla { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tec-tabla td { padding: 8px 10px; }
.tec-tabla td:first-child { color: var(--muted); width: 45%; }
.tec-tabla td:last-child { font-weight: 600; }
.tec-tabla tr:nth-child(odd) td { background: var(--surface-2); }
.tec-tabla tr td:first-child { border-radius: 8px 0 0 8px; }
.tec-tabla tr td:last-child { border-radius: 0 8px 8px 0; }

/* Lightbox de la galería */
.lightbox {
  position: fixed; inset: 0; background: rgba(10, 10, 12, 0.92); z-index: 100;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity 0.2s ease;
}
.lightbox.abierto { opacity: 1; visibility: visible; }
.lightbox img {
  width: 90vw; height: 88vh; max-width: 90vw; max-height: 88vh; object-fit: contain; background: #fff;
  border-radius: 8px; cursor: zoom-out; transform: scale(0.92); transition: transform 0.2s ease;
}
.lightbox.abierto img { transform: scale(1); }
.lightbox-cerrar {
  position: absolute; top: 10px; right: 10px; background: none; border: none; color: #fff;
  font-size: 34px; line-height: 1; cursor: pointer; width: 48px; height: 48px;
  display: grid; place-items: center;
}
.lightbox-flecha {
  position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, 0.15);
  color: #fff; border: none; width: 50px; height: 50px; border-radius: 50%; font-size: 28px;
  line-height: 1; cursor: pointer;
}
.lightbox-flecha:hover { background: rgba(255, 255, 255, 0.3); }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* Relacionados */
.related-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .related-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; } }
@media (min-width: 1020px) { .related-grid { grid-template-columns: repeat(5, 1fr); } }
.related-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px;
  display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); font-size: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
@media (hover: hover) and (pointer: fine) {
  .related-item:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }
}
.related-item .related-foto { position: relative; aspect-ratio: 1; background: #fff; border-radius: 8px; overflow: hidden; }
.related-item .related-foto img { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); object-fit: contain; }
.related-item span {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em;
}
.related-item strong { color: var(--ink); font-size: 13.5px; font-variant-numeric: tabular-nums; }

/* ---- Footer ---- */
.footer { background: var(--dark-panel); color: var(--dark-panel-ink); margin-top: 40px; padding: 34px 0 40px; }
.footer .wrap { display: grid; gap: 22px; }
@media (min-width: 700px) { .footer .wrap { grid-template-columns: 2fr 1fr 1fr; } }
.footer h3 { margin: 0 0 8px; font-size: 14px; font-weight: 800; }
.footer p, .footer a { font-size: 13.5px; opacity: 0.85; margin: 0 0 6px; display: block; text-decoration: none; color: inherit; }
.footer a:hover { opacity: 1; text-decoration: underline; }
.footer .nota { font-size: 12px; opacity: 0.55; margin-top: 10px; }

/* ---- Flotantes (WhatsApp + volver arriba) ---- */
.whatsapp-flotante {
  position: fixed; right: 16px; bottom: 16px; z-index: 50; width: 56px; height: 56px; border-radius: 50%;
  background: #25D366; display: flex; align-items: center; justify-content: center; text-decoration: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
@media (hover: hover) and (pointer: fine) {
  .whatsapp-flotante:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3); }
}
.volver-arriba {
  position: fixed; right: 20px; bottom: 84px; z-index: 50; width: 48px; height: 48px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(8px) scale(0.9);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.volver-arriba.visible { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }
@media (hover: hover) and (pointer: fine) { .volver-arriba:hover { border-color: var(--accent); } }

/* ---- Carrito (Pedidos web, Etapa 2) ---- */
/* Contador del botón del header: se oculta con el carrito vacío. */
.hbtn .carrito-num {
  position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 800; line-height: 19px; text-align: center;
}
.hbtn .carrito-num.vacio { display: none; }
/* Feedback de "Agregado ✓" en las tarjetas y la ficha. */
.btn-card.ok, .btn-agregar-ficha.ok { background: var(--good); color: #fff; }

/* Drawer "Tu pedido" (mismo patrón visual que la maqueta aprobada). */
.overlay {
  position: fixed; inset: 0; background: rgba(10, 10, 12, 0.5); z-index: 60;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.overlay.abierto { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; z-index: 70; background: var(--surface); display: flex; flex-direction: column;
  top: 0; right: 0; bottom: 0; width: min(420px, 100vw); transform: translateX(102%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1); box-shadow: -8px 0 40px rgba(0, 0, 0, 0.18);
}
.drawer.abierto { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-head strong { font-size: 17px; font-weight: 900; }
.drawer-cerrar { border: 0; background: none; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 4px 8px; }
.drawer-items { flex: 1; overflow-y: auto; padding: 10px 18px; display: flex; flex-direction: column; gap: 14px; }
.drawer-vacio { color: var(--muted); text-align: center; margin-top: 46px; font-size: 14px; }
.item { display: flex; gap: 12px; align-items: center; }
.item-foto {
  width: 54px; height: 54px; border-radius: 10px; background: #fff; border: 1px solid var(--line);
  display: grid; place-items: center; padding: 4px; flex-shrink: 0; overflow: hidden;
}
.item-foto img { max-width: 100%; max-height: 100%; object-fit: contain; }
.item-info { flex: 1; min-width: 0; }
.item-info .t {
  font-size: 13px; font-weight: 600; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.item-info .p { font-size: 13.5px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.item-qty { display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 9px; }
.item-qty button { width: 28px; height: 30px; border: 0; background: none; color: var(--ink); font-size: 16px; cursor: pointer; }
.item-qty span { min-width: 22px; text-align: center; font-weight: 700; font-size: 13.5px; }
.drawer-pie { border-top: 1px solid var(--line); padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.envio-barra { background: var(--surface-2); border-radius: 999px; height: 7px; overflow: hidden; }
.envio-barra i { display: block; height: 100%; background: var(--good); border-radius: 999px; transition: width 0.35s; }
.envio-texto { font-size: 12.5px; color: var(--muted); }
.envio-texto.logrado { color: var(--good); font-weight: 700; }
.total-fila { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.total-fila span { font-size: 13.5px; color: var(--muted); }
.total-fila strong { font-size: 21px; font-weight: 900; font-variant-numeric: tabular-nums; }
.total-fila.chica { margin-bottom: -4px; }
.total-fila.chica .monto { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.total-fila.desc span, .total-fila.desc .monto { color: var(--good); font-weight: 700; }
.btn-wa {
  border: 0; border-radius: 12px; background: #22b358; color: #fff; font-weight: 800; font-size: 15px;
  padding: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 9px;
  text-decoration: none; text-align: center;
}
.btn-wa:active { transform: scale(0.98); }
.btn-wa:disabled, .btn-wa.deshabilitado { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.drawer-nota { font-size: 11.5px; color: var(--muted); text-align: center; }
.fab-carrito {
  position: fixed; z-index: 55; left: 14px; right: 14px; bottom: 14px; border: 0; border-radius: 14px;
  background: var(--ink); color: var(--bg); font-weight: 800; font-size: 15px; padding: 15px;
  display: none; align-items: center; justify-content: space-between; cursor: pointer;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px));
}
.fab-carrito .fab-total { font-variant-numeric: tabular-nums; }
@media (max-width: 699px) {
  .fab-carrito.visible { display: flex; }
  /* Con la barra del carrito visible, los flotantes de WhatsApp/volver arriba suben. */
  .whatsapp-flotante { bottom: 84px; }
  .volver-arriba { bottom: 150px; }
}

/* ---- Confirmar pedido (checkout) ---- */
.conf-grid { display: grid; gap: 16px; margin: 10px 0 30px; }
/* El display:grid explícito le gana al atributo hidden (bug real visto probando): al
   confirmar, la grilla se oculta con el atributo y esta regla lo hace valer. */
.conf-grid[hidden] { display: none; }
@media (min-width: 900px) { .conf-grid { grid-template-columns: 1fr 1.1fr; align-items: start; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 14px; font-size: 16px; font-weight: 900; }
.conf-items { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.conf-totales { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.campo-f { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.campo-f label { font-size: 12.5px; font-weight: 700; }
.campo-f label small { color: var(--muted); font-weight: 500; }
.campo-f input, .campo-f textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font: inherit; font-size: 14px; color: var(--ink); width: 100%;
}
.campo-f input:focus, .campo-f textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.campo-f input.falta { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.campo-f .ayuda-error { display: none; font-size: 12px; color: var(--accent); }
.campo-f.con-error .ayuda-error { display: block; }
.cp-fila { display: flex; gap: 8px; }
.cp-fila input { flex: 1; }
.btn-sec {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 10px; padding: 11px 16px; font-weight: 700; font-size: 13.5px; cursor: pointer; flex-shrink: 0;
}
@media (hover: hover) and (pointer: fine) { .btn-sec:hover { border-color: var(--accent); color: var(--accent); } }
.envio-resultado { display: none; border-radius: 10px; padding: 10px 12px; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.envio-resultado.visible { display: block; }
.envio-resultado.ok { background: var(--good-soft); color: var(--good); }
.envio-resultado.aviso { background: var(--surface-2); color: var(--ink); }
.pago-caja { border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; margin-bottom: 14px; background: var(--bg); }
.pago-titulo { font-size: 13.5px; font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pill-web {
  display: inline-block; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent);
  border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 800;
}
.pago-alias {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.pago-alias + .pago-alias { margin-top: 8px; }
.pago-alias .pago-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.pago-alias strong { font-size: 15px; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.pago-nota { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.btn-wa-ancho { width: 100%; }
.conf-nota { display: block; margin: 10px 0 0; }
.conf-error { color: var(--accent); font-size: 13px; font-weight: 600; margin: 0 0 10px; }
.panel-exito { max-width: 560px; margin: 10px auto 30px; }
.exito-texto { margin: 0 0 14px; font-size: 14px; color: var(--muted); line-height: 1.55; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .drawer, .overlay, .envio-barra i { transition: none; }
}
