* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  min-height: 100vh; 
  background: linear-gradient(180deg, #200040, #000);
  background-size: cover; 
  background-repeat: no-repeat; 
  padding: 20px;
  overflow-x: hidden;
}

main {
  flex: 1;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2.5rem;
  text-transform: uppercase;
  letter-spacing: 4px;
  animation: fadeIn 2s ease-in-out;
  margin-top: 40px;
}

.categoryLinks {
  display: grid;
  grid-template-columns: repeat(4, 1fr); 
  gap: 20px;
  min-width: 100%; 
  padding: 20px;
}

.categoryLinks img{
  width: 100%;
}

.categoryLinks h4{
  margin-top: 10px;
}

.category {
  position: relative;
  display: block;
  text-align: center;
  text-decoration: none;
  color: #fff;
  padding: 20px;
  background: #200040;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.3s ease, background 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.category img {
  width: 100%;
  border-radius: 10px;
  display: block; 
}

.category h4 {
  position: absolute;
  top: 50%;
  left: 50%; 
  transform: translate(-50%, -50%); 
  font-size: 1.5rem;
  font-weight: bold;
  z-index: 10;
  margin: 0;
}

.category .overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5); 
  border-radius: 10px;
  z-index: 5; 
  transition: background-color 0.3s ease;
}

.category:hover {
  transform: scale(1.1);
  background: #3d0070;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  padding: 10px;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  animation: fadeInGallery 1.5s ease-in-out;
}

.gallery img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.7);
  transform: scale(1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.gallery img:hover {
  transform: scale(1.04);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.9);
}

/* Modal styles */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none; 
  justify-content: center;
  align-items: center;
  z-index: 1000;
  flex-direction: column;
  transition: 0.25s ease-out;
}

.modal.open {
  display: flex; 
}

.full-img {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
  transition: transform 0.3s ease;
  border: 1px solid #3d0070;
}

.caption {
  color: #fff;
  margin-top: 10px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: normal; 
}

/* Button styles */

.back-btn {
  position: fixed;
  top: 20px;
  left: 20px; 
  padding: 10px 20px;
  background-color: #3d0070;
  color: #fff;
  font-size: 1rem;
  text-decoration: none;
  border-radius: 5px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  transition: background-color 0.3s ease;
}

.back-btn:hover {
  background-color: #200040;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.back-btn {
  animation: slideIn 0.5s ease-out;
}

footer {
  margin-top: 2rem;
  font-size: 0.8rem;
  opacity: 0.7;
  min-height: 50px;
}

@keyframes fadeInGallery {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
} 

@media (max-width: 1024px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr); /* Limit to 2 columns */
  }
}

@media (max-width: 768px) {
  header h1 {
    font-size: 2rem;
  }

  .categoryLinks, .gallery {
    grid-template-columns: repeat(2, 1fr); 
  }

  .category {
    padding: 15px; 
  }

  .back-btn {
    font-size: 0.9rem; 
    padding: 8px 16px;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.5rem;
  }

  .categoryLinks, .gallery {
    grid-template-columns: 1fr;
  }

  .category {
    padding: 10px; 
  }

  .back-btn {
    font-size: 0.6rem; 
    padding: 6px 12px;
    margin-bottom: 20px;
  }

  footer {
    margin-top: 2rem;
    font-size: 0.8rem;
    opacity: 0.7;
    min-height: 50px;
    text-align: center; 
    width: 100%; 
    display: flex;
    justify-content: center; 
    align-items: center; 
  }
}
