/* === Цветовые переменные === */
:root {
  --bg-light: #f7f7f7;
  --bg-dark: #17191b;
  --fg-light: #1a1a1a;
  --fg-dark: #f5f5f5;

  --card-light: #ffffff;
  --card-dark: #1f2226;

  --muted-light: #666;
  --muted-dark: #aaa;

  --modal-bg-light: #f4f4f5;
  --modal-bg-dark: #0d0f11;
}

body {
  background: var(--bg-light);
  color: var(--fg-light);
}
.dark body {
  background: var(--bg-dark);
  color: var(--fg-dark);
}

body.no-scroll {
  overflow: hidden;
}

/* === Галерея === */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

.photo-card {
  background: var(--card-light);
  border-radius: 0.5rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}
.photo-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}
.dark .photo-card {
  background: var(--card-dark);
  box-shadow: 0 4px 10px rgba(0,0,0,0.6);
}
.dark .photo-card:hover {
  box-shadow: 0 6px 15px rgba(0,0,0,0.8);
}

.photo-frame {
  aspect-ratio: 4/5;
  background: #000;
}
.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-caption {
  padding: 0.8rem 1rem 1rem;
}
.photo-caption p {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--fg-light);
}
.dark .photo-caption p {
  color: var(--fg-dark);
}

.photo-actions {
  display: flex;
  gap: 1rem;
}
.photo-actions button {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.photo-actions img {
  width: 18px;
  height: 18px;
  opacity: 0.6;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.photo-actions img:hover {
  transform: scale(1.1);
  opacity: 1;
}
.photo-actions span {
  font-size: 0.85rem;
  color: var(--muted-light);
}
.dark .photo-actions span {
  color: var(--muted-dark);
}

/* === Модальное окно === */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
}
.modal.hidden {
  display: none;
}

.modal-dialog {
  max-width: 90%;
  max-height: 85%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-card {
  background: var(--modal-bg-light);
  border-radius: 0.75rem;
  max-width: 600px;
  width: 100%;
  overflow: hidden;
  transition: background 0.3s ease;
}
.dark .modal-card {
  background: var(--modal-bg-dark);
}

/* убрали рамки сверху и по бокам */
.modal-frame {
  background: transparent;
  padding: 0;
}
.modal-frame img {
  display: block;
  max-height: 70vh;
  width: 100%;
  object-fit: contain;
  border-radius: 0;
}

.photo-caption {
  padding: 0.8rem 1rem 1rem;
  background: var(--card-light);
}
.dark .photo-caption {
  background: var(--card-dark);
}

.fade-in {
  opacity: 0;
  transition: opacity 0.4s ease;
}
.fade-in.show {
  opacity: 1;
}

/* === Внешние кнопки управления === */
.modal-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  background: rgba(0,0,0,0.4);
  color: #fff;
  font-size: 1.5rem;
  border-radius: 9999px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
}
.modal-nav:hover {
  background: rgba(0,0,0,0.6);
  transform: translateY(-50%) scale(1.1);
}
.modal-nav-left {
  left: 1rem;
}
.modal-nav-right {
  right: 1rem;
}
.dark .modal-nav {
  background: rgba(255,255,255,0.2);
  color: #eee;
}
.dark .modal-nav:hover {
  background: rgba(255,255,255,0.35);
}

/* Крестик */
.modal-close-outside {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 60;
  background: rgba(0,0,0,0.4);
  color: #fff;
  font-size: 1.2rem;
  border-radius: 9999px;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
}
.modal-close-outside:hover {
  background: rgba(0,0,0,0.6);
  transform: scale(1.1);
}
.dark .modal-close-outside {
  background: rgba(255,255,255,0.2);
  color: #eee;
}
.dark .modal-close-outside:hover {
  background: rgba(255,255,255,0.35);
}