/* ============================================================
   PRODUCTS-FILTER.CSS  (v5.7.20)
   Category filter for products.html — loader + choreographed motion.

   Rules of the road
   - Only transform / opacity / clip-path-free properties are animated.
   - Entrance uses the *individual* transform properties (translate / scale)
     so it never fights hover transforms or the floating icons' keyframes.
   - Everything is gated by .pf-on (added by JS). No JS = full page, untouched.
   - prefers-reduced-motion = instant swap, no skeleton, no loader.
   ============================================================ */

:root {
  --pf-ease:   cubic-bezier(.22, 1, .36, 1);     /* expo-out: fast start, long settle */
  --pf-spring: cubic-bezier(.34, 1.56, .64, 1);  /* slight overshoot */
}

/* ---------- 0. no flash: while a ?type= page boots, hide the full list ---------- */
.pf-pending .product-showcase .showcase-item { display: none; }

/* ---------- 1. filter bar ---------- */
.pf-bar {
  position: relative;
  scroll-margin-top: calc(var(--header-height-scrolled, 78px) + 20px);
  margin: 0 0 46px;
  padding: 20px 22px 18px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .10);
  z-index: 2;
}
.pf-bar[hidden] { display: none; }
.pf-bar.pf-bar-in { animation: pfBarIn .6s var(--pf-ease) both; }
@keyframes pfBarIn {
  from { opacity: 0; translate: 0 -14px; }
  to   { opacity: 1; translate: 0 0; }
}

/* progress bar — driven by the Web Animations API (trickle -> complete) */
.pf-loader {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  overflow: hidden;
  pointer-events: none;
}
.pf-loader i {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #e31e24 0%, #f39200 100%);
  transform-origin: left center;
  transform: scaleX(0);
  opacity: 0;
  box-shadow: 0 0 12px rgba(243, 146, 0, .7);
}

