:root {
  --primaryy: #000000;
  --cover-timing: 0.5s;
  --cover-ease: cubic-bezier(0.66, 0.08, 0.19, 0.97);
  --cover-stagger: 0.15s;
  --text-timing: 0.75s;
  --text-stagger: 0.015s;
  --text-ease: cubic-bezier(0.38, 0.26, 0.05, 1.07);
  --title-stagger: 0.05s;
  --highlight: white;
}

.metal-card-sec {
  width: 100vw;
  min-height: 90vh;
  /* height: 100%; */
  background-color: white;
  /* background-color: var(--primaryy); */
  /* background: linear-gradient(to bottom, white 0%, white 2%, var(--primaryy) 2%, var(--primaryy) 100% ); */
  padding: 0;
  /* padding-block: 0 0px; */
  user-select: none;
  /* background-color: green; */
  display: flex;
  justify-content: center;
  align-items: center;
}

.l-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-gap: 25px;
  width: 100%;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
}

@media screen and (max-width: 480px) {
.metal-card-sec {
  width: 100vw;
  min-height: auto;
}
}

@media screen and (max-width: 760px) {
  .l-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

.b-game-card {
  position: relative;
  width: 100%;
  aspect-ratio: 1080/1920;
  perspective: 1000px;
}

.b-game-card__cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  /* height: 100%; */
  aspect-ratio: 1080/1920;
  border-radius: 20px;
  background-size: cover;
  background-position: center;
  overflow: hidden;
  transform-style: preserve-3d;
  transform-origin: center center;
  border: 2px solid rgba(0, 0, 0) ;

  transition: transform 0.35s ease-in-out, box-shadow 1s var(--cover-ease), border 0.35s ease-in-out;

  /* Enhanced shadow system */
  box-shadow: rgba(255, 255, 255, 0.3) 0 5vw 6vw -8vw,
    rgba(255, 255, 255, 0) 0 4.5vw 5vw -6vw,
    rgba(50, 50, 80, 0.5) 0px 4vw 8vw -2vw, rgba(0, 0, 0, 0.8) 0px 4vw 5vw -3vw;
}

/* Z-index layering system */
.b-game-card__cover {
  z-index: 1;
}

/* Gloss effect - highest z-index for top layer */
.b-game-card__cover::after {
  content: "";
  position: absolute;
  z-index: 100;
  top: 0;
  left: 0;
  width: 100%;
  height: 120%;
  background: linear-gradient(
    226deg,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(255, 255, 255, 0.2) 35%,
    rgba(255, 255, 255, 0.1) 42%,
    rgba(255, 255, 255, 0) 60%
  );
  transform: translateY(-20%);
  transition: transform 0.65s cubic-bezier(0.18, 0.9, 0.58, 1);
  border-radius: 12px;
  pointer-events: none;

}

/* Text overlay animations - medium z-index */
.b-game-card__cover::before {
  content: "";
  position: absolute;
  z-index: 10;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  /* background: var(--primary); */
  transform-origin: left;
  transform: scaleX(0);
  transition: all var(--cover-timing) var(--cover-ease);
  border-radius: 12px;

}

/* Text content - high z-index above overlay */
.text {
  position: absolute;
  z-index: 50;
  inset: 20px;
  top: 50%;
  left: 50%;
  transform: translateX(-50%) translateY(-50%);
  width: 90%;
  color: white;
  /* background-color: red; */
}

.text h2 {
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 800;
  margin-bottom: 0.2em;
  margin-top: 0;
  font-family: Bebas;
  position: absolute;
  top: 50%;
  left: 50%;
  text-align: center;
  text-wrap: balance;
  width: 100%;
  /* background-color: red; */
  transform: translateX(-50%) translateY(-50%);
}

.text p {
  font-size: clamp(10px, 1.25vw, 17px);
  line-height: 1.6;
  margin: 0.2em 0 0 0;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  font-family: ITCNormal;
  text-align: center;
  text-shadow: 0 0 5px 2px rgb(0, 0, 0);
  transform: translateX(-50%) translateY(-50%);
}

.text p .word {
  color: var(--highlight);
  display: inline-block;
  opacity: 0;
  transform: translateY(50px);
  transition-property: transform, opacity, color;
  transition-timing-function: var(--text-ease);
  transition-duration: var(--text-timing), var(--text-timing),
    calc(var(--text-timing) * 2);
}

.text h2 .char {
  color: var(--highlight);
  display: inline-block;
  opacity: 1; 
  transform: translateY(0px); 
  transition-property: transform, opacity, color;
  transition-timing-function: var(--text-ease);
  transition-duration: var(--text-timing), var(--text-timing),
    calc(var(--text-timing) * 0.5);
  transition-delay: calc(0.1s + var(--char-index) * var(--title-stagger));
  /* text-decoration: underline; */
}

.b-game-card:hover .text h2 .char {
  opacity: 0; 
  transform: translateY(-50px); 
  color: inherit;
  transition-delay: calc(0.s + var(--char-index) * var(--title-stagger));
  transition-property: transform, opacity, color;
  transition-timing-function: var(--text-ease);
  transition-duration: var(--text-timing), var(--text-timing),
    calc(var(--text-timing) * 0.3);
}

/* Text animations */
.b-game-card:hover .text p .word {
  opacity: 1;
  transform: translateY(0);
  color: inherit;
  transition-delay: calc(0.3s + var(--word-index) * var(--text-stagger));
}

