/* Gallery Page */

@font-face {
  font-family: 'DM Serif Display';
  src: url('../fonts/DMSerifDisplay-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Serif Display';
  src: url('../fonts/DMSerifDisplay-Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  background-color: #030303;
  margin: 0;
  padding: 0;
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
}

/* ── Header ── */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 48px;
  background-color: #030303;
  border-bottom: 1px solid #1a1a1a;
}

.back-link {
  color: #d4d4d4;
  text-decoration: none;
  font-size: 3rem;
  line-height: 1;
  transition: color 0.3s;
}

.back-link:hover {
  color: #fff;
}

.header-name {
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
  font-size: 2.4rem;
  color: #d4d4d4;
  letter-spacing: 0.1em;
}

/* ── Grid ── */
#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px;
  padding: 4px;
}

.thumb {
  display: block;
  overflow: hidden;
  cursor: pointer;
  background-color: #0a0a0a;
  aspect-ratio: 3 / 2;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(20%);
  transition: filter 0.4s, transform 0.4s;
}

.thumb:hover img {
  filter: grayscale(0%);
  transform: scale(1.05);
}

/* ── Lightbox ── */
#lightbox {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.95);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

#lightbox.hidden {
  display: none;
}

#lb-img {
  max-width: calc(100vw - 120px);
  max-height: calc(100vh - 160px);
  object-fit: contain;
  display: block;
  user-select: none;
}

#lb-close {
  position: fixed;
  top: 20px;
  right: 28px;
  background: none;
  border: none;
  color: #a6a6a6;
  font-size: 2.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: color 0.3s;
  font-family: 'DM Serif Display', Georgia, serif;
}

#lb-close:hover {
  color: #fff;
}

#lb-prev,
#lb-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #a4a4a4;
  font-size: 4rem;
  cursor: pointer;
  padding: 0 20px;
  line-height: 1;
  transition: color 0.3s;
  font-family: 'DM Serif Display', Georgia, serif;
  user-select: none;
}

#lb-prev { left: 0; }
#lb-next { right: 0; }

#lb-prev:hover,
#lb-next:hover {
  color: #d4d4d4;
}

#lb-counter {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  color: #a4a4a4;
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 1.2rem;
  letter-spacing: 0.15em;
  white-space: nowrap;
  margin-bottom: 10px;
}

#lb-meta {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: #a5a5a5;
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 1rem;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  header {
    padding: 14px 20px;
  }

  .header-name {
    font-size: 1.4rem;
  }

  #grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 2px;
    padding: 2px;
  }

  #lb-img {
    max-width: 100vw;
    max-height: 100vh;
  }

  #lb-prev,
  #lb-next {
    font-size: 2.5rem;
    padding: 0 10px;
  }
}
