/* ═══════════════════════════════════════════════════
   Pachamama — Estilos
   Estética: cálida, mística, natural — Deco & Velas
   ═══════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --pm-brown:    #2C1810;
  --pm-terra:    #A0522D;
  --pm-amber:    #C4862A;
  --pm-gold:     #D4A017;
  --pm-sage:     #5C7A5C;
  --pm-cream:    #FAF3E0;
  --pm-parchment:#F2E8D0;

  --bg:          var(--pm-parchment);
  --surface:     #FFFDF6;
  --border:      #E0D4B8;
  --border-light:#EDE6D0;
  --text:        #2C1810;
  --text-2:      #6B4E35;
  --text-muted:  #A08060;

  --f-head: 'Rubik',       system-ui, sans-serif;
  --f-body: 'Nunito Sans', system-ui, sans-serif;

  --r-sm:   8px;
  --r-md:   14px;
  --r-pill: 999px;
  --sh-sm:  0 2px 10px rgba(44,24,16,.12);
  --sh-md:  0 6px 20px rgba(44,24,16,.16);
  --header-h: 90px;
  --t: .18s ease;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  font-family: var(--f-body);
  color: var(--text);
}

/* Garantiza que [hidden] siempre oculte el elemento */
[hidden] { display: none !important; }

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ─── Background pattern ─────────────────────────── */
.bg-pattern {
  position: fixed;
  inset: -200px;
  z-index: -1;
  background-image: url('../img/logo_white.jpeg');
  background-size: 100px auto;
  background-repeat: repeat;
  filter: grayscale(1) sepia(.4);
  opacity: .04;
  pointer-events: none;
  transform: rotate(-12deg);
}

/* ─── Header ──────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--pm-brown);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  overflow: hidden;
}

.site-header::before {
  content: '';
  position: absolute;
  inset: -300px;
  background-image: url('../img/logo_white.png');
  background-size: 140px auto;
  background-repeat: repeat;
  opacity: .28;
  transform: rotate(-12deg);
  pointer-events: none;
}

.site-header::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: linear-gradient(90deg, var(--pm-terra), var(--pm-amber), var(--pm-gold));
  z-index: 2;
}

.logo-link {
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1;
}

.site-logo {
  height: 64px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 3px 14px rgba(0,0,0,.9));
}

/* ─── Filter bar ─────────────────────────────────── */
.filter-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--header-h);
  z-index: 90;
}

.filter-bar-inner { padding-top: 10px; padding-bottom: 0; }
.search-section   { padding-bottom: 4px; }

