/* ============================================================
   Catálogo PureVape — tema claro con los colores del logo
   (violeta, crema y negro)
   ============================================================ */
:root {
  color-scheme: light;
  --bg: #f6f3f8;
  --surface: #ffffff;
  --surface-2: #f3eef6;
  --line: #e9e2ee;

  --ink: #1b1522;
  --ink-2: #5e5668;
  --ink-3: #958ca1;

  --brand: #72308a;
  --brand-2: #8e44ad;
  --brand-soft: #f1e7f6;
  --cream: #efe2b8;
  --cream-ink: #4a3600;
  --wa: #25d366;

  --shadow: 0 1px 2px rgba(27, 21, 34, .05), 0 6px 20px rgba(27, 21, 34, .06);
  --shadow-hover: 0 2px 4px rgba(27, 21, 34, .06), 0 14px 34px rgba(114, 48, 138, .14);

  --r: 18px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --display: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px; line-height: 1.45;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 10px; }
.ico { width: 1.2em; height: 1.2em; flex: none; }

/* ---------- Humo animado de fondo ---------- */
.smoke {
  position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%;
  pointer-events: none; filter: blur(8px);
}

/* ============================================================
   Header
   ============================================================ */
.bar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.bar__inner { max-width: 1180px; margin: 0 auto; padding: 10px 12px 10px; display: grid; gap: 10px; }
.bar__top { display: flex; align-items: center; gap: 10px; min-height: 48px; }

.logo {
  position: relative; flex: none; width: 48px; height: 48px; border-radius: 13px; overflow: hidden;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: .95rem; color: #fff;
  background: var(--brand);
}
.logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.logo.has-img { background: none; border-radius: 0; overflow: visible; color: transparent; }

.bar__title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bar__brand {
  font-family: var(--display); font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; line-height: 1;
  color: var(--ink);
}
.bar__tagline { font-size: .72rem; color: var(--ink-3); white-space: nowrap; }

.search-toggle {
  flex: none; width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center; background: var(--surface-2); color: var(--ink);
}
.search-toggle .ico { width: 20px; height: 20px; }

.search {
  display: none; flex: 1; min-width: 0;
  align-items: center; gap: 8px; height: 44px; padding: 0 6px 0 14px;
  border-radius: 14px; background: var(--surface-2); color: var(--ink-3);
  box-shadow: inset 0 0 0 2px var(--brand);
}
.search input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
  font: inherit; font-size: 16px; color: var(--ink);
}
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button { display: none; }
.search__close { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-2); }

.bar.is-searching .bar__title, .bar.is-searching .search-toggle { display: none; }
.bar.is-searching .search { display: flex; }

.bar__wa { display: none; }

/* Categorías en celular: una fila de iconos, todas visibles */
.chips { display: flex; gap: 4px; }
.chip {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  font-size: .68rem; font-weight: 600; color: var(--ink-2);
}
.chip__ico {
  width: 46px; height: 46px; border-radius: 15px;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-2);
  transition: transform .25s var(--ease), background .2s, color .2s, box-shadow .2s;
}
.chip__ico .ico { width: 22px; height: 22px; stroke-width: 1.7; }
.chip__label { white-space: nowrap; letter-spacing: -.01em; }
.chip:active .chip__ico { transform: scale(.92); }
.chip[aria-pressed="true"] { color: var(--brand); font-weight: 700; }
.chip[aria-pressed="true"] .chip__ico {
  background: var(--brand); color: #fff;
  box-shadow: 0 8px 18px rgba(114, 48, 138, .35);
}
.chip[hidden] { display: none; }

