@charset "UTF-8";
/* Контейнер фліпбука */
.flipbook-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-inline: auto;
  max-width: 100%;
  width: 100%;
  padding: 1rem;
  padding-top: 5vh;
  box-sizing: border-box;
  position: relative;
}

/* Фліпбук */
.flipbook {
  width: clamp(2rem, 40vw, 25rem);
  max-width: 100%;
  min-width: 2rem;
  aspect-ratio: 4/3;
  perspective: 2000px;
  position: relative;
  transition: transform 0.85s ease;
  transform-origin: left center;
  margin: 0 auto;
}

/* Відкритий стан: трансформ не більше, ніж половина ширини фліпбука, і щоб не виходила за межі */
.flipbook.opened {
  transform: translateX(min(50%, clamp(2rem, 40vw, 25rem) / 2));
}

.flipbook.back-cover-opened {
  transform: translateX(min(100%, clamp(2rem, 40vw, 25rem)));
}

/* Сторінки */
.page {
  width: 100%;
  aspect-ratio: 4/3;
  position: absolute;
  top: 0;
  left: 0;
  transform-style: preserve-3d;
  transition: transform 0.85s ease;
  cursor: pointer;
  transform-origin: left center;
  z-index: 0;
}

/* Сторінки - передня і задня частина */
.page .front,
.page .back {
  width: 100%;
  aspect-ratio: 4/3;
  position: absolute;
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: clamp(1rem, 2vw, 1.5rem);
  user-select: none;
  box-sizing: border-box;
  overflow: hidden;
  background: white;
  color: black;
  text-align: center;
}

.page .front img,
.page .back img {
  max-width: 100%;
  max-height: 100%;
  outline: 4px solid transparent; /* початково прозора обводка */
  outline-offset: -4px;
  transition: outline-color 0.3s ease, outline-offset 0.3s ease;
}

.page .front img:hover,
.page .front img:focus,
.page .back img:hover,
.page .back img:focus {
  outline-color: rgb(105, 95, 47); /* колір обводки при наведенні або фокусі */
}

/* Трансформи на перегортання сторінок */
.page .back {
  transform: rotateY(180deg);
}

.flipped {
  transform: rotateY(-180deg);
}

/* Контейнери для кнопок */
.flipbook-buttons-wrapper {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  width: clamp(2rem, 40vw, 25rem);
  max-width: 400px;
  padding-top: 3vh;
}

.flipbook-button-container {
  flex: 0 0 clamp(1rem, 6vw, 5rem);
  max-width: clamp(1rem, 6vw, 5rem);
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Кнопки */
.flipbook-button-container button {
  width: 100%;
  aspect-ratio: 1/1;
  background-color: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 70;
}

.flipbook-button-container button img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  display: block;
}

.flipbook-button-container button:disabled {
  cursor: not-allowed;
}

/* Оверлей лайтбокса */
#lightboxOverlay {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

#lightboxOverlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Контейнер для зображення в лайтбоксі */
#lightboxContent {
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: transparent;
  position: relative;
  border-radius: 0.5rem;
  user-select: none;
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  opacity: 0;
  transition: opacity 0.2s ease;
  transition-delay: 0.2s;
}

#lightboxOverlay.active #lightboxContent {
  opacity: 1;
}

/* Зображення в лайтбоксі */
#lightboxContent img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  transform-origin: center center;
  transform: translate(0, 0) scale(1);
  cursor: grab;
  touch-action: none;
}

/* Кнопки керування */
#lightboxControls {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  display: flex;
  gap: 0.5rem;
  z-index: 10000;
}

#lightboxControls button {
  position: static;
  top: auto;
  transform: none;
  padding: 0;
  width: 2rem;
  height: 2rem;
  font-size: 1.5rem;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.8);
  user-select: none;
  transition: background-color 0.3s ease;
}

#lightboxControls button:hover {
  background: rgb(255, 255, 255);
}

/*# sourceMappingURL=flipbook.css.map */
