/* General Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif; /* Modern font */
  background-color: #1f1f1f; /* Fixed dark background color */
  color: #e2e2e2; /* Light text for contrast */
  line-height: 1.6;
  padding: 0; /* Remove default padding */
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden; /* Prevent scrolling while animation is loading */
  animation: fadeContent 2s ease-in-out; /* Dynamic content animation on page load */
  user-select: none; /* Prevent text selection */
}

/* Prevent scrolling on page load */
html,
body {
  height: 100%;
  width: 100%;
}

/* Keyframe for fading and moving content */
@keyframes fadeContent {
  0% {
    opacity: 0; /* Start with hidden content */
    transform: translateY(50px); /* Content comes from below */
  }
  100% {
    opacity: 1; /* Fully visible */
    transform: translateY(0); /* Final position */
  }
}

.container {
  max-width: 1400px;
  width: 100%;
}

h1 {
  text-align: center;
  font-size: 3rem;
  color: #ecf0f1; /* Soft white color for title */
  margin-bottom: 40px;
  font-weight: 600;
  text-transform: uppercase;
  animation: fadeText 2s ease-in-out; /* Dynamic title animation */
}

@keyframes fadeText {
  0% {
    opacity: 0; /* Start hidden */
    transform: translateY(-20px); /* Title comes from the top */
  }
  100% {
    opacity: 1; /* Fully visible */
    transform: translateY(0); /* Final position */
  }
}

.games-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 40px;
  padding: 20px;
  animation: fadeContent 2s ease-in-out; /* Dynamic content animation */
  width: 100%;
}

.game-card {
  background: linear-gradient(
    to bottom,
    rgba(44, 62, 80, 1) 0%,
    rgba(44, 62, 80, 0.9) 50%,
    rgba(44, 62, 80, 1) 100%
  ); /* Solid gradient */
  border-radius: 15px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2); /* Softer shadow */
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  position: relative;
  color: #fff; /* Ensure the text inside is visible */
  animation: fadeCard 2s ease-in-out; /* Dynamic card animation */
}

@keyframes fadeCard {
  0% {
    opacity: 0; /* Start with hidden card */
    transform: translateY(30px); /* Card slides up from below */
  }
  100% {
    opacity: 1; /* Fully visible card */
    transform: translateY(0); /* Final position */
  }
}

.game-card:hover {
  transform: translateY(-15px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3); /* Darker shadow on hover */
}

.game-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: opacity 0.3s ease;
  border-bottom: 5px solid rgba(52, 152, 219, 0.75); /* Border removed */
  user-select: none; /* Prevent text selection */
  -webkit-user-drag: none; /* Prevent image drag in webkit-based browsers */
}

.game-card img:hover {
  opacity: 0.85;
}

.game-details {
  padding: 20px;
  background: rgba(45, 52, 54, 0.9); /* Solid background */
  position: relative;
  z-index: 1;
  animation: fadeDetails 2s ease-in-out; /* Dynamic details background animation */
}

@keyframes fadeDetails {
  0% {
    opacity: 0; /* Start with hidden details */
    transform: translateY(20px); /* Details come from below */
  }
  100% {
    opacity: 1; /* Fully visible details */
    transform: translateY(0); /* Final position */
  }
}

.game-title {
  font-size: 1.7rem;
  font-weight: 700;
  color: rgba(52, 152, 219, 1); /* Solid blue title */
  margin-bottom: 10px;
  transition: color 0.3s ease;
}

.game-card:hover .game-title {
  color: rgb(7, 93, 150); /* Change to specific blue on hover */
}

.game-title:hover {
  color: rgb(7, 93, 150); /* Red on hover */
}

.game-description {
  font-size: 1rem;
  color: rgba(189, 195, 199, 1); /* Solid gray description text */
  line-height: 1.6;
}

.game-card:hover .game-description {
  color: rgba(236, 240, 241, 1); /* White text on hover */
}

/* Disable pointer events on game cards when modal is open */
.games-container.disabled .game-card {
  pointer-events: none;
  opacity: 0.6;
}

/* Updated Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #2c3e50; /* Matches the card's dark gradient */
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3); /* Softer shadow for consistency */
  padding: 20px;
  z-index: 1000;
  border-radius: 15px; /* Matches the rounded corners of the cards */
  width: 90%;
  max-width: 500px;
  color: #ecf0f1; /* Light text for readability */
  animation: fadeModal 0.3s ease-in-out; /* Smooth fade-in animation */
}

@keyframes fadeModal {
  0% {
    opacity: 0; /* Start hidden */
    transform: translate(-50%, -45%); /* Slight offset for animation */
  }
  100% {
    opacity: 1; /* Fully visible */
    transform: translate(-50%, -50%); /* Centered */
  }
}

.modal h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: rgba(52, 152, 219, 1); /* Matches the card title color */
  margin-bottom: 15px;
  text-align: center;
}

.modal p {
  font-size: 1rem;
  color: #bdc3c7; /* Matches card description text */
  line-height: 1.6;
  margin-bottom: 20px;
  text-align: center;
}

.modal .go-to-game-btn {
  display: inline-block;
  padding: 10px 20px;
  background-color: rgba(52, 152, 219, 1); /* Matches the hover blue color */
  color: white;
  text-align: center;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  transition: background-color 0.3s ease, transform 0.3s ease;
  margin-top: 20px;
}

.modal .go-to-game-btn:hover {
  background-color: rgb(7, 93, 150); /* Darker blue on hover */
  transform: scale(1.05); /* Slight hover effect */
}

.modal .close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  background-color: #ecf0f1;
  color: #2c3e50;
  border-radius: 50%;
  text-align: center;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.3s ease;
}

.modal .close-btn:hover {
  background-color: #e74c3c; /* Red color on hover */
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8); /* Darker overlay for better focus */
  z-index: 999;
  animation: fadeOverlay 0.3s ease-in-out; /* Smooth fade-in animation */
  pointer-events: none; /* Disable click events on the overlay */
}

@keyframes fadeOverlay {
  0% {
    opacity: 0; /* Start hidden */
  }
  100% {
    opacity: 1; /* Fully visible */
  }
}

@media (max-width: 1024px) {
  h1 {
    font-size: 2.5rem;
  }
  .games-container {
    gap: 30px;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }
  .games-container {
    gap: 20px;
  }

  .game-card {
    height: 350px; /* Adjust card height on smaller screens */
  }
}

/* For very small screens (mobile) */
@media (max-width: 480px) {
  .game-card {
    height: 300px; /* Further reduce the height of cards on small screens */
  }
  .game-title {
    font-size: 1.5rem;
  }
  .game-description {
    font-size: 0.9rem;
  }
}

/* Link Button as a Button */
.link-btn {
  display: inline-block;
  padding: 10px 20px;
  background-color: rgba(52, 152, 219, 1); /* Matches the hover blue color */
  color: white;
  text-align: center;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  text-decoration: none; /* Remove the underline */
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.link-btn:hover {
  background-color: rgb(7, 93, 150); /* Darker blue on hover */
  transform: scale(1.05); /* Slight hover effect */
}

.link-btn:active {
  transform: scale(1); /* Reset scale when button is clicked */
}