/* Shadow layer - lowest z-index */
.b-game-card::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 5%;
  left: 5%;
  width: 90%;
  height: 90%;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 6px 12px 12px rgba(0, 0, 0, 0.4);
  transform-origin: top center;
  transition: transform 0.35s ease-in-out, opacity 0.5s ease-in-out;
  border-radius: 8px;

}


.text img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50%;
  transform: translateX(-50%) translateY(-50%);
  opacity: 0;
  transition: 0.5s ease-in-out;

}


/* Hover states - all animations coordinated */
.b-game-card:hover .b-game-card__cover {
  transform: rotateX(15deg)  translateY(-8px) translateZ(20px);
  box-shadow: white 0 5vw 6vw -9vw, var(--highlight) 0 5.5vw 5vw -7.5vw,
    rgba(50, 50, 80, 0.5) 0px 4vw 8vw -2vw, rgba(0, 0, 0, 0.8) 0px 4vw 5vw -3vw;
  border: 2px solid var(--primary) ;
  filter: saturate(1.2) brightness(1.5);

  transition: 1s ease-in-out, box-shadow 1s var(--cover-ease), border 0.35s ease-in-out;

}

.b-game-card:hover{
    z-index: 100;
}

/* Gloss animation on hover */
.b-game-card:hover .b-game-card__cover::after {
  transform: translateY(0%);
}

/* Text overlay reveal */
.b-game-card:hover .b-game-card__cover::before {
  transform: scaleX(1);
}

/* Card shadow lift */
.b-game-card:hover::before {
  opacity: 0.6;
  transform: rotateX(7deg) translateY(-6px) scale(1.05);
}

/* ===== CLICK STATES - SAME AS HOVER ===== */

/* Click state for title characters */
.b-game-card:active .text h2 .char {
  opacity: 0; 
  /* transform: translateY(-1000px);  */
  color: inherit;
  transition-delay: calc(0.s + var(--char-index) * var(--title-stagger));
  transition-property: transform, opacity, color;
  transition-timing-function: var(--text-ease);
  transition-duration: var(--text-timing), var(--text-timing),
    calc(var(--text-timing) * 0.3);
}

/* Click state for text animations */
.b-game-card:active .text p .word {
  opacity: 0;
  transform: translateY(0);
  color: inherit;
  transition-delay: calc(0.3s + var(--word-index) * var(--text-stagger));
}

/* Click state for main card cover */
.b-game-card:active .b-game-card__cover {
  transform: rotateX(0deg)  translateY(0px) translateZ(-80px);
  box-shadow: white 0 5vw 6vw -9vw, var(--highlight) 0 5.5vw 5vw -7.5vw,
    rgba(50, 50, 80, 0.5) 0px 4vw 8vw -2vw, var(--primary) 0px 2vw 3vw -2vw;
  border: 2px solid white ;
  filter: saturate(1.2) brightness(1.2);
    cursor: pointer;
  transition: 0.3s ease-in-out, box-shadow 0.2s var(--cover-ease), border 0.35s ease-in-out;
}

/* Click state for card z-index */
.b-game-card:active{
  z-index: 100;
}

/* Click state for gloss animation */
.b-game-card:active .b-game-card__cover::after {
  transform: translateY(0%);
}

/* Click state for text overlay reveal */
.b-game-card:active .b-game-card__cover::before {
  transform: scaleX(1);
}

/* Click state for card shadow lift */
.b-game-card:active::before {
  opacity: 0.6;
  transform: rotateX(7deg) translateY(-6px) scale(1.05);
}



/* Text animations */
.b-game-card:active .text p .word {
  opacity: 0;
  color: transparent;
  color: inherit;
  transition: 0.2s ease-in-out, transform 0.2s ease-in-out, opacity 0.2s ease-in-out;
  transition-delay: 0;
}

.b-game-card:active .b-game-card__cover::before {
  content: "";
  position: absolute;
  z-index: 10;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0);
  /* background: var(--primary); */
  transform-origin: left;
  transform: scaleX(100%);
  transition: all var(--cover-timing) var(--cover-ease);
  border-radius: 12px;

}

.b-game-card:active .b-game-card__cover::after {
  content: "";
  position: absolute;
  z-index: 100;
  top: 0;
  left: 0;
  width: 100%;
  /* opacity: 0; */
  height: 120%;
  background: linear-gradient(
    226deg,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(255, 255, 255, 0.2) 35%,
    rgba(255, 255, 255, 0.1) 42%,
    rgba(255, 255, 255, 0) 60%
  );
  transform: translateY(-50%);
  transition: transform 0.65s cubic-bezier(0.18, 0.9, 0.58, 1);
  border-radius: 12px;
  pointer-events: none;

}

.b-game-card:active .text img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50%;
  transform: translateX(-50%) translateY(-50%);
  opacity: 1;
  transition: 0.5s ease-in-out;
}


/* Color variations */
.b-game-card:nth-of-type(1) {
  /* --highlight: coral; */
  --highlight: var(--primary);
}

.b-game-card:nth-of-type(2) {
  /* --highlight: #56ffe5; */
  --highlight: var(--primary);
}

.b-game-card:nth-of-type(3) {
  /* --highlight: #ff6b9d; */
  --highlight: var(--primary);
}

.b-game-card:nth-of-type(4) {
  /* --highlight: #ffd93d; */
  --highlight: var(--primary);
}