/*
 * Modüler Fotoğraf Galerisi — inc/bbb-gallery.php + assets/js/bbb-gallery.js
 *
 * Tamamen izole: her seçici `.bbb-gallery` altında yaşar, temanın mevcut
 * `.gallery-grid` / `.lightbox` bloklarına dokunmaz. Renkler style.css'teki
 * CSS değişkenlerinden gelir, yeni bir palet tanımlanmaz.
 */

/* ── Bölüm başlığı ─────────────────────────────────────── */
.bbb-gallery { margin: 40px 0 0; }

.bbb-gallery__heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 6px;
}
.bbb-gallery__count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.bbb-gallery__note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  /* WCAG AA: #9CA3AF beyaz üzerinde 2.55:1 kalıyordu, --gray 4.83:1 veriyor. */
  color: var(--gray);
  margin: 0 0 18px;
}

/* ── Grid ──────────────────────────────────────────────── */
.bbb-gallery__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
@media (min-width: 560px)  { .bbb-gallery__grid { grid-template-columns: repeat(3, 1fr); gap: 12px; } }
@media (min-width: 1024px) { .bbb-gallery__grid { grid-template-columns: repeat(4, 1fr); } }

.bbb-gallery__item { margin: 0; }

.bbb-gallery__btn {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  cursor: zoom-in;
  /* aspect-ratio + width/height attribute → CLS yok */
  aspect-ratio: 1;
  position: relative;
}
.bbb-gallery__btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s cubic-bezier(0.19, 1, 0.22, 1);
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
.bbb-gallery__btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.28), transparent 55%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.bbb-gallery__btn:hover img { transform: scale(1.07); }
.bbb-gallery__btn:hover::after { opacity: 1; }

.bbb-gallery__btn:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 3px;
}

/* Yeni yüklenen kareler yumuşak girsin */
.bbb-gallery__item--new { animation: bbb-gallery-in 0.45s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes bbb-gallery-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ── "Daha Fazla" ──────────────────────────────────────── */
.bbb-gallery__more-wrap { display: flex; justify-content: center; margin-top: 20px; }
.bbb-gallery__more {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 26px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.bbb-gallery__more:hover {
  border-color: var(--navy);
  color: var(--navy);
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -12px rgba(31, 66, 126, 0.5);
}
.bbb-gallery__more:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }
.bbb-gallery__more[hidden] { display: none; }
.bbb-gallery__more-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--navy-lt);
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 800;
}

.bbb-gallery__status {
  margin: 12px 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--gray);
  min-height: 1.2em;
}

/* ── Lightbox ──────────────────────────────────────────── */
.bbb-lb {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 12, 22, 0.95);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
.bbb-lb.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease;
}

.bbb-lb__figure {
  margin: 0;
  max-width: min(1200px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.bbb-lb__img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
.bbb-lb__caption {
  max-width: 70ch;
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.78);
}

.bbb-lb__btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.bbb-lb__btn:hover { background: rgba(255, 255, 255, 0.3); }
.bbb-lb__btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.bbb-lb__btn--close { top: 16px; right: 16px; }
.bbb-lb__btn--prev  { left: 16px;  top: 50%; transform: translateY(-50%); }
.bbb-lb__btn--next  { right: 16px; top: 50%; transform: translateY(-50%); }
.bbb-lb__btn--prev:hover, .bbb-lb__btn--next:hover { transform: translateY(-50%) scale(1.06); }

.bbb-lb__counter {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

@media (max-width: 560px) {
  .bbb-lb__btn { width: 48px; height: 48px; font-size: 23px; background: rgba(255, 255, 255, 0.22); }
  .bbb-lb__btn--prev { left: 8px; }
  .bbb-lb__btn--next { right: 8px; }
  .bbb-lb__img { max-height: 68vh; }
}

/* ── Hareket azaltma tercihi ───────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .bbb-gallery__btn img,
  .bbb-gallery__btn::after,
  .bbb-gallery__more,
  .bbb-lb,
  .bbb-lb__btn { transition: none; }
  .bbb-gallery__item--new { animation: none; }
  .bbb-gallery__btn:hover img { transform: none; }
}
