/* =========================================================
   Encuerada — estilos
   Los colores y tipografías se sobreescriben desde la hoja
   "Config" (ver js/app.js → applyTheme). Estos son los valores
   por defecto mientras carga.
   ========================================================= */
:root {
  --c-primary: #7a4a2b;      /* cuero café */
  --c-secondary: #c89b6d;    /* miel */
  --c-bg: #f7f1e8;           /* papel */
  --c-surface: #fffaf3;
  --c-text: #2b1d14;
  --c-accent: #2f4a36;       /* verde botella */
  --c-muted: #7d6b5d;
  --c-line: #e4d6c3;
  --c-on-primary: #fff;
  --f-head: "Playfair Display", Georgia, serif;
  --f-body: "Inter", system-ui, -apple-system, sans-serif;
  --radius: 14px;
  --shadow: 0 10px 30px -12px rgba(43, 29, 20, .28);
  --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--f-head); line-height: 1.15; margin: 0 0 .5em; font-weight: 700; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }
.muted { color: var(--c-muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; color: var(--c-secondary); margin: 0 0 .4em; font-weight: 600; }

/* ---------- Botones e inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  background: var(--c-primary); color: var(--c-on-primary);
  border: 0; border-radius: 999px; padding: .85em 1.6em;
  font-weight: 600; text-decoration: none; transition: transform .15s, filter .15s, opacity .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn--block { width: 100%; }
.btn--ghost { background: transparent; color: var(--c-text); border: 1px solid var(--c-line); }
.btn--wa { background: #25d366; color: #fff; }
.input {
  width: 100%; font: inherit; color: var(--c-text);
  background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 10px;
  padding: .7em .9em; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--c-secondary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-secondary) 25%, transparent); }
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .35em; }
.field--row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.field--row label { margin: 0; }

/* ---------- Header ---------- */
.announce { background: var(--c-accent); color: #fff; text-align: center; font-size: .85rem; padding: .5em 1em; }
.header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--c-bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--c-line);
}
.header__inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; }
.brand__logo { height: 40px; width: auto; }
.brand__name { font-family: var(--f-head); font-size: 1.6rem; font-weight: 700; letter-spacing: .01em; color: var(--c-primary); }
.nav { display: flex; gap: 1.8rem; }
.nav a { text-decoration: none; font-weight: 500; font-size: .95rem; position: relative; }
.nav a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: -4px; height: 2px; background: var(--c-secondary); transition: right .2s; }
.nav a:hover::after { right: 0; }
.header__actions { display: flex; align-items: center; gap: .25rem; }
.icon-btn { position: relative; background: none; border: 0; padding: .5rem; color: var(--c-text); border-radius: 10px; }
.icon-btn:hover { background: var(--c-line); }
.badge {
  position: absolute; top: 0; right: 0; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--c-primary); color: var(--c-on-primary);
  font-size: .7rem; font-weight: 700; display: grid; place-items: center;
}
.nav-toggle { display: none; }

/* ---------- Slider ---------- */
.hero { padding: 20px 0 0; }
.slider {
  position: relative; overflow: hidden;
  max-width: var(--max); margin: 0 auto; border-radius: 0;
  aspect-ratio: 21 / 9; min-height: 340px; background: var(--c-primary);
}
@media (min-width: 1220px) { .slider { border-radius: var(--radius); } }
.slider__track { display: flex; height: 100%; transition: transform .7s cubic-bezier(.6, .05, .2, 1); }
.slide { position: relative; flex: 0 0 100%; height: 100%; }
.slide img { width: 100%; height: 100%; object-fit: cover; }
.slide__overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: clamp(24px, 5vw, 64px);
  background: linear-gradient(90deg, rgba(20, 12, 6, .72) 0%, rgba(20, 12, 6, .25) 55%, transparent 100%);
  color: #fff;
}
.slide__overlay h1 { font-size: clamp(2rem, 5vw, 3.8rem); max-width: 14ch; margin-bottom: .2em; }
.slide__overlay p { max-width: 44ch; font-size: clamp(1rem, 1.6vw, 1.2rem); margin: 0 0 1.2em; opacity: .92; }
.slide__overlay .btn { align-self: flex-start; background: var(--c-surface); color: var(--c-text); }
.slider__arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .85); color: var(--c-text); font-size: 1.6rem; line-height: 1;
  display: grid; place-items: center; opacity: 0; transition: opacity .2s;
}
.slider:hover .slider__arrow { opacity: 1; }
.slider__arrow--prev { left: 16px; }
.slider__arrow--next { right: 16px; }
.slider__dots { position: absolute; bottom: 18px; right: 24px; display: flex; gap: 8px; }
.slider__dots button { width: 9px; height: 9px; border-radius: 99px; border: 0; padding: 0; background: rgba(255, 255, 255, .5); transition: width .3s, background .3s; }
.slider__dots button.is-active { width: 26px; background: #fff; }

/* ---------- Valores ---------- */
.values { border-bottom: 1px solid var(--c-line); }
.values__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; padding-top: 28px; padding-bottom: 28px; }
.values__grid div { display: flex; flex-direction: column; text-align: center; }
.values__grid strong { font-family: var(--f-head); font-size: 1.1rem; color: var(--c-primary); }
.values__grid span { font-size: .875rem; color: var(--c-muted); }

