html {
  --bg: hsl(132, 83%, 5%);
  --fsize: 16px;
}

html, body {
  min-height: 100vh;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  display: grid;
  grid-template-rows: 1fr auto;
  font-size: var(--fsize);
  background-color: var(--bg);
  position: relative;
  overflow-x: hidden;
  padding: 2rem 1rem;
  place-items: center;
  color: white;
  font-family: sans-serif;
}

p {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-bottom: 2rem;
}

p a {
  color: var(--accent);
  text-decoration: none;
  font-weight: bold;
}

#circle {
  position: absolute;
}

.gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  width: 90vw;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 0;
  container-type: inline-size;
  container-name: gallery;
}

.image-container {
  position: relative;
  display: inline-block;
  flex: 1 1 250px;
  max-width: 300px;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.image-container img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3/4;
  object-fit: cover;
  transition: transform 0.3s ease-in-out;
  border-radius: 12px;
}

@media (hover: hover) {
  .image-container:hover img {
    transform: scale(1.05);
  }

  .image-container:hover::after {
    opacity: 1;
    transform: translate(-50%, -10px);
  }
}

.image-container:active img {
  transform: scale(1.05);
}

.image-container:active::after {
  opacity: 1;
  transform: translate(-50%, -10px);
}

.image-container::after {
  content: attr(data-title);
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 1rem;
  font-weight: bold;
  font-family: sans-serif;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
  padding: 0.25rem 0.5rem;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  width: 90%;
  box-sizing: border-box;
  pointer-events: none;
}

@container gallery (min-width: 750px) {
  @media (hover: hover) {
    .image-container:hover img {
      transform: scale(1.1);
    }
  }

  .image-container:active img {
    transform: scale(1.1);
  }
}

.popup {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  z-index: 100;
  width: 100vw;
}

.popup-content {
  background: white;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  position: relative;
  color: #333;
  width: 90vw;
  max-width: 450px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  cursor: pointer;
  font-size: 24px;
  color: #888;
  transition: color 0.2s ease;
}

.close-btn:hover {
  color: #333;
}

.options {
  margin-top: 15px;
}

.option {
  padding: 12px;
  background: #e74c3c;
  color: white;
  margin: 8px 0;
  cursor: pointer;
  border-radius: 5px;
  transition: background-color 0.2s ease;
  font-weight: bold;
}

.option:hover {
  background-color: #c0392b;
}

@media (max-width: 768px) {
  html {
    --fsize: 14px;
  }

  body {
    padding: 1rem 0.5rem;
  }

  .gallery {
    width: 95vw;
    gap: 1rem;
  }

  .image-container {
    flex-basis: 150px;
  }

  .image-container::after {
    font-size: 0.9rem;
  }

  .popup-content {
    width: 90vw;
    max-width: 90vw;
  }
}

@media (max-width: 480px) {
  html {
    --fsize: 13px;
  }

  .gallery {
    gap: 0.5rem;
  }

  .image-container {
    flex-basis: calc(50% - 1rem);
    max-width: calc(50% - 1rem);
  }

  .image-container::after {
    font-size: 0.8rem;
  }
}
