/* Базові налаштування фону без щілин при скролі */
html {
  background-color: #F9F6F0;
  scroll-behavior: smooth;
}

body {
  background-color: #F9F6F0;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* 
  Фіксація шапки на iOS Safari:
  padding-top: env(safe-area-inset-top) заливає фон під чілкою/Dynamic Island
*/
#sticky-header {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 40;
  margin-top: 0;
  padding-top: env(safe-area-inset-top, 0px);
  background-color: rgba(249, 246, 240, 0.96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #F0EAE1;
}

/* 3-етапна плавна анімація шапки без зміщення контейнера */
#header-logo {
  height: 54px;
  max-width: 220px;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
}

#header-tagline {
  max-height: 30px;
  opacity: 1;
  font-size: 0.72rem;
  margin-top: 0.35rem;
  margin-bottom: 0.25rem;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin 0.3s ease;
}

#header-nav {
  padding-top: 0.35rem;
  padding-bottom: 0.25rem;
  gap: 1.25rem;
  font-size: 0.75rem;
  transition: padding 0.3s ease, font-size 0.3s ease, gap 0.3s ease;
}

/* Фаза 1: ховаємо підпис бренду */
#sticky-header.step-1 #header-tagline,
#sticky-header.step-2 #header-tagline {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  margin-bottom: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Фаза 2: компактний логотип та меню */
#sticky-header.step-2 #header-logo {
  height: 36px;
}

#sticky-header.step-2 #header-nav {
  padding-top: 0.15rem;
  padding-bottom: 0.15rem;
  gap: 1rem;
  font-size: 0.7rem;
}

/* Приховування смуги прокрутки для горизонтального списку фільтрів */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Лічильник медіа у картці товару */
.media-counter {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background-color: rgba(44, 40, 37, 0.75);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.55rem;
  border-radius: 9999px;
  z-index: 10;
}

/* Повноекранна галерея (Lightbox) */
.zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background-color: rgba(20, 18, 16, 0.95);
  backdrop-filter: blur(10px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
  user-select: none;
  touch-action: none;
}

.zoom-overlay.active {
  opacity: 1;
}

.zoom-container {
  position: relative;
  width: 100vw;
  height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.zoom-img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  cursor: zoom-in;
  transform-origin: center center;
  will-change: transform;
  transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1);
}

.zoom-img.magnified {
  cursor: grab;
}

.zoom-img.magnified:active {
  cursor: grabbing;
}

.zoom-video {
  max-width: 90vw;
  max-height: 80vh;
  outline: none;
  border-radius: 8px;
}

.zoom-close-btn {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  right: 1rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  z-index: 110;
  transition: background-color 0.2s ease;
}

.zoom-close-btn:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.zoom-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  z-index: 110;
  transition: background-color 0.2s ease;
}

.zoom-arrow:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.zoom-arrow.prev { left: 1rem; }
.zoom-arrow.next { right: 1rem; }

.zoom-thumbnails {
  position: absolute;
  bottom: max(2rem, env(safe-area-inset-bottom));
  display: flex;
  gap: 0.5rem;
  z-index: 110;
  max-width: 90vw;
  overflow-x: auto;
  padding: 0.25rem;
}

.zoom-thumb-btn {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  background: none;
  padding: 0;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.zoom-thumb-btn.active {
  border-color: #ffffff;
  opacity: 1;
}

.zoom-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.zoom-hint {
  position: absolute;
  bottom: max(0.6rem, env(safe-area-inset-bottom));
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.04em;
  text-align: center;
  z-index: 110;
  pointer-events: none;
}

/* Кнопка швидкого повернення вгору */
.scroll-top-btn {
  position: fixed;
  bottom: max(1.5rem, env(safe-area-inset-bottom));
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #2C2825;
  color: #F9F6F0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  border: 1px solid #F0EAE1;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
  z-index: 30;
}

.scroll-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  background-color: #403a35;
}
