/* ==========================================================================
   Gallery page
   Matches the Stitch "gallery_page" screen.
   ========================================================================== */

.gallery-page { min-height: 100vh; padding-bottom: 6rem; }

/* ---- Intro --------------------------------------------------------------- */
.gallery-intro {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-block: 4rem;
  padding-inline: var(--page-margin);
  text-align: center;
}
.gallery-intro h1 {
  margin-bottom: 1.5rem;
  font-size: 3rem;
  line-height: 3.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.gallery-intro p {
  max-width: 42rem;
  margin-inline: auto;
  font-size: 1.125rem;
  line-height: 1.75rem;
  color: var(--color-on-surface-variant);
}

@media (min-width: 768px) {
  .gallery-intro { padding-block: 6rem; }
}

/* ---- Photo grid ---------------------------------------------------------- */
.gallery-grid-wrap {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--page-margin);
}
.gallery-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gutter);
}
.gallery-item {
  position: relative;
  aspect-ratio: 3 / 4;
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-card);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  transition: box-shadow 150ms var(--ease);
}
.gallery-item:hover {
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }

.gallery-item__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
  pointer-events: none;
  background: linear-gradient(to top,
    color-mix(in srgb, var(--color-on-surface) 80%, transparent),
    color-mix(in srgb, var(--color-on-surface) 0%, transparent));
  color: #FFFFFF;
  opacity: 0;
  transition: opacity 300ms ease;
}
.gallery-item:hover .gallery-item__overlay,
.gallery-item:focus-within .gallery-item__overlay { opacity: 1; }
.gallery-item__overlay .material-symbols-outlined { margin-bottom: 0.5rem; }
.gallery-item__title {
  margin-bottom: 0.25rem;
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 600;
}
.gallery-item__text { color: color-mix(in srgb, var(--color-surface-bright) 90%, transparent); }

/* Transparent button covering the photo: opens the lightbox and makes items keyboard-reachable. */
.gallery-item__open {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
}
.gallery-item__open:focus-visible { outline-offset: -4px; }

@media (min-width: 768px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---- Lightbox ------------------------------------------------------------ */
.lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 1rem;
  border: 0;
  background: color-mix(in srgb, var(--color-inverse-surface) 95%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--color-surface-bright);
}
.lightbox[open] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.lightbox::backdrop { background: transparent; }

.lightbox__close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  padding: 0.5rem;
  border-radius: var(--radius-soft);
  color: var(--color-surface-bright);
  transition: color 150ms var(--ease), background-color 150ms var(--ease);
}
.lightbox__close:hover { background: rgb(255 255 255 / 0.1); color: var(--color-primary-fixed); }
.lightbox__close .material-symbols-outlined { font-size: 1.875rem; }

.lightbox__stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 64rem;
  max-height: 85vh;
}
.lightbox__img {
  width: auto;
  max-height: 75vh;
  object-fit: contain;
  border-radius: var(--radius-control);
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}
.lightbox__caption { margin-top: 1.5rem; text-align: center; }
.lightbox__title {
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 600;
  color: var(--color-primary-fixed);
}
.lightbox__text {
  font-size: 1.125rem;
  line-height: 1.75rem;
  color: color-mix(in srgb, var(--color-surface-bright) 80%, transparent);
}

@media (min-width: 768px) {
  .lightbox { padding: 3rem; }
}
