/* Tienda pública — mobile-first. Los colores de marca llegan como --brand / --accent desde Ajustes. */
:root {
  --brand: #d6336c;
  --brand-ink: #fff;
  --accent: #1f2937;
  --bg: #fff8f4;
  --surface: #fff;
  --ink: #1d1a1f;
  --ink-2: #5b5560;
  --ink-3: #8c8590;
  --line: #f0e6e1;
  --ok: #16834f;
  --wa: #1fa855;
  --sold: #6b6670;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(40, 20, 30, .05), 0 6px 18px rgba(40, 20, 30, .06);
  --font: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--ink); background: var(--bg); }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); font-weight: 900; }
h2 { font-size: clamp(1.25rem, 3.2vw, 1.6rem); font-weight: 800; }
h3 { font-size: 1rem; font-weight: 800; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1rem; }
.muted { color: var(--ink-3); }
.small { font-size: .88rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, white); outline-offset: 2px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .7rem 1.15rem; border-radius: 999px; border: 2px solid transparent;
  font: inherit; font-weight: 800; font-size: .95rem; line-height: 1; cursor: pointer; text-decoration: none;
  background: var(--brand); color: var(--brand-ink); transition: transform .08s ease, filter .15s;
}
.btn:hover { filter: brightness(.95); }
.btn:active { transform: scale(.98); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); filter: none; }
.btn-dark { background: var(--accent); color: #fff; }
.btn-sm { padding: .5rem .8rem; font-size: .85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 2.6rem; height: 2.6rem; padding: 0; border-radius: 50%; }

/* ---------- Encabezado ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: .75rem; min-height: 64px; }
.logo { display: flex; align-items: center; gap: .55rem; text-decoration: none; font-weight: 900; font-size: 1.15rem; color: var(--ink); }
.logo img { height: 42px; width: auto; border-radius: 12px; }
.header-search { flex: 1; display: none; }
.search-field { position: relative; width: 100%; }
.search-field input {
  width: 100%; padding: .7rem 1rem .7rem 2.6rem; border-radius: 999px; border: 2px solid var(--line);
  background: var(--surface); font: inherit; color: var(--ink);
}
.search-field input:focus { border-color: var(--brand); outline: none; }
.search-field .icon { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.header-actions { margin-left: auto; display: flex; gap: .4rem; align-items: center; }
.list-btn { position: relative; background: var(--surface); color: var(--ink); border: 2px solid var(--line); }
.list-count { position: absolute; top: -4px; right: -4px; min-width: 1.3rem; height: 1.3rem; padding: 0 .3rem; border-radius: 999px; background: var(--brand); color: #fff; font-size: .72rem; display: grid; place-items: center; font-weight: 900; }
.mobile-search { padding: 0 0 .75rem; }
@media (min-width: 800px) {
  .header-search { display: block; max-width: 520px; margin: 0 auto; }
  .mobile-search { display: none; }
}

.cat-nav { display: flex; gap: .5rem; overflow-x: auto; padding: .25rem 0 .9rem; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.cat-nav::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .9rem; border-radius: 999px;
  background: var(--surface); border: 2px solid var(--line); text-decoration: none; font-weight: 700; font-size: .9rem; color: var(--ink-2); white-space: nowrap; cursor: pointer;
}
.chip:hover, .chip.is-active { border-color: var(--brand); color: var(--brand); }
.chip.is-active { background: color-mix(in srgb, var(--brand) 10%, white); }
.chip[disabled], .chip.is-unavailable { opacity: .45; text-decoration: line-through; }
.swatch { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); display: inline-block; }

/* ---------- Portada ---------- */
.hero { padding: 2rem 0 1.5rem; }
.hero-card {
  position: relative; overflow: hidden; border-radius: 28px; padding: 2rem 1.5rem;
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #ff9f43));
  color: #fff; box-shadow: var(--shadow);
}
.hero-card h1 { color: #fff; max-width: 18ch; }
.hero-card p { max-width: 46ch; font-size: 1.05rem; opacity: .95; }
.hero-card .btn { background: #fff; color: var(--brand); }
.hero-card .btn-wa { background: var(--wa); color: #fff; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.hero-deco { position: absolute; right: -30px; bottom: -40px; font-size: 9rem; opacity: .18; transform: rotate(-12deg); pointer-events: none; }
@media (min-width: 800px) { .hero-card { padding: 3rem; } .hero-deco { font-size: 14rem; right: 20px; } }

.section { padding: 1.25rem 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.section-head a { font-weight: 800; color: var(--brand); text-decoration: none; white-space: nowrap; }

.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.cat-tile { display: flex; flex-direction: column; justify-content: flex-end; min-height: 92px; padding: 1rem; border-radius: var(--radius); background: var(--surface); border: 2px solid var(--line); text-decoration: none; font-weight: 800; box-shadow: var(--shadow); }
.cat-tile:hover { border-color: var(--brand); }
.cat-tile small { color: var(--ink-3); font-weight: 600; }
@media (min-width: 640px) { .cat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .cat-grid { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Tarjetas de producto ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; } }
@media (min-width: 1040px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card { position: relative; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--line); }
.card-media { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: #fbefe9; }
.card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card.is-sold-out .card-media img { filter: grayscale(.7); opacity: .7; }
.badges { position: absolute; top: .5rem; left: .5rem; display: flex; flex-wrap: wrap; gap: .3rem; }
.badge { display: inline-block; padding: .2rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 900; letter-spacing: .02em; text-transform: uppercase; background: var(--accent); color: #fff; }
.badge-sold { background: var(--sold); }
.badge-new { background: var(--ok); }
.badge-sale { background: var(--brand); }
.flag { display: inline-block; padding: .15rem .5rem; border-radius: 6px; font-size: .72rem; font-weight: 800; color: #fff; background: #6b7280; }
.card-body { display: flex; flex-direction: column; gap: .35rem; padding: .75rem .8rem .85rem; flex: 1; }
.card-title { font-size: .95rem; font-weight: 800; line-height: 1.25; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-title::after { content: ""; position: absolute; inset: 0; } /* toda la tarjeta es clicable */
.card-cat { font-size: .75rem; color: var(--ink-3); font-weight: 700; }
.price { font-weight: 900; font-size: 1.1rem; color: var(--ink); }
.price-old { color: var(--ink-3); text-decoration: line-through; font-weight: 600; font-size: .85rem; margin-left: .3rem; }
.price-from { font-size: .75rem; color: var(--ink-3); font-weight: 700; }
.tier-hint { font-size: .78rem; color: var(--ok); font-weight: 800; }
.card-flags { display: flex; flex-wrap: wrap; gap: .25rem; }
.card-actions { display: flex; gap: .4rem; margin-top: auto; padding-top: .35rem; position: relative; z-index: 2; }
.card-actions .btn { flex: 1; padding: .55rem .6rem; font-size: .82rem; }

/* ---------- Catálogo ---------- */
.catalog-layout { display: grid; gap: 1rem; }
.filters-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.filters-panel h3 { margin-top: .5rem; }
.filters-panel label { display: flex; align-items: center; gap: .45rem; font-weight: 700; font-size: .92rem; margin: .35rem 0; cursor: pointer; }
.filters-panel input[type=number], .filters-panel select { width: 100%; padding: .55rem .7rem; border-radius: var(--radius-sm); border: 2px solid var(--line); font: inherit; background: #fff; }
.price-range { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; margin-bottom: .9rem; }
.toolbar select { padding: .5rem .8rem; border-radius: 999px; border: 2px solid var(--line); font: inherit; font-weight: 700; background: var(--surface); }
.filters-toggle { display: inline-flex; }
.active-filters { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.active-filters a { text-decoration: none; }
@media (min-width: 900px) {
  .catalog-layout { grid-template-columns: 250px minmax(0, 1fr); align-items: start; }
  .filters-panel { position: sticky; top: 90px; display: block !important; }
  .filters-toggle { display: none; }
}
.breadcrumbs { font-size: .85rem; color: var(--ink-3); margin: 1rem 0 .4rem; }
.breadcrumbs a { color: var(--ink-3); text-decoration: none; }
.breadcrumbs a:hover { color: var(--brand); }
.empty-state { text-align: center; padding: 3rem 1rem; background: var(--surface); border-radius: var(--radius); border: 1px dashed var(--line); }
.pagination { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; margin: 1.5rem 0; }
.pagination a, .pagination span { min-width: 2.4rem; padding: .5rem .8rem; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); text-align: center; text-decoration: none; font-weight: 800; }
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Ficha de producto ---------- */
.product { display: grid; gap: 1.25rem; padding-bottom: 2rem; }
@media (min-width: 900px) { .product { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 2.5rem; align-items: start; } }
.gallery-main { aspect-ratio: 1 / 1; border-radius: 24px; overflow: hidden; background: #fbefe9; box-shadow: var(--shadow); position: relative; }
.gallery-main img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumbs { display: flex; gap: .5rem; margin-top: .6rem; overflow-x: auto; }
.thumbs button { flex: 0 0 64px; height: 64px; padding: 0; border-radius: 12px; overflow: hidden; border: 2px solid transparent; background: none; cursor: pointer; }
.thumbs button.is-active { border-color: var(--brand); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.product-info h1 { margin-top: .25rem; }
.product-price { display: flex; align-items: baseline; gap: .5rem; margin: .5rem 0 1rem; }
.product-price .price { font-size: 1.8rem; }
.option-group { margin: 1rem 0; }
.option-group .label { font-weight: 800; margin-bottom: .45rem; display: block; }
.options { display: flex; flex-wrap: wrap; gap: .45rem; }
.presentations { display: grid; gap: .4rem; }
.presentation { display: flex; align-items: center; gap: .6rem; padding: .65rem .8rem; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; }
.presentation:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, white); }
.presentation .p-price { margin-left: auto; font-weight: 900; }
.tiers { margin: .75rem 0; padding: .75rem .9rem; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--ok) 9%, white); color: #0f5e38; font-weight: 700; font-size: .92rem; }
.tiers ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.notices { display: grid; gap: .4rem; margin: 1rem 0; }
.notice { display: flex; gap: .55rem; align-items: flex-start; padding: .6rem .8rem; border-radius: var(--radius-sm); background: var(--surface); border-left: 5px solid #6b7280; font-size: .92rem; }
.qty-row { display: flex; gap: .6rem; align-items: center; margin: 1rem 0; flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: center; border: 2px solid var(--line); border-radius: 999px; background: var(--surface); }
.stepper button { width: 2.5rem; height: 2.5rem; border: 0; background: none; font-size: 1.2rem; font-weight: 900; cursor: pointer; color: var(--ink); }
.stepper input { width: 3rem; border: 0; text-align: center; font: inherit; font-weight: 800; background: transparent; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.buy-actions { display: grid; gap: .55rem; }
@media (min-width: 480px) { .buy-actions { grid-template-columns: 1fr 1fr; } }
.availability { font-weight: 800; font-size: .92rem; }
.availability.is-out { color: var(--sold); }
.availability.is-in { color: var(--ok); }
.description { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--ink-2); white-space: pre-line; }
.sku { font-size: .8rem; color: var(--ink-3); }

/* ---------- Mi lista ---------- */
.list-items { display: grid; gap: .6rem; }
.list-item { display: grid; grid-template-columns: 64px 1fr auto; gap: .75rem; align-items: center; padding: .65rem; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); }
.list-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; background: #fbefe9; }
.list-item .name { font-weight: 800; line-height: 1.2; }
.list-item .meta { font-size: .85rem; color: var(--ink-3); }
.list-summary { margin-top: 1rem; padding: 1rem; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); }
.list-summary .total { display: flex; justify-content: space-between; font-weight: 900; font-size: 1.2rem; margin-bottom: .75rem; }
.link { background: none; border: 0; color: var(--brand); font: inherit; font-weight: 800; cursor: pointer; padding: 0; }

/* ---------- Pie y WhatsApp flotante ---------- */
.site-footer { margin-top: 2rem; padding: 2rem 0 5rem; background: var(--accent); color: #f3eef0; }
.site-footer a { color: #fff; }
.footer-grid { display: grid; gap: 1.25rem; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; } .site-footer { padding-bottom: 2rem; } }
.site-footer h3 { color: #fff; }
.socials { display: flex; gap: .6rem; flex-wrap: wrap; }
.fab-wa { position: fixed; right: 1rem; bottom: 1rem; z-index: 50; width: 3.6rem; height: 3.6rem; border-radius: 50%; display: grid; place-items: center; background: var(--wa); color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.25); text-decoration: none; font-size: 1.7rem; }
.toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%) translateY(200%); opacity: 0; pointer-events: none; z-index: 60; padding: .75rem 1.1rem; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 800; box-shadow: var(--shadow); transition: transform .25s ease; }
.toast.is-visible { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast:empty { display: none; }

/* ---------- Página de error ---------- */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.error-box { max-width: 520px; text-align: center; background: var(--surface); padding: 2rem; border-radius: 24px; box-shadow: var(--shadow); }
.error-code { font-size: 4rem; font-weight: 900; color: var(--brand); margin: 0; }
.error-details { text-align: left; font-size: .75rem; overflow: auto; max-height: 50vh; background: #111; color: #eee; padding: 1rem; border-radius: 12px; }
