/* The Modal (background) */
.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1002; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
  /* Centering is done when it's visible */
  align-items: center;
  justify-content: center;
}

/* This class will be toggled with JS to show the modal */
.modal.modal-visible {
    display: flex;
}

/* Make the container wrap the image */
.modal-image-container {
    position: relative;
    display: inline-block; /* Shrink-wrap the content */
}

/* Modal Content (image) */
.modal-content {
  display: block;
  object-fit: contain;
  max-width: 75vw; /* Max width relative to viewport */
  max-height: 90vh; /* Max height relative to viewport */
}

/* Add Animation */
.modal-content {
  -webkit-animation-name: zoom;
  -webkit-animation-duration: 0.6s;
  animation-name: zoom;
  animation-duration: 0.6s;
}

@-webkit-keyframes zoom {
  from {-webkit-transform:scale(0)}
  to {-webkit-transform:scale(1)}
}

@keyframes zoom {
  from {transform:scale(0)}
  to {transform:scale(1)}
}

/* The Close Button - positioned inside the container */
.close {
  position: absolute;
  top: 5px;
  right: 5px;
  color: #eb7b12; /* Orange color */
  font-size: 35px;
  font-weight: bold;
  transition: 0.3s;
  z-index: 10; /* Above image */
  text-shadow: 0 0 5px rgba(0,0,0,0.7); /* Add shadow for visibility */
}

.close:hover,
.close:focus {
  color: #d36e10; /* Darker orange on hover */
  text-decoration: none;
  cursor: pointer;
}

/* Next & previous buttons - positioned inside the container */
.prev, .next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  transform: translateY(-50%); /* Precise vertical centering */
  width: auto;
  padding: 16px;
  color: #eb7b12; /* Orange color */
  font-weight: bold;
  font-size: 24px;
  transition: 0.3s ease;
  user-select: none;
  z-index: 10; /* Above image */
  text-shadow: 0 0 5px rgba(0,0,0,0.7); /* Add shadow for visibility */
}

/* Position the buttons inside the image frame */
.next {
  right: 5px;
}

.prev {
  left: 5px;
}

/* On hover, add a subtle background */
.prev:hover, .next:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
}

/* Media query for smaller screens */
@media only screen and (max-width: 768px){
  .modal-content {
    max-width: 95vw;
    max-height: 90vh;
  }
  .close {
    font-size: 30px;
    top: 0;
    right: 0;
  }
  .prev, .next {
    font-size: 20px;
    padding: 12px;
  }
}