/* Header en computador: marca | buscador | WhatsApp  +  pestañas centradas */
@media (min-width: 860px) {
  .bar__inner { padding: 14px 28px 0; gap: 12px; }
  .bar__top { gap: 24px; min-height: 56px; }
  .logo { width: 56px; height: 56px; }
  .bar__title { flex: none; }
  .bar__brand { font-size: 1.55rem; }
  .bar__tagline { font-size: .78rem; }

  .search {
    display: flex; flex: 1; max-width: 560px; margin: 0 auto; height: 46px;
    box-shadow: inset 0 0 0 1px transparent; transition: box-shadow .2s, background .2s;
  }
  .search:focus-within { background: #fff; box-shadow: inset 0 0 0 2px var(--brand); }
  .search__close, .search-toggle { display: none; }

  .bar__wa {
    flex: none; display: inline-flex; align-items: center; gap: 8px;
    height: 44px; padding: 0 18px; border-radius: 999px;
    font-weight: 700; font-size: .92rem; color: #fff; background: var(--ink);
    transition: background .2s;
  }
  .bar__wa .ico { color: var(--wa); width: 20px; height: 20px; }
  .bar__wa:hover { background: var(--brand); }

  .chips { justify-content: center; gap: 4px; margin: 0 -28px; padding: 0 28px; border-top: 1px solid var(--line); }
  .chip {
    flex: none; flex-direction: row; gap: 8px; position: relative;
    padding: 12px 16px; font-size: .92rem; color: var(--ink-2);
    transition: color .2s;
  }
  .chip__ico { width: auto; height: auto; background: none; border-radius: 0; box-shadow: none !important; color: inherit; }
  .chip__ico .ico { width: 19px; height: 19px; }
  .chip:hover { color: var(--ink); }
  .chip[aria-pressed="true"] { color: var(--brand); }
  .chip[aria-pressed="true"] .chip__ico { background: none; color: var(--brand); }
  .chip::after {
    content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px;
    border-radius: 3px 3px 0 0; background: var(--brand);
    transform: scaleX(0); transition: transform .25s var(--ease);
  }
  .chip[aria-pressed="true"]::after { transform: scaleX(1); }
}

/* ============================================================
   Grid de productos (2 por fila en celular)
   ============================================================ */
.grid {
  position: relative; z-index: 1;
  max-width: 1180px; margin: 0 auto; padding: 14px 12px 110px;
  display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 600px) { .grid { gap: 18px; padding: 20px 16px 110px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 22px; padding: 28px 28px 110px; } }
@media (min-width: 1180px) { .grid { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Tarjeta ---------- */
.card {
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--r); background: var(--surface);
  box-shadow: var(--shadow); border: 1px solid var(--line);
  animation: in .45s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 40ms);
  transition: transform .25s var(--ease), box-shadow .25s;
}
@keyframes in { from { opacity: 0; transform: translateY(10px); } }
@media (hover: hover) {
  .card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
}

.card__media { position: relative; aspect-ratio: 1; background: var(--surface-2); overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; }

.card__body { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 10px 12px 0; }
.card__brand { font-size: .64rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); }
.card__name {
  font-family: var(--display); font-size: 1rem; font-weight: 600; line-height: 1.2; letter-spacing: -.01em;
  margin-top: 2px;
}
.card__variant { font-size: .8rem; color: var(--ink-2); margin-top: 2px; }
.card__desc { display: none; }
.card__price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; margin-top: auto; padding-top: 8px; }

.price { font-family: var(--display); font-size: 1.15rem; font-weight: 700; letter-spacing: -.02em; }
.price--ask { font-family: inherit; font-size: .9rem; font-weight: 600; color: var(--ink-2); }
.price-old { font-size: .8rem; color: var(--ink-3); text-decoration: line-through; }

.btn-wa, .btn-out {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; margin: 10px; padding: 0 12px; border-radius: 12px;
  font-size: .92rem; font-weight: 700; white-space: nowrap;
}
.btn-wa { color: #fff; background: var(--ink); transition: background .2s, transform .15s; }
.btn-wa .ico { color: var(--wa); }
.btn-wa:hover { background: var(--brand); }
.btn-wa:active { transform: scale(.97); }
.btn-wa .lg { display: none; }
.btn-out { color: var(--ink-3); background: var(--surface-2); }

/* Sellos sobre la foto */
.tag, .save {
  position: absolute; top: 8px;
  padding: 3px 9px; border-radius: 999px; font-size: .68rem; font-weight: 700; line-height: 1.4;
}
.tag { left: 8px; max-width: calc(100% - 70px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; background: var(--ink); }
.tag--promo { color: var(--cream-ink); background: var(--cream); }
.tag--out { color: var(--ink-2); background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.save { right: 8px; color: #fff; background: var(--brand); }

.card--promo { border-color: rgba(114, 48, 138, .35); }

.card.is-out .card__media > .art, .card.is-out .card__media > img { opacity: .45; filter: grayscale(1); }
.card.is-out .price { color: var(--ink-3); }

@media (min-width: 600px) {
  .card__body { padding: 14px 16px 0; }
  .card__brand { font-size: .7rem; }
  .card__name { font-size: 1.12rem; }
  .card__variant { font-size: .88rem; }
  .card__desc {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    font-size: .84rem; color: var(--ink-3); margin-top: 6px;
  }
  .price { font-size: 1.35rem; }
  .price-old { font-size: .88rem; }
  .btn-wa, .btn-out { min-height: 46px; margin: 14px; font-size: .95rem; }
  .btn-wa .lg { display: inline; }
  .tag, .save { top: 12px; font-size: .74rem; padding: 4px 10px; }
  .tag { left: 12px; }
  .save { right: 12px; }
}

/* Ilustración cuando el producto no tiene foto */
.art {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 45%, hsl(var(--h) 55% 90%), var(--surface-2) 70%);
  color: hsl(var(--h) 38% 52%);
}
.art .ico { width: 38%; height: 38%; stroke-width: 1.2; }

/* Carga */
.card--skeleton { min-height: 260px; background: var(--surface); animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .5; } }

.empty { grid-column: 1 / -1; text-align: center; color: var(--ink-2); padding: 48px 16px; }

/* ---------- WhatsApp flotante ---------- */
.wa-fab {
  position: fixed; z-index: 30;
  right: max(16px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; background: var(--wa);
  box-shadow: 0 10px 24px rgba(37, 211, 102, .4), 0 2px 6px rgba(0, 0, 0, .12);
  transition: transform .2s var(--ease);
}
.wa-fab .ico { width: 30px; height: 30px; }
.wa-fab:active { transform: scale(.94); }
@media (min-width: 860px) { .wa-fab { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
