/* Catálogo Digital · La Casa de Mamá
   Paleta tomada del logo: crema, café espresso y barro; cempasúchil y azul talavera de las piezas pintadas. */

:root {
  --crema: #f6eddc;
  --crema-2: #efe2c9;
  --papel: #fffaf0;
  --cafe: #46230d;
  --cafe-2: #6d4127;
  --barro: #c5713a;
  --barro-2: #a95a28;
  --cempasuchil: #efa53a;
  --talavera: #1f4e8c;
  --whats: #1a9d4f;
  --whats-2: #13803f;
  --linea: rgba(70, 35, 13, .16);
  --sombra: 0 10px 30px -18px rgba(70, 35, 13, .55);
  --serif: "Young Serif", Georgia, serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --top: calc(64px + env(safe-area-inset-top));
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--top); }
body {
  margin: 0;
  font: 400 16px/1.5 var(--sans);
  color: var(--cafe);
  background: var(--crema);
  /* grano de barro muy tenue */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .27 0 0 0 0 .14 0 0 0 0 .05 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--talavera); }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid var(--cempasuchil); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0; letter-spacing: -.005em; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(246, 237, 220, .92);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--linea); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; margin-right: auto; min-width: 0; }
.brand img { width: 40px; height: 40px; border-radius: 50%; background: var(--papel); }
.brand span { display: grid; line-height: 1.1; min-width: 0; }
.brand b { font: 400 18px var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { font-size: 12.5px; color: var(--cafe-2); font-weight: 600; }
.icon-btn {
  position: relative; display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--linea); background: var(--papel);
}
.icon-btn .count {
  position: absolute; top: -3px; right: -3px; min-width: 21px; height: 21px; padding: 0 5px;
  border-radius: 11px; background: var(--barro); color: #fff; font-size: 12px; font-weight: 800;
  display: grid; place-items: center; border: 2px solid var(--crema);
}
.install-btn {
  display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px 0 10px;
  border-radius: 20px; border: 0; background: var(--cafe); color: var(--crema); font-weight: 700; font-size: 14px;
}
.install-btn svg { width: 20px; height: 20px; }
@media (max-width: 420px) {
  .has-back .brand img { display: none; }
  .has-back .install-btn { width: 44px; padding: 0; justify-content: center; }
  .has-back .install-btn span { display: none; }
  .brand b { font-size: 16.5px; }
  .install-btn { padding: 0 12px 0 9px; font-size: 13.5px; }
}

main { display: block; max-width: 1180px; margin: 0 auto; padding: 0 16px 40px; outline: none; }

.loading { min-height: 70vh; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--cafe-2); }
.loading img { width: 84px; height: 84px; border-radius: 50%; animation: latido 1.4s ease-in-out infinite; }
@keyframes latido { 50% { transform: scale(.92); opacity: .7; } }

/* ---------- Portada ---------- */
.hero { margin: 4px -16px 0; position: relative; }
.hero img { width: 100%; aspect-ratio: 8 / 3; object-fit: cover; object-position: 30% 50%; }
@media (max-width: 640px) { .hero img { aspect-ratio: 16 / 9; object-position: 32% 50%; } }

