@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400&family=Inter:wght@300;400;500;600;700&display=swap');

/* --- Viewport: без авто-приближения на телефоне --- */
html {
  overflow-x: hidden;
  width: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* --- KAVALER: сдержанный фон, без кричащих акцентов --- */
body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  background-color: #f7f5f2;
  background-image:
    linear-gradient(135deg, rgba(17, 24, 39, 0.03) 25%, transparent 25%),
    linear-gradient(225deg, rgba(17, 24, 39, 0.03) 25%, transparent 25%);
  background-size: 48px 48px;
}

html.dark body {
  background-color: #111827;
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, 0.02) 25%, transparent 25%),
    linear-gradient(225deg, rgba(255, 255, 255, 0.02) 25%, transparent 25%);
}

/* --- Переход темы: одна длительность для всего (меняй только здесь) --- */
:root {
  --theme-transition-duration: 1.2s;
}

/* Во время переключения темы (класс .theme-transitioning вешает JS) все меняется плавно */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition-property: background-color, color, border-color, box-shadow, opacity !important;
  transition-duration: var(--theme-transition-duration) !important;
  transition-timing-function: ease-in-out !important;
}

/* Каталог: при прокрутке меню скрывается, фильтры прижаты к верху */
.catalog-navbar.catalog-navbar-hidden {
  transform: translate(-50%, -120%);
  opacity: 0;
  pointer-events: none;
}

/* Оверлей меню — поверх шапки, чтобы меню открывалось и было видно */
#menu-overlay.is-open {
  z-index: 60;
}

/* Кнопка «Меню» в полосе фильтров видна только когда шапка скрыта (при прокрутке) */
#catalog-filters-wrap.catalog-filters-pinned #catalog-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Портал выпадающих списков: при прокрутке на одном уровне с фильтрами */
#catalog-dropdown-portal.catalog-filters-pinned {
  top: 0;
}

/* Тонкая полоса прокрутки в блоке фильтров */
#catalog-filters .scrollbar-thin {
  scrollbar-width: thin;
}
#catalog-filters .scrollbar-thin::-webkit-scrollbar {
  height: 4px;
}
#catalog-filters .scrollbar-thin::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
}
#catalog-filters-wrap.catalog-filters-pinned {
  top: 0;
}
#catalog-filters-wrap.catalog-filters-pinned #catalog-filters {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

/* Обрезка описания в карточке товара (2 строки) */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Числовые поля «от»/«до» в фильтрах — без стрелочек (спиннеров) */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Контейнеры с hover-zoom: обрезка по скруглению (rounded-* задаётся в разметке) */
.img-zoom-wrap {
  overflow: hidden;
  isolation: isolate;
}

/* Фото светлая/тёмная: плавный crossfade по opacity (как фон и кнопки) */
.theme-img-wrap {
  position: relative;
}
.theme-img-wrap .theme-img-light {
  opacity: 1;
}
.theme-img-wrap .theme-img-dark {
  opacity: 0;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  pointer-events: none;
}
html.dark .theme-img-wrap .theme-img-light {
  opacity: 0;
}
html.dark .theme-img-wrap .theme-img-dark {
  opacity: 1;
  pointer-events: auto;
}

/* --- Блок «О нас»: более мягкий поворот (flip-left/right с меньшим углом) --- */
#about [data-aos="flip-left"] {
  transform: perspective(1200px) rotateY(-42deg);
}
#about [data-aos="flip-left"].aos-animate {
  transform: perspective(1200px) rotateY(0);
}

#about [data-aos="flip-right"] {
  transform: perspective(1200px) rotateY(42deg);
}
#about [data-aos="flip-right"].aos-animate {
  transform: perspective(1200px) rotateY(0);
}

/* --- Navbar --- */
#navbar {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Мобильная шапка: без налезания, удобные зоны нажатия, не шире экрана */
@media (max-width: 767px) {
  #navbar {
    width: 100%;
    max-width: 100vw;
    left: 0;
    right: 0;
    transform: none;
    border-radius: 0;
    top: 0;
  }
  #navbar .flex {
    flex-wrap: nowrap;
    min-height: 44px;
  }
  #navbar a[href="index.html"] {
    min-width: 0;
  }
  #theme-toggle-mobile {
    min-width: 44px;
    min-height: 44px;
  }
  #menu-toggle {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Безопасная зона для вырезов/островков на телефонах */
@supports (padding: max(0px)) {
  #navbar {
    padding-left: max(0.5rem, env(safe-area-inset-left));
    padding-right: max(0.5rem, env(safe-area-inset-right));
  }
}

#navbar nav a:not(.font-brand) {
  position: relative;
  transition: color 0.2s ease;
}

#navbar nav a:not(.font-brand)::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.25s ease;
}

#navbar nav a:not(.font-brand):hover::after {
  width: 100%;
}

.navbar-scrolled {
  background-color: rgba(247, 245, 242, 0.95);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  top: 0;
  left: 0;
  transform: none;
  width: 100%;
  max-width: none;
  border-radius: 0;
}

html.dark .navbar-scrolled {
  background-color: rgba(17, 24, 39, 0.95);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* --- Hamburger Menu Morph --- */
#menu-toggle {
  width: 30px;
  height: 24px;
  position: relative;
  z-index: 100;
}

