/* ============================================
   ZUCCHERINO — Candy Shop Catalog
   Aesthetic: Playful Confectionery Wonderland
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito:wght@400;600;700&display=swap');

/* --- Design Tokens --- */
:root {
  --purple: #6B3FA0;
  --purple-deep: #5A2D8C;
  --purple-light: #8B5FBF;
  --purple-glow: rgba(107, 63, 160, 0.15);
  --pink: #D94F8C;
  --pink-light: #F0A0C4;
  --yellow: #F5D547;
  --yellow-warm: #FFE066;
  --blue-light: #87CEEB;
  --blue-pale: #C4E6F5;
  --green-wa: #25D366;
  --cream: #FFF9F2;
  --cream-dark: #FFF0E0;
  --white: #FFFFFF;
  --gray-100: #F7F4FA;
  --gray-200: #EDE8F2;
  --gray-400: #B0A3BF;
  --gray-600: #6E6080;
  --gray-800: #3D2E50;
  --shadow-soft: 0 2px 12px rgba(107, 63, 160, 0.10);
  --shadow-card: 0 3px 16px rgba(107, 63, 160, 0.12);
  --shadow-card-hover: 0 8px 28px rgba(107, 63, 160, 0.18);
  --shadow-float: 0 6px 24px rgba(107, 63, 160, 0.16);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --font-display: 'Fredoka', sans-serif;
  --font-body: 'Nunito', sans-serif;
  --header-h: 64px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--gray-800);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- Background Sprinkles (decorative) --- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle 3px at 12% 18%, var(--pink-light) 50%, transparent 51%),
    radial-gradient(circle 2px at 85% 8%, var(--yellow) 50%, transparent 51%),
    radial-gradient(circle 2.5px at 92% 45%, var(--blue-pale) 50%, transparent 51%),
    radial-gradient(circle 3px at 8% 72%, var(--yellow-warm) 50%, transparent 51%),
    radial-gradient(circle 2px at 78% 88%, var(--pink-light) 50%, transparent 51%),
    radial-gradient(circle 2.5px at 45% 5%, var(--purple-glow) 50%, transparent 51%),
    radial-gradient(circle 2px at 55% 92%, var(--blue-pale) 50%, transparent 51%),
    radial-gradient(circle 3px at 30% 55%, var(--pink-light) 50%, transparent 51%);
  opacity: 0.55;
}

/* --- Sticky Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(255, 249, 242, 0.82);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 2px solid var(--purple-glow);
  box-shadow: 0 2px 20px rgba(107, 63, 160, 0.06);
}

.site-header .logo {
  height: 44px;
  width: auto;
  flex-shrink: 0;
  transition: transform var(--transition);
}
.site-header .logo:active {
  transform: scale(0.93);
}

.wa-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--green-wa);
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  box-shadow: 0 3px 12px rgba(37, 211, 102, 0.30);
  transition: transform var(--transition), box-shadow var(--transition);
}
.wa-btn:active {
  transform: scale(0.95);
}
.wa-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* --- Main Content --- */
main {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 12px 40px;
}

/* --- Section Titles --- */
.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--purple);
  margin: 24px 0 12px;
  padding-left: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 22px;
  background: linear-gradient(180deg, var(--yellow), var(--pink));
  border-radius: 3px;
  flex-shrink: 0;
}

/* --- Hero / Featured Scroll --- */
.featured-wrap {
  position: relative;
}

.featured-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 16px;
  scrollbar-width: none;
}
.featured-scroll::-webkit-scrollbar { display: none; }

.featured-scroll .product-card {
  min-width: 160px;
  max-width: 180px;
  flex-shrink: 0;
  scroll-snap-align: start;
}

/* --- Scroll Arrows (mobile) --- */
.scroll-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-55%);
  z-index: 10;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--purple);
  color: var(--white);
  box-shadow: var(--shadow-float);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
}
.scroll-arrow svg {
  width: 18px;
  height: 18px;
}
.scroll-arrow:active {
  transform: translateY(-55%) scale(0.9);
}
.scroll-arrow.hidden {
  opacity: 0;
  pointer-events: none;
}
.scroll-arrow--left { left: -4px; }
.scroll-arrow--right { right: -4px; }

