/* ============================================================
   RipRift — Collection showcase section
   Namespaced: `.collection …`, `.collection-*`, `.tilt-*`.
   Consumes base tokens/components only — never redefines them.
   ============================================================ */

/* ---------- Layout: copy+panel (46%) / card field (54%) ---------- */
.collection-grid {
  display: grid;
  grid-template-columns: minmax(0, 46fr) minmax(0, 54fr);
  gap: clamp(36px, 4.5vw, 72px);
  align-items: center;
}

.collection .section-head { margin-bottom: clamp(28px, 3vw, 40px); }

/* ---------- Collection UI panel (app mock) ---------- */
.collection-panel {
  position: relative;
  width: min(380px, 100%);
  padding: 22px;
  border-radius: 20px;
  background: linear-gradient(180deg, #0D1B22, #081014);
  border: 1px solid var(--border);
  box-shadow:
    0 30px 60px -24px rgba(0, 0, 0, 0.72),
    0 0 44px -18px var(--teal-glow);
}
.collection-panel::before { /* faint turquoise edge light along the top border */
  content: ""; position: absolute; top: -1px; left: 10%; right: 10%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(63, 193, 232, 0.5), transparent);
}

.collection-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.collection-panel-title {
  font-family: var(--font-display); font-size: 17px; font-weight: 600;
  letter-spacing: -0.01em;
}
.collection-panel-logo {
  width: 22px; height: 22px;
  filter: drop-shadow(0 0 8px rgba(63, 193, 232, 0.55));
}

/* Filter chips — purely visual, real buttons for a11y */
.collection-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.collection-chip {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px; font-weight: 500; line-height: 1.2;
  color: var(--text-2);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease),
              background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.collection-chip:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.18); }
.collection-chip.is-active {
  background: var(--teal);
  border-color: transparent;
  color: #fff;
  box-shadow:
    0 2px 16px -2px rgba(7, 85, 115, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

/* Stats + progress */
.collection-stats { display: flex; flex-wrap: wrap; gap: 14px 32px; margin-bottom: 20px; }
.collection-stat-value {
  display: block;
  font-family: var(--font-display); font-size: 20px; font-weight: 600;
}
.collection-stat-label {
  display: block; margin-top: 2px;
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
}
.collection-progress {
  flex-basis: 100%; height: 4px; margin-top: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.collection-progress-fill {
  display: block; width: 42%; height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #075573, #3FC1E8);
  box-shadow: 0 0 10px rgba(63, 193, 232, 0.45);
}

/* Mini card grid (4 × 2) */
.collection-minis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.collection .rc-mini { width: 100%; border-radius: 9px; }
.collection .rc-mini::before { inset: 4px; border-radius: 6px; }
.collection .rc-mini .rc-back-logo { width: 46%; }
.collection .rc-mini .rc-card-sheen {
  background: radial-gradient(120px circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 255, 255, 0.2), transparent 46%);
}

/* ---------- Floating card field ---------- */
.collection-field { position: relative; }

.collection-glow { /* large blurred ambient behind the field */
  width: 70%; aspect-ratio: 1;
  left: 12%; top: 6%;
  filter: blur(40px);
}
.collection-glow-2 { width: 46%; left: auto; right: -4%; top: 52%; opacity: 0.45; }

.collection-field-persp {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(16px, 2vw, 26px);
  perspective: 1200px;
}
.collection-field .rc-card { width: 100%; }

/* Float + scatter wrapper: owns the float animation and the fixed
   rotateZ/translateY scatter so the card itself stays free for the
   JS tilt transform. --ty offsets stagger the columns, --rz scatters. */
.collection .tilt-float {
  position: relative;
  z-index: var(--z, 1);
  width: clamp(120px, 13vw, 170px);
  max-width: 100%;
  justify-self: center;
  animation: collection-float var(--dur, 7s) ease-in-out var(--fd, 0s) infinite;
  will-change: transform;
}
@keyframes collection-float {
  0%, 100% { transform: translateY(var(--ty, 0px)) rotate(var(--rz, 0deg)); }
  50%      { transform: translateY(calc(var(--ty, 0px) - 8px)) rotate(var(--rz, 0deg)); }
}

/* Column stagger (4-column rhythm) */
.collection-field .tilt-float:nth-child(4n+1) { --ty: -16px; --rz: -3.4deg; --dur: 6.8s; --fd: -1.1s; }
.collection-field .tilt-float:nth-child(4n+2) { --ty: 24px;  --rz: 2.6deg;  --dur: 7.6s; --fd: -3.2s; }
.collection-field .tilt-float:nth-child(4n+3) { --ty: -10px; --rz: -1.4deg; --dur: 5.9s; --fd: -2.1s; }
.collection-field .tilt-float:nth-child(4n+4) { --ty: 30px;  --rz: 3.8deg;  --dur: 7.1s; --fd: -4.4s; }

/* Per-card jitter for an organic scatter */
.collection-field .tilt-float:nth-child(1) { --ty: -22px; --rz: -4.5deg; }
.collection-field .tilt-float:nth-child(3) { --ty: -28px; --rz: 1.8deg; --dur: 6.2s; }
.collection-field .tilt-float:nth-child(5) { --rz: 4.6deg; --fd: -5.3s; }
.collection-field .tilt-float:nth-child(7) { --ty: -26px; --rz: -4.8deg; --dur: 7.9s; }

/* Row stacking + centered final pair (Thornback Alpha, mystery back) */
.collection-field .tilt-float:nth-child(n+5):nth-child(-n+8) { --z: 2; }
.collection-field .tilt-float:nth-child(9),
.collection-field .tilt-float:nth-child(10) { --z: 3; --ty: 6px; }
.collection-field .tilt-float:nth-child(9)  { grid-column: 2; --rz: -2.8deg; }
.collection-field .tilt-float:nth-child(10) { grid-column: 3; --rz: 2.2deg; --dur: 6.5s; }

/* Hovered card rises above neighbours */
.collection-field .tilt-float:hover { z-index: 10; }

/* Deepen shadows on hover — sells the "lifted foil card" feel.
   (No transform transition here; tilt.js lerps transforms itself.) */
.collection .rc-card { transition: box-shadow 0.35s var(--ease); }
.collection .rc-card:hover {
  box-shadow:
    0 28px 56px -14px rgba(0, 0, 0, 0.85),
    0 0 40px -8px color-mix(in srgb, var(--rar, #7D8A90) 70%, transparent);
}

/* ---------- ≤1023px: stacked, field below copy ---------- */
@media (max-width: 1023px) {
  .collection-grid { grid-template-columns: 1fr; gap: clamp(44px, 6vw, 64px); }
  .collection-copy { max-width: 560px; }
  .collection-field { width: min(620px, 100%); margin-inline: auto; }
}

/* ---------- ≤639px: two neat rows of smaller cards ---------- */
@media (max-width: 639px) {
  .collection-field-persp { grid-template-columns: repeat(5, 1fr); gap: 9px; }
  .collection-field .tilt-float:nth-child(n) { --ty: 0px; }
  .collection-field .tilt-float:nth-child(9),
  .collection-field .tilt-float:nth-child(10) { grid-column: auto; }

  .collection-field .rc-card { border-radius: 8px; }
  .collection-field .rc-card::before { inset: 4px; border-radius: 5px; }

  .collection-glow { width: 100%; left: 0; top: 10%; }
}
