/* =========================================================
   Catálogo personalizable — Estampados VOI
   El color de marca se define desde la planilla (--brand)
   ========================================================= */
:root {
  --brand: #111827;
  --brand-ink: #ffffff;      /* texto sobre el color de marca */
  --brand-soft: #f3f4f6;     /* versión suave del color de marca */
  --bg: #fafaf9;
  --surface: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e7e5e4;
  --danger: #dc2626;
  --wa: #25d366;
  --wa-ink: #ffffff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 8px 24px rgb(0 0 0 / .06);
  --shadow-lg: 0 24px 64px rgb(0 0 0 / .18);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --max: 1180px;
  --gutter: 16px;
}

* { box-sizing: border-box; }
:root[data-scheme="dark"] { color-scheme: dark; --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .35); }
:root[data-scheme="dark"] .card { border-color: var(--line); }
:root[data-scheme="dark"] .state__icon { background: rgb(220 38 38 / .18); }
:root[data-scheme="dark"] .sheet__backdrop { background: rgb(0 0 0 / .65); }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }
body.locked { overflow: hidden; }

/* ---------- Carga / error ---------- */
.loader {
  position: fixed; inset: 0; display: grid; place-content: center; gap: 14px;
  text-align: center; color: var(--muted); background: var(--bg); z-index: 50;
}
.loader__spinner {
  width: 36px; height: 36px; margin: 0 auto; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--ink);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.state { max-width: 460px; margin: 18vh auto 0; padding: 0 var(--gutter); text-align: center; }
.state__icon {
  width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 50%;
  display: grid; place-content: center; font-weight: 800; font-size: 24px;
  background: #fee2e2; color: var(--danger);
}
.state h1 { font-size: 22px; margin: 0 0 8px; }
.state p { color: var(--muted); margin: 0; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: var(--max); margin: 0 auto; padding: 10px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand__logo { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; background: var(--brand-soft); }
.brand__initial {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-content: center;
  background: var(--brand); color: var(--brand-ink); font-weight: 800; font-size: 18px; flex: none;
}
.brand__name { font-weight: 800; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { display: flex; gap: 6px; }
.icon-btn {
  position: relative; width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-content: center; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); text-decoration: none;
  transition: background .15s, transform .15s;
}
.icon-btn:hover { background: var(--brand-soft); }
.icon-btn:active { transform: scale(.95); }
.badge {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--brand); color: var(--brand-ink);
  font-size: 11px; font-weight: 800; display: grid; place-content: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.badge.bump { animation: bump .35s ease; }
@keyframes bump { 50% { transform: scale(1.35); } }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 60%),
    linear-gradient(180deg, var(--brand-soft), var(--bg));
}
.hero__inner { max-width: var(--max); margin: 0 auto; padding: 36px var(--gutter) 24px; }
.hero__title { font-size: clamp(28px, 6vw, 46px); line-height: 1.08; letter-spacing: -.03em; margin: 0 0 10px; font-weight: 800; }
.hero__text { max-width: 620px; color: var(--muted); margin: 0; font-size: 16px; white-space: pre-line; }
.hero__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hero__chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink);
}
.hero__chip svg { width: 16px; height: 16px; color: var(--brand); flex: none; }
@media (max-width: 699px) {
  .hero__inner { padding: 26px var(--gutter) 18px; }
  .hero__text { font-size: 15px; }
  .hero__chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 14px calc(var(--gutter) * -1) 0; padding: 0 var(--gutter); }
  .hero__chips::-webkit-scrollbar { display: none; }
  .hero__chip { flex: none; font-size: 12.5px; padding: 5px 11px; }
}

