@charset "utf-8";
/* CSS Document */

/* ---------------------------------------------------------------
   1. THE GRID
   --------------------------------------------------------------- */
.gallery {
  display: grid;
  /* Columns fit themselves to the space: min 200px wide, then wrap */
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 30px;
  margin: 0 auto;
  padding: 10px;
  max-width: 1100px;
  list-style: none;
}

.gallery a {
  display: block;
  overflow: hidden;
  border-radius: 4px;
  outline-offset: 3px;
}

.gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;   /* keeps every tile the same shape */
  object-fit: cover;     /* crops rather than squashes */
  transition: transform .35s ease;
}

.gallery a:hover img,
.gallery a:focus-visible img {
  transform: scale(1.06);
}

.gallery2 {
  display: grid;
  /* Columns fit themselves to the space: min 200px wide, then wrap */
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 30px;
  margin: 0 auto;
  padding: 10px;
  max-width: 1100px;
  list-style: none;
}

.gallery2 a {
  display: block;
  overflow: hidden;
  border-radius: 4px;
  outline-offset: 3px;
}

.gallery2 img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;   /* keeps every tile the same shape */
  object-fit: cover;     /* crops rather than squashes */
  transition: transform .35s ease;
}

.gallery2 a:hover img,
.gallery2 a:focus-visible img {
  transform: scale(1.06);
}
/* ---------------------------------------------------------------
   2. THE POPUP (lightbox)
   Hidden by default. Becomes visible when its id is in the URL,
   which happens when you click a thumbnail link.
   --------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;                 /* top/right/bottom/left: 0 */
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 15, 18, .92);

  /* hidden state */
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s;
}

.lightbox:target {
  opacity: 1;
  visibility: visible;
}

/* Invisible layer filling the screen, so clicking anywhere closes it */
.lightbox__backdrop {
  position: absolute;
  inset: 0;
}

.lightbox figure {
  position: relative;       /* sits above the backdrop */
  margin: 0;
  max-width: min(1000px, 100%);
  text-align: center;
}

.lightbox img {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  margin: 0 auto;
  border-radius: 4px;
}

.lightbox figcaption {
  margin-top: 12px;
  color: #e8e8ea;
  font: 15px/1.5 system-ui, sans-serif;
}

/* ---------------------------------------------------------------
   3. CONTROLS
   --------------------------------------------------------------- */
.lightbox__close,
.lightbox__nav {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(255, 0, 0, .43); 
  border-radius: 50%;
  text-decoration: none;
  line-height: 1;
  transition: background .2s ease;
}

.lightbox__close:hover,
.lightbox__nav:hover,
.lightbox__close:focus-visible,
.lightbox__nav:focus-visible {
  background: rgba(255, 255, 255, .3);
}

.lightbox__close {
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  font-size: 26px;
}

.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  font-size: 24px;
}

.lightbox__nav--prev { left: 16px; }
.lightbox__nav--next { right: 16px; }

/* Screen-reader-only text for the control labels */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .gallery img, .lightbox { transition: none; }
}
