/* ================================ */
/* CATEGORY GALLERY LAYOUT          */
/* ================================ */

/* ── Hero Section ── */
.category-hero {
  position: relative;
  width: 100%;
  min-height: 40vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 80px 1rem 1.5rem; /* Tighter padding on mobile */
  background: var(--color-beige-lighter);
  overflow: hidden;
}

@media (min-width: 768px) {
  .category-hero {
    min-height: 45vh;
    padding: 120px 2rem 4rem;
  }
}

.category-hero-title {
  font-family: var(--font-serif);
  font-size: clamp(var(--fs-2xl), 10vw, var(--fs-5xl)); /* Scaled perfectly for mobile up to large desktop */
  color: var(--color-brown-dark);
  font-weight: 400;
  font-style: italic;
  margin-bottom: var(--space-lg); /* Space below title before the line */
  position: relative;
  z-index: 2;
  line-height: 1.1;
  word-wrap: break-word;
  max-width: 95vw;
  order: 2; /* Title comes second */
}

.category-hero-subtitle {
  font-family: var(--font-heading);
  font-size: var(--fs-sm);
  color: var(--color-gold);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 600;
  position: relative;
  z-index: 2;
  margin-bottom: var(--space-sm); /* Small gap between subtitle and title */
  order: 1; /* Subtitle at the top (Eyebrow) */
}

.category-hero-line {
  width: 60px;
  height: 2px;
  background: var(--color-gold);
  margin: 0 auto;
  order: 3; /* Line at the bottom */
}

/* ── Masonry Grid Gallery ── */
.gallery-section {
  background: var(--color-beige-lighter);
  padding: var(--space-xl) 0 var(--space-4xl); /* Reduced top padding from 3xl */
  min-height: 50vh;
}

.gallery-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 10px; /* Barely any side padding on mobile, lets images breathe */
  /* CSS Columns for pure Masonry */
  column-count: 1;
  column-gap: 10px; /* Extremely tight 10px gap on mobile */
}

@media (min-width: 600px) {
  .gallery-container {
    padding: 0 var(--container-pad); /* Restore padding for tablets/desktop */
    column-count: 2;
    column-gap: var(--space-md);
  }
}

@media (min-width: 1024px) {
  .gallery-container {
    column-count: 3;
    column-gap: var(--space-xl);
  }
}

@media (min-width: 1400px) {
  .gallery-container {
    column-count: 4;
  }
}

/* ── Individual Photo Item ── */
.gallery-item {
  position: relative;
  break-inside: avoid;
  margin-bottom: 10px; /* Reduced bottom margin to perfectly match 10px column-gap on mobile */
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  background: var(--color-white);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05); /* Soft premium shadow */
  cursor: pointer;
  /* Hardware acceleration for smooth scale */
  transform: translateZ(0); 
  will-change: transform;
}

/* For spacing consistency at breakpoints */
@media (min-width: 768px) {
  .gallery-item {
    margin-bottom: var(--space-lg);
  }
}

@media (min-width: 1024px) {
  .gallery-item {
    margin-bottom: var(--space-xl);
  }
}

.gallery-item-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), filter 0.8s ease;
}

/* ── Hover Effects ── */
.gallery-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(139, 90, 43, 0.4) 0%, transparent 40%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

.gallery-item:hover .gallery-item-img {
  transform: scale(1.04);
  filter: brightness(0.9);
}

.gallery-item:hover::after {
  opacity: 1;
}

/* ── Back to Menu Button ── */
.back-btn-wrapper {
  text-align: center;
  margin-top: var(--space-4xl);
}

.btn-outline-gold {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-brown-dark);
  border: 1px solid var(--color-gold);
  padding: 12px 30px;
  border-radius: 50px;
  text-decoration: none;
  transition: all 0.4s ease;
}

.btn-outline-gold:hover {
  background: var(--color-brown-dark);
  color: var(--color-white);
  border-color: var(--color-brown-dark);
}

/* ── Floating Back Button ── */
.floating-back-btn {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-brown-dark);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(212, 175, 55, 0.3);
  padding: 12px 22px;
  border-radius: 50px;
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(212, 175, 55, 0.08);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.floating-back-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.floating-back-btn:hover {
  background: var(--color-brown-dark);
  color: var(--color-white);
  border-color: var(--color-brown-dark);
  box-shadow: 0 8px 30px rgba(26, 26, 26, 0.18);
  transform: translateY(-2px);
}

.floating-back-btn:hover svg {
  transform: translateX(-3px);
}

@media (max-width: 480px) {
  .floating-back-btn {
    bottom: 20px;
    left: 20px;
    padding: 10px 18px;
    font-size: 10px;
  }
}
