/* ===== CARD LIBRARY ===== */

.library {
  max-width: 1200px;
  margin: 0 auto;
}

.library__section {
  margin-bottom: 56px;
}

.library__section-title {
  text-align: center;
  font-family: var(--f-display);
  font-size: 1.05em;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--c-gold-deep);
  margin: 0 0 28px;
  font-weight: 500;
}

.library__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, 220px);
  gap: 40px 32px;
  justify-content: center;
}

.card-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.scene {
  position: relative;
  width: 220px;
  height: 316px;
  perspective: 1400px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.scene:hover { transform: translateY(-6px); }

.card {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform var(--t-flip);
  will-change: transform;
}

.card.is-flipped { transform: rotateY(180deg); }

.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.45), 0 3px 6px rgba(0, 0, 0, 0.3);
  transform: translateZ(0);
}

.face img {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.face--front { transform: rotateY(180deg) translateZ(0); }

/* Cursor sheen */
.face::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  mix-blend-mode: soft-light;
  background: radial-gradient(
    circle 160px at var(--mx, 50%) var(--my, 50%),
    rgba(255, 240, 200, 0.85) 0%,
    rgba(255, 220, 150, 0.35) 25%,
    rgba(255, 255, 255, 0) 60%
  );
}

.scene:hover .face::after { opacity: 1; }

.card-label {
  margin-top: 14px;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.08em;
  opacity: 0.85;
  max-width: 220px;
}

/* Rare treatment */
.scene.rare::before {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 22px;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 195, 100, 0.55) 0%,
    rgba(255, 180, 80, 0.25) 35%,
    rgba(255, 180, 80, 0) 70%
  );
  z-index: -1;
  pointer-events: none;
  animation: rare-pulse 3.5s ease-in-out infinite;
}

@keyframes rare-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.04); }
}

.scene.rare .face--back::before,
.scene.rare .face--front::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 0%,
    transparent 42%,
    rgba(255, 230, 150, 0.5) 50%,
    transparent 58%,
    transparent 100%
  );
  transform: translateX(-100%);
  mix-blend-mode: overlay;
  animation: shimmer-sweep 4.5s ease-in-out infinite;
}

.scene.rare .face--front::before {
  animation-duration: 5.5s;
  animation-delay: 1s;
  background: linear-gradient(
    115deg,
    transparent 0%,
    transparent 42%,
    rgba(255, 230, 150, 0.32) 50%,
    transparent 58%,
    transparent 100%
  );
}

@keyframes shimmer-sweep {
  0%, 25%   { transform: translateX(-100%); }
  65%, 100% { transform: translateX(100%); }
}

.scene.rare .face::after {
  background: radial-gradient(
    circle 200px at var(--mx, 50%) var(--my, 50%),
    rgba(255, 220, 140, 0.95) 0%,
    rgba(255, 190, 110, 0.5) 18%,
    rgba(130, 200, 255, 0.18) 38%,
    rgba(255, 255, 255, 0) 60%
  );
}

.scene.rare ~ .card-label {
  color: var(--c-gold-bright);
  font-weight: 500;
}

.scene.rare ~ .card-label::after {
  content: ' \2726';
  color: var(--c-gold-spark);
}

/* Info button + overlay */
.info-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(15, 28, 32, 0.75);
  border: 1px solid var(--c-border);
  color: var(--c-gold);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, background 0.2s, transform 0.2s, border-color 0.2s;
}

.card.is-flipped ~ .info-btn {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.3s ease 0.35s, background 0.2s, transform 0.2s, border-color 0.2s;
}

.info-btn:hover {
  background: rgba(40, 70, 75, 0.9);
  border-color: var(--c-border-strong);
  transform: scale(1.12);
}

.info-btn svg { width: 14px; height: 14px; }

.info-overlay {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: var(--c-overlay-bg);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.info-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.info-panel {
  background: linear-gradient(160deg, #1f3a3b 0%, #0d1f20 100%);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 18px 16px 16px;
  color: var(--c-text);
  width: 100%;
  position: relative;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55), inset 0 0 30px rgba(255, 195, 100, 0.05);
}

.info-panel h3 {
  margin: 0 0 10px;
  font-family: var(--f-display);
  font-size: 16px;
  letter-spacing: 0.05em;
  color: var(--c-gold-bright);
  text-align: center;
  font-weight: 600;
}

.info-panel p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--c-text);
  text-align: center;
}

.info-close {
  position: absolute;
  top: 2px;
  right: 6px;
  background: none;
  border: none;
  color: var(--c-gold);
  font-size: 22px;
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: color 0.2s, transform 0.2s;
}

.info-close:hover {
  color: var(--c-gold-bright);
  transform: scale(1.2);
}
