/* Bento Grid Layout */
.art-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 200px; /* Base row height */
  gap: 15px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Feature card (The tall middle one in your screenshot) */
.bento-card-feature {
  grid-column: 2;
  grid-row: span 2;
}

.bento-card {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}

.lightbox-button {
  width: 100%;
  height: 100%;
  cursor: pointer;
  border: none;
  padding: 0;
  background: none;
  position: relative;
}

.lightbox-button img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Ensures images fill the bento boxes nicely */
  transition: transform 0.3s ease;
  display: block;
}

.lightbox-button:hover img {
  transform: scale(1.05);
}

/* Overlay Text Styling */
.overlay-bento {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 15px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: white;
  font-family: sans-serif;
  font-size: 0.9rem;
  pointer-events: none; /* Allows clicks to pass through to the button */
}

/* Lightbox View */
.lightbox-view {
  display: none; /* Controlled by JS */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.lightbox-view.hidden {
  display: none !important;
}

/* 90% Height Constraint */
.lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 90%;
  height: 95%; /* Total container height */
}

.lightbox-content img {
  max-height: 85vh; /* Image takes up ~90% of screen height */
  max-width: 100%;
  object-fit: contain;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

/* Navigation underneath the image */
.navigation {
  margin-top: 15px;
  display: flex;
  gap: 40px;
}

.navigation button {
  background: white;
  color: black;
  border: none;
  padding: 10px 20px;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 5px;
  transition: opacity 0.2s;
}

.navigation button:hover {
  opacity: 0.8;
}

.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: white;
  font-size: 30px;
  cursor: pointer;
}

/* Visible Focus State for Navigation Buttons */
.navigation button:focus-visible {
  outline: 4px solid #0056b3; /* A high-contrast color */
  outline-offset: 4px;
  background-color: #f0f0f0; /* Lighten background to show it's active */
  color: #000;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* Also apply to the close button for full compliance */
.close-btn:focus-visible {
  outline: 4px solid #0056b3;
  outline-offset: 4px;
  background-color: #fff;
  color: #000;
}

/* Ensure buttons don't lose focus outline in high-contrast modes */
@media (forced-colors: active) {
  .navigation button:focus-visible,
  .close-btn:focus-visible {
    outline: 2px solid LinkText;
  }
}
/* Responsive adjustments for Mobile */
@media (max-width: 768px) {
  .art-gallery {
    grid-template-columns: 1fr; /* Forces a single column layout */
    grid-auto-rows: auto;        /* Allows images to dictate their own height */
    gap: 20px;                   /* Increases spacing for better mobile tap targets */
  }

  .bento-card-feature {
    grid-column: auto; /* Resets the feature card from the middle column */
    grid-row: auto;    /* Resets the double-height span */
  }

  .lightbox-button img {
    height: 300px;    /* Gives cards a consistent, visible height on mobile */
    object-fit: cover;
  }

  /* Accessibility/Mobile optimization: Larger buttons for thumbs */
  .navigation {
    width: 100%;
    justify-content: space-around;
    gap: 0;
  }

  .navigation button {
    padding: 15px 40px; /* Larger tap target for fingers */
    font-size: 24px;
  }

  .lightbox-content img {
    max-height: 75vh; /* Slightly smaller image on mobile to ensure buttons are visible */
  }
}