/* Dicart — estilo de la tienda (mismo look que el tema Horizon de la tienda Shopify):
   Inter, fondo blanco, texto negro 81 %, barra de avisos beige, botones negros con esquinas de 14px.
   El panel /admin reutiliza estos tokens. */
:root {
  --paper: #ffffff;
  --card: #ffffff;
  --ink: #303030;            /* rgba(0,0,0,.81) sobre blanco */
  --heading: #000000;
  --muted: #6b6b6b;
  --line: #e6e6e6;
  --input: #dfdfdf;
  --soft: #f5f5f5;           /* fondo de fotos */
  --sand: #f5f0e8;           /* barra de avisos y botón WhatsApp */
  --sand-ink: #4a2e1a;
  --black: #000000;
  --accent: #000000;
  --accent-ink: #ffffff;
  --accent-soft: #f5f0e8;
  --wa: #1f7a46;
  --shadow: 0 12px 40px -12px rgba(0, 0, 0, .25);

  --display: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --r: 14px;
  --gutter: 40px;
  color-scheme: light;
}
@media (max-width: 749px) { :root { --gutter: 16px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.6 var(--body); -webkit-font-smoothing: antialiased; }
img, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }
h1, h2, h3 { color: var(--heading); font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }

.wrap { max-width: 1600px; margin-inline: auto; padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px)); }

.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; padding: 0;
  border-radius: 999px; color: var(--heading); flex: none; position: relative;
}
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--soft); }
.link-btn { border: 0; background: none; padding: 6px 0; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

/* ── Barra de avisos ─────────────────────────────────── */
.announce {
  background: var(--sand); color: var(--sand-ink); min-height: 43px;
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  padding-inline: max(calc(var(--gutter) - 14px), env(safe-area-inset-left, 0px));
}
.ann-text { margin: 0; text-align: center; font-size: 14px; line-height: 1.35; padding: 8px 0; }
.ann-text b { font-weight: 600; }
.ann-arrow { border: 0; background: none; width: 44px; height: 40px; display: grid; place-items: center; color: var(--sand-ink); padding: 0; }
.ann-arrow svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 749px) { .ann-text { font-size: 12.5px; } }

/* ── Encabezado ─────────────────────────────────────── */
.site-head { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid transparent; transition: border-color .2s; }
.site-head.scrolled { border-bottom-color: var(--line); }
.head-row {
  max-width: 1600px; margin-inline: auto; min-height: 66px;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px;
  padding: 6px max(calc(var(--gutter) - 10px), env(safe-area-inset-right, 0px)) 6px max(var(--gutter), env(safe-area-inset-left, 0px));
}
.logo { display: block; line-height: 0; }
.logo img { height: 36px; width: auto; }
.menu-btn { display: none; }
.main-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; }
.main-nav a { text-decoration: none; font-size: 15px; color: var(--ink); padding: 4px 0; white-space: nowrap; border-bottom: 1px solid transparent; }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--heading); border-bottom-color: currentColor; }
.head-icons { display: flex; align-items: center; gap: 2px; }
.cart-count {
  position: absolute; top: 3px; right: 1px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px; background: var(--black); color: #fff; border: 2px solid var(--paper);
  font-size: 10.5px; font-weight: 600; display: grid; place-items: center; font-variant-numeric: tabular-nums; line-height: 1;
}
@media (max-width: 1099px) {
  .head-row { grid-template-columns: 1fr auto 1fr; gap: 8px; padding-left: max(calc(var(--gutter) - 10px), env(safe-area-inset-left, 0px)); }
  .menu-btn { display: grid; justify-self: start; }
  .main-nav { display: none; }
  .logo { justify-self: center; }
  .head-icons { justify-self: end; }
}
@media (max-width: 749px) { .head-row { min-height: 58px; } .logo img { height: 32px; } }

.search-bar {
  max-width: 1600px; margin-inline: auto; display: flex; align-items: center; gap: 14px;
  padding: 0 max(var(--gutter), env(safe-area-inset-right, 0px)) 14px max(var(--gutter), env(safe-area-inset-left, 0px));
}
.search-field {
  flex: 1; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px;
  border: 1px solid var(--input); border-radius: var(--r); background: var(--paper);
}
.search-field svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; flex: none; }
.search-field input { border: 0; outline: none; background: transparent; width: 100%; min-width: 0; font-size: 16px; }

