/* ===== ГАЛЕРЕЯ в стиле geoledgy ===== */

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: 'Lacquer', 'Trebuchet MS', cursive;
  font-size: 16px;
  color: #3a2a1a;

  background-image: url('img/galler_bg.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-color: #c8d8e0;

  min-height: 100vh;
}

/* ===== ШАПКА ===== */
 #header {
  max-width: 1100px;
  margin: 20px auto 10px auto;
  padding: 20px;
  min-height: 140px;

  background-image: url('img/banner_gallery.png');
  background-size: cover;          /* ← растягивает, обрезает лишнее */
  background-position: center;
  background-repeat: no-repeat;

  border: 4px solid #808000;
  border-radius: 15px;
  text-align: center;

  display: flex;
  align-items: center;
  justify-content: center;
}

#main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

#header h1 {
  margin: 0;
  font-family: 'Lacquer', cursive;
  font-size: 32px;
  color: #3a2a1a;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #fff9e9;
}

/* ===== ОБЩАЯ КОРОБКА ===== */
#container {
  max-width: 1200px;
  margin: 0 auto 20px auto;
  display: flex;
  gap: 20px;
  padding: 20px;

  background-image: url('img/gallery_bg2.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  border: none;              /* ← БЕЗ рамки */
  border-radius: 0;          /* ← БЕЗ скругления */
  align-items: flex-start;      /* ← добавил — дети прижаты к верху */
}

/* ===== ЛЕВЫЙ САЙДБАР ===== */
#sidebar {
  flex: 0 0 200px;
}

.sidebar-logo {
  display: block;
  width: 100%;
  border: 3px solid #808000;         /* ← оливковая рамка */
  border-radius: 8px;
  margin-bottom: 15px;
  transition: border-color 0.2s ease;
}

/* ===== МЕНЮ КНОПКАМИ-КАРТИНКАМИ ===== */

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: -60px;          /* ← вылезают за блок влево, как на референсе */
  padding: 0;
}

/* Каждая кнопка */
.sticker {
  display: block;
  text-decoration: none;
  transition: transform 0.2s ease;
  /* важно: прозрачный фон, чтобы PNG-кнопки не имели белого квадрата */
  background: transparent;
  border: none;
  padding: 0;
}

.sticker img {
  display: block;
  width: 260px;                /* ← ширина кнопки */
  height: auto;
  border: none;                /* ← БЕЗ рамки */
  background: transparent;     /* ← БЕЗ белого фона */
  filter: drop-shadow(2px 3px 2px rgba(0, 0, 0, 0.25)); /* ← лёгкая тень, «отрыв» */
  transition: transform 0.2s ease, filter 0.2s ease;
}

/* ===== РАЗНЫЕ НАКЛОНЫ — «наклеенный» вид ===== */
.nav .sticker:nth-child(1) { transform: rotate(-2deg); }
.nav .sticker:nth-child(2) { transform: rotate(1.5deg); }
.nav .sticker:nth-child(3) { transform: rotate(-3deg); }
.nav .sticker:nth-child(4) { transform: rotate(2deg); }
.nav .sticker:nth-child(5) { transform: rotate(-1.5deg); }
.nav .sticker:nth-child(6) { transform: rotate(3deg); }
.nav .sticker:nth-child(7) { transform: rotate(-2deg); }
.nav .sticker:nth-child(8) { transform: rotate(1deg); }
.nav .sticker:nth-child(9) { transform: rotate(-1.5deg); }

/* ===== АНИМАЦИЯ ПРИ НАВЕДЕНИИ ===== */
.nav .sticker:hover {
  transform: rotate(0deg) scale(1.08) translateX(8px);
  z-index: 10;
}

.nav .sticker:hover img {
  filter: drop-shadow(4px 6px 6px rgba(0, 0, 0, 0.45));
}

/* ===== РАСКЛАДКА: ГАЛЕРЕЯ + ТЕГИ ===== */
.gallery-layout {
  display: flex;
  gap: 15px;
  align-items: flex-start;      /* ← важно: дети прижаты к верху */
  justify-content: space-between; /* ← лево и право разнесены */
}

.gallery-content {
  flex: 1 1 auto;              /* ← растягивается, но не сжимает теги */
  min-width: 0;                 /* ← важно для flex */
}

/* ===== СЕТКА ГАЛЕРЕИ ===== */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.gallery-item {
  background: #fff9e9;
  border: 6px solid #808000;         /* ← оливковая рамка */
  border-radius: 8px;
  padding: 5px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s ease;

  aspect-ratio: 1 / 1;               /* ← КВАДРАТ — все карточки одинаковые */
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden;
}

.gallery-item:hover {
  transform: translateY(-4px);
  border-color: #FFA500;             /* ← оранжевая при наведении */
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;                       /* ← растягивается на всю высоту карточки */
  object-fit: cover;                  /* ← обрезает лишнее, но не искажает */
  background: #fff;
  border-radius: 4px;
  flex: 1;
}