.pf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.pf-showing { color: #666; font-size: .78rem; letter-spacing: .4px; }
.pf-showing strong { display: inline-block; color: #1a1a1a; font-weight: 600; }

.pf-all {
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  background: var(--sw-red, #e31e24);
  transition: background .25s ease, box-shadow .25s ease, transform .35s var(--pf-spring);
}
.pf-all:hover { background: #c4161c; box-shadow: 0 8px 20px rgba(227, 30, 36, .35); transform: translateY(-2px); }
.pf-all:active { transform: translateY(0) scale(.97); }

/* chips + sliding pill (shared-element style) */
.pf-chips { position: relative; display: flex; flex-wrap: wrap; gap: 8px; }
.pf-pill {
  position: absolute;
  left: 0; top: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #e31e24, #c4161c);
  box-shadow: 0 8px 20px rgba(227, 30, 36, .32);
  pointer-events: none;
  opacity: 0;
  transition: transform .6s var(--pf-ease), width .6s var(--pf-ease), height .3s ease, opacity .25s ease;
  will-change: transform, width;
}
.pf-pill.pf-pill-no-anim { transition: none; }

.pf-chip {
  position: relative;
  z-index: 1;
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: .74rem;
  letter-spacing: .3px;
  padding: 8px 16px;
  border-radius: 999px;
  color: #333;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, .18);
  transition: color .3s ease .08s, border-color .3s ease, transform .35s var(--pf-spring);
}
.pf-chip:hover { border-color: var(--sw-red, #e31e24); color: var(--sw-red, #e31e24); transform: translateY(-2px); }
.pf-chip:active { transform: translateY(0) scale(.96); }
.pf-chip:focus-visible { outline: 2px solid var(--sw-red, #e31e24); outline-offset: 2px; }
.pf-chip.is-active,
.pf-chip.is-active:hover { color: #fff; border-color: transparent; }

/* ---------- 2. skeleton (shown while the product "loads") ---------- */
.pf-skel { pointer-events: none; }
.pf-skel.pf-skel-in  { animation: pfFade .35s ease both; }
.pf-skel.pf-skel-out { opacity: 0; transition: opacity .18s ease; }
@keyframes pfFade { from { opacity: 0; } to { opacity: 1; } }

.pf-sk {
  position: relative;
  overflow: hidden;
  background: #eceef1;
  border-radius: 8px;
}
.pf-sk::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .8) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: pfShimmer 1.3s ease-in-out infinite;
}
@keyframes pfShimmer { to { transform: translateX(100%); } }

.pf-sk-tag   { width: 64px;  height: 44px; margin-bottom: 14px; }
.pf-sk-title { width: 78%;   height: 34px; margin-bottom: 12px; }
.pf-sk-title.s { width: 46%; margin-bottom: 22px; }
.pf-sk-line  { height: 14px; margin-bottom: 11px; }
.pf-sk-feat  { height: 18px; margin: 20px 0 0; }
.pf-sk-btns  { display: flex; gap: 14px; margin-top: 34px; }
.pf-sk-btn   { width: 150px; height: 50px; border-radius: 10px; }

/* ---------- 3. item states ---------- */
.pf-on .showcase-item.pf-hide { display: none; }

/* while filtered the old scroll-reveal must not double-animate the item */
.pf-filtered .showcase-item[data-reveal] { opacity: 1; filter: none; transition: none; }
.pf-filtered .showcase-item { margin-bottom: 40px; }
.pf-on .showcase-item[id] { scroll-margin-top: calc(var(--header-height-scrolled, 78px) + 20px); }

/* exit */
.pf-on .showcase-item.pf-out,
.pf-on .showcase-item.pf-out[data-reveal] {
  opacity: 0;
  translate: 0 -14px;
  transition: opacity .2s ease, translate .2s ease;
}

/* ---------- 4. enter choreography (class .pf-in on the item) ----------
   0.00s  curtain wipes off the image, image settles from 1.3x
   0.20s  big number slides in
   0.35s  title words rise out of a mask, one by one
   0.50s  description
   0.55s  badge slides in, floating icons pop with a spring
   0.62s  feature rows stagger, check icons pop
   0.95s  buttons
   ---------------------------------------------------------------------- */
.pf-in .showcase-image-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 5;
  background: linear-gradient(135deg, #1a0508 0%, #8f0f16 55%, #e31e24 100%);
  transform-origin: right center;
  animation: pfCurtain 1s var(--pf-ease) .05s both;
  pointer-events: none;
}
.pf-in.showcase-item-reverse .showcase-image-wrap::after { transform-origin: left center; }
@keyframes pfCurtain { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.pf-in .showcase-image-wrap img { animation: pfSettle 1.5s var(--pf-ease) both; }
@keyframes pfSettle { from { scale: 1.3; } to { scale: 1; } }

.pf-in .showcase-tag   { animation: pfSlide .8s var(--pf-ease) .2s both; }
@keyframes pfSlide { from { opacity: 0; translate: -22px 0; } to { opacity: 1; translate: 0 0; } }

/* title words (split by JS) */
.pf-w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .14em; margin-bottom: -.14em; }
.pf-w > span { display: inline-block; }
.pf-in .pf-w > span { animation: pfWord .85s var(--pf-ease) both; animation-delay: calc(.35s + var(--wi, 0) * .08s); }
@keyframes pfWord { from { translate: 0 115%; } to { translate: 0 0; } }

.pf-in .showcase-desc  { animation: pfRise .75s var(--pf-ease) .5s both; }
.pf-in .showcase-badge { animation: pfSlide .7s var(--pf-ease) .55s both; }
@keyframes pfRise { from { opacity: 0; translate: 0 18px; } to { opacity: 1; translate: 0 0; } }

/* floating icons: entrance on `scale`, their own float keeps running on `transform` */
.pf-in .float-el {
  animation-name: floatEl, pfPop;
  animation-duration: 6s, .75s;
  animation-timing-function: ease-in-out, var(--pf-spring);
  animation-iteration-count: infinite, 1;
  animation-fill-mode: none, both;
}
.pf-in .float-el-1 { animation-delay: 0s, .70s; }
.pf-in .float-el-2 { animation-delay: 2s, .82s; }
.pf-in .float-el-3 { animation-delay: 4s, .94s; }
@keyframes pfPop { from { opacity: 0; scale: .3; } to { opacity: 1; scale: 1; } }

.pf-in .showcase-features li { animation: pfRise .7s var(--pf-ease) both; }
.pf-in .showcase-features li:nth-child(1) { animation-delay: .62s; }
.pf-in .showcase-features li:nth-child(2) { animation-delay: .70s; }
.pf-in .showcase-features li:nth-child(3) { animation-delay: .78s; }
.pf-in .showcase-features li:nth-child(4) { animation-delay: .86s; }
.pf-in .showcase-features li:nth-child(n+5) { animation-delay: .94s; }
.pf-in .showcase-features li i { animation: pfPop .55s var(--pf-spring) both; }
.pf-in .showcase-features li:nth-child(1) i { animation-delay: .78s; }
.pf-in .showcase-features li:nth-child(2) i { animation-delay: .86s; }
.pf-in .showcase-features li:nth-child(3) i { animation-delay: .94s; }
.pf-in .showcase-features li:nth-child(n+4) i { animation-delay: 1s; }

.pf-in .showcase-btn { animation: pfRise .7s var(--pf-ease) both; }
.pf-in .showcase-btn:nth-child(1) { animation-delay: .95s; }
.pf-in .showcase-btn:nth-child(2) { animation-delay: 1.05s; }

/* "Show all" — items rise in one after another */
.pf-rise { animation: pfRise .8s var(--pf-ease) both; animation-delay: calc(var(--ri, 0) * .09s); }

/* ---------- 5. small screens / reduced motion ---------- */
@media (max-width: 640px) {
  .pf-bar { padding: 16px 14px 14px; margin-bottom: 32px; }
  .pf-chip { padding: 7px 12px; font-size: .7rem; }
  .pf-sk-btn { width: 120px; height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  .pf-loader, .pf-skel { display: none !important; }
  .pf-bar.pf-bar-in,
  .pf-rise,
  .pf-in *, .pf-in *::after { animation: none !important; }
  .pf-pill, .pf-chip, .pf-all { transition: none !important; }
}
