/* =============================================================
   GALLERY.CSS — Accordion image slider + footer
   ============================================================= */

.gallery {
  background: var(--c-bg);
  padding: 7rem 0;
}

.gallery__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* =============================================
   SECTION HEADER
   ============================================= */

.gallery__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}

.gallery__header-left {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.gallery__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--font-body);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-accent);
}

.gallery__headline {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 4vw, 3.5rem);
  font-weight: 300;
  letter-spacing: -0.03em;
  color: var(--c-text);
  line-height: 1;
}

.gallery__all-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--c-text-mid);
  border-bottom: 1px solid var(--c-border-warm);
  padding-bottom: 0.125rem;
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 0.25rem;
  transition:
    color        0.22s var(--ease-expo),
    border-color 0.22s var(--ease-expo);
}

.gallery__all-link:hover { color: var(--c-text); border-color: var(--c-accent-lt); }

.gallery__all-arrow {
  display: flex;
  align-items: center;
  transition: transform 0.22s var(--ease-expo);
}

.gallery__all-link:hover .gallery__all-arrow { transform: translateX(3px) translateY(-1px); }


/* =============================================
   ACCORDION STRIP
   Five panels that expand on hover / focus
   ============================================= */

.gallery__accordion {
  display: flex;
  gap: 0.375rem;
  height: 540px;
  border-radius: 1.75rem;
  overflow: hidden;
  /* Outer shell — matching double-bezel language */
  background: var(--c-text);
  padding: 0.375rem;
  border: 1px solid var(--c-border-warm);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 24px 64px rgba(28, 20, 16, 0.12),
    0 4px 16px  rgba(28, 20, 16, 0.06);
}

.gallery__panel {
  flex: 1;
  position: relative;
  overflow: hidden;
  border-radius: calc(1.75rem - 0.5rem);
  cursor: pointer;
  /* GPU-safe: only animate flex (layout) and image transform (GPU) */
  transition: flex 0.65s var(--ease-spring);
  outline: none;
}

/* Expand hovered / focused panel */
.gallery__accordion:has(.gallery__panel:hover)    .gallery__panel:hover,
.gallery__accordion:has(.gallery__panel:focus)    .gallery__panel:focus {
  flex: 4.5;
}

/* Compress all other panels when one is active */
.gallery__accordion:has(.gallery__panel:hover)    .gallery__panel:not(:hover),
.gallery__accordion:has(.gallery__panel:focus)    .gallery__panel:not(:focus) {
  flex: 0.35;
}

/* Image */
.gallery__panel-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.7s var(--ease-spring);
  /* Slight warmth via CSS — matches parchment palette */
  filter: sepia(0.08) saturate(1.05);
}

.gallery__panel:hover .gallery__panel-img,
.gallery__panel:focus .gallery__panel-img {
  transform: scale(1.04);
  filter: sepia(0) saturate(1);
}

/* Dark gradient overlay */
.gallery__panel-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(28, 20, 16, 0.08) 0%,
    rgba(28, 20, 16, 0.55) 100%
  );
  pointer-events: none;
  transition: opacity 0.5s var(--ease-expo);
}

.gallery__panel:hover .gallery__panel-overlay,
.gallery__panel:focus .gallery__panel-overlay {
  opacity: 0.85;
}

/* Vertical label — visible on compressed panels when accordion is hovered */
.gallery__panel-label {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-body);
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(253, 250, 244, 0.5);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  /* Hidden by default, shown only when other panel is hovered */
  opacity: 0;
  transition: opacity 0.35s var(--ease-expo);
}

.gallery__accordion:has(.gallery__panel:hover) .gallery__panel:not(:hover) .gallery__panel-label,
.gallery__accordion:has(.gallery__panel:focus) .gallery__panel:not(:focus) .gallery__panel-label {
  opacity: 1;
}

/* Caption + tag — revealed when expanded */
.gallery__panel-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.75rem 1.75rem 1.625rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity   0.35s var(--ease-expo) 0.15s,
    transform 0.45s var(--ease-expo) 0.1s;
}

.gallery__panel:hover .gallery__panel-info,
.gallery__panel:focus .gallery__panel-info {
  opacity: 1;
  transform: translateY(0);
}

.gallery__panel-tag {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-accent-lt);
  padding: 0.25rem 0.625rem;
  border: 1px solid rgba(196, 163, 90, 0.35);
  border-radius: 100px;
  background: rgba(196, 163, 90, 0.1);
  align-self: flex-start;
}

.gallery__panel-caption {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.01em;
  color: rgba(253, 250, 244, 0.92);
  line-height: 1.3;
}


/* =============================================
   FOOTER NOTE
   ============================================= */

.gallery__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.25rem;
}

.gallery__footer-note {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 300;
  color: var(--c-text-light);
  letter-spacing: 0.02em;
}

.gallery__footer-count {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--c-text-mid);
}

.gallery__footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--c-accent);
  transition: gap 0.22s var(--ease-expo), color 0.22s var(--ease-expo);
}

.gallery__footer-link:hover { gap: 0.625rem; color: var(--c-text); }


/* =============================================================
   RESPONSIVE
   ============================================================= */

@media (max-width: 860px) {
  .gallery__accordion {
    height: 420px;
  }
}