.gallery-item-info {
  padding: 4px 3px 2px 3px;
  text-align: center;
  flex-shrink: 0;
  height: 32px;                  /* ← чуть выше — 2 строки */
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-item-info h4 {
  margin: 0;
  font-family: 'Lacquer', cursive;
  font-size: 12px;
  color: #3a2a1a;
  line-height: 1.2;
  max-height: 28px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;         /* ← максимум 2 строки */
  -webkit-box-orient: vertical;
}

.gallery-item-info p {
  margin: 0;
  font-size: 12px;
  color: #b4562b;
}

.empty-msg {
  text-align: center;
  padding: 30px;
  font-size: 18px;
  color: #b4562b;
}

/* ===== ПРАВАЯ КОЛОНКА С ТЕГАМИ ===== */
.tags-sidebar {
  flex: 0 0 200px;             /* ← фиксированная ширина — не сжимается */
  width: 200px;                 /* ← тоже фикс, для надёжности */
  background: #fff9e9;
  border: 3px solid #3a2a1a;
  border-radius: 8px;
  padding: 10px;
  box-sizing: border-box;       /* ← чтобы padding не расширял */
  align-self: flex-start;       /* ← прижат к ВЕРХУ, не растягивается */
}

.tags-title {
  font-family: 'Lacquer', cursive;
  font-size: 16px;
  color: #808000;
  text-align: center;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px dashed #808000;
  text-transform: uppercase;
}

.tags-group {
  margin-bottom: 8px;
}

.tags-group summary {
  background: #808000;
  color: #fff9e9;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Lacquer', cursive;
  font-size: 14px;
  list-style: none;
  user-select: none;
}

.tags-group summary::-webkit-details-marker { display: none; }
.tags-group summary::before { content: '▶ '; font-size: 10px; }
.tags-group[open] summary::before { content: '▼ '; }

.tags-group summary:hover {
  background: #b4562b;
}

.tags-group .tag-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  padding: 6px;
  background: #ffbd6f;
  border-radius: 6px;
}

.tags-group .tag {
  text-align: left;
  font-size: 13px;
  padding: 5px 10px;
  background: #fff9e9;
  border: 2px solid #808000;
  color: #b4562b;
  border-radius: 15px;
  cursor: pointer;
  font-family: 'Lacquer', cursive;
}

.tags-group .tag:hover {
  background: #d06d40;
  color: #fff9e9;
}

.tags-group .tag.active {
  background: #399c91;
  border-color: #399c91;
  color: #fff9e9;
}

/* ===== ФУТЕР ===== */
#footer {
  max-width: 1220px;
  margin: 0 auto 20px auto;
  padding: 12px;

  background: #ffbd6f;
  border: 4px solid #808000;
  border-radius: 15px;
  text-align: center;
  color: #fff9e9;
  font-size: 14px;
}

#footer p { margin: 0; }

/* ===== ОКНО ПРОСМОТРА ФОТО ===== */
.photo-viewer {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.photo-viewer-inner {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: #fff9e9;
  border: 4px solid #808000;
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.photo-viewer-img {
  display: block;
  max-width: 80vw;
  max-height: 65vh;
  object-fit: contain;
  background: #fff;
  border-radius: 5px;
}

.photo-viewer-caption {
  padding: 12px;
  margin-top: 6px;
  text-align: center;
}

.photo-viewer-caption h3 {
  margin: 0 0 5px 0;
  font-family: 'Lacquer', cursive;
  font-size: 22px;
  color: #000000;
}

.photo-viewer-caption p {
  margin: 0;
  font-size: 14px;
  color: #000000;
}

.photo-viewer-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: #808000;
  color: #fff9e9;
  border: none;
  border-radius: 50%;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: sans-serif;
  transition: background 0.15s;
}

.photo-viewer-close:hover {
  background: #399c91;
}

/* Убираем ВСЕ рамки и скругления */
#container,
#main,
#sidebar,
.gallery-layout,
.gallery-content,
.tags-sidebar {
  border: none !important;
  border-radius: 0 !important;
}

/* ===== НИЖНИЕ КНОПКИ ПАГИНАЦИИ ===== */
.gallery-pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  padding: 10px 0;
}

.page-btn {
  width: 90px;
  height: 50px;
  background: #808000;
  color: #fff9e9;
  border: 3px solid #808000;
  border-radius: 8px;
  font-family: 'Lacquer', cursive;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.page-btn:hover {
  background: #fff9e9;
  color: #808000;
  transform: translateY(-2px);
}

.page-btn:active {
  transform: translateY(0);
  background: #5c5c00;
  color: #fff9e9;
}

/* ===== КНОПКИ ПАГИНАЦИИ ===== */
.gallery-pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  padding: 10px 0;
}

.page-btn {
  width: 70px;
  height: 40px;
  background: #808000;
  color: #fff9e9;
  border: 3px solid #808000;
  border-radius: 8px;
  font-family: 'Lacquer', cursive;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.page-btn:hover:not(:disabled) {
  background: #fff9e9;
  color: #808000;
  transform: translateY(-2px);
}

.page-btn:active:not(:disabled) {
  transform: translateY(0);
  background: #5c5c00;
  color: #fff9e9;
}

/* Выключенная кнопка (когда страница первая/последняя) */
.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Надпись "страница X из Y" */
.page-info {
  text-align: center;
  font-family: 'Lacquer', cursive;
  font-size: 14px;
  color: #808000;
  margin-top: 10px;
}

/* ===== СТРАНИЦА ССЫЛОК ===== */
body {
  background-image: url('img/galler_bg.jpg');
  background-size: cover;
  background-attachment: fixed;
  font-family: 'Lacquer', cursive;
  color: #3a2a1a;
  padding: 30px 15px;
}

h1 {
  text-align: center;
  color: #808000;
  text-transform: uppercase;
}

.friend-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 800px;
  margin: 0 auto;
}

.friend-links a {
  display: inline-block;
  text-decoration: none;
  transition: transform 0.15s ease;
}

.friend-links a:hover {
  transform: scale(1.1);
}

.friend-links img {
  display: block;
  width: 88px;
  height: 31px;
  border: 2px solid #808000;
  background: #fff;
  image-rendering: pixelated;
}