/*
 * Menu page — polish layer (v2). Purely presentational: every selector
 * targets the EXISTING class names that both the SSR partial (menu-card.ejs)
 * and js/menu.js's productCard() emit. No markup changes, so the client
 * re-render keeps working unchanged.
 */

/* ---------------- entrance animations ---------------- */
@keyframes sbm-rise {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes sbm-float {
  0%,
  100% {
    transform: translateY(0) rotate(-4deg);
  }
  50% {
    transform: translateY(-9px) rotate(3deg);
  }
}
@keyframes sbm-shine {
  from {
    transform: translateX(-130%) skewX(-18deg);
  }
  to {
    transform: translateX(230%) skewX(-18deg);
  }
}
@keyframes sbm-pop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.35);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes sbm-ring {
  from {
    box-shadow: 0 0 0 0 rgba(139, 0, 0, 0.35);
  }
  to {
    box-shadow: 0 0 0 12px rgba(139, 0, 0, 0);
  }
}
@keyframes sbm-fly {
  to {
    transform: translate(var(--fx), var(--fy)) scale(0.35);
    opacity: 0.1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .product-card,
  .menu-intro *,
  .category-chip * {
    animation: none !important;
  }
}

/* ---------------- hero intro band ---------------- */
.menu-intro {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 26px 26px 24px;
  margin: 20px 0;
  color: #fff;
  background:
    radial-gradient(
      130% 180% at 100% 0%,
      rgba(255, 255, 255, 0.17),
      transparent 52%
    ),
    linear-gradient(
      135deg,
      var(--primary) 0%,
      var(--primary-dark) 58%,
      var(--primary-deep) 105%
    );
  box-shadow: 0 14px 34px -16px rgba(139, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  align-items: center;
}
.menu-intro::before {
  /* soft glow bubble */
  content: "";
  position: absolute;
  inset-inline-end: -60px;
  top: -70px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.15),
    transparent 62%
  );
  pointer-events: none;
}
.menu-intro-text h1 {
  font-size: clamp(24px, 3.4vw, 32px);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.menu-intro-text h1 .accent {
  color: #ffd9a1;
}
.menu-intro-text .intro-desc {
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  margin-top: 6px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.menu-intro-art {
  font-size: 58px;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.3));
  animation: sbm-float 4.5s ease-in-out infinite;
}

/* ---------------- search ---------------- */
.search-box input {
  height: 54px;
  border-radius: 16px;
  font-size: 14.5px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.search-box input:focus {
  border-color: var(--primary);
  box-shadow:
    0 0 0 4px var(--primary-tint),
    0 8px 22px -12px rgba(139, 0, 0, 0.45);
}

/* ---------------- category chips ---------------- */
.category-chip {
  transition:
    transform 0.18s cubic-bezier(0.22, 0.9, 0.36, 1),
    box-shadow 0.18s,
    background 0.18s,
    color 0.18s,
    border-color 0.18s;
  scroll-snap-align: center;
}
.category-bar {
  scroll-snap-type: x proximity;
}
.category-chip:not(.active):hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 6px 16px -8px rgba(139, 0, 0, 0.4);
}
.category-chip.active {
  box-shadow: 0 8px 20px -8px rgba(139, 0, 0, 0.65);
}
.category-chip.active:active {
  animation: sbm-ring 0.5s ease;
}
.chip-emoji {
  transition: transform 0.18s;
}
.category-chip:hover .chip-emoji {
  transform: scale(1.2) rotate(-8deg);
}

/* ---------------- product cards ---------------- */
.product-grid .product-card {
  animation: sbm-rise 0.5s cubic-bezier(0.22, 0.9, 0.36, 1) both;
}
/* staggered entrance — nth-child waves keep it fast for large grids */
.product-grid .product-card:nth-child(2n) {
  animation-delay: 40ms;
}
.product-grid .product-card:nth-child(3n) {
  animation-delay: 80ms;
}
.product-grid .product-card:nth-child(4n) {
  animation-delay: 120ms;
}
.product-grid .product-card:nth-child(5n) {
  animation-delay: 160ms;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow:
    0 22px 42px -18px rgba(33, 27, 24, 0.3),
    0 12px 30px -14px rgba(139, 0, 0, 0.35);
  border-color: #dccfc5;
}
.product-card:active {
  transform: scale(0.985);
}

/* shine sweep on media hover */
.card-media::after {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  width: 46%;
  inset-inline-start: -60%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.38),
    transparent
  );
  pointer-events: none;
  opacity: 0;
}
.product-card:hover .card-media::after {
  opacity: 1;
  animation: sbm-shine 0.8s ease;
}
.product-card:hover .card-media img {
  transform: scale(1.08);
}

/* price pill + add button */
.card-price {
  font-size: 16px;
  background: var(--primary-tint);
  padding: 4px 10px;
  border-radius: 10px;
  width: fit-content;
}
.card-price small {
  display: inline;
}

.card-add-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px !important;
  color: #fff !important;
  background: linear-gradient(
    135deg,
    var(--primary),
    var(--primary-dark)
  ) !important;
  box-shadow: 0 6px 14px -6px rgba(139, 0, 0, 0.6);
  font-size: 17px;
  transition:
    transform 0.16s cubic-bezier(0.22, 0.9, 0.36, 1),
    box-shadow 0.16s,
    filter 0.16s;
}
.card-add-btn:hover {
  transform: rotate(90deg) scale(1.1);
  filter: brightness(1.12);
  box-shadow: 0 8px 18px -6px rgba(139, 0, 0, 0.75);
}
.card-add-btn:active {
  transform: scale(0.9) rotate(90deg);
}

/* favorite heart pop */
.fav-heart[data-pressed="true"],
.fav-heart.active {
  animation: sbm-pop 0.4s ease;
}

/* discount badge glow */
.discount-badge {
  box-shadow: 0 4px 12px -5px rgba(139, 0, 0, 0.5);
}

/* ---------------- fly-to-cart (spawned by menu-fx JS) ---------------- */
.sbm-fly-item {
  position: fixed;
  z-index: 300;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  animation: sbm-fly 0.7s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}

/* cart-badge pulse when something landed */
.sbm-cart-bumped {
  animation: sbm-pop 0.45s ease;
}
