/* 
 * Стили для галереи проекта портфолио
 * Объединенные стили из разных CSS файлов для навигационной панели проекта портфолио
 */

/* Основные стили для контейнера проекта */

.section__projekt {
  flex-flow: column;
  justify-content: space-between;
  align-items: stretch;
  display: flex;
}

/* Заголовок проекта и навигация */

.projekt-header {
  z-index: 100;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  min-height: 40px;
  align-items: center;
}

.projekt-title {
  letter-spacing: 0;
  font-size: 22px;
  line-height: 25px;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: keep-all;
  white-space: normal;
  max-width: 60%;
}

.projekt-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.thumbnails-toggle {
  width: 40px;
  height: 40px;
  border: none;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 26px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.thumbnails-toggle:hover,
.thumbnails-toggle:focus-visible {
  opacity: 0.7;
}

.thumbnails-toggle.is-gallery {
  background-image: url('../images/grid-view.svg');
}

.thumbnails-toggle.is-grid {
  background-image: url('../images/image-view.svg');
}

.counter-text {
  font-size: 22px;
  width: 80px;
  text-align: center;
}

.close-button {
  display: inline-flex;
  background-image: url('../images/cancel.svg');
  background-position: 50%;
  background-repeat: no-repeat;
  background-size: 20px;
  justify-content: center;
  align-items: center;
  width: 30px;
  height: 30px;
}

.content-wrapper {
  display: flex;
  flex-direction: column;
  gap: clamp(2rem, 4vw, 4rem);
  padding-top: 1rem;
}

.gallery-content {
  position: relative;
}

.thumbnails-panel {
  width: 100%;
  min-height: calc(100vh - var(--gallery-offset, 0px));
  display: none;
}

.thumbnails-panel:not([hidden]) {
  display: block;
}


.thumbnails-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: clamp(1rem, 3vw, 2rem);
  width: 100%;
  align-items: start;
}

.thumbnail-item {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  position: relative;
  align-self: start;
}

.thumbnail-item img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

/* Контейнеры для изображений */
.image-container {
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  display: flex;
  position: relative;
}

.p-images-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}



.image-wrapper {
  box-sizing: border-box;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding-top: 0;
  padding-bottom: 40px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  min-height: 320px;
  height: 320px;
}

.p-image {
  object-fit: contain;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  display: none;
  margin: 0 auto;
  transition: opacity 0.3s ease;
}

.p-image.is-landscape,
.p-image.is-square {
  width: 100%;
  height: auto;
  max-height: 100%;
}

.p-image.is-portrait {
  width: auto;
  height: 100%;
  max-height: 100%;
}

/* Контейнер для текстового содержимого */
.text-wrapper {
  flex-flow: column;
  justify-content: flex-start;
  align-items: center;
  padding-top: 0;
  padding-bottom: 2rem;
  display: flex;
}

.p-rich-text {
  letter-spacing: -.5px;
  width: min(63%, 900px);
  margin: 0 auto 1rem;
  font-size: 22px;
  line-height: 31px;
  text-align: center;
}

/* Адаптивные стили */
@media screen and (max-width: 991px) {  
  .p-rich-text {
    width: 80%;
  }
}

@media screen and (max-width: 767px) {

  .image-wrapper {
    min-height: 50vh;
  }
  .projekt-title, .counter-text {
    font-size: 18px;
  }
  .close-button {
    background-size: 16px;
  }

  .thumbnails-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .thumbnails-toggle {
    width: 34px;
    height: 34px;
    background-size: 22px;
  }

  .projekt-header {
    align-items: flex-start;
  }
}

@media screen and (max-width: 767px) and (orientation: portrait) {
  .image-wrapper {
    padding-bottom: 0;
  }
  .image-container,
  .p-images-wrapper {
    height: 100%;
  }
  .p-image {
    height: 100%;
    max-width: 95vw;
    width: auto;
  }
}

@media screen and (max-width: 479px) {
  .p-rich-text {
    width: 100%;
  }

  .thumbnails-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }
} 