/* =========================================================
   Gallery page – filter buttons, image grid, lightbox
   ========================================================= */
.gallery { background: var(--cream); padding: 48px 0 100px; min-height: 50vh; }

/* ---- Filter buttons ---- */
.gallery-filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 28px; }
.gallery-filter {
  font-family: var(--font-body); font-size: .9rem; font-weight: 600; cursor: pointer;
  padding: 10px 20px; border-radius: 999px; color: var(--navy-dark);
  background: var(--white); border: 1.5px solid var(--line);
  transition: background .2s, border-color .2s, transform .2s, box-shadow .2s;
}
.gallery-filter:hover { border-color: var(--gold); transform: translateY(-2px); }
.gallery-filter:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.gallery-filter.is-active {
  background: var(--gold-fill); border-color: var(--gold-fill); box-shadow: 0 8px 20px rgba(255,191,15,.45);
}

/* ---- Grid ---- */
.gallery-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.gallery-item { margin: 0; opacity: 0; transform: translateY(28px) scale(.96);
  transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1); transition-delay: calc(var(--d, 0) * 70ms); }
.gallery-item.is-in { opacity: 1; transform: none; }
.gallery-item button {
  display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in; background: #cfe9f7;
  border-radius: 16px; overflow: hidden; aspect-ratio: 1 / 1; background: #fff; position: relative;
  box-shadow: 0 6px 18px rgba(14,32,56,.10); transition: box-shadow .35s ease, transform .35s ease;
}
.gallery-item button::after { /* hover overlay + zoom icon */
  content: "+"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font: 300 3rem/1 var(--font-head); color: #fff; background: rgba(14,32,56,.45); opacity: 0; transition: opacity .3s ease;
}
.gallery-item button::before { /* light sweep */
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; z-index: 1; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent); transform: skewX(-18deg);
}
.gallery-item button:hover, .gallery-item button:focus-visible { transform: translateY(-6px); box-shadow: 0 18px 36px rgba(14,32,56,.25); }
.gallery-item button:hover::after, .gallery-item button:focus-visible::after { opacity: 1; }
.gallery-item button:hover::before { left: 130%; transition: left .8s ease; }
.gallery-item img { width: 100%; height: 100%; object-fit: contain; transition: transform .6s ease; }
.gallery-item button:hover img, .gallery-item button:focus-visible img { transform: scale(1.06); }
.gallery-item button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.gallery-item figcaption { font-size: .85rem; color: var(--muted); margin: 10px 4px 0; }
.gallery-empty { text-align: center; color: var(--muted); padding: 48px 0; margin: 0; }
@keyframes pop { 0% { transform: scale(.9); opacity: 0; } 100% { transform: none; opacity: 1; } }
.posts-count.pop { animation: pop .4s ease; }
.gallery-filter:active { transform: scale(.95); }

/* ---- Lightbox ---- */
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(14,32,56,.94); display: flex; align-items: center; justify-content: center; padding: 24px; }
.lightbox[hidden] { display: none; }
.lightbox { animation: lb-fade .3s ease; }
.lightbox-fig img { animation: lb-zoom .35s cubic-bezier(.2,.7,.2,1); }
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lb-zoom { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
.lightbox-fig { margin: 0; max-width: min(1100px, 100%); text-align: center; }
.lightbox-fig img { max-height: 80vh; max-width: 100%; width: auto; margin: 0 auto; border-radius: 10px; }
.lightbox-fig figcaption { color: rgba(255,255,255,.85); margin-top: 14px; font-size: .95rem; }
.lightbox-close, .lightbox-nav {
  position: absolute; border: 0; cursor: pointer; color: #fff; background: rgba(255,255,255,.14);
  width: 46px; height: 46px; border-radius: 50%; font-size: 1.8rem; line-height: 1; transition: background .2s;
}
.lightbox-close:hover, .lightbox-nav:hover { background: var(--gold-fill); color: var(--navy-dark); }
.lightbox-close { top: 20px; right: 20px; }
.lightbox-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 20px; top: 50%; transform: translateY(-50%); }

@media (max-width: 1100px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; } }
@media (max-width: 640px) {
  .gallery { padding: 36px 0 70px; }
  .gallery-grid { gap: 12px; }
  .gallery-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; margin-right: calc(var(--gutter) * -1); padding-right: var(--gutter); }
  .gallery-filter { white-space: nowrap; flex: none; }
  .lightbox-nav { top: auto; bottom: 20px; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .gallery-item { opacity: 1; transform: none; transition: none; } .lightbox, .lightbox-fig img, .posts-count.pop { animation: none; } .gallery-item img, .gallery-filter { transition: none; } }
