/* ============================================================
   Фотогалерея — разделы, поколения, лайтбокс
   ============================================================ */

.gallery-head {
  margin-bottom: 28px;
}

.gallery-head p {
  color: var(--ink-soft);
  margin-top: 8px;
  max-width: 60ch;
}

/* ----- вкладки разделов ----- */
.gallery-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-bottom: 28px;
}

.gallery-tab {
  appearance: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: var(--t-xl);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  padding: 6px 20px;
  border-radius: 12px;
  color: var(--ink);
  background: var(--bg-tile);
  border: 1px solid var(--line);
  transition: color 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.gallery-tab:hover {
  color: var(--accent);
  border-color: var(--line-strong);
}

.gallery-tab.is-active {
  color: #fff;
  background: var(--accent);
  border-color: transparent;
  box-shadow: 0 0 18px -4px var(--glow-green);
}

/* ----- подраздел «Поколения» ----- */
.gallery-gen {
  margin-bottom: 24px;
}

.gallery-gen__label {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 12px;
}

.gallery-gen__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.gallery-gen__tab {
  appearance: none;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--t-xl);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  min-width: 48px;
  padding: 6px 14px;
  border-radius: 10px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.gallery-gen__tab:hover {
  color: var(--accent);
  border-color: var(--line-strong);
}

.gallery-gen__tab.is-active {
  color: var(--btn-ink);
  background: var(--accent);
  border-color: transparent;
}

/* ----- сетка превью ----- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.gallery-item {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-tile);
  border: 1px solid var(--line);
  background: var(--bg-tile);
  cursor: pointer;
  padding: 0;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.gallery-item:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.45);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-empty {
  padding: 36px 24px;
  text-align: center;
  color: var(--ink-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius-tile);
}

.gallery-section { display: none; }
.gallery-section.is-active { display: block; }

/* ----- лайтбокс ----- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(3, 5, 8, 0.92);
  backdrop-filter: blur(4px);
}

.lightbox.is-open {
  display: flex;
}

.lightbox__img {
  max-width: 92vw;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.lightbox__btn {
  position: absolute;
  appearance: none;
  cursor: pointer;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 1.6rem;
  line-height: 1;
  transition: background 0.15s, transform 0.15s;
}

.lightbox__btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.lightbox__btn--close { top: 20px; right: 20px; }
.lightbox__btn--prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox__btn--next { right: 16px; top: 50%; transform: translateY(-50%); }
.lightbox__btn--prev:hover { transform: translateY(-50%) scale(1.08); }
.lightbox__btn--next:hover { transform: translateY(-50%) scale(1.08); }

.lightbox__counter {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.8);
  font-family: var(--font-mono);
  font-size: var(--t-sm);
}

@media (max-width: 600px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .lightbox__btn--prev { left: 8px; }
  .lightbox__btn--next { right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-item,
  .lightbox__btn { transition: none; }
}