/* --- Category Selector --- */
.category-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 50;
  padding: 12px 0;
  background: rgba(255, 249, 242, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.category-select-wrap {
  position: relative;
  width: 100%;
}

.category-select-wrap::after {
  content: '';
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid var(--white);
  pointer-events: none;
}

.category-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--white);
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-deep) 100%);
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 44px 14px 18px;
  cursor: pointer;
  box-shadow: var(--shadow-float);
  transition: transform var(--transition), box-shadow var(--transition);
}
.category-select:focus {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}
.category-select:active {
  transform: scale(0.98);
}
.category-select option {
  background: var(--white);
  color: var(--gray-800);
  font-family: var(--font-body);
  font-weight: 600;
}

/* --- Product Grid --- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 4px 0 24px;
}

.products-grid:empty::after {
  content: '';
  display: none;
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-400);
  font-family: var(--font-display);
  font-size: 1rem;
}
.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
  display: block;
  opacity: 0.5;
}

/* --- Product Card --- */
.product-card {
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
  animation: cardIn 0.35s ease both;
}
.product-card:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-soft);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.product-card .card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--gray-100);
  overflow: hidden;
}

.product-card .card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.product-card .brand-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(107, 63, 160, 0.88);
  backdrop-filter: blur(6px);
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.6rem;
  letter-spacing: 0.03em;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  max-width: calc(100% - 12px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.product-card .card-name {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.75rem;
  line-height: 1.3;
  color: var(--gray-800);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card .card-code {
  font-family: var(--font-body);
  font-size: 0.65rem;
  color: var(--gray-400);
  letter-spacing: 0.02em;
}

.product-card .card-price {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--pink);
  margin-top: auto;
  padding-top: 4px;
}

.product-card .card-badge {
  display: inline-block;
  align-self: flex-end;
  margin-top: 6px;
  padding: 2px 8px;
  background: #F59E0B;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 20px;
}

/* Highlighted badge for featured */
.product-card.is-featured .card-img-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--yellow), var(--pink), var(--purple-light));
}

/* --- Placeholder image --- */
.card-img-wrap .img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
  color: var(--gray-400);
  font-family: var(--font-display);
  font-size: 0.75rem;
}

/* --- Footer --- */
.site-footer {
  position: relative;
  z-index: 1;
  background: linear-gradient(135deg, var(--purple-deep) 0%, var(--purple) 100%);
  color: rgba(255, 255, 255, 0.85);
  padding: 32px 16px 24px;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.7;
}
.site-footer a {
  color: var(--yellow);
  text-decoration: none;
}
.site-footer .footer-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--white);
  margin-bottom: 8px;
}
.site-footer .footer-divider {
  width: 40px;
  height: 3px;
  background: var(--pink);
  border-radius: 2px;
  margin: 12px auto;
}

/* --- Loading skeleton --- */
.skeleton-card {
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}
.skeleton-card .sk-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: linear-gradient(110deg, var(--gray-100) 30%, var(--gray-200) 50%, var(--gray-100) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
}
.skeleton-card .sk-text {
  padding: 10px;
}
.skeleton-card .sk-line {
  height: 10px;
  border-radius: 5px;
  background: var(--gray-200);
  margin-bottom: 6px;
}
.skeleton-card .sk-line:last-child {
  width: 50%;
  margin-bottom: 0;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Scroll-to-top --- */
.scroll-top-btn {
  position: fixed;
  bottom: 20px;
  right: 16px;
  z-index: 90;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--purple);
  color: var(--white);
  border: none;
  box-shadow: var(--shadow-float);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}
.scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.scroll-top-btn:active {
  transform: scale(0.9);
}
.scroll-top-btn svg {
  width: 22px;
  height: 22px;
}

