/* ==========================================================================
   Salaroma PHOTOGRAPHY — GALLERY STYLESHEET
   Pinterest-style masonry gallery with category filtering.
   Table of contents:
     1. Gallery Intro
     2. Filter Bar
     3. Masonry Grid
     4. Gallery Item + Hover Overlay
     5. Image Loading States
     6. Responsive
     7. Touch-device overlay parity (no-hover devices)
   ========================================================================== */


/* ==========================================================================
   1. GALLERY INTRO
   ========================================================================== */
.gallery-intro {
  max-width: 760px;
  margin-inline: auto;
  padding-top: calc(var(--nav-height) + var(--space-xl));
  padding-inline: var(--space-md);
  padding-bottom: var(--space-md);
  text-align: center;
}

.gallery-intro .eyebrow {
  display: block;
  margin-bottom: var(--space-sm);
}

.gallery-intro__title {
  font-family: var(--font-display);
  font-size: var(--fs-h1);
  font-weight: 400;
  color: var(--color-text);
}

.gallery-intro__text {
  margin-top: var(--space-sm);
  color: var(--color-text-secondary);
  font-size: 1rem;
  line-height: 1.75;
}


/* ==========================================================================
   2. FILTER BAR
   ========================================================================== */
.filter-bar {
  position: sticky;
  top: 72px; /* matches .site-header.is-scrolled .navbar height — gallery.html always renders the solid nav state */
  z-index: 100;
  background: var(--color-bg);
  padding-block: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

.filter-bar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-md);
}

.filter-btn {
  padding: 0.6rem 1.4rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast),
    background-color var(--transition-fast), transform var(--transition-fast);
}

.filter-btn:hover {
  color: var(--color-text);
  border-color: var(--color-accent);
  transform: translateY(-1px);
}

.filter-btn.is-active {
  color: var(--color-white);
  background: var(--color-text);
  border-color: var(--color-text);
}

.filter-btn.is-active:hover {
  border-color: var(--color-text);
}


/* ==========================================================================
   3. MASONRY GRID
   ========================================================================== */
.gallery {
  max-width: var(--container-max);
  margin-inline: auto;
  padding: var(--space-lg) var(--space-md) var(--space-xl);
}

.gallery__grid {
  column-count: 4;
  column-gap: 1.75rem;
}

.gallery__empty {
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  padding-block: var(--space-lg);
}


/* ==========================================================================
   4. GALLERY ITEM + HOVER OVERLAY
   ========================================================================== */
.gallery__item {
  position: relative;
  display: block;
  break-inside: avoid;
  margin-bottom: 1.75rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-white);
  box-shadow: 0 10px 30px -14px var(--shadow-soft);
  opacity: 0;
  transform: translateY(24px) scale(0.98);
  transition: opacity 0.7s var(--ease-luxury), transform 0.7s var(--ease-luxury),
    box-shadow var(--transition-fast);
  transition-delay: var(--reveal-delay, 0s);
}

.gallery__item.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.gallery__item:hover {
  box-shadow: 0 24px 48px -18px var(--shadow-medium);
}

.gallery__item.is-hidden {
  display: none;
}

.gallery__link {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.gallery__img-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: linear-gradient(135deg, #EFEFEF 0%, #F7F7F5 100%);
}

.gallery__img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 0.6s var(--ease-luxury), transform 0.9s var(--ease-luxury);
}

.gallery__img.is-loaded {
  opacity: 1;
}

.gallery__item:hover .gallery__img {
  transform: scale(1.08);
}

/* Overlay revealed on hover / focus */
.gallery__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 1.5rem;
  background: linear-gradient(180deg, rgba(10, 10, 10, 0) 45%, rgba(10, 10, 10, 0.72) 100%);
  opacity: 0;
  transition: opacity var(--transition-medium);
}

.gallery__item:hover .gallery__overlay,
.gallery__link:focus-visible .gallery__overlay {
  opacity: 1;
}

.gallery__category {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-accent-soft);
  margin-bottom: 0.3rem;
}

.gallery__view {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-style: italic;
  color: var(--color-white);
}

.gallery__view svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transform: translateX(0);
  transition: transform var(--transition-fast);
}

.gallery__item:hover .gallery__view svg {
  transform: translateX(4px);
}


/* ==========================================================================
   5. IMAGE LOADING STATES
   ========================================================================== */
.gallery__img-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0) 30%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0) 70%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite;
  opacity: 1;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.gallery__img-wrap:has(.gallery__img.is-loaded)::before {
  opacity: 0;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* ==========================================================================
   6. RESPONSIVE
   ========================================================================== */
@media (max-width: 1100px) {
  .gallery__grid {
    column-count: 3;
  }
}

@media (max-width: 768px) {
  .gallery__grid {
    column-count: 2;
    /* Slightly narrower than desktop's 1.75rem, but kept close to it —
       and to the same gutter proportion as the 3-column tablet step —
       rather than collapsing to a cramped mobile-only value. */
    column-gap: 1.25rem;
  }

  .gallery__item {
    margin-bottom: 1.25rem;
    /* Same var(--radius-md) as desktop — intentionally NOT switched to
       --radius-sm here, so card corners look identical to desktop. */
  }

  .gallery-intro {
    padding-top: calc(var(--nav-height) + var(--space-lg));
  }
}

@media (max-width: 520px) {
  /* Fixed: this used to drop to a single column here, while the mobile
     stylesheet forced 2 columns back at <=480px — leaving a 481-520px
     range that briefly showed 1 column. Kept at 2 columns to match
     desktop's masonry feel all the way down, and to close that gap. */
  .gallery__grid {
    column-count: 2;
    column-gap: 1rem;
  }

  .gallery__item {
    margin-bottom: 1rem;
  }

  .filter-bar__inner {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .filter-bar__inner::-webkit-scrollbar {
    display: none;
  }

  .filter-btn {
    flex-shrink: 0;
  }
}


/* ==========================================================================
   7. TOUCH-DEVICE OVERLAY PARITY
   Desktop reveals the category label + "View full size" cue on :hover.
   Touch devices have no hover, so without this, that entire piece of the
   desktop design is invisible on phones — tapping a thumbnail jumps
   straight to the lightbox and the overlay is never seen. This shows the
   same overlay by default, but ONLY on devices that report no real
   hover/pointer (phones, most tablets). Anything with a mouse or
   trackpad — i.e. the desktop experience — is untouched, since it still
   matches `hover: hover` and keeps the original hover-to-reveal behavior.
   ========================================================================== */
@media (hover: none) and (pointer: coarse) {
  .gallery__overlay {
    opacity: 1;
  }

  .gallery__link {
    -webkit-tap-highlight-color: transparent;
  }
}
