/* ============================================================
   JARS MOTION — Premium micro-interaction layer
   Load after premium-theme.css. Semantic, physics-grounded,
   zero AI-tell. All timings empirically tuned.
   ============================================================ */

/* ── 0. Page enter ─────────────────────────────────────── */
@keyframes _jars-fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}
body {
  animation: _jars-fadein 0.35s cubic-bezier(0.16,1,0.3,1) both;
}

/* ── 1. Scroll-reveal base ─────────────────────────────── */
.jm-reveal {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity  0.52s cubic-bezier(0.22,1,0.36,1),
    transform 0.52s cubic-bezier(0.22,1,0.36,1);
  will-change: opacity, transform;
}
.jm-reveal.jm-visible {
  opacity: 1;
  transform: translateY(0);
}
/* stagger siblings */
.jm-reveal:nth-child(2) { transition-delay: 0.06s; }
.jm-reveal:nth-child(3) { transition-delay: 0.12s; }
.jm-reveal:nth-child(4) { transition-delay: 0.18s; }
.jm-reveal:nth-child(5) { transition-delay: 0.24s; }
.jm-reveal:nth-child(6) { transition-delay: 0.28s; }

/* ── 2. Card lift + light sweep ────────────────────────── */
.cards, .cards-blog, .jars-card,
.containerProduct .containers,
.card-populer {
  position: relative;
  overflow: hidden;
  transition:
    box-shadow 0.28s cubic-bezier(0.22,1,0.36,1),
    transform  0.28s cubic-bezier(0.22,1,0.36,1),
    border-color 0.2s ease;
}
.cards:hover, .cards-blog:hover, .jars-card:hover,
.containerProduct .containers:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(0,0,0,0.10);
}

/* Light sweep — tidak ada di card-populer karena dia sudah punya spin border */
.cards::after, .cards-blog::after {
  content: '';
  position: absolute;
  top: 0; left: -80%;
  width: 50%; height: 100%;
  background: linear-gradient(
    120deg,
    transparent 20%,
    rgba(255,255,255,0.08) 50%,
    transparent 80%
  );
  transform: skewX(-18deg);
  transition: left 0.55s cubic-bezier(0.22,1,0.36,1);
  pointer-events: none;
  z-index: 1;
}
.cards:hover::after, .cards-blog:hover::after {
  left: 130%;
}

/* ── 3. Buttons — micro press ──────────────────────────── */
.btnYellowPrimary,
.btnYellowSecond,
.btnGrey,
.button-more {
  transition:
    transform  0.14s cubic-bezier(0.22,1,0.36,1),
    box-shadow 0.14s ease,
    background 0.18s ease,
    opacity    0.14s ease !important;
}
.btnYellowPrimary:active,
.btnYellowSecond:active,
.btnGrey:active {
  transform: scale(0.965) !important;
  box-shadow: none !important;
}
.btnYellowPrimary:hover {
  box-shadow: 0 6px 20px rgba(136,0,240,0.28);
}

/* ── 4. Navbar refined scroll state ────────────────────── */
.navbar {
  transition:
    background   0.3s ease,
    box-shadow   0.3s ease,
    padding-top  0.3s ease,
    padding-bottom 0.3s ease;
}
.navbar.jm-scrolled {
  box-shadow: 0 2px 20px rgba(0,0,0,0.12) !important;
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}

/* ── 5. Read progress bar (top) ────────────────────────── */
#jm-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: var(--yellow-primary);
  z-index: 99999;
  transition: width 0.12s linear;
  pointer-events: none;
  opacity: 0.85;
}

/* ── 6. Flash sale badge pulse ─────────────────────────── */
@keyframes _jars-softpulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.65; }
}
.swiper-slide.flashSale .disc,
.badge-flash, [class*="flash"][class*="badge"],
.disc-badge {
  animation: _jars-softpulse 2.4s ease-in-out infinite;
}

/* ── 7. Skeleton shimmer ───────────────────────────────── */
@keyframes _jars-shimmer {
  from { background-position: -200% 0; }
  to   { background-position:  200% 0; }
}
.lazy-image {
  background:
    linear-gradient(
      90deg,
      var(--light-grey) 25%,
      rgba(136,0,240,0.06) 50%,
      var(--light-grey) 75%
    );
  background-size: 200% 100%;
  animation: _jars-shimmer 1.6s ease infinite;
  filter: none !important;
}
.lazy-image.loaded {
  background: none;
  animation: none;
}

/* ── 8. Input focus lift ───────────────────────────────── */
.floating-label-content .floating-input,
.floating-label-content .floating-select,
.custom_field {
  transition:
    border-color 0.18s ease,
    box-shadow   0.18s ease,
    transform    0.18s ease !important;
}
.floating-label-content .floating-input:focus,
.floating-label-content .floating-select:focus,
.custom_field:focus {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(136,0,240,0.10) !important;
}

/* ── 9. Product image — clean zoom, no over-blur ───────── */
.containerProduct .containers .product-img {
  transform: scale(1);
  transition: transform 0.42s cubic-bezier(0.22,1,0.36,1),
              filter    0.42s ease !important;
}
.containerProduct .containers:hover .product-img {
  transform: scale(1.06) !important;
  filter: blur(8px) !important;
}

/* ── 10. Nav tabs ink indicator ────────────────────────── */
.navTabs .btnNavTabs {
  position: relative;
  transition: color 0.18s ease !important;
}
.navTabs .btnNavTabs::after {
  content: '';
  position: absolute;
  bottom: -3px; left: 50%;
  width: 0; height: 2px;
  background: var(--yellow-primary);
  border-radius: 2px;
  transform: translateX(-50%);
  transition: width 0.22s cubic-bezier(0.22,1,0.36,1);
}
.navTabs .btnNavTabs:hover::after,
.navTabs .btnNavTabs.active::after {
  width: 60%;
}

/* ── 11. Mobile nav hide/show smoother ─────────────────── */
.mobileNav {
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1) !important;
}

/* ── 12. Toastr refinement ─────────────────────────────── */
#toast-container > div {
  border-radius: 12px !important;
  box-shadow: 0 8px 28px rgba(0,0,0,0.14) !important;
  font-family: var(--jars-font-body, sans-serif) !important;
}

/* ── 13. Ripple on interactive elements ────────────────── */
.jm-ripple {
  position: relative;
  overflow: hidden;
}
.jm-ripple-dot {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255,255,255,0.22);
  pointer-events: none;
  animation: _jars-ripple 0.5s linear;
}
@keyframes _jars-ripple {
  to { transform: scale(4); opacity: 0; }
}

/* ── 14. Reduce-motion respect ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .jm-reveal { opacity: 1 !important; transform: none !important; }
  body { animation: none !important; }
}
