/* ========================================
   Gallery Page Styles
   ======================================== */

/* Hero / Intro Section */
.hero {
  padding: 10rem 4rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 300;
  margin-bottom: 0;
  letter-spacing: 0.02em;
}

.hero .concept {
  font-size: 1.1rem;
  color: #555;
  max-width: 600px;
  line-height: 1.8;
}

/* Gallery Grid */
.gallery {
  padding: 2rem 4rem 6rem;
  max-width: 1200px;
  margin: 0 auto;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.gallery-item {
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  border-radius: 2.5rem;
  position: relative;
  background: #e8e8e8;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  padding: 0;
  font: inherit;
  text-align: left;
}

.gallery-item.img-loaded {
  background: transparent;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.gallery-item:hover img {
  transform: scale(1.03);
}

.gallery-item .gallery-label {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #1a1a2e;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  padding: 0.6rem 1.25rem;
  border-radius: 2rem;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.gallery-item:hover .gallery-label {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========================================
   Lightbox
   ======================================== */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(250, 250, 250, 0.98);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

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

/* Navigation zones */
.lightbox-nav-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s;
}

.lightbox-nav-zone:hover {
  background: linear-gradient(to right, rgba(0,0,0,0.03), transparent);
}

.lightbox-nav-zone.next:hover {
  background: linear-gradient(to left, rgba(0,0,0,0.03), transparent);
}

.lightbox-nav-zone.prev {
  left: 0;
}

.lightbox-nav-zone.next {
  right: 0;
}

.lightbox-nav-zone svg {
  width: 28px;
  height: 28px;
  color: #111;
  opacity: 0.4;
  transition: opacity 0.2s;
}

.lightbox-nav-zone:hover svg {
  opacity: 0.9;
}

/* Close button */
.lightbox-close {
  position: absolute;
  top: 2rem;
  right: 3rem;
  width: 28px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 20;
}

.lightbox-close span {
  display: block;
  position: absolute;
  height: 1.5px;
  width: 100%;
  background: #1a1a2e;
  left: 0;
  top: 50%;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.lightbox-close span:nth-child(1) {
  transform: translateY(-50%) rotate(45deg);
}

.lightbox-close span:nth-child(2) {
  transform: translateY(-50%) rotate(-45deg);
}

.lightbox-close:hover span {
  opacity: 1;
}

/* Content area */
.lightbox-content {
  position: absolute;
  top: 0;
  left: 120px;
  right: 120px;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  padding: 3rem 2rem;
}

.lightbox-image {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-width: 0;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease 0.1s, transform 0.4s ease 0.1s;
}

.lightbox.active .lightbox-image {
  opacity: 1;
  transform: translateY(0);
}

.lightbox-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lightbox-caption {
  width: 280px;
  flex-shrink: 0;
  color: #111;
  align-self: flex-end;
  padding-bottom: 2rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease 0.2s, transform 0.4s ease 0.2s;
}

.lightbox.active .lightbox-caption {
  opacity: 1;
  transform: translateY(0);
}

.lightbox-caption .title {
  font-size: 1.25rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.lightbox-caption .meta {
  font-size: 0.75rem;
  color: rgba(0, 0, 0, 0.6);
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.lightbox-caption .description {
  font-size: 0.85rem;
  line-height: 1.7;
  color: rgba(0, 0, 0, 0.7);
}

.lightbox-counter {
  font-size: 0.7rem;
  color: rgba(0, 0, 0, 0.55);
  letter-spacing: 0.1em;
  margin-top: 2rem;
}

/* ========================================
   Responsive - Gallery
   ======================================== */
@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .lightbox-nav-zone {
    width: 80px;
  }

  .lightbox-content {
    left: 80px;
    right: 80px;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 4rem 1.5rem 2rem;
  }

  .lightbox-image {
    width: 100%;
    flex: 1;
    min-height: 0;
  }

  .lightbox-caption {
    width: 100%;
    max-width: 600px;
    align-self: center;
    padding-bottom: 0;
    text-align: left;
  }
}

@media (max-width: 768px) {
  .hero {
    padding: 5.5rem 1.5rem 1.5rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .gallery {
    padding: 1.5rem 1.5rem 4rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .gallery-item {
    border-radius: 1.5rem;
  }

  .lightbox-nav-zone {
    width: 60px;
  }

  .lightbox-nav-zone svg {
    width: 22px;
    height: 22px;
  }

  .lightbox-content {
    left: 60px;
    right: 60px;
    gap: 0.6rem;
    padding: 3rem 1rem 1.5rem;
    justify-content: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .lightbox-image {
    flex: none;
    max-height: 35vh;
  }

  .lightbox-caption {
    flex-shrink: 0;
  }

  .lightbox-caption .title {
    font-size: 1rem;
  }

  .lightbox-caption .description {
    font-size: 0.8rem;
  }

  .lightbox-close {
    top: 1.5rem;
    right: 1.5rem;
  }
}

/* Mobile landscape */
@media (max-height: 500px) and (orientation: landscape) {
  .lightbox-nav-zone {
    width: 50px;
  }

  .lightbox-nav-zone svg {
    width: 20px;
    height: 20px;
  }

  .lightbox-content {
    left: 50px;
    right: 50px;
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem;
  }

  .lightbox-image {
    flex: 1;
    height: 100%;
    min-width: 0;
  }

  .lightbox-caption {
    width: 180px;
    flex-shrink: 0;
    align-self: center;
    padding-bottom: 0;
    text-align: left;
  }

  .lightbox-caption .title {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
  }

  .lightbox-caption .meta {
    font-size: 0.65rem;
    margin-bottom: 0.5rem;
  }

  .lightbox-caption .description {
    font-size: 0.7rem;
    line-height: 1.5;
  }

  .lightbox-counter {
    margin-top: 1rem;
    font-size: 0.6rem;
  }

  .lightbox-close {
    top: 2rem;
    right: 3rem;
  }
}

/* Exhibition note below gallery */
.gallery-exhibition-note {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 4rem 4rem;
  font-size: 0.85rem;
  line-height: 1.7;
  color: rgba(0, 0, 0, 0.6);
}

.gallery-exhibition-note em {
  font-style: italic;
}

.gallery-exhibition-note .related-link {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.gallery-exhibition-note .related-link a {
  color: inherit;
  opacity: 0.6;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.gallery-exhibition-note .related-link a:hover {
  opacity: 1;
}

@media (max-width: 768px) {
  .gallery-exhibition-note {
    padding: 0 1.5rem 3rem;
  }
}

/* Lightbox image transition */
.lightbox-image.loading img {
  opacity: 0;
}

.lightbox-image img {
  transition: opacity 0.25s ease;
}

.lightbox-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  animation: lightbox-spin 0.6s linear infinite;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.lightbox-image.loading .lightbox-spinner {
  opacity: 1;
  transition-delay: 0.15s;
}

@keyframes lightbox-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}
