/* ==========================================================================
   Revive category decks (home page "Revive Products" section)
   One tile per store category; its flagship products fan out like a hand of
   cards (front / left / right). Everything uses the theme's purple accent so
   the three tiles read as one family instead of yellow / blue / pink.
   Which products appear is set in components/products.njk (_plan).
   ========================================================================== */

.rvk-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}

.rvk {
  --c: 168, 85, 247;               /* accent (rgb triplet) */
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--rv10-line, rgba(255, 255, 255, .09));
  background:
    radial-gradient(70% 55% at 50% 52%, rgba(var(--c), .26), transparent 72%),
    linear-gradient(180deg, rgba(var(--c), .07), transparent 38%),
    var(--rv10-surface, #0e0e15);
  transition: border-color .3s, box-shadow .3s, transform .3s;
}
/* tiny hue shifts inside the purple family, nothing louder than that */
.rvk[data-tone="external"] { --c: 139, 120, 255; }
.rvk[data-tone="programs"] { --c: 214, 80, 240; }
.rvk:hover,
.rvk:focus-within {
  border-color: rgba(var(--c), .55);
  box-shadow: 0 30px 70px -34px rgba(var(--c), .8);
  transform: translateY(-3px);
}

.rvk-count {
  position: absolute;
  z-index: 10;
  top: 16px;
  left: 16px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #efe6ff;
  background: rgba(var(--c), .16);
  border: 1px solid rgba(var(--c), .42);
  backdrop-filter: blur(6px);
}

/* ---------- the hand ---------- */
.rvk-stage {
  position: relative;
  height: 306px;
  container-type: inline-size;
  /* faint "table" under the cards */
  background: radial-gradient(60% 26px at 50% calc(100% - 22px), rgba(0, 0, 0, .55), transparent 70%);
}

.rvk-card {
  --x: 0%; --y: 0px; --r: 0deg; --s: 1;
  position: absolute;
  left: 50%;
  bottom: 30px;
  --w: clamp(110px, 40cqw, 168px);
  width: var(--w);
  aspect-ratio: 3 / 4;
  margin-left: calc(var(--w) / -2);
  pointer-events: none;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: #0a0a10;
  box-shadow: 0 24px 38px -16px rgba(0, 0, 0, .9), 0 0 0 1px rgba(0, 0, 0, .5);
  color: inherit;
  text-decoration: none;
  transform-origin: 50% 100%;
  transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(var(--s));
  transition: transform .5s cubic-bezier(.2, .85, .25, 1), box-shadow .3s, filter .3s, border-color .3s;
  -webkit-tap-highlight-color: transparent;
}
.rvk-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}
.rvk-card-name {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 12px;
  text-align: center;
  font-weight: 800;
  color: #fff;
}
/* soft inner sheen so every card reads as a "card" */
.rvk-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(155deg, rgba(255, 255, 255, .14), transparent 34%, transparent 70%, rgba(0, 0, 0, .28));
}

/* slots (offsets are multiples of the card width so the hand always stays inside the tile) */
.rvk-card--front { z-index: 3; --s: 1.08; --y: -4px; }
.rvk-card--left  { z-index: 1; --x: -50%; --r: -8deg; --s: .92; filter: brightness(.7) saturate(.9); }
.rvk-card--right { z-index: 2; --x:  50%; --r:  8deg; --s: .92; filter: brightness(.7) saturate(.9); }

/* only two products (Externals): front card leans right, the other peeks out left */
.rvk[data-n="2"] .rvk-card--front { --x: 18%; --r: 4deg; }
.rvk[data-n="2"] .rvk-card--left  { --x: -30%; --r: -8deg; --s: .96; }
.rvk[data-n="1"] .rvk-card--front { --y: 0px; }

/* hover the TILE and the whole hand opens and the front card pops up (cards themselves aren't hoverable) */
.rvk:hover .rvk-card--left,
.rvk:focus-within .rvk-card--left   { --x: -56%; --r: -11deg; filter: brightness(.85); }
.rvk:hover .rvk-card--right,
.rvk:focus-within .rvk-card--right  { --x:  56%; --r:  11deg; filter: brightness(.85); }
.rvk:hover .rvk-card--front,
.rvk:focus-within .rvk-card--front  { --y: -20px; --s: 1.12; box-shadow: 0 34px 50px -16px rgba(0, 0, 0, .95), 0 0 40px -4px rgba(var(--c), .6); border-color: rgba(var(--c), .8); }
.rvk[data-n="2"]:hover .rvk-card--front { --x: 28%; --r: 6deg; }
.rvk[data-n="2"]:hover .rvk-card--left  { --x: -40%; --r: -11deg; }

.rvk-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; color: rgb(var(--c)); }