.search {
  position: relative; margin: -30px 0 0; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  background: var(--papel); border: 1.5px solid var(--cafe); border-radius: 18px;
  padding: 0 8px 0 16px; box-shadow: var(--sombra);
}
.search svg { color: var(--barro-2); }
.search input {
  flex: 1; min-width: 0; height: 58px; border: 0; background: none; outline: none;
  font: 500 17px var(--sans); color: var(--cafe);
}
.search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.search input::placeholder { color: #9b7a64; }
.search .clear { border: 0; background: var(--crema-2); border-radius: 50%; width: 36px; height: 36px; display: grid; place-items: center; }
.search .clear svg { width: 18px; height: 18px; color: var(--cafe); }
.search:focus-within { border-color: var(--barro); }

.promise {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 16px -16px 0; padding: 2px 16px;
}
.promise::-webkit-scrollbar { display: none; }
.promise span {
  flex: none; display: flex; align-items: center; gap: 7px;
  padding: 8px 13px 8px 10px; border-radius: 30px; font-size: 14px; font-weight: 600;
  background: var(--crema-2); color: var(--cafe);
}
.promise svg { width: 18px; height: 18px; color: var(--barro-2); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 34px 0 14px; }
.section-head h2 { font-size: clamp(24px, 6.4vw, 32px); }
.section-head p { margin: 4px 0 0; color: var(--cafe-2); font-size: 15px; }

/* ---------- Categorías: tarjeta con borde de color y foto circular ---------- */
.cats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 640px) { .cats { grid-template-columns: repeat(3, 1fr); gap: 18px; } }
@media (min-width: 960px) { .cats { grid-template-columns: repeat(4, 1fr); } }
.cat {
  --c: var(--barro);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 18px 12px 16px; border-radius: 24px; text-decoration: none; color: inherit;
  background: var(--papel);
  background: color-mix(in srgb, var(--c) 7%, var(--papel));
  border: 2px solid var(--c);
  transition: transform .15s ease, box-shadow .2s ease;
}
.cat:hover { box-shadow: 0 12px 26px -18px var(--c); }
.cat:active { transform: scale(.97); }
.cat-photo {
  width: 78%; aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: var(--crema-2);
  box-shadow: 0 0 0 4px var(--papel), 0 0 0 7px var(--c);
  margin: 7px 0 4px;
}
.cat-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.cat:hover .cat-photo img { transform: scale(1.06); }
.cat h3 { font-size: 18px; margin: 14px 0 10px; line-height: 1.2; }
.cat-count {
  margin-top: auto; padding: 3px 11px; border-radius: 20px; font-size: 13px; font-weight: 700;
  color: color-mix(in srgb, var(--c) 72%, #2a1406); background: color-mix(in srgb, var(--c) 14%, transparent);
}
@supports not (color: color-mix(in srgb, red, blue)) { .cat-count { color: var(--cafe); background: var(--crema-2); } }

/* ---------- Productos ---------- */
.rail { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 4px 16px 10px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail .card { flex: 0 0 min(62%, 240px); scroll-snap-align: start; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 24px 16px; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card { position: relative; display: block; text-align: left; border: 0; padding: 0; background: none; width: 100%; }
.card .photo {
  position: relative; aspect-ratio: 1; border-radius: 16px; overflow: hidden;
  background: var(--crema-2); border: 1px solid var(--linea);
}
.card .photo img { width: 100%; height: 100%; object-fit: cover; }
.card h3 { font: 600 15.5px/1.3 var(--sans); margin: 9px 2px 2px; }
.card .price { margin: 0 2px; font-weight: 800; font-size: 16px; color: var(--barro-2); }
.card .price small { font-weight: 600; color: var(--cafe-2); font-size: 12.5px; }
.card .dots { position: absolute; left: 8px; bottom: 8px; display: flex; gap: 3px; }
.card .dots i { width: 13px; height: 13px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.tag {
  position: absolute; top: 8px; left: 8px; padding: 4px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 800; background: var(--papel); color: var(--cafe);
}
.tag.out { background: var(--cafe); color: var(--crema); }
.card.is-out .photo img { filter: grayscale(.6) opacity(.75); }

/* ---------- Vista de categoría ---------- */
.cat-head { padding: 18px 0 6px; }
.cat-head h1 { font-size: clamp(30px, 8vw, 44px); }
.cat-head p { margin: 6px 0 0; color: var(--cafe-2); }
.chips {
  position: sticky; top: var(--top); z-index: 20;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 10px -16px 18px; padding: 10px 16px; background: rgba(246, 237, 220, .94);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 40px; padding: 0 16px; border-radius: 20px; border: 1.5px solid var(--linea);
  background: var(--papel); font-weight: 600; font-size: 15px; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--cafe); color: var(--crema); border-color: var(--cafe); }
.chip small { opacity: .65; margin-left: 3px; }

.empty { text-align: center; padding: 50px 10px; color: var(--cafe-2); }
.empty h2 { font-size: 24px; color: var(--cafe); margin-bottom: 6px; }

/* ---------- Personalizados ---------- */
.custom {
  margin-top: 40px; border-radius: 24px; padding: 26px 22px; position: relative; overflow: hidden;
  background: var(--talavera); color: #f3f6fb;
}
.custom::after { /* flor de talavera */
  content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; opacity: .18;
  background: radial-gradient(circle, #fff 0 14px, transparent 15px),
              conic-gradient(from 0deg, #fff 0 10%, transparent 0 12.5%, #fff 0 22.5%, transparent 0 25%, #fff 0 35%, transparent 0 37.5%, #fff 0 47.5%, transparent 0 50%, #fff 0 60%, transparent 0 62.5%, #fff 0 72.5%, transparent 0 75%, #fff 0 85%, transparent 0 87.5%, #fff 0 97.5%, transparent 0);
  border-radius: 50%;
}
.custom h2 { font-size: 26px; max-width: 16ch; }
.custom p { max-width: 42ch; margin: 10px 0 18px; color: #d9e3f2; }
.custom ul { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 20px; }
.custom li { padding: 5px 12px; border-radius: 20px; background: rgba(255,255,255,.14); font-weight: 600; font-size: 14px; }

/* ---------- Visítanos ---------- */
.visit { display: grid; gap: 18px; margin-top: 40px; align-items: center; }
@media (min-width: 760px) { .visit { grid-template-columns: 300px 1fr; gap: 34px; } }
.visit video { width: 100%; max-width: 300px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 22px; background: var(--cafe); margin: 0 auto; }
@media (max-width: 759px) { .visit video { max-width: none; aspect-ratio: 4 / 5; } }
.visit h2 { font-size: 30px; }
.visit dl { margin: 14px 0 20px; display: grid; gap: 12px; }
.visit dl div { display: flex; gap: 12px; }
.visit dt svg { color: var(--barro-2); margin-top: 1px; }
.visit dd { margin: 0; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 54px; padding: 0 22px; border-radius: 16px; border: 0;
  font-weight: 800; font-size: 17px; text-decoration: none; transition: transform .1s, background .2s;
}
.btn:active { transform: scale(.98); }
.btn-whats { background: var(--whats); color: #fff; }
.btn-whats:hover { background: var(--whats-2); }
.btn-light { background: #fff; color: var(--talavera); }
.btn-outline { background: transparent; border: 2px solid var(--cafe); color: var(--cafe); }
.btn-cafe { background: var(--cafe); color: var(--crema); }
.btn-block { width: 100%; }
.wa-icon { width: 24px; height: 24px; fill: currentColor; stroke: none; }

/* ---------- Pie ---------- */
.footer { background: var(--cafe); color: var(--crema); margin-top: 30px; padding: 40px 16px calc(34px + env(safe-area-inset-bottom)); text-align: center; }
.footer img { width: 120px; height: 120px; border-radius: 50%; margin: 0 auto 8px; }
.footer p { margin: 6px auto; max-width: 40ch; color: #e6d3b6; font-size: 15px; }
.social { display: flex; justify-content: center; gap: 14px; margin: 20px 0 22px; }
.social a {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(246, 237, 220, .1); color: var(--crema); border: 1px solid rgba(246,237,220,.25);
}
.social a:hover { background: var(--barro); border-color: var(--barro); }
.social svg { width: 26px; height: 26px; fill: currentColor; stroke: none; }
.footer .fine { font-size: 13px; color: #bfa58a; }

/* ---------- Hojas (producto, lista) ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(40, 20, 8, .5); animation: fade .25s; }
.sheet-panel {
  position: relative; width: 100%; max-width: 620px; max-height: 94vh; max-height: 94dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--crema); border-radius: 26px 26px 0 0; animation: subir .32s cubic-bezier(.2,.8,.2,1);
  padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 760px) {
  .sheet { align-items: center; }
  .sheet-panel { border-radius: 26px; max-height: 90vh; }
}
@keyframes subir { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.sheet-close {
  position: absolute; top: 12px; right: 12px; z-index: 3; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(255, 250, 240, .92); display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.gallery { position: relative; background: var(--crema-2); }
.gallery-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track img { flex: 0 0 100%; width: 100%; aspect-ratio: 1; object-fit: cover; scroll-snap-align: center; }
.gallery-dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.gallery-dots i { width: 8px; height: 8px; border-radius: 4px; background: rgba(255,255,255,.6); transition: width .2s; }
.gallery-dots i.on { width: 22px; background: #fff; }

.p-body { padding: 20px 20px 24px; }
.p-cat { font-size: 14px; font-weight: 600; color: var(--barro-2); text-decoration: none; }
.p-body h2 { font-size: 28px; margin: 4px 0 6px; }
.p-price { font-size: 28px; font-weight: 800; color: var(--cafe); }
.p-price small { font-size: 15px; font-weight: 600; color: var(--cafe-2); }
.p-desc { margin: 10px 0 0; font-size: 16.5px; line-height: 1.55; max-width: 60ch; }
.seal { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 16px 0 4px; padding: 0; list-style: none; }
.seal li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; line-height: 1.25; padding: 9px 10px; border-radius: 12px; background: var(--papel); border: 1px solid var(--linea); }
.seal svg { width: 20px; height: 20px; color: var(--barro-2); }
.opt { margin-top: 20px; }
.opt h3 { font: 700 15px var(--sans); margin-bottom: 9px; }
.opt h3 span { font-weight: 500; color: var(--cafe-2); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  min-height: 46px; padding: 6px 16px; border-radius: 14px; border: 1.5px solid var(--linea); background: var(--papel);
  display: grid; text-align: center; line-height: 1.2; font-weight: 700;
}
.pill small { font-weight: 600; color: var(--cafe-2); font-size: 13px; }
.pill[aria-pressed="true"] { border-color: var(--cafe); background: var(--cafe); color: var(--crema); }
.pill[aria-pressed="true"] small { color: #e6d3b6; }
.swatch { display: flex; align-items: center; gap: 8px; padding: 5px 14px 5px 6px; border-radius: 30px; border: 1.5px solid var(--linea); background: var(--papel); font-weight: 600; min-height: 44px; }
.swatch i { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.swatch[aria-pressed="true"] { border-color: var(--cafe); box-shadow: 0 0 0 2px var(--cafe); }
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--linea); border-radius: 14px; background: var(--papel); }
.qty button { width: 48px; height: 46px; border: 0; background: none; font-size: 22px; font-weight: 700; }
.qty output { min-width: 34px; text-align: center; font-weight: 800; font-size: 18px; }
.p-actions {
  position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr auto; gap: 10px;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); margin-bottom: calc(-1 * env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(246,237,220,0), var(--crema) 26%);
}
.p-actions .btn-outline { padding: 0 16px; }
.p-share { margin-top: 16px; display: flex; gap: 8px; }
.link-btn { border: 0; background: none; color: var(--talavera); font-weight: 700; display: inline-flex; gap: 6px; align-items: center; padding: 8px 0; }
.link-btn svg { width: 20px; height: 20px; }

.list-panel { padding: 22px 20px 0; }
.list-panel h2 { font-size: 28px; padding-right: 50px; }
.list-items { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 12px; }
.list-items li { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; align-items: center; background: var(--papel); border-radius: 16px; padding: 8px; border: 1px solid var(--linea); }
.list-items img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; }
.list-items b { display: block; font-size: 15px; line-height: 1.25; }
.list-items small { color: var(--cafe-2); font-size: 13px; }
.list-items .rm { border: 0; background: none; width: 40px; height: 40px; display: grid; place-items: center; color: var(--cafe-2); }
.list-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 18px; font-weight: 700; padding: 6px 2px 0; }
.list-total strong { font-size: 24px; }
.list-note { font-size: 13.5px; color: var(--cafe-2); margin: 4px 2px 0; }

.ios-panel { padding: 30px 24px 34px; text-align: center; }
.ios-panel img { margin: 0 auto 12px; border-radius: 18px; }
.ios-panel h2 { font-size: 24px; }
.ios-panel ol { text-align: left; margin: 18px auto 0; max-width: 340px; padding-left: 22px; display: grid; gap: 10px; font-size: 16.5px; }
.inline { width: 20px; height: 20px; vertical-align: -4px; color: var(--talavera); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 80;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: var(--cafe); color: var(--crema); padding: 12px 18px; border-radius: 14px; font-weight: 600;
  transition: .25s; max-width: calc(100% - 32px); box-shadow: var(--sombra);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