#menu-toggle span {
  display: block;
  position: absolute;
  height: 3px;
  width: 100%;
  background: #111827;
  border-radius: 3px;
  opacity: 1;
  left: 0;
  transition: 0.25s ease-in-out;
}

html.dark #menu-toggle span {
  background: #f7f5f2;
}

#menu-toggle span:nth-child(1) {
  top: 0px;
}

#menu-toggle span:nth-child(2) {
  top: 10px;
}

#menu-toggle span:nth-child(3) {
  top: 20px;
}

#menu-toggle.is-active span:nth-child(1) {
  top: 10px;
  transform: rotate(135deg);
  background: #f7f5f2;
  /* hof-ivory */
}

#menu-toggle.is-active span:nth-child(2) {
  opacity: 0;
  left: -30px;
}

#menu-toggle.is-active span:nth-child(3) {
  top: 10px;
  transform: rotate(-135deg);
  background: #f7f5f2;
  /* hof-ivory */
}

/* --- Full Screen Menu --- */
#menu-overlay {
  clip-path: circle(0% at calc(100% - 40px) 40px);
  transition: clip-path 0.5s cubic-bezier(0.77, 0, 0.175, 1);
}

#menu-overlay.is-open {
  clip-path: circle(150% at calc(100% - 40px) 40px);
}

/* Menu link animation (replaces GSAP) */
#menu-overlay nav a {
  transform: translateY(20px);
  opacity: 0;
  transition-property: transform, opacity;
  transition-duration: 0.3s;
  transition-timing-function: ease-in-out;
}

#menu-overlay nav div {
  /* Social icons */
  transform: translateY(20px);
  opacity: 0;
  transition-property: transform, opacity;
  transition-duration: 0.3s;
  transition-timing-function: ease-in-out;
}

/* Staggered delay */
#menu-overlay.is-open nav a:nth-child(1) {
  transition-delay: 0.15s;
}

#menu-overlay.is-open nav a:nth-child(2) {
  transition-delay: 0.2s;
}

#menu-overlay.is-open nav a:nth-child(3) {
  transition-delay: 0.25s;
}

#menu-overlay.is-open nav a:nth-child(4) {
  transition-delay: 0.3s;
}

#menu-overlay.is-open nav a:nth-child(5) {
  transition-delay: 0.35s;
}

#menu-overlay.is-open nav a:nth-child(6) {
  transition-delay: 0.4s;
}

#menu-overlay.is-open nav div {
  transition-delay: 0.45s;
}

#menu-overlay.is-open nav a,
#menu-overlay.is-open nav div {
  transform: translateY(0);
  opacity: 1;
}

/* --- Horizontal Scroller (Swiper) --- */
.collections-slider {
  width: 100%;
  overflow: visible;
  /* Allows shadows to show */
}

.collections-slider .swiper-slide {
  width: 20rem;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.collections-slider .swiper-slide:hover {
  transform: translateY(-2px);
}

.collections-slider .swiper-slide .rounded-2xl {
  transition: box-shadow 0.4s ease;
}

.collections-slider .swiper-slide:hover .rounded-2xl {
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.15);
}

@media (min-width: 768px) {
  .collections-slider .swiper-slide {
    width: 24rem;
    /* 384px */
  }
}

.collections-slider .swiper-pagination-bullet {
  background-color: #111827;
  opacity: 0.4;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

html.dark .collections-slider .swiper-pagination-bullet {
  background-color: #f7f5f2;
}

.collections-slider .swiper-pagination-bullet-active {
  opacity: 1;
  transform: scale(1.15);
}

/* --- Fancybox Caption Styling --- */
.fancybox-caption {
  background: rgba(17, 24, 39, 0.88);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #f7f5f2;
  padding: 20px;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

/* --- Masonry Gallery --- */
.masonry-gallery {
  column-count: 1;
  column-gap: 1.5rem;
  /* gap-6 */
}

@media (min-width: 768px) {
  /* md: */
  .masonry-gallery {
    column-count: 2;
  }
}

@media (min-width: 1024px) {
  /* lg: */
  .masonry-gallery {
    column-count: 3;
  }
}

.masonry-item {
  display: inline-block;
  width: 100%;
  margin-bottom: 1.5rem;
  break-inside: avoid;
}

.masonry-item img {
  transition: box-shadow 0.4s ease, opacity 0.3s ease;
}

.masonry-item:hover img {
  box-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.12);
  opacity: 0.97;
}

/* --- Logo Scroller (As Featured In) --- */
.logo-scroller {
  overflow: hidden;
  position: relative;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 10%,
    black 90%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 10%,
    black 90%,
    transparent 100%
  );
}

.logo-scroller-inner {
  display: flex;
  width: fit-content;
  animation: scroll 30s linear infinite;
}

.logo-scroller-inner img {
  height: 32px;
  margin: 0 2.5rem;
  object-fit: contain;
}

/* --- Преимущества: сдержанный hover --- */
#process div.rounded-2xl {
  transition: box-shadow 0.35s ease;
}

#process div.rounded-2xl:hover {
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.12);
}

html.dark #process div.rounded-2xl:hover {
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.4);
}

@keyframes scroll {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-50%);
  }
}