/* Menú del teléfono */
.menu-drawer {
  width: min(380px, 88vw); height: 100%; max-height: 100%; margin: 0 auto 0 0; padding: 0;
  border: 0; background: var(--paper); color: var(--ink);
}
.menu-drawer::backdrop, .drawer::backdrop { background: rgba(0, 0, 0, .35); }
.menu-inner { padding: calc(10px + env(safe-area-inset-top, 0px)) 20px calc(20px + env(safe-area-inset-bottom, 0px)); }
.menu-drawer .logo img { height: 34px; }
.menu-links { display: grid; margin-top: 10px; }
.menu-links a { text-decoration: none; font-size: 18px; font-weight: 500; color: var(--heading); padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.menu-links a small { color: var(--muted); font-weight: 400; font-size: 14px; }
.menu-links a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }

/* ── Hero ───────────────────────────────────────────── */
.hero { position: relative; height: clamp(380px, 29vw, 520px); overflow: hidden; background: #b9b5ae; color: #fff; }
.hero-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; max-width: none; }
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(18, 18, 18, .4), rgba(18, 18, 18, 0)); }
.hero-content { position: relative; height: 100%; display: grid; place-content: center; justify-items: center; gap: 24px; text-align: center; padding: 24px var(--gutter); }
.hero h2 { color: #fff; font-size: clamp(36px, 4.2vw, 56px); margin: 0; letter-spacing: -.02em; text-shadow: 0 1px 24px rgba(0, 0, 0, .12); }
.btn-outline-light {
  display: inline-flex; align-items: center; min-height: 54px; padding: 16px 24px; border-radius: var(--r);
  border: 1px solid rgba(255, 255, 255, .85); color: #fff; text-decoration: none; font-size: 14px; transition: background .2s, color .2s;
}
.btn-outline-light:hover { background: #fff; color: var(--black); }
@media (max-width: 749px) { .hero { height: 440px; } }

/* ── Secciones y grilla de productos ────────────────── */
.section { padding-top: 48px; padding-bottom: 8px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.sec-head h2 { font-size: 24px; margin: 0; }
.view-all { font-size: 14px; color: var(--ink); text-decoration: none; }
.view-all:hover { text-decoration: underline; text-underline-offset: 3px; }

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px 12px; padding-bottom: 40px; }
@media (max-width: 989px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 749px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 8px; } }
.empty { color: var(--muted); grid-column: 1 / -1; padding: 30px 0; }

.collection { padding-top: 36px; min-height: 60vh; }
.coll-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 24px; }
.coll-head h1 { font-size: clamp(28px, 3vw, 40px); margin: 0; }
.count { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }

/* Foto con inicial de respaldo */
.ph { position: relative; overflow: hidden; display: block; background: var(--soft); }
.ph::before {
  content: attr(data-initial); position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--display); font-weight: 600; font-size: clamp(36px, 8vw, 64px); color: rgba(0, 0, 0, .12);
}
.ph > img { position: relative; width: 100%; height: 100%; object-fit: cover; }
.ph > img[data-broken] { visibility: hidden; }