/* ---------- Secciones ---------- */
.section { padding: 72px 0; }
.section--alt { background: var(--c-surface); border-top: 1px solid var(--c-line); border-bottom: 1px solid var(--c-line); }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.section__head h2 { margin: 0; }
.section__head p { margin: 0; }

.toolbar { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.toolbar__right { display: flex; gap: .6rem; }
.toolbar__right .input { width: auto; }
#search { width: 200px; }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--c-line); background: var(--c-surface); color: var(--c-text);
  padding: .45em 1em; border-radius: 999px; font-size: .9rem; font-weight: 500; transition: all .15s;
}
.chip:hover { border-color: var(--c-secondary); }
.chip.is-active { background: var(--c-text); color: var(--c-bg); border-color: var(--c-text); }

/* ---------- Grilla de productos ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 24px; }
.loading, .grid .empty { grid-column: 1 / -1; text-align: center; padding: 3rem 0; color: var(--c-muted); }
.card {
  background: var(--c-surface); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--c-line); display: flex; flex-direction: column;
  transition: transform .25s, box-shadow .25s; cursor: pointer; text-align: left; padding: 0; color: inherit;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card__img { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--c-line); }
.card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s, opacity .3s; }
.card__img img + img { position: absolute; inset: 0; opacity: 0; }
.card:hover .card__img img:first-child { transform: scale(1.04); }
.card:hover .card__img img + img { opacity: 1; }
.card__tag {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  background: var(--c-surface); color: var(--c-text); font-size: .72rem; font-weight: 700;
  padding: .3em .7em; border-radius: 999px; letter-spacing: .03em;
}
.card__tag--low { background: var(--c-secondary); color: #fff; }
.card__tag--out { background: var(--c-text); color: var(--c-bg); }
.card__body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.card__cat { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--c-muted); }
.card__name { font-family: var(--f-head); font-size: 1.2rem; font-weight: 700; }
.card__foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 6px; }
.card__price { font-weight: 600; color: var(--c-primary); }
.card__dots { display: flex; gap: 4px; }
.card__dots i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .15); }
.card.is-out { opacity: .65; }

/* ---------- Personaliza ---------- */
.split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: center; }
.steps { padding-left: 1.2em; margin: 1.2em 0 1.8em; }
.steps li { margin-bottom: .5em; }
.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.swatch {
  aspect-ratio: 1; border-radius: var(--radius); position: relative; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08), var(--shadow);
}
.swatch::before { /* costura */
  content: ""; position: absolute; inset: 10px; border: 2px dashed rgba(255, 255, 255, .55); border-radius: 8px;
}
.swatch::after { /* textura */
  content: ""; position: absolute; inset: 0; opacity: .35; mix-blend-mode: multiply;
  background-image: radial-gradient(rgba(0, 0, 0, .25) 1px, transparent 1.5px);
  background-size: 6px 6px;
}
.swatch span { position: absolute; bottom: 16px; left: 18px; color: #fff; font-weight: 600; font-size: .85rem; z-index: 1; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }

/* ---------- Footer ---------- */
.footer { background: var(--c-text); color: var(--c-bg); padding: 56px 0 24px; }
.footer .muted { color: color-mix(in srgb, var(--c-bg) 65%, transparent); }
.footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.footer__brand { color: var(--c-secondary); }
.footer h4 { font-family: var(--f-body); font-size: .8rem; text-transform: uppercase; letter-spacing: .14em; margin-bottom: 1em; }
.footer__list { list-style: none; padding: 0; margin: 0; }
.footer__list li { margin-bottom: .4em; }
.footer__list a { text-decoration: none; }
.footer__list a:hover { text-decoration: underline; }
.footer__bottom { border-top: 1px solid rgba(255, 255, 255, .12); margin-top: 40px; padding-top: 20px; font-size: .85rem; }

.wa-float {
  position: fixed; right: 20px; bottom: 20px; z-index: 30; width: 56px; height: 56px; border-radius: 50%;
  background: #25d366; color: #fff; display: grid; place-items: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  transition: transform .2s;
}
.wa-float:hover { transform: scale(1.06); }

/* ---------- Modal producto ---------- */
.modal, .drawer { position: fixed; inset: 0; z-index: 60; }
.modal__backdrop, .drawer__backdrop { position: absolute; inset: 0; background: rgba(20, 12, 6, .55); animation: fade .2s; }
.modal__panel {
  position: relative; margin: 4vh auto; width: min(1000px, calc(100% - 32px)); max-height: 92vh; overflow: auto;
  background: var(--c-bg); border-radius: var(--radius); box-shadow: var(--shadow); animation: pop .25s;
}
.modal__close {
  position: absolute; top: 10px; right: 12px; z-index: 3; width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: var(--c-surface); color: var(--c-text); font-size: 1.5rem; line-height: 1;
}
.pm { display: grid; grid-template-columns: 1.05fr 1fr; }
.pm__gallery { padding: 20px; }
.pm__main { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--c-line); }
.pm__main img { width: 100%; height: 100%; object-fit: cover; transition: filter .3s; }
.pm__engrave {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-family: var(--f-head); font-size: clamp(1.4rem, 3.5vw, 2.4rem); font-weight: 700; letter-spacing: .08em;
  color: rgba(40, 22, 10, .55); text-shadow: 0 1px 0 rgba(255, 255, 255, .28), 0 -1px 0 rgba(0, 0, 0, .35);
  pointer-events: none; white-space: nowrap;
}
.pm__thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.pm__thumbs button { width: 64px; height: 64px; padding: 0; border-radius: 8px; overflow: hidden; border: 2px solid transparent; background: none; }
.pm__thumbs button.is-active { border-color: var(--c-primary); }
.pm__thumbs img { width: 100%; height: 100%; object-fit: cover; }
.pm__info { padding: 32px 32px 28px 12px; }
.pm__info h3 { font-size: 2rem; }
.pm__price { font-size: 1.4rem; font-weight: 600; color: var(--c-primary); margin: 0; }
.pm__stock { font-size: .875rem; margin: .2em 0 1em; color: var(--c-accent); font-weight: 500; }
.pm__stock.is-low { color: var(--c-secondary); }
.pm__stock.is-out { color: #b3261e; }
.pm__desc { color: var(--c-muted); margin-bottom: 1.4em; }
.opt { margin-bottom: 1rem; }
.opt__label { font-weight: 600; font-size: .9rem; margin-bottom: .45em; display: flex; gap: .4em; }
.opt__label span { font-weight: 400; color: var(--c-muted); }
.opt__values { display: flex; flex-wrap: wrap; gap: 8px; }
.opt__values input { position: absolute; opacity: 0; pointer-events: none; }
.opt__pill {
  display: inline-flex; align-items: center; gap: .45em; border: 1px solid var(--c-line); background: var(--c-surface);
  border-radius: 999px; padding: .4em .9em; font-size: .88rem; cursor: pointer; transition: all .15s;
}
.opt__pill i { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .15); }
.opt__values input:checked + .opt__pill { border-color: var(--c-text); box-shadow: inset 0 0 0 1px var(--c-text); }
.opt__values input:focus-visible + .opt__pill { outline: 2px solid var(--c-secondary); outline-offset: 2px; }
.qty { display: inline-flex; border: 1px solid var(--c-line); border-radius: 999px; overflow: hidden; background: var(--c-surface); }
.qty button { width: 38px; border: 0; background: none; font-size: 1.1rem; color: var(--c-text); }
.qty input { width: 48px; text-align: center; border: 0; background: none; font: inherit; color: var(--c-text); -moz-appearance: textfield; }
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ---------- Carrito ---------- */
.drawer__panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%);
  background: var(--c-bg); display: flex; flex-direction: column; animation: slide .3s;
}
.drawer__head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--c-line); position: relative; }
.drawer__head h3 { margin: 0; }
.drawer__head .modal__close { position: static; }
.drawer__body { flex: 1; overflow: auto; padding: 18px 20px; }
.drawer__foot { padding: 16px 20px 20px; border-top: 1px solid var(--c-line); display: grid; gap: 10px; grid-template-columns: auto 1fr; }
.drawer__foot .total, .drawer__foot .error { grid-column: 1 / -1; }
.drawer__foot .btn--block { grid-column: span 2; }
#back-btn:not([hidden]) + .btn--block { grid-column: auto; }
.total { display: flex; justify-content: space-between; font-size: 1.1rem; }
.error { color: #b3261e; font-size: .9rem; margin: 0; }
.cart-list { list-style: none; margin: 0; padding: 0; }
.cart-item { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--c-line); }
.cart-item img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.cart-item__name { font-weight: 600; }
.cart-item__opts { font-size: .82rem; color: var(--c-muted); }
.cart-item__right { text-align: right; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; }
.cart-item .qty button { width: 28px; }
.cart-item .qty input { width: 30px; font-size: .9rem; }
.link-btn { background: none; border: 0; padding: 0; color: var(--c-muted); font-size: .8rem; text-decoration: underline; }
.empty { text-align: center; padding: 2rem 0; }
.radios { display: grid; gap: 8px; }
.radios label {
  display: flex; align-items: center; gap: .6em; padding: .7em .9em; border: 1px solid var(--c-line);
  border-radius: 10px; background: var(--c-surface); font-weight: 500; cursor: pointer; margin: 0;
}
.radios label:has(input:checked) { border-color: var(--c-text); }
.radios .muted { margin-left: auto; font-weight: 400; font-size: .85rem; }
.done-icon { width: 64px; height: 64px; border-radius: 50%; margin: 2rem auto 1rem; background: var(--c-accent); color: #fff; font-size: 2rem; display: grid; place-items: center; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80;
  background: var(--c-text); color: var(--c-bg); padding: .8em 1.3em; border-radius: 999px; font-size: .92rem;
  box-shadow: var(--shadow); animation: pop .2s;
}

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes slide { from { transform: translateX(100%); } }
.toast { animation-name: toastIn; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav {
    position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--c-bg); border-bottom: 1px solid var(--c-line); padding: 8px 20px 16px;
    transform: translateY(-8px); opacity: 0; visibility: hidden; transition: transform .2s, opacity .2s, visibility .2s;
  }
  .nav.is-open { transform: none; opacity: 1; visibility: visible; }
  .nav a { padding: .8em 0; border-bottom: 1px solid var(--c-line); }
  .nav-toggle { display: block; }
  .values__grid { grid-template-columns: repeat(2, 1fr); row-gap: 20px; }
  .split, .pm, .footer__grid { grid-template-columns: 1fr; }
  .pm__info { padding: 4px 20px 24px; }
  .slider { aspect-ratio: 4 / 5; max-height: 560px; }
  .slider__arrow { display: none; }
  .slide__overlay { background: linear-gradient(0deg, rgba(20, 12, 6, .8) 0%, rgba(20, 12, 6, .2) 60%, transparent 100%); }
  .toolbar__right { width: 100%; }
  #search { flex: 1; width: auto; min-width: 0; }
  #sort { flex: 0 0 44%; min-width: 0; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .card__name { font-size: 1.02rem; }
  .card__body { padding: 10px 12px 14px; }
  .modal__panel { margin: 0; width: 100%; max-height: 100vh; height: 100%; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Idioma ---------- */
.lang-btn {
  border: 1px solid var(--c-line); background: var(--c-surface); color: var(--c-text);
  border-radius: 999px; padding: .3em .75em; font-size: .78rem; font-weight: 700; letter-spacing: .06em; margin-right: .25rem;
}
.lang-btn:hover { border-color: var(--c-secondary); }

/* ---------- Producto: plazo y reseñas ---------- */
.pm__lead { font-size: .88rem; margin: -.6em 0 1em; color: var(--c-muted); display: flex; gap: .4em; align-items: center; }
.pm__lead::before { content: "⏱"; }
.pm__lead:empty { display: none; }
.pm__reviews { margin-top: 1.6rem; border-top: 1px solid var(--c-line); padding-top: 1rem; }
.pm__reviews:empty { display: none; }
.pm__reviews .review { padding: .7rem 0; border: 0; background: none; box-shadow: none; }
.opt__text { position: relative; }
.opt__text small { display: block; margin-top: .3em; }

/* ---------- Reseñas ---------- */
.rating-summary { display: flex; align-items: center; gap: .6rem; font-weight: 600; }
.stars { color: var(--c-secondary); letter-spacing: .1em; }
.stars .off { color: var(--c-line); }
.reviews { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.review { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 18px 20px; }
.review p { margin: .5em 0 .6em; }
.review__meta { font-size: .82rem; color: var(--c-muted); }
.modal__panel--sm { width: min(480px, calc(100% - 32px)); }
.pad { padding: 28px; }
.stars-input { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.stars-input input { position: absolute; opacity: 0; pointer-events: none; }
.stars-input label { font-size: 2rem; color: var(--c-line); cursor: pointer; margin: 0; line-height: 1; }
.stars-input input:checked ~ label, .stars-input label:hover, .stars-input label:hover ~ label { color: var(--c-secondary); }
.stars-input input:focus-visible + label { outline: 2px solid var(--c-secondary); border-radius: 4px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; }

/* ---------- Galería ---------- */
.gallery { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.gallery a, .gallery div { aspect-ratio: 1; overflow: hidden; border-radius: 10px; display: block; background: var(--c-line); }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.gallery a:hover img { transform: scale(1.05); }
@media (max-width: 860px) { .gallery { grid-template-columns: repeat(3, 1fr); } }