.search-wrapper {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border-radius: var(--r-pill);
  padding: 0 12px; height: 36px; border: 1.5px solid var(--border);
}
.search-icon { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }
.search-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: var(--f-body); font-size: 16px; color: var(--text); line-height: 1; min-width: 0;
}
.search-input::placeholder { color: var(--text-muted); }
.search-clear {
  width: 28px; height: 28px; border-radius: 50%; background: var(--border);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background var(--t);
}
.search-clear svg { width: 13px; height: 13px; color: var(--text-2); }
.search-clear:hover { background: #d4c4a0; }

/* ─── Categorías ──────────────────────────────────── */
.categories-section { min-width: 0; }
.categories-track {
  display: flex;
  width: 100%;
  gap: 6px;
  padding: 4px 0 8px;
  overflow-x: hidden;  /* no scroll, entran todos */
}
.categories-track::-webkit-scrollbar { display: none; }

.cat-pill {
  flex: 1;              /* cada pill ocupa el mismo ancho */
  min-width: 0;
  scroll-snap-align: start;
  padding: 6px 4px; border-radius: var(--r-pill);
  font-family: var(--f-body); font-size: 11px; font-weight: 700;
  white-space: nowrap; min-height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--t); border: 2px solid transparent; cursor: pointer;
  background: var(--border); color: var(--text-2);
}
.cat-pill.cat-all { background: var(--pm-brown); color: #fff; }
.cat-pill.is-active:not(.cat-all) { border-color: rgba(0,0,0,.15); }
.track-spacer { flex-shrink: 0; width: 8px; }

/* Desktop filter */
@media (min-width: 768px) {
  .filter-bar-inner {
    display: flex; flex-direction: row-reverse;
    align-items: center; gap: 20px; padding: 10px 0; margin: 0 auto;
  }
  .search-section { flex-shrink: 0; width: 280px; padding-bottom: 0; }
  .categories-section { flex: 1; min-width: 0; }
  .categories-track { width: 100%; margin: 0; justify-content: flex-start; padding: 0; }
}

/* ─── Grilla ──────────────────────────────────────── */
.main-content { padding: 20px 0 60px; }

.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 540px)  { .products-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px)  { .products-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
@media (min-width: 1024px) { .products-grid { grid-template-columns: repeat(5, 1fr); } }

/* ─── Cards ───────────────────────────────────────── */
.product-card {
  background: var(--surface); border-radius: var(--r-md);
  overflow: hidden; box-shadow: var(--sh-sm);
  display: flex; flex-direction: column;
  animation: fadeUp .4s ease both;
  border: 1px solid var(--border-light);
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-img-wrap {
  background: var(--surface); padding: 8px; height: 190px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.card-img-wrap img { width: 100%; height: 100%; object-fit: cover; }

.card-body { padding: 10px 12px; flex: 1; display: flex; flex-direction: column; gap: 2px; }

.card-meta { display: flex; align-items: baseline; gap: 6px; overflow: hidden; }
.card-marca {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-transform: uppercase; letter-spacing: .4px;
}
.card-medida { font-size: 10px; font-weight: 600; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

.card-modelo {
  font-family: var(--f-head); font-size: 14px; font-weight: 800; color: var(--text);
  line-height: 1.25; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.card-precio {
  font-family: var(--f-head); font-size: 20px; font-weight: 800;
  color: var(--pm-terra); margin-top: auto; padding-top: 6px; line-height: 1;
}

.card-footer-strip {
  padding: 6px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-height: 28px;
}
.branch-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .3px;
  padding: 2px 8px; border-radius: var(--r-pill);
  background: rgba(0,0,0,.18); white-space: nowrap; line-height: 1.5; color: inherit;
}

/* ─── Skeleton ────────────────────────────────────── */
.card-skeleton {
  border-radius: var(--r-md); height: 250px;
  background: linear-gradient(90deg, #ece3d0 25%, #f5efdf 50%, #ece3d0 75%);
  background-size: 800px 100%; animation: shimmer 1.4s infinite; border: 1px solid var(--border-light);
}
@keyframes shimmer { 0% { background-position: -800px 0; } 100% { background-position: 800px 0; } }

/* ─── Empty state ─────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; grid-column: 1 / -1; }
.empty-icon  { width: 48px; height: 48px; color: var(--text-muted); margin: 0 auto 16px; }
.empty-title { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.empty-body  { font-size: 14px; color: var(--text-2); margin-bottom: 20px; }
.btn-reset {
  padding: 10px 24px; border-radius: var(--r-pill); background: var(--pm-terra); color: #fff;
  font-family: var(--f-body); font-size: 14px; font-weight: 700; border: none; cursor: pointer; transition: background var(--t);
}
.btn-reset:hover { background: var(--pm-amber); }

/* ─── Resultados ──────────────────────────────────── */
.results-count { font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 14px; }

/* ─── Footer ──────────────────────────────────────── */
.site-footer { background: var(--pm-brown); padding: 22px 0 20px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; }
.footer-copy { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.45); }
.footer-right { display: flex; align-items: center; gap: 16px; }
.footer-social { display: flex; gap: 18px; }
.footer-social a { font-size: 18px; color: rgba(255,255,255,.55); transition: color var(--t); }
.footer-social a:hover { color: #fff; }
.footer-update { margin-top: 10px; font-size: 11px; color: rgba(255,255,255,.25); font-weight: 500; }

/* ─── WhatsApp ────────────────────────────────────── */
.whatsapp-fab {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: #25D366; color: #fff; text-decoration: none;
  font-size: 0; flex-shrink: 0; transition: background var(--t), transform var(--t);
}
.whatsapp-fab i { font-size: 17px; }
.whatsapp-label { display: none; }
.whatsapp-fab:hover { background: #1ebe5b; transform: scale(1.08); }
@media (min-width: 768px) {
  .whatsapp-fab { width: auto; height: auto; border-radius: var(--r-pill); padding: 9px 18px; gap: 8px; font-family: var(--f-body); font-size: 14px; font-weight: 700; }
  .whatsapp-label { display: inline; }
}

/* ─── Desktop header ─────────────────────────────── */
@media (min-width: 768px) {
  :root { --header-h: 120px; }
  .site-logo { height: 86px; }
}
