@import url('../fonts/fonts.css');
/* ==========================================================
   Vitrina · Base compartida (tokens, tipografía, componentes)
   Estilo: "Vibrant & block-based" — bloques de color por categoría,
   tinta casi negra, papel cálido y un acento naranja quemado.
   ========================================================== */

:root {
  --ink: #17171c;
  --ink-2: #2a2a31;
  --paper: #f6f3ed;
  --surface: #ffffff;
  --muted: #ede8df;
  --line: #e2dcd1;
  --line-2: #cfc7b9;
  --text: #17171c;
  --text-2: #57534e;
  --text-3: #78716c;
  --brand: #c2410c;
  --brand-hover: color-mix(in srgb, var(--brand) 80%, #000);
  --brand-soft: color-mix(in srgb, var(--brand) 13%, #fff);
  --accent: #d9f99d; --on-accent: #17171c;
  --lime: var(--accent);
  --ok: #15803d; --ok-soft: #dcfce7;
  --warn: #b45309; --warn-soft: #fef3c7;
  --danger: #dc2626; --danger-soft: #fee2e2;
  --info: #1d4ed8; --info-soft: #dbeafe;
  --violet: #6d28d9; --violet-soft: #ede9fe;
  --teal: #0f766e; --teal-soft: #ccfbf1;

  --font-head: 'Outfit', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Work Sans', 'Segoe UI', system-ui, sans-serif;
  --on-brand: #fff;

  --r-sm: 8px; --r: 14px; --r-lg: 22px; --r-xl: 30px; --r-pill: 999px;
  --sh-1: 0 1px 2px rgba(23,23,28,.06), 0 1px 1px rgba(23,23,28,.04);
  --sh-2: 0 8px 24px -8px rgba(23,23,28,.18);
  --sh-3: 0 24px 60px -18px rgba(23,23,28,.35);
  --ease: cubic-bezier(.2,.8,.2,1);
  --wrap: 1240px;
  --gutter: clamp(16px, 4vw, 32px);
  --z-header: 40; --z-nav: 45; --z-layer: 100; --z-toast: 200;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font-body); font-size: 16px; line-height: 1.55; color: var(--text); background: var(--paper); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.1; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }
.no-scroll { overflow: hidden; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--text-2); }
.small { font-size: .875rem; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--r-sm); z-index: 999; }
.skip:focus { top: 12px; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.ico { flex: none; }

/* ---------- Botones ---------- */
.btn { --bg: var(--surface); --fg: var(--ink); --bd: var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 46px; padding: 0 1.25em;
  border-radius: var(--r-pill); border: 1.5px solid var(--bd); background: var(--bg); color: var(--fg);
  font-family: var(--font-head); font-weight: 600; font-size: 1rem; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .18s var(--ease), color .18s, border-color .18s, transform .12s var(--ease); touch-action: manipulation; }
.btn:hover { --bd: var(--ink); }
.btn:active { transform: scale(.97); }
.btn--primary { --bg: var(--brand); --fg: var(--on-brand); --bd: var(--brand); }
.btn--primary:hover { --bg: var(--brand-hover); --bd: var(--brand-hover); }
.btn--ink { --bg: var(--ink); --fg: #fff; --bd: var(--ink); }
.btn--ink:hover { --bg: var(--ink-2); }
.btn--ghost { --bg: transparent; --bd: transparent; }
.btn--ghost:hover { --bg: var(--muted); --bd: transparent; }
.btn--danger { --bg: var(--danger); --fg: #fff; --bd: var(--danger); }
.btn--wa { --bg: #128c4a; --fg: #fff; --bd: #128c4a; }
.btn--wa:hover { --bg: #0d7139; }
.btn--sm { min-height: 38px; padding: 0 .95em; font-size: .9rem; }
.btn--lg { min-height: 54px; padding: 0 1.6em; font-size: 1.05rem; }
.btn--block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-pill); border: 0; background: transparent; cursor: pointer; position: relative; color: inherit; text-decoration: none; transition: background .18s; }
.icon-btn:hover { background: var(--muted); }
.icon-btn .count { position: absolute; top: 3px; right: 1px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--brand); color: #fff; font: 700 11px/19px var(--font-head); text-align: center; }
.icon-btn .count:empty, .icon-btn .count[data-n="0"] { display: none; }

/* ---------- Formularios ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-weight: 600; font-size: .9rem; }
.req { color: var(--danger); }
.input, .select, .textarea { width: 100%; min-height: 46px; padding: 10px 14px; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--surface); font-size: 16px; transition: border-color .15s, box-shadow .15s; }
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(194,65,12,.18); }
.field.is-invalid .input, .field.is-invalid .select, .field.is-invalid .textarea { border-color: var(--danger); }
.field__error { color: var(--danger); font-size: .85rem; display: none; }
.field.is-invalid .field__error { display: block; }
.field__hint { color: var(--text-3); font-size: .85rem; }
.grid-2 { display: grid; gap: 0 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 36px; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-pill); font: 600 .78rem/1.5 var(--font-head); white-space: nowrap; }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--violet { background: var(--violet-soft); color: var(--violet); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--teal { background: var(--teal-soft); color: var(--teal); }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--ink { background: var(--ink); color: #fff; }
.badge--brand { background: var(--brand); color: var(--on-brand); }
.badge--save { background: var(--lime); color: var(--ink); }
.badge--lime { background: var(--lime); color: var(--ink); }

/* ---------- Estrellas ---------- */
.stars { display: inline-flex; gap: 1px; color: var(--line-2); vertical-align: middle; }
.stars .star.is-on { color: #e8a317; }
.stars .star.is-on svg { fill: currentColor; }

/* ---------- Capas: modal y drawer ---------- */
.layer { position: fixed; inset: 0; z-index: var(--z-layer); }
.layer[hidden] { display: none; }
.layer__scrim { position: absolute; inset: 0; background: rgba(15,15,20,.5); opacity: 0; transition: opacity .22s; }
.layer.is-open .layer__scrim { opacity: 1; }
.drawer__panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--surface); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .28s var(--ease); box-shadow: var(--sh-3); }
.drawer--left .drawer__panel { right: auto; left: 0; transform: translateX(-100%); }
.layer.is-open .drawer__panel { transform: none; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 14px 22px; border-bottom: 1px solid var(--line); }
.drawer__head h2, .drawer__head h3 { margin: 0; font-size: 1.25rem; }
.drawer__body { flex: 1; overflow-y: auto; padding: 18px 22px; overscroll-behavior: contain; }
.drawer__foot { padding: 16px 22px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.modal { display: grid; place-items: center; padding: 16px; }
.modal__box { position: relative; background: var(--surface); border-radius: var(--r-lg); width: min(720px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 24px; box-shadow: var(--sh-3); transform: translateY(14px) scale(.98); opacity: 0; transition: transform .24s var(--ease), opacity .2s; }
.modal__box--sm { width: min(440px, 100%); }
.layer.is-open .modal__box { transform: none; opacity: 1; }
.modal__title { margin-bottom: 8px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.modal__close { position: absolute; top: 12px; right: 12px; }
@media (max-width: 640px) {
  .modal { place-items: end center; padding: 0; }
  .modal__box { border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92dvh; padding-bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateY(40px); }
}

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: var(--z-toast); left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); }
@media (min-width: 900px) { .toasts { bottom: 24px; left: auto; right: 24px; transform: none; } }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--ink); color: #fff; box-shadow: var(--sh-2); animation: toastIn .25s var(--ease); font-size: .95rem; }
.toast--ok svg { color: #86efac; }
.toast--error svg { color: #fca5a5; }
.toast span { flex: 1; }
.toast__btn { background: none; border: 0; color: var(--lime); font-weight: 700; cursor: pointer; padding: 6px; }
.toast.is-out { opacity: 0; transform: translateY(8px); transition: .2s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Varios ---------- */
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line-2); border-radius: var(--r-pill); background: var(--surface); }
.qty button { width: 40px; height: 40px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; border-radius: var(--r-pill); }
.qty button:hover { background: var(--muted); }
.qty input { width: 40px; text-align: center; border: 0; background: none; font-weight: 600; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.empty { text-align: center; padding: 48px 16px; color: var(--text-2); }
.empty .ico { margin: 0 auto 12px; color: var(--text-3); }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row--between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Estilo elegido en el panel (sobrescribe al tema) ---------- */
html[data-corners="rectas"] { --r-sm: 0; --r: 0; --r-lg: 0; --r-xl: 0; }
html[data-corners="suaves"] { --r-sm: 6px; --r: 8px; --r-lg: 12px; --r-xl: 16px; }
html[data-corners="redondas"] { --r-sm: 12px; --r: 18px; --r-lg: 26px; --r-xl: 34px; }
html[data-buttons="pildora"] .btn, html[data-buttons="pildora"] .opt { border-radius: 999px; }
html[data-buttons="redondeado"] .btn, html[data-buttons="redondeado"] .opt { border-radius: 10px; }
html[data-buttons="recto"] .btn, html[data-buttons="recto"] .opt { border-radius: 0; }
html[data-density="compacta"] .pgrid { gap: 8px; }
html[data-density="compacta"] .pcard__body { padding: 8px 10px 10px; }
html[data-density="compacta"] .section { padding: 24px 0; }
html[data-density="amplia"] .pgrid { gap: 28px; }
html[data-density="amplia"] .pcard__body { padding: 18px 20px 20px; }
html[data-density="amplia"] .section { padding: clamp(48px, 8vw, 104px) 0; }
/* Modo de compra sin carrito: pedido por WhatsApp o cotización */
html[data-buy] [data-open="cart"], html[data-buy] .tabbar [data-open="cart"] { display: none !important; }
html[data-buy] .tabbar { grid-template-columns: repeat(4, 1fr); }
.btn--wa-ghost { --bg: transparent; --fg: #128c4a; --bd: #128c4a; }
.price__ask { font-family: var(--font-head); font-weight: 700; }
/* Datos extra del producto */
.pfacts { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.pfact { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--muted); font-size: .85rem; font-weight: 600; }
.pfact .ico { width: 15px; height: 15px; }
.pfact--cond { background: var(--ok-soft); color: var(--ok); }