/* Tarjeta */
.card { position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card-img { position: relative; }
.card-media { position: relative; display: block; border: 0; padding: 0; width: 100%; aspect-ratio: 4 / 5; cursor: pointer; text-decoration: none; }
.card-media img { transition: transform .6s ease, opacity .3s; }
.card-media .alt-img { position: absolute; inset: 0; opacity: 0; }
@media (hover: hover) {
  .card:hover .card-media .alt-img { opacity: 1; }
}
.badge {
  position: absolute; top: 10px; right: 10px; z-index: 1; border-radius: 100px; padding: 4px 10px;
  font-size: 13px; line-height: 1.2; background: #fff; color: var(--ink);
}
.card-add {
  position: absolute; z-index: 2; right: 10px; bottom: 10px;
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 50px;
  border: 0; background: #fff; color: var(--ink); font-size: 14px; box-shadow: 0 2px 10px rgba(0, 0, 0, .1);
  opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s;
}
.card-add svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
@media (hover: hover) { .card:hover .card-add, .card-add:focus-visible { opacity: 1; transform: none; } }
@media (hover: none) {
  .card-add { opacity: 1; transform: none; width: 36px; padding: 0; justify-content: center; }
  .card-add span { display: none; }
}
.card-body { display: grid; gap: 2px; min-width: 0; }
.card-title {
  border: 0; background: none; padding: 0; text-align: left; font-size: 14px; line-height: 1.6; color: var(--ink);
  overflow-wrap: anywhere; text-decoration: none; cursor: pointer;
}
.card-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.price { display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline; font-variant-numeric: tabular-nums; margin: 0; font-weight: 500; font-size: 14px; color: var(--ink); }
.price s { color: var(--muted); font-weight: 400; font-size: 13px; }
.price .ask { color: var(--muted); font-weight: 400; }
.bs { margin: 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.card.sold-out .card-media img { opacity: .6; }

/* ── Página de producto ─────────────────────────────── */
.product { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 48px; padding-top: 32px; padding-bottom: 64px; align-items: start; }
.gallery { display: grid; gap: 10px; min-width: 0; }
.gallery-main { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.gallery-main .ph { aspect-ratio: 4 / 5; }
.gallery-main .ph:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
.gallery-dots { display: none; }
.pinfo { position: sticky; top: 90px; display: grid; gap: 16px; min-width: 0; }
.pinfo h1 { font-size: 32px; margin: 0; overflow-wrap: anywhere; }
.pinfo .price { font-size: 14px; font-weight: 400; }
.pinfo .price .now { font-size: 16px; }
.pinfo .bs { font-size: 13px; margin-top: -10px; }
.pinfo hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.opt-label { font-size: 14px; margin: 0 0 8px; color: var(--ink); }
.opt-label b { font-weight: 500; }
.opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.opt {
  min-height: 46px; padding: 6px 10px; border-radius: var(--r); border: 1px solid rgba(0, 0, 0, .13); background: #fff;
  color: rgba(0, 0, 0, .6); font-size: 14px; line-height: 1.2; transition: border-color .15s;
}
.opt:hover { border-color: var(--black); color: var(--black); }
.opt[aria-pressed="true"] { background: var(--black); color: #fff; border-color: var(--black); }
.opt.unavailable { background-image: linear-gradient(to top right, transparent calc(50% - .5px), rgba(0, 0, 0, .18) 50%, transparent calc(50% + .5px)); color: rgba(0, 0, 0, .4); }
.opt.unavailable[aria-pressed="true"] { background-color: var(--black); color: rgba(255, 255, 255, .7); }
.buy-row { display: grid; grid-template-columns: 126px 1fr; gap: 8px; }
.qty {
  display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; height: 52px;
  border: 1px solid var(--input); border-radius: var(--r); background: rgba(255, 255, 255, .78); color: #333;
}
.qty button { border: 0; background: none; height: 100%; font-size: 18px; color: #333; }
.qty output { text-align: center; font-variant-numeric: tabular-nums; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; width: 100%;
  padding: 0 20px; border-radius: var(--r); border: 1px solid transparent; font-size: 14px; text-decoration: none;
  transition: background .2s, border-color .2s;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--black); color: #fff; }
.btn.primary:hover { background: #333; }
.btn.primary:disabled { background: #c9c9c9; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--black); border-color: var(--black); width: auto; min-height: 44px; }
.btn.secondary:hover { background: #fafafa; }
.btn.wa-buy { background: var(--sand); color: #333; font-size: 16px; font-weight: 600; border-radius: 4px; min-height: 54px; }
.btn.wa-buy:hover { background: #ede5d8; }
.btn[aria-busy="true"] { opacity: .7; pointer-events: none; }
.pd-desc { margin: 0; white-space: pre-line; color: var(--ink); }
.pd-meta { color: var(--muted); font-size: 13px; margin: 0; }
.pd-meta a { color: var(--ink); }
@media (max-width: 989px) {
  .product { grid-template-columns: 1fr; gap: 20px; padding-top: 0; }
  .wrap.product { padding-inline: 0; }
  .pinfo { position: static; padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px)); }
  .pinfo h1 { font-size: 26px; }
  .gallery-main { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 0; scrollbar-width: none; }
  .gallery-main::-webkit-scrollbar { display: none; }
  .gallery-main .ph { flex: 0 0 100%; scroll-snap-align: center; }
  .gallery-dots { display: flex; justify-content: center; gap: 6px; }
  .gallery-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(0, 0, 0, .2); }
  .gallery-dots i.on { background: var(--black); }
}

/* ── Carrito ────────────────────────────────────────── */
dialog { color: var(--ink); }
.drawer {
  width: min(440px, 100%); height: 100%; max-height: 100%; margin: 0 0 0 auto; padding: 0; border: 0;
  background: var(--paper); box-shadow: var(--shadow); max-width: 100%;
}
.drawer-inner {
  height: 100%; display: flex; flex-direction: column; gap: 16px; overflow-y: auto;
  padding: calc(14px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) 20px;
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.drawer-head h2 { font-size: 20px; margin: 0; }
.cart-title-count { color: var(--muted); font-weight: 400; font-size: 14px; }
#cart-view { display: flex; flex-direction: column; gap: 16px; flex: 1; }
.lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.line { display: grid; grid-template-columns: 76px 1fr auto; gap: 14px; align-items: start; }
.line-img { width: 76px; aspect-ratio: 4 / 5; }
.line-img::before { font-size: 24px !important; }
.line-info { min-width: 0; display: grid; gap: 6px; }
.line-info b { font-weight: 500; overflow-wrap: anywhere; color: var(--heading); }
.line-info small { color: var(--muted); font-size: 13px; }
.line .qty { height: 38px; width: 112px; grid-template-columns: 34px 1fr 34px; border-radius: 10px; }
.line .qty button { font-size: 16px; }
.line-price { font-variant-numeric: tabular-nums; text-align: right; display: grid; gap: 6px; justify-items: end; font-weight: 500; }
.remove { border: 0; background: none; color: var(--muted); font-size: 12.5px; text-decoration: underline; padding: 0; }
.cart-empty { display: grid; gap: 16px; justify-items: center; text-align: center; padding: 40px 0; color: var(--heading); font-size: 18px; }
.cart-empty .btn { width: auto; }
.cart-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 16px; display: grid; gap: 10px; }
.total-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; color: var(--heading); }
.total-row b { font-variant-numeric: tabular-nums; font-size: 17px; font-weight: 600; }
.total-bs { text-align: right; margin-top: -8px !important; font-variant-numeric: tabular-nums; }
.fine { color: var(--muted); font-size: 13px; margin: 0; }

.checkout { display: grid; gap: 14px; }
.back { justify-self: start; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--heading); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; border: 1px solid var(--input); background: #fff; border-radius: 10px; padding: 11px 14px; font-size: 16px;
}
.field textarea { min-height: 72px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--black); outline-offset: -1px; }
.field input[aria-invalid="true"] { border-color: #b3261e; }
.form-error { color: #b3261e; font-weight: 500; font-size: 14px; margin: 0; }
.sent { display: grid; gap: 10px; background: var(--sand); color: var(--sand-ink); border-radius: var(--r); padding: 14px; font-size: 14px; }
.sent p { margin: 0; }
.sent-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Pie ─────────────────────────────────────────────── */
.site-foot { border-top: 1px solid var(--line); margin-top: 40px; }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px; padding-top: 24px; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.foot-pages { display: contents; }
.foot-links a { font-size: 14px; text-decoration: none; }
.foot-links a:hover { text-decoration: underline; }
.foot-legal { margin: 0; color: var(--muted); font-size: 12.5px; }

/* Aviso flotante */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 50;
  background: var(--black); color: #fff; border-radius: 10px; padding: 12px 18px; font-size: 14px;
  box-shadow: var(--shadow); max-width: calc(100% - 32px);
}

/* ── Detalles de experiencia (solo tienda; el panel /admin no usa .store) ── */
.store { -webkit-tap-highlight-color: transparent; }
.store ::selection { background: var(--sand); color: var(--sand-ink); }
html:has(dialog[open]) { overflow: hidden; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 60; background: var(--black); color: #fff;
  padding: 10px 14px; border-radius: 10px; text-decoration: none; font-size: 14px; transition: top .15s;
}
.skip-link:focus { top: 12px; }

/* Respuesta al toque */
.store .btn, .store .icon-btn, .card-add, .opt, .qty button, .ann-arrow, .to-top { transition: transform .12s ease, background .2s, border-color .2s, opacity .2s; }
.store .btn:active:not(:disabled), .store .icon-btn:active, .card-add:active, .opt:active, .to-top:active { transform: scale(.96); }
.qty button:disabled { opacity: .3; cursor: default; }

/* Fotos: brillo de carga y fundido al aparecer */
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.store .ph:not(.has-thumb):has(> img:not([data-loaded]):not([data-broken])),
.skeleton .sk-img, .skeleton .sk-line {
  background: linear-gradient(100deg, var(--soft) 30%, #fbfbfb 50%, var(--soft) 70%) var(--soft);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
.store .ph:not(.has-thumb):has(> img:not([data-loaded]):not([data-broken]))::before { opacity: 0; }
.store .ph > img { transition: opacity .4s ease, transform .6s ease; }
.store .ph > img:not([data-loaded]) { opacity: 0; }

/* Tarjetas esqueleto mientras carga el catálogo */
.skeleton { gap: 10px; }
.skeleton .sk-img { aspect-ratio: 4 / 5; }
.skeleton .sk-line { height: 12px; border-radius: 6px; width: 80%; }
.skeleton .sk-line.short { width: 40%; }

/* Tarjeta: zoom suave y descuento */
@media (hover: hover) {
  .card:hover .card-media img[data-loaded] { transform: scale(1.035); }
}
.badge.sale { background: var(--black); color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }
.card-add.done { background: var(--black); color: #fff; opacity: 1; transform: none; }
.card-add.done svg { stroke-width: 2.4; }

/* Contador del carrito: rebote al añadir */
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }
.cart-count.bump { animation: bump .45s cubic-bezier(.3, 1.6, .5, 1); }

/* Paneles: entran deslizando */
@keyframes slide-right { from { transform: translateX(100%); } }
@keyframes slide-left { from { transform: translateX(-100%); } }
@keyframes fade-in { from { opacity: 0; } }
.drawer[open] { animation: slide-right .32s cubic-bezier(.2, .8, .2, 1); }
.menu-drawer[open] { animation: slide-left .32s cubic-bezier(.2, .8, .2, 1); }
.drawer[open]::backdrop, .menu-drawer[open]::backdrop { animation: fade-in .3s ease; }
.search-bar:not([hidden]) { animation: fade-in .2s ease; }

/* Hero */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.hero-content > * { animation: rise .8s cubic-bezier(.2, .8, .2, 1) both; }
.hero-content > :nth-child(2) { animation-delay: .12s; }

/* Producto: ruta, ahorro y vistas */
.crumbs { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: -28px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--heading); text-decoration: underline; text-underline-offset: 3px; }
.save { background: var(--sand); color: var(--sand-ink); border-radius: 100px; padding: 2px 10px; font-size: 12.5px; font-weight: 600; }
#view-product:not([hidden]) .pinfo, #view-collection:not([hidden]) .grid { animation: fade-in .35s ease; }
@media (max-width: 989px) {
  .crumbs { display: none; }
  .gallery-dots i { transition: width .25s, background .25s; }
  .gallery-dots i.on { width: 16px; border-radius: 3px; }
}

/* Barra fija para comprar (teléfono) */
.sticky-buy {
  position: fixed; inset: auto 0 0 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: rgba(255, 255, 255, .94); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  transform: translateY(110%); visibility: hidden; transition: transform .3s cubic-bezier(.2, .8, .2, 1), visibility 0s .3s;
}
.sticky-info { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.sticky-info b { font-weight: 500; color: var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sticky-info span { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.sticky-buy .btn { width: auto; min-height: 46px; padding-inline: 24px; }
@media (min-width: 990px) { .sticky-buy { display: none !important; } }

/* Volver arriba */
.to-top {
  position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 25;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); color: var(--heading);
  display: grid; place-items: center; box-shadow: 0 4px 16px rgba(0, 0, 0, .1); opacity: 0; transform: translateY(10px) scale(.92); pointer-events: none; transition: opacity .25s ease, transform .25s ease;
}
.to-top svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Aviso flotante con acción */
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }
.toast { display: flex; align-items: center; gap: 14px; animation: toast-in .22s ease; transition: opacity .18s, transform .18s; }
.toast.out { opacity: 0; transform: translate(-50%, 8px); }
.toast-action { border: 0; background: none; color: #fff; font-weight: 600; padding: 4px 0; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }

/* Carrito vacío y error del formulario */
.cart-empty-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; }
.cart-empty-icon svg { width: 28px; height: 28px; fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.cart-empty p { margin: 0; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.form-error:not([hidden]) { animation: shake .35s ease; }

/* ── Ajustes para teléfono (la mayoría de las visitas) ── */
@media (max-width: 749px) {
  /* El inicio deja ver los primeros productos sin tanto desplazamiento */
  .hero { height: min(440px, 48svh); min-height: 320px; }
  .section { padding-top: 32px; }
  .sec-head h2 { font-size: 21px; }

  /* Producto: foto cuadrada para que nombre, precio y botón aparezcan antes */
  .gallery-main .ph { aspect-ratio: 1 / 1; }
  .pinfo { gap: 14px; }
  .pinfo .bs { margin-top: -8px; }
  .buy-row { grid-template-columns: 112px 1fr; }

  /* Botón "+" más cómodo para el dedo */
  .card-add { min-height: 40px; }
  @media (hover: none) { .card-add { width: 40px; right: 8px; bottom: 8px; } }
  .badge { top: 8px; right: 8px; font-size: 12px; padding: 3px 8px; }

  /* Aviso: barra completa abajo, una sola línea */
  .toast { left: 12px; right: 12px; transform: none; max-width: none; justify-content: space-between; padding: 12px 16px; }
  @keyframes toast-in-m { from { opacity: 0; transform: translateY(12px); } }
  .toast { animation-name: toast-in-m; }
  .toast.out { transform: translateY(8px); }
  .has-sticky-buy .toast { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
}
#toast-msg { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body:has(.toast:not([hidden])) .to-top { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 989px) { .has-sticky-buy { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); } }
.menu-links a { align-items: center; }
.search-field input::-webkit-search-cancel-button { filter: grayscale(1); opacity: .6; cursor: pointer; }

/* ── Colección: ordenar y "solo disponibles" ─────────── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.coll-head { margin-bottom: 14px; }
.coll-tools { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.coll-tools .count { margin-right: auto; }
.instock { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; min-height: 40px; user-select: none; }
.instock input { appearance: none; -webkit-appearance: none; margin: 0; width: 36px; height: 22px; border-radius: 999px; background: var(--input); position: relative; cursor: pointer; transition: background .2s; flex: none; }
.instock input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.instock input:checked { background: var(--black); }
.instock input:checked::after { transform: translateX(14px); }
.sort-field select {
  appearance: none; -webkit-appearance: none; min-height: 40px; padding: 0 34px 0 14px; border: 1px solid var(--input); border-radius: 999px;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23303030' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 14px;
  font-size: 14px; color: var(--ink); cursor: pointer;
}
.sort-field select:hover { border-color: var(--black); }
@media (max-width: 749px) {
  .coll-tools { gap: 6px 12px; }
  .coll-tools .count { flex-basis: 100%; margin-right: 0; }
  .instock { flex: none; }
  .sort-field { flex: 1; min-width: 0; display: flex; justify-content: flex-end; }
  .sort-field select { width: 100%; max-width: 230px; text-overflow: ellipsis; }
}

/* ── Producto: "También te puede gustar" ─────────────── */
.related { grid-column: 1 / -1; padding-top: 32px; border-top: 1px solid var(--line); margin-top: 8px; }
.related h2 { font-size: 22px; margin: 0 0 18px; }
.related .grid { padding-bottom: 0; }
@media (max-width: 989px) {
  .related { padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px)); margin-top: 24px; padding-top: 28px; }
  .related h2 { font-size: 19px; }
}
@media (min-width: 990px) { .related .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Menú de computadora en una línea: lo que no cabe va en "Más ▾" (ver fitNav en app.js) */
.nav-more { position: relative; }
.nav-more summary { list-style: none; cursor: pointer; font-size: 15px; color: var(--ink); padding: 4px 0; display: inline-flex; align-items: center; gap: 4px; border-bottom: 1px solid transparent; white-space: nowrap; }
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); transition: transform .2s; }
.nav-more[open] summary::after { transform: translateY(1px) rotate(-135deg); }
.nav-more summary:hover, .nav-more.current summary { color: var(--heading); border-bottom-color: currentColor; }
.nav-more-list {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 30; min-width: 210px; display: grid; padding: 8px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); animation: fade-in .15s ease;
}
.main-nav .nav-more-list a { padding: 9px 12px; border-radius: 8px; border: 0; }
.main-nav .nav-more-list a:hover, .main-nav .nav-more-list a[aria-current="page"] { background: var(--soft); }

/* ── Galería: cada foto abre el visor ───────────────── */
.gallery-main .zoomable { border: 0; padding: 0; margin: 0; width: 100%; cursor: zoom-in; font: inherit; color: inherit; }
.gallery-main .zoomable:disabled { cursor: default; }

/* ── Visor de fotos a pantalla completa ─────────────── */
.zoom { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #fff; color: var(--ink); overflow: hidden; }
.zoom::backdrop { background: #fff; }
.zoom[open] { animation: fade-in .2s ease; }
.zoom-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.zoom-track::-webkit-scrollbar { display: none; }
.zoom-track.locked { overflow-x: hidden; }
.zoom-slide { flex: 0 0 100%; height: 100%; scroll-snap-align: center; overflow: hidden; display: grid; place-items: center; cursor: zoom-in; touch-action: pan-x pan-y; }
.zoom-slide img { max-width: 100vw; max-height: 100dvh; width: auto; height: auto; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.zoom-slide.zoomed { overflow: auto; display: block; cursor: zoom-out; }
.zoom-slide.zoomed img { max-width: none; max-height: none; width: 230%; }
@media (min-width: 990px) { .zoom-slide.zoomed img { width: 160%; } }
.zoom-bar {
  position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  pointer-events: none;
}
.zoom-count { font-size: 14px; font-variant-numeric: tabular-nums; background: rgba(255, 255, 255, .85); padding: 4px 10px; border-radius: 999px; }
.zoom-count:empty { visibility: hidden; }
.zoom-btn {
  pointer-events: auto; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, .92);
  display: grid; place-items: center; color: var(--heading); box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
}
.zoom-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.zoom-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.zoom-nav.prev { left: max(16px, env(safe-area-inset-left, 0px)); }
.zoom-nav.next { right: max(16px, env(safe-area-inset-right, 0px)); }
.zoom-nav:disabled { opacity: 0; pointer-events: none; }
.zoom-hint { position: absolute; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); margin: 0; text-align: center; font-size: 13px; color: var(--muted); pointer-events: none; animation: hint-out 3.5s ease forwards; }
@keyframes hint-out { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
@media (hover: none) { .zoom-nav { display: none; } }
.zoom:has(.zoomed) .zoom-hint { display: none; }
@media (hover: hover) { .zoom-hint { display: none; } }

/* ── Producto: envío, pago y ayuda ─────────────────── */
.pd-info { list-style: none; margin: 4px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.pd-info li { display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start; font-size: 13.5px; line-height: 1.45; color: var(--ink); }
.pd-info svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; margin-top: 1px; }
.pd-info a { color: var(--heading); font-weight: 500; }

/* ── "Ver más productos" ───────────────────────────── */
.grid-more { display: flex; justify-content: center; padding: 0 0 40px; margin-top: -8px; }
.grid-more .btn { width: auto; padding-inline: 28px; }

/* ── Compartir ─────────────────────────────────────── */
.pd-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.pd-title h1 { flex: 1; min-width: 0; }
.share-btn { margin: -4px -10px 0 0; color: var(--ink); }
.share-btn svg { width: 21px; height: 21px; }
.coll-head { align-items: center; }
.coll-head .share-btn { margin: 0 0 0 auto; }

/* ── Sugerencias de búsqueda ───────────────────────── */
.suggest {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 25; background: var(--paper);
  border-top: 1px solid var(--line); box-shadow: 0 18px 30px -18px rgba(0, 0, 0, .28);
  max-height: min(72dvh, 560px); overflow-y: auto; overscroll-behavior: contain;
  padding: 14px max(var(--gutter), env(safe-area-inset-right, 0px)) 16px max(var(--gutter), env(safe-area-inset-left, 0px));
  animation: fade-in .15s ease;
}
.suggest > * { max-width: 760px; margin-inline: auto; }
.sg-h { margin: 0 auto 10px; font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.sg-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.sg-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--input); text-decoration: none; font-size: 14px; color: var(--heading); background: var(--paper);
}
.sg-chip small { color: var(--muted); font-size: 12px; }
.sg-chip:hover, .sg-chip:focus-visible { border-color: var(--black); }
.sg-list { list-style: none; margin: 0 auto; padding: 0; display: grid; }
.sg-item { display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: center; padding: 8px 6px; margin-inline: -6px; border-radius: 10px; text-decoration: none; color: inherit; }
.sg-item:hover, .sg-item:focus-visible { background: var(--soft); outline-offset: -2px; }
.sg-img { width: 56px; height: 56px; border-radius: 8px; }
.sg-img::before { font-size: 20px !important; }
.sg-txt { display: grid; min-width: 0; line-height: 1.35; }
.sg-txt b { font-weight: 500; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-txt small { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.sg-txt small.sale { color: var(--heading); font-weight: 600; }
.sg-all {
  display: block; width: 100%; margin: 10px auto 0; min-height: 46px; border-radius: var(--r); border: 1px solid var(--black);
  background: var(--paper); color: var(--black); font-size: 14px; font-weight: 500;
}
.sg-all:hover { background: var(--soft); }
.sg-empty { margin: 4px auto; color: var(--muted); font-size: 14px; }
.sg-empty a { color: var(--heading); font-weight: 500; }
@media (max-width: 749px) { .suggest { max-height: 62dvh; } }

/* ── Movimiento: entradas, salidas y transiciones (todo se apaga con "reducir movimiento") ── */
@keyframes slide-right-out { to { transform: translateX(100%); } }
@keyframes slide-left-out { to { transform: translateX(-100%); } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes tick { from { opacity: .35; transform: translateY(5px); } }
@keyframes from-right { from { opacity: 0; transform: translateX(28px); } }
@keyframes from-left { from { opacity: 0; transform: translateX(-28px); } }
@keyframes line-out { to { opacity: 0; transform: translateX(28px); } }
@keyframes flash { 0%, 35% { background: var(--sand); box-shadow: 0 0 0 8px var(--sand); } 100% { background: transparent; box-shadow: 0 0 0 8px transparent; } }
@keyframes card-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes link-in { from { opacity: 0; transform: translateX(-12px); } }

/* Paneles: también salen con animación */
.drawer.closing { animation: slide-right-out .24s cubic-bezier(.4, 0, 1, 1) forwards; }
.menu-drawer.closing { animation: slide-left-out .24s cubic-bezier(.4, 0, 1, 1) forwards; }
.zoom.closing { animation: fade-out .18s ease forwards; }
.drawer.closing::backdrop, .menu-drawer.closing::backdrop, .zoom.closing::backdrop { animation: fade-out .24s ease forwards; }

/* Menú del teléfono: los enlaces entran en cascada */
.menu-drawer[open] .menu-links a { animation: link-in .32s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 22ms + 70ms); }

/* Menú de computadora: el subrayado crece desde el centro */
.main-nav > a { border-bottom: 0; padding-bottom: 5px; background: linear-gradient(currentColor, currentColor) no-repeat 50% 100% / 0 1px; transition: background-size .25s ease, color .2s; }
.main-nav > a:hover, .main-nav > a[aria-current="page"] { background-size: 100% 1px; }

/* Encabezado: sombra suave al desplazarse */
.site-head { transition: border-color .2s, box-shadow .25s; }
.site-head.scrolled { box-shadow: 0 10px 24px -20px rgba(0, 0, 0, .35); }

/* Buscador y sugerencias bajan suavemente */
.search-bar:not([hidden]), .suggest:not([hidden]) { animation: drop-in .2s ease; }

/* Carrito: la línea nueva se resalta, la que se quita se desliza, el total "late" */
.line { border-radius: 10px; }
.line.just-added { animation: flash 1.6s ease; }
.line.leaving { animation: line-out .22s cubic-bezier(.4, 0, 1, 1) forwards; pointer-events: none; }
.tick { animation: tick .3s cubic-bezier(.2, .8, .2, 1); }
.from-right { animation: from-right .28s cubic-bezier(.2, .8, .2, 1); }
.from-left { animation: from-left .28s cubic-bezier(.2, .8, .2, 1); }
.sent:not([hidden]) { animation: drop-in .25s ease; }

/* Barra fija y "volver arriba": entran y salen */
.sticky-buy.show { transform: none; visibility: visible; transition: transform .3s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }

/* Tarjetas nuevas en cascada (ordenar, filtrar, buscar, ver más) */
.card.card-enter { animation: card-in .42s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 35ms); }

/* Fotos de la ficha: la miniatura se ve al instante mientras carga la grande */
.gallery-main .ph.has-thumb { background-size: cover; background-position: center; background-repeat: no-repeat; }
.ph.has-thumb::before { content: none; }

/* Cambio de página: fundido corto; la foto de la tarjeta se transforma en la foto del producto */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }
::view-transition-group(pd-photo) { animation-duration: .38s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-old(pd-photo), ::view-transition-new(pd-photo) { height: 100%; object-fit: cover; overflow: clip; }

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

/* Páginas de texto (Envíos, Sobre nosotros…) */
.page { padding-top: 36px; min-height: 60vh; max-width: 760px; }
.page h1 { font-size: clamp(28px, 3vw, 40px); margin: 0 0 20px; }
.page-body { font-size: 16px; line-height: 1.7; color: var(--ink); }
.page-body p, .page-body ul { margin: 0 0 16px; }
.page-body ul { padding-left: 22px; }
.page-body a { color: var(--heading); }

/* Inventario y cupones */
.stock-low { margin: 0; color: #a4361b; font-size: 14px; font-weight: 600; }
.coupon { display: grid; gap: 8px; }
.coupon .link-btn { justify-self: start; }
.coupon-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.coupon-row input { min-height: 48px; border: 1px solid var(--input); border-radius: var(--r); padding: 0 14px; font: inherit; font-size: 16px; text-transform: uppercase; background: var(--paper); color: var(--ink); }
.coupon-row .btn { min-height: 48px; }
.coupon-ok { margin: 0; color: #1f7a46; font-weight: 600; font-size: 14px; }
.total-row.sub { font-size: 14px; color: var(--ink); }
.total-row.disc { color: #1f7a46; }
