body {
  font-family: Arial, sans-serif;
  background-color: #f0f0f0;
  margin: 0;
}

html.modal-open,
body.modal-open {
  overflow: hidden;
  height: 100%;
}

header,
footer {
  text-align: center;
}

footer {
  margin: 20px 0;
}

/* Стили для ссылок в описании */
a {
  color: #333;
  text-decoration: none;
  transition: all 0.3s ease;
}

a:hover {
  color: #666;
  border-bottom-color: #666;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  padding: 20px;
  margin-top: 20px;
}

.gallery-item {
  scroll-margin-top: calc(var(--nav-height) + var(--months-height) + 20px);
}

.year-header {
  grid-column: 1 / -1;
  font-size: 2em;
  font-weight: normal;
  color: #bdbdbd;
  padding-bottom: 10px;
  text-align: center;
}

.thumbnail {
  width: 100%;
  height: 200px;
  object-fit: cover;
  /* border-radius: 5px; */
  cursor: pointer;
  transition: transform 0.2s;
}

.thumbnail:hover {
  transform: scale(1.02);
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  overflow-y: auto;
  z-index: 1000;
  padding: 40px 20px;
  box-sizing: border-box;
  transition: opacity 0.3s;
}

.modal:not([style*="display: block"]) {
  opacity: 0;
  pointer-events: none;
}

.modal-info {
  padding: 15px;
  text-align: center;
}

.modal-datetime,
.modal-location {
    margin: 8px 0;
    color: #ccc;
}

.modal-description {
  white-space: pre-line;
}

.modal-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, max-content));
  justify-content: center;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 0;
}

.modal-description {
  display: none;
  grid-column: 1 / -1;
  color: white;
  text-align: left;
  padding: 20px;
  font-size: 1.1em;
  line-height: 1.4;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  max-height: 50vh;
  overflow-y: auto;
  margin-top: 30px;
  /* Стили для Firefox */
  scrollbar-width: thin;
  scrollbar-color: #666 #333;
}

/* Показываем только при наличии контента */
.modal-description.has-content {
  display: block;
  max-width: 1160px;
  margin: 0 auto;
}

/* Стили для скролла в описании */
.modal::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.modal::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.modal::-webkit-scrollbar-thumb {
  background: #666;
  border-radius: 3px;
  transition: background 0.3s;
}

.modal::-webkit-scrollbar-thumb:hover {
  background: #888;
}

/* Стили для скролла в описании */
.modal-description::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.modal-description::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.modal-description::-webkit-scrollbar-thumb {
  background: #666;
  border-radius: 3px;
  transition: background 0.3s;
}

.modal-description::-webkit-scrollbar-thumb:hover {
  background: #888;
}

.modal-image {
  width: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.3s;
}

.modal-content.single-item {
  grid-template-columns: 1fr;
  justify-items: center;
}

.modal-content.single-item .modal-image {
  max-width: 800px;
}

.close {
  position: fixed;
  top: 30px;
  right: 30px;
  color: white;
  font-size: 40px;
  cursor: pointer;
}

/* Стили для хедера */
.year-nav {
  position: sticky;
  top: 0;
  background: #1a1a1a;
  z-index: 1000;
  padding: 15px 20px;
  display: flex;
  gap: 15px;
  overflow-x: auto;
  scrollbar-width: thin;
  --nav-height: 60px;
}

.year-nav a {
  color: #fff;
  text-decoration: none;
  font-size: 1.1em;
  padding: 5px 10px;
  border-radius: 5px;
  transition: all 0.3s;
}

.year-nav a:hover,
.year-nav a.active {
  background: #333;
}

.year-nav::-webkit-scrollbar {
  height: 5px;
}

.year-nav::-webkit-scrollbar-thumb {
  background: #666;
  border-radius: 3px;
}

/* Стили для навигации */
.months-container {
  position: sticky;
  top: 60px;
  left: 0;
  right: 0;
  background: #1a1a1a;
  opacity: 0.9;
  padding: 10px;
  display: none;
  flex-wrap: wrap;
  gap: 5px;
  z-index: 999;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  --months-height: 60px;
}

.months-container.active {
  display: flex;
}

.month-link {
  cursor: pointer;
  padding: 5px 10px;
  margin: 2px;
  background: #333;
  border-radius: 3px;
  color: white;
  transition: all 0.3s;
  white-space: nowrap;
}

.month-link:hover,
.month-link.active {
  background: #666;
}

.year-item.active .year-link {
  background: #333;
}

/* Стили для неактивных фото */
.gallery-item.inactive {
  opacity: 0.3;
  pointer-events: none;
  transition: opacity 0.3s;
}

/* Мобильные устройства */
@media (max-width: 768px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    padding: 10px;
  }

  .year-header {
    font-size: 1.5em;
    padding: 20px 0 10px;
  }

  .year-nav {
    padding: 10px 15px;
  }

  .months-container {
    top: 46px;
    padding: 8px;
    gap: 3px;
  }

  .month-link {
    font-size: 0.9em;
  }

  .gallery-item {
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    position: relative;
    scroll-margin-top: 90px;
  }

  .thumbnail {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    object-fit: cover;
  }

  .modal-content {
    grid-template-columns: minmax(100%, 1fr);
    padding: 30px 0 0;
    gap: 10px;
  }

  .modal-image {
    max-width: 100%;
    height: auto;
  }

  .modal {
    padding: 20px 10px;
  }

  .close {
    top: 15px;
    right: 15px;
    font-size: 30px;
  }

  .modal-description {
    padding: 15px;
    font-size: 1em;
    margin-top: 15px;
  }

  .modal-description.has-content {
    margin: 20px 0;
    padding-bottom: 40px;
  }

  .year-nav {
    padding: 10px 15px;
    gap: 10px;
  }

  .year-nav a {
    font-size: 0.9em;
    padding: 5px 8px;
  }

  /* Адаптация для очень маленьких экранов */
  @media (max-width: 480px) {
    .gallery {
      gap: 3px;
      padding: 5px;
    }

    .thumbnail {
      width: 100%;
      height: auto;
      aspect-ratio: 1/1;
      object-fit: cover;
    }

    .year-header {
      font-size: 1.3em;
      padding: 15px 0 5px;
    }

    .modal-content {
      grid-template-columns: 1fr;
    }
  }
}