@media (max-width: 768px) {
  .gallery {
    padding: 5rem 0;
  }

  .gallery__inner {
    padding: 0 1.25rem;
  }

  .gallery__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .gallery__all-link {
    align-self: flex-start;
    margin-bottom: 0;
  }

  /* On mobile: grid fallback — 2 cols, first panel full-width */
  .gallery__accordion {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 220px 160px 160px;
    height: auto;
    border-radius: 1.25rem;
    padding: 0.25rem;
    gap: 0.25rem;
  }

  .gallery__panel {
    flex: none;
    border-radius: calc(1.25rem - 0.35rem);
    /* Disable expand behaviour */
    transition: none;
  }

  /* First panel spans full width */
  .gallery__panel:first-child {
    grid-column: span 2;
  }

  /* Always show caption info on mobile */
  .gallery__panel-info {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .gallery__panel-label { display: none; }

  /* Reset accordion :has() rules for mobile */
  .gallery__accordion:has(.gallery__panel:hover) .gallery__panel:hover,
  .gallery__accordion:has(.gallery__panel:focus) .gallery__panel:focus,
  .gallery__accordion:has(.gallery__panel:hover) .gallery__panel:not(:hover),
  .gallery__accordion:has(.gallery__panel:focus) .gallery__panel:not(:focus) {
    flex: none;
  }
}

@media (max-width: 480px) {
  .gallery__accordion {
    grid-template-rows: 180px 140px 140px;
  }
}


/* =============================================================
   /gallery/ — album listing page (shell mirrors .news-page)
   ============================================================= */

.gallery-page {
  background: var(--c-bg);
  padding: calc(var(--nav-height) + 3rem) 0 7rem;
  min-height: 100dvh;
}

.gallery-page__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 3rem;
}

.gallery-page__header {
  margin-bottom: 3rem;
  max-width: 46ch;
}

.gallery-page__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.gallery-page__card {
  display: flex;
  flex-direction: column;
  border-radius: 1.25rem;
  overflow: hidden;
  background: var(--c-bg-warm);
  border: 1px solid var(--c-border-warm);
  transition: transform 0.4s var(--ease-expo), box-shadow 0.4s var(--ease-expo);
}

.gallery-page__card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 48px rgba(28, 20, 16, 0.12);
}

.gallery-page__card-img-wrap {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.gallery-page__card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease-spring);
}

.gallery-page__card:hover .gallery-page__card-img { transform: scale(1.05); }

.gallery-page__card-body {
  padding: 1.25rem 1.375rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.gallery-page__card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.gallery-page__card-title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--c-text);
  line-height: 1.25;
}

.gallery-page__card-count {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--c-text-light);
  letter-spacing: 0.02em;
}


/* =============================================================
   /gallery/<slug>/ — album detail page (photo grid → lightbox)
   ============================================================= */

.gallery-detail {
  background: var(--c-bg);
  padding: calc(var(--nav-height) + 3rem) 0 7rem;
  min-height: 100dvh;
}

.gallery-detail__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 3rem;
}

.gallery-detail__header {
  margin: 1.5rem 0 3rem;
  max-width: 60ch;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gallery-detail__top {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.gallery-detail__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.4vw, 3rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--c-text);
  line-height: 1.1;
}

.gallery-detail__excerpt {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 300;
  color: var(--c-text-mid);
  line-height: 1.6;
}

.gallery-detail__count {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--c-text-light);
  letter-spacing: 0.02em;
}

.gallery-detail__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.gallery-detail__thumb {
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  aspect-ratio: 4 / 3;
  border-radius: 0.75rem;
  overflow: hidden;
}

.gallery-detail__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease-spring);
}

.gallery-detail__thumb:hover img { transform: scale(1.06); }

@media (max-width: 768px) {
  .gallery-page__inner,
  .gallery-detail__inner { padding: 0 1.25rem; }
}


/* =============================================================
   LIGHTBOX EXTENSIONS — prev/next, counter, caption (album
   browsing). Base .lightbox/.lightbox__img/.lightbox__close
   live in css/news.css (shared singleton, first used there).
   ============================================================= */

.lightbox__figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  max-width: 100%;
  max-height: 100%;
}

.lightbox__caption {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: rgba(253, 250, 244, 0.75);
  text-align: center;
  max-width: 60ch;
}

.lightbox__counter {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: rgba(253, 250, 244, 0.65);
}

.lightbox__nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--c-bg);
  background: rgba(253, 250, 244, 0.12);
  border: 1px solid rgba(253, 250, 244, 0.25);
  transition: background 0.22s var(--ease-expo), transform 0.22s var(--ease-expo);
}

.lightbox__nav:hover {
  background: rgba(253, 250, 244, 0.22);
}

.lightbox__nav--prev { left: 1.5rem; }
.lightbox__nav--prev:hover { transform: translateY(-50%) translateX(-2px); }
.lightbox__nav--next { right: 1.5rem; }
.lightbox__nav--next:hover { transform: translateY(-50%) translateX(2px); }

@media (max-width: 480px) {
  .lightbox__nav { width: 40px; height: 40px; }
  .lightbox__nav--prev { left: 0.5rem; }
  .lightbox__nav--next { right: 0.5rem; }
  .lightbox__counter { bottom: 0.75rem; }
}
