/* 030 — Tilt Card
   Carte 3D qui suit le curseur : rotateX/Y, glare mobile, ombre dynamique.
   Les variables --tilt-* sont pilotées par anim.js (lissage rAF). */

.tilt-card {
  --tilt-rx: 0deg;
  --tilt-ry: 0deg;
  --tilt-gx: 50%;
  --tilt-gy: 50%;
  --tilt-glare: 0;
  --tilt-pop: 0;
  --tilt-sx: 0px;
  --tilt-sy: 14px;
  position: relative;
  width: min(280px, 100%);
  border-radius: 18px;
  perspective: 900px;
}

/* Ombre dynamique : glisse à l'opposé de l'inclinaison, teintée accent */
.tilt-card::before {
  content: "";
  position: absolute;
  inset: 14% 8% -4% 8%;
  z-index: -1;
  border-radius: inherit;
  background:
    radial-gradient(closest-side, var(--tilt-shadow-tint, rgba(124, 140, 255, 0.22)), transparent 72%),
    radial-gradient(closest-side, rgba(4, 7, 16, 0.9), transparent 78%);
  filter: blur(18px);
  transform: translate3d(var(--tilt-sx), var(--tilt-sy), 0)
    scale(calc(1 + var(--tilt-pop) * 1.6));
}

.tilt-card__inner {
  position: relative;
  border-radius: inherit;
  padding: 24px 22px 20px;
  background:
    linear-gradient(165deg, rgba(232, 234, 242, 0.07), rgba(232, 234, 242, 0.02) 42%),
    var(--ml-surface, #151a24);
  border: 1px solid var(--tilt-border, rgba(124, 140, 255, 0.16));
  box-shadow: inset 0 1px 0 rgba(232, 234, 242, 0.08);
  transform-style: preserve-3d;
  transform: rotateX(var(--tilt-rx)) rotateY(var(--tilt-ry))
    scale(calc(1 + var(--tilt-pop)));
}

/* Reflet glare — suit le curseur via --tilt-gx / --tilt-gy */
.tilt-card__glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    240px circle at var(--tilt-gx) var(--tilt-gy),
    rgba(255, 255, 255, 0.55),
    rgba(255, 255, 255, 0.08) 45%,
    transparent 72%
  );
  mix-blend-mode: overlay;
  opacity: var(--tilt-glare);
  transform: translateZ(2px);
}

/* Profondeur du contenu (parallax interne) */
.tilt-card__layer {
  transform: translateZ(var(--tilt-depth, 26px));
}

.tilt-card__layer--far {
  transform: translateZ(var(--tilt-depth-far, 46px));
}

/* Contenu de démo */
.tilt-card__badge {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  border-radius: 12px;
  font-size: 17px;
  color: var(--ml-accent, #7c8cff);
  background: rgba(124, 140, 255, 0.12);
  border: 1px solid rgba(124, 140, 255, 0.3);
}

.tilt-card__title {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--ml-fg, #e8eaf2);
}

.tilt-card__text {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ml-muted, #8b91a3);
}

.tilt-card__chips {
  display: flex;
  gap: 6px;
}

.tilt-card__chip {
  padding: 4px 10px;
  font-size: 11px;
  letter-spacing: 0.02em;
  border-radius: 999px;
  color: var(--ml-accent-2, #2dd4bf);
  background: rgba(45, 212, 191, 0.1);
  border: 1px solid rgba(45, 212, 191, 0.25);
}

@media (prefers-reduced-motion: reduce) {
  .tilt-card__inner {
    transform: none;
  }

  .tilt-card__glare {
    opacity: 0;
  }

  .tilt-card::before {
    transform: none;
  }
}
