/* gallery.css */

/* Thumbnail Grid */
.screenshot-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
  align-items: center; /* Centers the items vertically if they have different heights */
}

.screenshot-gallery a.gallery-item {
/*  display: block;*/
  display: inline-flex; /* Changed from block to inline-flex to shrink-wrap the image perfectly */
  cursor: zoom-in;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
  line-height: 0; /* This is the magic trick that removes the invisible bottom gap! */
 
}

.screenshot-gallery a.gallery-item:hover {
  border-color: var(--accent);
  transform: scale(1.02); /* Slightly larger hover effect */
}

.screenshot-gallery img {
  display: block;

  /* Let the image dictate the size, but cap it so it stays a thumbnail */
  max-width: 120px; 
  max-height: 90px; 

  /* Optional: if you want them to look uniform even if some are tiny */
  width: auto;
  height: auto;

  object-fit: contain; /* Changed from 'cover' to 'contain' */
}

/* Modal Overlay */
.gallery-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.gallery-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

/* Modal Content Box */
.gallery-modal-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px; /* Leaves space for close button and controls */
  box-sizing: border-box;
}

/* The actual image inside the modal */
.gallery-modal-image {
  max-width: 100%;
  max-height: 100%; /* Fits perfectly within the padded area */
  object-fit: contain;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  background: var(--surface);
}

/* Close Button (Top Right) */
.gallery-modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
  transition: opacity 0.15s ease;
  z-index: 10;
}

.gallery-modal-close:hover {
  opacity: 1;
}

/* Arrow Controls (Bottom Center) */
.gallery-modal-controls {
  position: absolute;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 20px;
  z-index: 10;
}

.gallery-modal-controls button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 44px; /* Slightly larger for mobile tapping */
  height: 44px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.gallery-modal-controls button:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Counter text between the arrows */
.gallery-modal-counter {
  color: #fff;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  opacity: 0.9;
}