/* --- Desktop Enhancements --- */
@media (min-width: 600px) {
  :root { --header-h: 72px; }

  .site-header { padding: 0 24px; }
  .site-header .logo { height: 52px; }

  main { padding: 0 24px 60px; }

  .featured-scroll {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    overflow: visible;
  }
  .featured-scroll .product-card {
    min-width: unset;
    max-width: unset;
  }
  .scroll-arrow { display: none; }

  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  .product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
  }
  .product-card:hover .card-img-wrap img {
    transform: scale(1.05);
  }

  .section-title { font-size: 1.4rem; }
  .product-card .card-name { font-size: 0.82rem; }
  .product-card .card-price { font-size: 1.1rem; }
}

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

/* --- Utility: Stagger animation --- */
.product-card:nth-child(1) { animation-delay: 0s; }
.product-card:nth-child(2) { animation-delay: 0.05s; }
.product-card:nth-child(3) { animation-delay: 0.10s; }
.product-card:nth-child(4) { animation-delay: 0.15s; }
.product-card:nth-child(5) { animation-delay: 0.20s; }
.product-card:nth-child(6) { animation-delay: 0.25s; }
.product-card:nth-child(7) { animation-delay: 0.30s; }
.product-card:nth-child(8) { animation-delay: 0.35s; }
.product-card:nth-child(9) { animation-delay: 0.40s; }
.product-card:nth-child(10) { animation-delay: 0.45s; }

/* --- Catalog meta count --- */
.catalog-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-400, #9ca3af);
  text-align: right;
  padding: 4px 0 8px;
  min-height: 1.2em;
}

/* --- Print-friendly --- */
@media print {
  .site-header, .category-bar, .scroll-top-btn, .wa-btn { display: none; }
  .product-card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
}

/* ============================================
   HOMEPAGE — carrusel, destacados sin precio, contacto
   ============================================ */

/* Hero a sangre; el resto del contenido conserva el ancho de siempre */
.home main {
  max-width: none;
  padding: 0 0 40px;
}
.home main > :not(.hero-carousel) {
  width: min(960px, calc(100% - 24px));
  margin-inline: auto;
}

.hero-carousel {
  position: relative;
}
.hero-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.hero-track::-webkit-scrollbar { display: none; }

.hero-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  aspect-ratio: 4 / 5;
  background: linear-gradient(135deg, var(--purple), var(--pink));
}
.hero-slide picture {
  display: block;
  height: 100%;
}
.hero-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.hero-slide img[hidden] { display: none; }

.hero-dots {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  padding: 2px 6px;
  background: rgba(61, 46, 80, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: var(--radius-pill);
}
.hero-dots[hidden] { display: none; }
.hero-dot {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-dot::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.55);
  transition: width var(--transition), background var(--transition);
}
.hero-dot[aria-selected="true"]::before {
  width: 22px;
  background: var(--white);
}
.hero-dot:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: -2px;
  border-radius: var(--radius-pill);
}

/* Destacados sin precio: la insignia HOT! baja al pie de la tarjeta */
.home .products-grid { grid-template-columns: repeat(2, 1fr); }
.home .product-card .card-badge { margin-top: auto; }

/* Contacto */
.contacto { padding-bottom: 8px; }
.contacto-grid {
  display: grid;
  gap: 12px;
  padding: 4px 0 16px;
}
.contacto-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 14px 16px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition);
}
.contacto-card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-soft);
}
.contacto-ico {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--green-wa);
  color: var(--white);
  border-radius: 50%;
}
.contacto-ico svg {
  width: 24px;
  height: 24px;
}
.contacto-zona {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--purple);
}
.contacto-num {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--gray-800);
  letter-spacing: 0.01em;
}

@media (min-width: 600px) {
  .home main > :not(.hero-carousel) { width: min(960px, calc(100% - 48px)); }
}

@media (min-width: 768px) {
  .hero-slide {
    aspect-ratio: 21 / 9;
    max-height: 560px;
  }
  .home .products-grid { grid-template-columns: repeat(3, 1fr); }
  .contacto-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}

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