/* Codex Artificialis — Rarity Visual Effects */

/* ===== COMMON ===== */
.rarity--common {
  border-color: rgba(255, 255, 255, 0.08);
}

.rarity--common .card-slot__rarity,
.rarity--common .modal__rarity-badge {
  color: var(--rarity-common);
  border-color: var(--rarity-common);
}

/* ===== UNCOMMON ===== */
.rarity--uncommon {
  border-color: rgba(57, 255, 20, 0.25);
  box-shadow: 0 0 8px rgba(57, 255, 20, 0.12), inset 0 0 12px rgba(57, 255, 20, 0.04);
}

.rarity--uncommon .card-slot__rarity,
.rarity--uncommon .modal__rarity-badge {
  color: var(--rarity-uncommon);
  border-color: var(--rarity-uncommon);
}

/* ===== RARE ===== */
.rarity--rare {
  border-color: rgba(0, 191, 255, 0.3);
  box-shadow: 0 0 12px rgba(0, 191, 255, 0.15);
  position: relative;
}

.rarity--rare::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    var(--shimmer-angle, 135deg),
    transparent 20%,
    rgba(0, 191, 255, 0.4) 40%,
    rgba(0, 255, 255, 0.3) 50%,
    rgba(0, 191, 255, 0.4) 60%,
    transparent 80%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: shimmerAngle 4s linear infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes shimmerAngle {
  from { --shimmer-angle: 0deg; }
  to { --shimmer-angle: 360deg; }
}

@property --shimmer-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 135deg;
}

.rarity--rare .card-slot__rarity,
.rarity--rare .modal__rarity-badge {
  color: var(--rarity-rare);
  border-color: var(--rarity-rare);
}

/* ===== EPIC ===== */
.rarity--epic {
  border-color: rgba(176, 38, 255, 0.35);
  box-shadow:
    0 0 16px rgba(176, 38, 255, 0.2),
    0 0 32px rgba(176, 38, 255, 0.08);
  position: relative;
}

.rarity--epic::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    var(--shimmer-angle, 135deg),
    transparent 15%,
    rgba(176, 38, 255, 0.5) 35%,
    rgba(255, 20, 147, 0.4) 50%,
    rgba(176, 38, 255, 0.5) 65%,
    transparent 85%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: shimmerAngle 3s linear infinite;
  pointer-events: none;
  z-index: 1;
}

.rarity--epic::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 20px rgba(176, 38, 255, 0.1);
  animation: epicPulse 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes epicPulse {
  0%, 100% { box-shadow: inset 0 0 20px rgba(176, 38, 255, 0.08); }
  50% { box-shadow: inset 0 0 30px rgba(176, 38, 255, 0.15); }
}

.rarity--epic .card-slot__rarity,
.rarity--epic .modal__rarity-badge {
  color: var(--rarity-epic);
  border-color: var(--rarity-epic);
}

/* ===== LEGENDARY ===== */
.rarity--legendary {
  border-color: rgba(212, 175, 55, 0.4);
  box-shadow:
    0 0 20px rgba(212, 175, 55, 0.25),
    0 0 40px rgba(212, 175, 55, 0.1);
  position: relative;
}

.rarity--legendary::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(
    from var(--shimmer-angle, 0deg),
    #D4AF37 0deg,
    #FFD700 45deg,
    #ff6b6b 90deg,
    #B026FF 135deg,
    #00BFFF 180deg,
    #39FF14 225deg,
    #FFD700 270deg,
    #D4AF37 360deg
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: shimmerAngle 6s linear infinite;
  pointer-events: none;
  z-index: 1;
}

.rarity--legendary::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  animation: legendaryPulse 2.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes legendaryPulse {
  0%, 100% {
    box-shadow:
      inset 0 0 20px rgba(212, 175, 55, 0.1),
      0 0 20px rgba(212, 175, 55, 0.15);
  }
  50% {
    box-shadow:
      inset 0 0 30px rgba(212, 175, 55, 0.18),
      0 0 35px rgba(212, 175, 55, 0.25);
  }
}

.rarity--legendary .card-slot__rarity,
.rarity--legendary .modal__rarity-badge {
  color: var(--rarity-legendary);
  border-color: var(--rarity-legendary);
}

/* ===== RARITY NAMES ===== */
.rarity-name--common { color: var(--rarity-common); }
.rarity-name--uncommon { color: var(--rarity-uncommon); }
.rarity-name--rare { color: var(--rarity-rare); }
.rarity-name--epic { color: var(--rarity-epic); }
.rarity-name--legendary { color: var(--rarity-legendary); }
