/* La Tiendita de Mila — estilos de la tienda (venta directa de Mila) */
:root {
  --beige: #f7f1e8;
  --cream: #fffaf3;
  --ink: #4a323a;
  --ink-soft: #7a5a63;
  --magenta: #b3123f;
  --magenta-dark: #8f0d31;
  --burgundy: #7f1d3f;
  --pink-soft: #fdeef3;
  --pink-line: #f3dbe2;
  --gold: #c9a227;
  --wa: #1eb85a;
  --wa-dark: #159a48;
  --ok: #1e8e4f;
  --warn: #b97d10;
  --sold: #8a8a8a;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(179, 18, 63, 0.10);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--beige);
  color: var(--ink);
  line-height: 1.5;
}

img { max-width: 100%; }

a { color: var(--magenta); }

.script {
  font-family: "Great Vibes", "Segoe Script", cursive;
  font-weight: 400;
}

/* ---------- Barra superior de la tienda ---------- */
@media (max-width: 480px) {
  .tbar .brand { font-size: 1.22rem; }
  .tbar .back { font-size: 0.85rem; }
  .tbar .wa-pill { font-size: 0.8rem; padding: 6px 10px; }
}

.tbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(255, 250, 243, 0.96);
  border-bottom: 1px solid var(--pink-line);
  backdrop-filter: blur(6px);
}

.tbar .back {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
}

.tbar .brand {
  flex: 1;
  text-align: center;
  font-size: 1.55rem;
  color: var(--burgundy);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
}

.tbar .wa-pill {
  background: var(--wa);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 7px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.wrap { max-width: 1024px; margin: 0 auto; padding: 0 14px 40px; }

/* ---------- Migas de pan ---------- */
.crumbs {
  font-size: 0.88rem;
  color: var(--ink-soft);
  padding: 12px 2px 4px;
}

.crumbs a { color: var(--magenta); text-decoration: none; font-weight: 600; }
.crumbs a:hover { text-decoration: underline; }

/* ---------- Portada de la tienda ---------- */
.store-hero {
  position: relative;
  margin: 14px 0 6px;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: linear-gradient(135deg, #ffe3ee 0%, #fff5f8 55%, #ffe9f1 100%);
  display: grid;
  grid-template-rows: 300px auto;
}

.store-hero .photo { position: relative; overflow: hidden; }
.store-hero .photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 22%;
  display: block;
}

.store-hero .content {
  padding: 18px 20px 22px;
  text-align: center;
  position: relative;
}

.store-hero h1 {
  margin: 0;
  font-size: 3rem;
  color: var(--burgundy);
  line-height: 1.05;
}

.store-hero .slogan { margin: 4px 0 0; font-size: 1.08rem; color: var(--ink); }
.store-hero .sub { margin: 8px 0 0; color: var(--ink-soft); font-size: 0.95rem; }

@media (min-width: 760px) {
  .store-hero { grid-template-rows: none; grid-template-columns: 42% 58%; min-height: 340px; }
  .store-hero .content { display: flex; flex-direction: column; justify-content: center; }
  .store-hero h1 { font-size: 3.8rem; }
}

.spark {
  position: absolute;
  color: var(--gold);
  font-size: 1.1rem;
  pointer-events: none;
  animation: twinkle 2.8s ease-in-out infinite;
}

.spark.s1 { top: 12px; right: 16px; }
.spark.s2 { top: 46%; right: 8%; font-size: 0.85rem; animation-delay: 0.9s; }
.spark.s3 { bottom: 14px; left: 14px; font-size: 0.95rem; animation-delay: 1.7s; }

@keyframes twinkle {
  0%, 100% { opacity: 0.15; transform: scale(0.8) rotate(0deg); }
  50% { opacity: 0.9; transform: scale(1.15) rotate(20deg); }
}

@media (prefers-reduced-motion: reduce) {
  .spark { animation: none; opacity: 0.5; }
}

/* ---------- Secciones ---------- */
h2.section-title {
  text-align: center;
  color: var(--burgundy);
  font-size: 2rem;
  margin: 30px 0 4px;
}

.section-sub { text-align: center; color: var(--ink-soft); margin: 0 0 14px; font-size: 0.95rem; }

/* Carrusel de recientes */
.rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 6px 2px 12px;
  -webkit-overflow-scrolling: touch;
}

.rail .pcard { flex: 0 0 168px; scroll-snap-align: start; }