/* ---------- Búsqueda y filtros ---------- */
.main { max-width: var(--max); margin: 0 auto; padding: 8px var(--gutter) 48px; }
.toolbar { display: flex; gap: 10px; margin-top: 8px; }
.search {
  flex: 1; display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 46px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.search svg { color: var(--muted); width: 20px; height: 20px; flex: none; }
.search input::placeholder { color: var(--muted); }
.search input { border: 0; outline: 0; background: transparent; width: 100%; height: 100%; font-size: 15px; }
.sort {
  height: 46px; padding: 0 34px 0 12px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px;
  appearance: none; -webkit-appearance: none; font-size: 14px; font-weight: 600; max-width: 42%;
}
.cats {
  display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 4px; margin: 0 calc(var(--gutter) * -1);
  padding-inline: var(--gutter); scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: none; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 14px; font-weight: 600; color: var(--ink);
  transition: background .15s, color .15s, border-color .15s;
}
.cat:hover { border-color: var(--brand); }
.cat.is-active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.results { color: var(--muted); font-size: 13px; margin: 12px 0 10px; }

/* ---------- Grilla de productos ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; } }

.card {
  position: relative; display: flex; flex-direction: column; text-align: left; padding: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: transform .2s ease, box-shadow .2s ease;
  animation: fadeUp .4s ease both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }
@media (hover: hover) { .card:hover { transform: translateY(-3px); box-shadow: var(--shadow); } }
.card__media { position: relative; aspect-ratio: 4 / 5; background: var(--brand-soft); overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
@media (hover: hover) { .card:hover .card__media img { transform: scale(1.04); } }
.card__tags { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.tag { padding: 4px 9px; border-radius: 8px; font-size: 11px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.tag--sale { background: var(--danger); color: #fff; }
.tag--star { background: var(--brand); color: var(--brand-ink); }
.tag--out { background: rgb(17 24 39 / .82); color: #fff; }
.card.is-out .card__media img { filter: grayscale(.85); opacity: .65; }
.card__body { padding: 12px 12px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card__cat { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.card__name { font-size: 14.5px; font-weight: 700; line-height: 1.3; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__price { margin-top: auto; padding-top: 6px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price { font-weight: 800; font-size: 16px; }
.price--old { font-size: 13px; color: var(--muted); text-decoration: line-through; font-weight: 500; }
.price--ask { font-size: 13px; font-weight: 700; color: var(--brand); }
@media (min-width: 700px) { .card__name { font-size: 15.5px; } .price { font-size: 17px; } }

/* Esqueleto de carga */
.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, var(--line) 0%, var(--surface) 50%, var(--line) 100%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite; aspect-ratio: 4 / 6.2; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty { text-align: center; padding: 48px 0; color: var(--muted); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 50px; padding: 0 20px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 700; font-size: 15px; text-decoration: none; transition: filter .15s, transform .1s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--brand); color: var(--brand-ink); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { background: var(--brand-soft); }
.btn--wa { background: var(--wa); color: var(--wa-ink); }
.btn--wa:hover { filter: brightness(1.05); }
.btn--wa svg { width: 20px; height: 20px; }
.btn--grow { flex: 1; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; color: var(--muted); font-size: 13px; text-decoration: underline; padding: 8px; margin: 4px auto 0; display: block; }

/* ---------- WhatsApp flotante ---------- */
.wa-float {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 15;
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-content: center;
  background: var(--wa); color: #fff; box-shadow: 0 10px 30px rgb(37 211 102 / .45);
  transition: transform .2s;
}
.wa-float:hover { transform: scale(1.06); }
.wa-float svg { width: 30px; height: 30px; }

/* ---------- Paneles (producto y carrito) ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet__backdrop { position: absolute; inset: 0; background: rgb(15 23 42 / .5); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet__panel {
  position: relative; background: var(--surface); width: 100%; max-height: 92vh; overflow-y: auto;
  border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg);
  animation: slideUp .28s cubic-bezier(.2,.8,.2,1);
  padding-bottom: env(safe-area-inset-bottom);
  overscroll-behavior: contain;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } }
.sheet__close {
  position: absolute; top: 12px; right: 12px; z-index: 3; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--ink); display: grid; place-content: center; box-shadow: var(--shadow);
}
.sheet__close--inline { position: static; box-shadow: none; background: var(--brand-soft); }

@media (min-width: 820px) {
  .sheet { align-items: center; padding: 24px; }
  .sheet__panel--product { max-width: 980px; border-radius: 24px; max-height: 88vh; }
  .sheet--side { justify-content: flex-end; padding: 0; }
  .sheet--side .sheet__panel { max-width: 420px; height: 100vh; max-height: none; border-radius: 0; animation: slideLeft .28s cubic-bezier(.2,.8,.2,1); }
}
@keyframes slideLeft { from { transform: translateX(40px); opacity: 0; } }

/* Producto */
.product { display: grid; }
@media (min-width: 820px) { .product { grid-template-columns: 1.05fr 1fr; } }
.gallery { position: relative; background: var(--brand-soft); }
.gallery__track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; aspect-ratio: 4 / 4.4;
}
@media (min-width: 820px) { .gallery__track { aspect-ratio: auto; height: 100%; max-height: 88vh; } }
.gallery__track::-webkit-scrollbar { display: none; }
.gallery__track img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: start; }
.gallery__dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.gallery__dots button { width: 8px; height: 8px; padding: 0; border-radius: 4px; border: 0; background: rgb(255 255 255 / .6); transition: width .2s, background .2s; }
.gallery__dots button.is-active { width: 22px; background: #fff; }
.product__info { padding: 22px 20px 24px; display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 820px) { .product__info { padding: 36px 32px; } }
.product__cat { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.product__name { margin: -8px 0 0; font-size: 24px; line-height: 1.2; letter-spacing: -.02em; }
.product__price { display: flex; align-items: baseline; gap: 10px; }
.product__price .price { font-size: 26px; }
.product__desc { margin: 0; color: color-mix(in srgb, var(--ink) 75%, var(--bg)); white-space: pre-line; }
.option__label { margin: 0 0 8px; font-size: 13px; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-width: 46px; height: 42px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); font-weight: 600; font-size: 14px; transition: all .15s;
}
.chip:hover { border-color: var(--ink); }
.chip.is-active { border-color: var(--brand); background: var(--brand); color: var(--brand-ink); }
.option__error { margin: -4px 0 0; color: var(--danger); font-size: 13px; font-weight: 600; }
.product__buy { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
@media (max-width: 819px) {
  .product__info { padding-bottom: 0; }
  .product__buy {
    position: sticky; bottom: 0; z-index: 2; margin: 4px -20px 0; padding: 12px 20px calc(14px + env(safe-area-inset-bottom));
    background: var(--surface); box-shadow: 0 -8px 24px rgb(0 0 0 / .06); border-top: 1px solid var(--line);
  }
}
.product__actions { display: flex; gap: 10px; }
.qty { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 14px; height: 50px; }
.qty button { width: 44px; height: 100%; border: 0; background: none; font-size: 20px; }
.qty span { min-width: 24px; text-align: center; font-weight: 700; }

/* Carrito */
.sheet__panel--cart { display: flex; flex-direction: column; }
.cart__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.cart__head h2 { margin: 0; font-size: 20px; }
.cart__body { padding: 8px 20px; flex: 1; }
.cart__empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.line { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: center; }
.line img { width: 64px; height: 76px; border-radius: 10px; object-fit: cover; background: var(--brand-soft); }
.line__name { font-weight: 700; font-size: 14px; margin: 0; line-height: 1.3; }
.line__meta { font-size: 12.5px; color: var(--muted); margin: 2px 0 6px; }
.line .qty { height: 34px; border-radius: 10px; width: fit-content; }
.line .qty button { width: 32px; font-size: 16px; }
.line__price { font-weight: 800; font-size: 14px; text-align: right; }
.line__remove { display: block; margin-top: 6px; background: none; border: 0; color: var(--muted); font-size: 12px; text-decoration: underline; padding: 0; margin-left: auto; }
.cart__foot { padding: 16px 20px 20px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; background: var(--surface); position: sticky; bottom: 0; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.field input, .field textarea {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 15px; font-weight: 400; resize: vertical; outline: 0;
  background: var(--bg); color: var(--ink);
}
.field input:focus, .field textarea:focus { border-color: var(--brand); }
.cart__total { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.cart__total strong { font-size: 22px; }

/* ---------- Pie ---------- */
.footer { border-top: 1px solid var(--line); background: var(--surface); padding-bottom: 80px; }
.footer__inner { max-width: var(--max); margin: 0 auto; padding: 28px var(--gutter); display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; }
.footer p { margin: 4px 0 0; color: var(--muted); font-size: 14px; white-space: pre-line; }
.footer__credit { font-size: 12px !important; }
.footer__credit a { color: inherit; }

/* ---------- Aviso ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600;
  z-index: 60; box-shadow: var(--shadow-lg); animation: slideUp .25s ease; max-width: calc(100% - 32px);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