/* ---------- text + CTA ---------- */
.rvk-body {
  z-index: 5;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 6px;
  padding: 4px 24px 22px;
}
.rvk-title {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--rv10-text, #f8f8fc);
}
.rvk-desc {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--rv10-muted, #9d9dad);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rvk-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  color: inherit;
  text-decoration: none;
}
.rvk-foot::after { content: ""; position: absolute; inset: 0; z-index: 8; border-radius: inherit; }
.rvk-desc + .rvk-foot, .rvk-title + .rvk-foot { margin-top: 14px; }
.rvk-cta {
  font-size: 15px;
  font-weight: 800;
  color: #e4d3ff;
  transition: color .25s;
}
.rvk-go {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 13px;
  color: #fff;
  background: rgba(var(--c), .2);
  border: 1px solid rgba(var(--c), .5);
  transition: background .25s, border-color .25s, transform .25s, box-shadow .25s;
}
.rvk:hover .rvk-cta, .rvk-foot:focus-visible .rvk-cta { color: #fff; }
.rvk:hover .rvk-go, .rvk-foot:focus-visible .rvk-go {
  background: rgb(var(--c));
  border-color: rgb(var(--c));
  transform: translateX(3px);
  box-shadow: 0 8px 22px -6px rgba(var(--c), .9);
}
.rvk-foot:focus-visible { outline: 2px solid rgba(var(--c), .9); outline-offset: 4px; border-radius: 8px; }

/* ---------- entrance: tile rises, then the cards are dealt out of the stack ---------- */
@keyframes rvk-deal {
  from { opacity: 0; transform: translate(0, 70px) rotate(0deg) scale(.7); filter: blur(6px); }
  60%  { opacity: 1; }
}
@keyframes rvk-rise {
  from { opacity: 0; transform: translateY(28px); }
}
.rvk-grid.is-armed .rvk:not(.is-dealt) { opacity: 0; }
.rvk-grid.is-armed .rvk:not(.is-dealt) .rvk-card { opacity: 0; }
.rvk-grid.is-armed .rvk.is-dealt {
  animation: rvk-rise .7s cubic-bezier(.2, .85, .25, 1) backwards;
  animation-delay: calc(var(--ti, 0) * 120ms);
}
.rvk-grid.is-armed .rvk.is-dealt .rvk-card {
  animation: rvk-deal .9s cubic-bezier(.2, .9, .25, 1.05) backwards;
}
.rvk-grid.is-armed .rvk.is-dealt .rvk-card--front { animation-delay: calc(var(--ti, 0) * 120ms + 260ms); }
.rvk-grid.is-armed .rvk.is-dealt .rvk-card--left  { animation-delay: calc(var(--ti, 0) * 120ms + 480ms); }
.rvk-grid.is-armed .rvk.is-dealt .rvk-card--right { animation-delay: calc(var(--ti, 0) * 120ms + 560ms); }
/* product art fades in once loaded instead of popping */
.rvk-grid.is-armed .rvk-card img { opacity: 0; transition: opacity .5s ease; }
.rvk-grid.is-armed .rvk-card img.is-loaded { opacity: 1; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .rvk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .rvk-grid { grid-template-columns: 1fr; gap: 18px; }
  .rvk-stage { height: 280px; }
}
/* touch screens have no hover, so keep the hand a little more open */
@media (hover: none) {
  .rvk-card--left  { --x: -56%; --r: -10deg; filter: brightness(.82); }
  .rvk-card--right { --x:  56%; --r:  10deg; filter: brightness(.82); }
  .rvk[data-n="2"] .rvk-card--front { --x: 24%; }
  .rvk[data-n="2"] .rvk-card--left  { --x: -36%; }
}
@media (prefers-reduced-motion: reduce) {
  .rvk, .rvk-card, .rvk-go { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   /products page entrance: header + filter bar glide in, then the product
   cards pop in row by row as they scroll into view (plays once, so filtering
   and sorting afterwards doesn't re-trigger it).
   ========================================================================== */
@keyframes rvp-rise   { from { opacity: 0; transform: translateY(22px); } }
@keyframes rvp-card   {
  from { opacity: 0; transform: translateY(46px) scale(.93) rotate(var(--tilt, 0deg)); filter: blur(5px); }
  55%  { opacity: 1; }
}
@keyframes rvp-art    { from { transform: scale(1.22); } }

.rv10-catalog .rv10-head-copy { animation: rvp-rise .7s cubic-bezier(.2, .85, .25, 1) backwards; }
.rv10-catalog .rv10-live      { animation: rvp-rise .7s cubic-bezier(.2, .85, .25, 1) .12s backwards; }
.rv10-catalog .rv10-bar       { animation: rvp-rise .7s cubic-bezier(.2, .85, .25, 1) .22s backwards; }

.rv10-grid.is-armed [data-rv10-item]:not(.is-in),
.rv10-grid.is-armed [data-rv10-tile]:not(.is-in) { opacity: 0; }
.rv10-grid.is-armed [data-rv10-item].is-in,
.rv10-grid.is-armed [data-rv10-tile].is-in {
  animation: rvp-card .85s cubic-bezier(.2, .9, .25, 1.04) var(--d, 0ms) backwards;
}
/* cards alternate a tiny tilt so the row feels dealt, not stamped */
.rv10-grid.is-armed [data-rv10-item]:nth-child(3n+1) { --tilt: -2.5deg; }
.rv10-grid.is-armed [data-rv10-item]:nth-child(3n+2) { --tilt: 1.5deg; }
.rv10-grid.is-armed [data-rv10-item]:nth-child(3n)   { --tilt: 2.5deg; }
/* box art settles from slightly zoomed */
.rv10-grid.is-armed .rv10-card.is-in .rv10-card-media img { animation: rvp-art 1.1s cubic-bezier(.2, .85, .25, 1) var(--d, 0ms) backwards; }
@media (prefers-reduced-motion: reduce) {
  .rv10-catalog .rv10-head-copy, .rv10-catalog .rv10-live, .rv10-catalog .rv10-bar,
  .rv10-grid.is-armed [data-rv10-item], .rv10-grid.is-armed [data-rv10-tile],
  .rv10-grid.is-armed .rv10-card .rv10-card-media img { animation: none !important; opacity: 1 !important; }
}