/* Tarjeta de producto */
.pcard {
  background: #fff;
  border: 1px solid var(--pink-line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(74, 50, 58, 0.05);
  display: flex;
  flex-direction: column;
}

.pcard a.photo-link { display: block; background: #fff; }
.pcard img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.pcard .pinfo { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pcard .pname { font-weight: 700; font-size: 0.96rem; line-height: 1.3; }
.pcard .pname a { color: var(--ink); text-decoration: none; }
.pcard .pname a:hover { color: var(--magenta); }
.pcard .pprice { color: var(--magenta); font-weight: 800; font-size: 1.08rem; margin-top: auto; }

.badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
  background: var(--ok);
}

.badge.reservado { background: var(--warn); }
.badge.vendido { background: var(--sold); }

/* Cuadrícula de productos (categoría) */
.pgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

@media (min-width: 760px) {
  .pgrid { grid-template-columns: repeat(3, 1fr); }
  .rail .pcard { flex-basis: 200px; }
}

/* Categorías */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

@media (min-width: 760px) {
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
}

.cat-tile {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  display: block;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(74, 50, 58, 0.08);
}

.cat-tile img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }

.cat-tile .label {
  position: absolute;
  inset: auto 0 0 0;
  padding: 22px 12px 10px;
  background: linear-gradient(transparent, rgba(74, 20, 38, 0.78));
  color: #fff;
  font-weight: 800;
  font-size: 1.02rem;
}

.cat-tile .label small { display: block; font-weight: 600; font-size: 0.8rem; opacity: 0.92; }

/* ---------- Página de producto ---------- */
.product-layout { display: grid; gap: 18px; margin-top: 10px; }

@media (min-width: 820px) {
  .product-layout { grid-template-columns: 1.05fr 1fr; gap: 26px; }
}

.gallery .main-photo {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--pink-line);
  background: #fff;
  cursor: zoom-in;
}

.gallery .main-photo img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; display: block; }

.thumbs { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.thumbs button {
  border: 2px solid var(--pink-line);
  border-radius: 10px;
  padding: 0;
  background: #fff;
  cursor: pointer;
  width: 64px; height: 64px;
  overflow: hidden;
}

.thumbs button.active { border-color: var(--magenta); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

.pdetail h1 { margin: 2px 0 4px; font-size: 1.55rem; line-height: 1.25; }
.pdetail .brandline { color: var(--ink-soft); margin: 0 0 8px; font-size: 0.95rem; }
.pdetail .price { color: var(--magenta); font-weight: 800; font-size: 1.7rem; margin: 8px 0; }
.pdetail .code { color: var(--ink-soft); font-size: 0.88rem; }
.pdetail .desc { margin: 12px 0; }

.specbox {
  background: var(--cream);
  border: 1px solid var(--pink-line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 14px 0;
}

.specbox h3 { margin: 0 0 8px; font-size: 1rem; color: var(--burgundy); }
.specbox ul { margin: 0; padding-left: 18px; }
.specbox table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.specbox td { padding: 4px 0; vertical-align: top; }
.specbox td.k { font-weight: 700; width: 38%; color: var(--ink); }

.cta-row { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

.btn-wa, .btn-mail, .btn-share {
  display: block;
  text-align: center;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.02rem;
  padding: 13px 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { background: var(--wa-dark); }
.btn-mail { background: var(--magenta); color: #fff; }
.btn-mail:hover { background: var(--magenta-dark); }
.btn-share { background: transparent; color: var(--magenta); font-size: 0.94rem; padding: 6px; }
.btn-share:hover { text-decoration: underline; }

.btn-disabled {
  background: #d8d2cc;
  color: #6f655f;
  cursor: default;
}

.fineprint { color: var(--ink-soft); font-size: 0.86rem; text-align: center; margin-top: 10px; }

/* Visor de foto ampliada */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(30, 10, 18, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 16px;
}

.lightbox img { max-width: 100%; max-height: 92vh; border-radius: 10px; }

.lightbox .close {
  position: absolute;
  top: 12px; right: 16px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
}

/* ---------- Pie de la tienda ---------- */
.tfoot {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
  padding: 26px 14px 34px;
  border-top: 1px solid var(--pink-line);
  margin-top: 34px;
}

.tfoot a { font-weight: 700; }

.empty-note {
  text-align: center;
  color: var(--ink-soft);
  background: var(--cream);
  border: 1px dashed var(--pink-line);
  border-radius: var(--radius);
  padding: 22px 16px;
  margin-top: 14px;
}
