/* --- ARTWORK GRID SYSTEM --- */
.art-gallery {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.artwork {
  display: block;
  position: relative;
  overflow: hidden;
  background: #151515;
  color: #f2eadc;
  min-height: 340px;
  border: 1px solid #11100f;
  grid-column: span 4; /* Default standard layout: 3 items per row */
}

/* Feature layouts for variety in early rows */
.art-gallery .artwork:nth-child(1) { grid-column: span 7; }
.art-gallery .artwork:nth-child(2) { grid-column: span 5; }

/* Dynamic fix for 1 trailing item at the end of a section (e.g. 13-item grid) */
.art-gallery .artwork:nth-child(3n + 1):last-child {
  grid-column: span 12;
}

/* Dynamic fix for 2 trailing items at the end of a section */
.art-gallery .artwork:nth-child(3n + 1):nth-last-child(2) {
  grid-column: span 6;
}
.art-gallery .artwork:nth-child(3n + 2):last-child {
  grid-column: span 6;
}

/* Dynamic fix for 3 trailing items (e.g. Posters) to fill 12 cols evenly */
.art-gallery .artwork:nth-child(3n + 1):nth-last-child(3),
.art-gallery .artwork:nth-child(3n + 2):nth-last-child(2),
.art-gallery .artwork:nth-child(3n + 3):last-child {
  grid-column: span 4;
}

.artwork img {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.artwork:hover img {
  transform: scale(1.045);
}

.artwork figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px 16px 15px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.88));
  font: 11px 'DM Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.artwork:hover figcaption,
.artwork:focus figcaption {
  opacity: 1;
  transform: none;
}

.artwork figcaption strong {
  display: block;
  font: 700 21px 'Syne', sans-serif;
  letter-spacing: -0.04em;
  color: #f2eadc;
}

.gallery-note {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  margin-bottom: 33px;
  font: 11px 'DM Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.gallery-note p {
  max-width: 380px;
  line-height: 1.5;
  margin: 0;
}

/* --- LIGHTBOX MODALS --- */
.lightbox {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw;
  height: 100vh;
  z-index: 9999 !important; /* Forces lightbox above sticky navbars */
  display: none;
  place-items: center;
  padding: 32px;
  background: rgba(17, 16, 15, 0.95);
  box-sizing: border-box;
}

.lightbox:target {
  display: grid !important;
}

.lightbox img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  pointer-events: auto;
}

/* Close Button Styling */
.lightbox .close {
  position: absolute !important;
  right: 30px !important;
  top: 30px !important;
  color: #f2eadc !important;
  font: 12px/1 'DM Mono', monospace !important;
  text-transform: uppercase;
  text-decoration: none !important;
  cursor: pointer !important;
  z-index: 10000 !important; /* Keeps X button above modal container */
  padding: 12px 18px !important;
  background: rgba(255, 255, 255, 0.15) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: block !important;
}

.lightbox .close:hover {
  background: #ff6b00 !important; /* Signature Orange */
  color: #11100f !important;
  border-color: #ff6b00 !important;
}

.lightbox .caption {
  position: absolute;
  bottom: 25px;
  color: #f2eadc;
  font: 11px 'DM Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  pointer-events: none;
}

/* --- RESPONSIVE MEDIA QUERIES --- */
@media (max-width: 700px) {
  .art-gallery {
    display: block;
  }
  .artwork,
  .artwork:nth-child(n) {
    min-height: 350px;
    margin-bottom: 15px;
  }
  .artwork figcaption {
    opacity: 1;
    transform: none;
  }
  .gallery-note {
    display: block;
  }
  .gallery-note p {
    margin-top: 10px;
  }
}