/*
 * BLUEBERRY GROUP - Gallery page
 * Visual archive for project photography and brand applications.
 */

/* 1. Page foundation */

.gallery-page {
  background: var(--blueberry-white);
  color: var(--blueberry-ink);
}

.gallery-page .shell {
  width: min(var(--blueberry-container), calc(100% - 48px));
  margin-inline: auto;
}

/* 2. Single-page hero */

.gallery-hero {
  overflow: hidden;
  color: var(--blueberry-white);
  background:
    linear-gradient(90deg, var(--blueberry-overlay-strong), rgba(var(--blueberry-deep-rgb), 0.5)),
    url("../../branding-profile/gallery.webp") center 50% / cover;
}

.gallery-hero-inner {
  display: flex;
  min-height: 400px;
  flex-direction: column;
  justify-content: center;
  padding-block: 78px 88px;
}

.gallery-breadcrumb {
  display: flex;
  gap: 8px;
  color: var(--blueberry-on-dark);
  font-size: var(--blueberry-text-meta);
  line-height: 1.5;
}

.gallery-breadcrumb a {
  color: inherit;
  text-decoration: none;
}

.gallery-hero h1 {
  max-width: 900px;
  margin: 24px 0 0;
  color: var(--blueberry-white);
  font-size: var(--blueberry-display-lg);
  font-weight: 300;
  line-height: 0.98;
  letter-spacing: -0.06em;
}

/* 3. Reveal motion */

.gallery-filters,
.gallery-item {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 0.75s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0ms);
}

.gallery-filters.is-visible,
.gallery-item.is-visible {
  opacity: 1;
  transform: none;
}

/* 4. Filters */

.gallery-board {
  padding-block: 58px 64px;
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 24px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--blueberry-line);
}

.gallery-filters button {
  display: inline-flex;
  min-height: auto;
  align-items: center;
  padding: 0 0 12px;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  appearance: none;
  color: var(--blueberry-deep);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--blueberry-text-label);
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition:
    border-color 0.25s ease,
    color 0.25s ease;
}

.gallery-filters button:hover,
.gallery-filters button:focus-visible,
.gallery-filters .is-active {
  border-bottom-color: var(--blueberry-aqua);
  background: transparent;
  color: var(--blueberry-aqua);
  outline: none;
}

/* 5. Gallery grid */

.gallery-grid {
  display: grid;
  grid-template-columns: var(--blueberry-archive-grid-columns);
  gap: var(--blueberry-archive-grid-gap);
  min-width: 0;
  max-width: 100%;
}

.gallery-item {
  margin: 0;
  min-width: 0;
  aspect-ratio: var(--blueberry-archive-media-ratio);
  content-visibility: auto;
  contain-intrinsic-size: 420px 540px;
}

.gallery-item[hidden] {
  display: none;
}

.gallery-filter-empty {
  margin: 28px 0 0;
  color: var(--blueberry-muted);
}

.gallery-page .archive-load-more {
  display: flex;
  justify-content: center;
  margin-top: 48px;
}

.gallery-item button {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  overflow: hidden;
  border: 0;
  border-radius: var(--blueberry-archive-media-radius);
  background: var(--blueberry-paper);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: box-shadow 0.35s ease, transform 0.35s ease;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.65s ease, filter 0.65s ease;
}

.gallery-item.focus-left img {
  object-position: left center;
}

.gallery-item.focus-center img {
  object-position: center;
}

.gallery-item span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.gallery-item button:hover img,
.gallery-item button:focus-visible img {
  filter: saturate(1.06) contrast(1.04);
  transform: scale(var(--blueberry-archive-image-scale));
}

.gallery-item button:hover,
.gallery-item button:focus-visible {
  box-shadow: var(--blueberry-archive-media-shadow);
  transform: translateY(-4px);
}

.gallery-item button:focus-visible {
  outline: 2px solid var(--blueberry-aqua);
  outline-offset: 5px;
}

/* 6. Responsive */

@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 600px) {
  .gallery-page .shell {
    width: calc(100% - 40px);
  }

  .gallery-hero-inner {
    min-height: 360px;
    padding-block: 62px 72px;
  }

  .gallery-hero h1 {
    font-size: var(--blueberry-display-sm);
  }

  .gallery-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .gallery-filters {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    justify-content: flex-start;
    overflow-x: auto;
    gap: 18px;
    padding-bottom: 4px;
  }

  .gallery-filters button {
    flex: 0 0 auto;
  }

}

@media (prefers-reduced-motion: reduce) {
  .gallery-page * {
    scroll-behavior: auto;
    transition-duration: 0.01ms;
  }

  .gallery-filters,
  .gallery-item {
    opacity: 1;
    transform: none;
  }
}

