/* ==========================================================================
   CRITICAL.CSS - Объединенный критический CSS для первого рендера
   Объединяет: reset.css, variables.css, base.css, grid.css, header.css
   Размер: ~13 KB | Загрузка: везде (синхронно)
   ========================================================================== */

/* ==========================================================================
   RESET.CSS - Normalize браузеров
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
  padding: 0;
  border: 0;
}
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: #000;
  background: #fff;
  overflow-x: hidden; /* Prevent horizontal scroll */
  width: 100%;
}
ul,
ol {
  list-style: none;
}
a {
  text-decoration: none;
  color: inherit;
}
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: none;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: normal;
  line-height: 1.2;
}
p {
  margin: 0;
}
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;
}
:focus {
  outline: none;
}
* {
  -webkit-tap-highlight-color: transparent;
  font-family: 'Geologica', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif !important;
}

/* ==========================================================================
   VARIABLES.CSS - CSS переменные (минималистичный современный стиль)
   ========================================================================== */

:root {
  /* Цвета - минимализм черно-белый */
  --c-black: #000;
  --c-white: #fff;
  --c-gray-50: #fafafa;
  --c-gray-100: #f5f5f5;
  --c-gray-200: #e5e5e5;
  --c-gray-300: #d4d4d4;
  --c-gray-400: #a3a3a3;
  --c-gray-500: #737373;
  --c-gray-600: #525252;
  --c-gray-700: #404040;
  --c-gray-800: #262626;
  --c-gray-900: #171717;

  /* Основные цвета */
  --c-primary: #9e6899;
  --c-primary-hover: #8a5a85;
  --c-primary-dark: #764b71;
  --c-text: var(--c-black);
  --c-text-light: var(--c-gray-600);
  --c-text-muted: var(--c-gray-400);
  --c-bg: var(--c-white);
  --c-bg-gray: var(--c-gray-50);
  --c-border: var(--c-gray-200);

  /* Шрифты для минималистичного дизайна */
  --font-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Cormorant Garamond', 'Playfair Display', Georgia, 'Times New Roman', serif;

  /* Размеры шрифтов */
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-2xl: 24px;
  --text-3xl: 32px;
  --text-4xl: 48px;

  /* Отступы */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Контейнеры */
  --container-max: 1320px;
  --container-padding: 20px;

  /* Grid gutter */
  --gutter: 0; /* Убран полностью */

  /* Тени */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);

  /* Transitions */
  --trans-fast: 0.15s ease;
  --trans-base: 0.3s ease;
  --trans-slow: 0.5s ease;

  /* Z-index */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-modal: 1050;

  /* CSS переменные для высот */
  --marquee-height: 35px;
  --header-main-height: 70px;
  --total-header-height: calc(var(--marquee-height) + var(--header-main-height));
}

/* ==========================================================================
   BASE.CSS - Базовые глобальные стили
   ========================================================================== */

body {
  font-family: var(--font-base);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Ensure search modal stays hidden until its CSS loads */
.modal-search {
  display: none;
}

.modal-search.show {
  display: block;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 500;
  color: var(--c-text);
  line-height: 1.2;
  margin: 0;
}
h1 {
  font-size: var(--text-4xl);
}
h2 {
  font-size: var(--text-3xl);
}
h3 {
  font-size: var(--text-2xl);
}
h4 {
  font-size: var(--text-xl);
}
h5 {
  font-size: var(--text-lg);
}
h6 {
  font-size: var(--text-base);
}
a {
  color: var(--c-text);
  text-decoration: none;
  transition: color var(--trans-fast);
}
a:hover {
  text-decoration: underline;
}
img {
  max-width: 100%;
  height: auto;
  display: block;
}
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}
.section {
  padding: var(--space-3xl) 0;
}
@media (max-width: 767px) {
  h1 {
    font-size: var(--text-3xl);
  }
  h2 {
    font-size: var(--text-2xl);
  }
  h3 {
    font-size: var(--text-xl);
  }
  .section {
    padding: var(--space-2xl) 0;
  }
  .container {
    padding: 0 var(--space-md);
  }

  /* Фикс для iOS: предотвращает автоматический зум при фокусе на инпут */
  input[type='text'],
  input[type='email'],
  input[type='tel'],
  input[type='password'],
  input[type='number'],
  input[type='search'],
  input[type='url'],
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* ==========================================================================
   GLOBAL COMPONENTS (inline to avoid extra requests)
   ========================================================================== */

/* Marquee (running line) */
.tf-marquee {
  background: #333;
  color: #fff;
  padding: 8px 0;
  font-size: 13px;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  z-index: 1001;
}

.marquee-wrapper {
  display: inline-block;
  white-space: nowrap;
}

.initial-child-container {
  display: inline-block;
  animation: marquee-scroll 60s linear infinite;
}

.marquee-child-item {
  display: inline-block;
  padding: 0 16px;
}

.marquee-child-item p {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
}

@keyframes marquee-scroll {
  0% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(-50%);
  }
}

[data-bs-dismiss='modal'] {
  cursor: pointer;
}

/* ==========================================================================
   GRID.CSS - Grid система (CSS Grid + Flexbox)
   ========================================================================== */

/* Grid основа */
.grid {
  display: grid;
  gap: var(--gutter);
}
.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}
.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}
.grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

/* Адаптивная сетка товаров */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}
@media (min-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
  }
}
@media (min-width: 992px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-xl);
  }
}

/* Flex утилиты */
.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.justify-end {
  justify-content: flex-end;
}
.gap-sm {
  gap: var(--space-sm);
}
.gap-md {
  gap: var(--space-md);
}
.gap-lg {
  gap: var(--space-lg);
}

/* Display */
.d-none {
  display: none;
}
.d-block {
  display: block;
}
.d-flex {
  display: flex;
}
@media (max-width: 767px) {
  .d-md-none {
    display: none;
  }
}
@media (min-width: 768px) {
  .d-md-block {
    display: block;
  }
  .d-mobile-none {
    display: none;
  }
}

/* Spacing */
.mt-sm {
  margin-top: var(--space-sm);
}
.mt-md {
  margin-top: var(--space-md);
}
.mt-lg {
  margin-top: var(--space-lg);
}
.mt-xl {
  margin-top: var(--space-xl);
}
.mb-sm {
  margin-bottom: var(--space-sm);
}
.mb-md {
  margin-bottom: var(--space-md);
}
.mb-lg {
  margin-bottom: var(--space-lg);
}
.mb-xl {
  margin-bottom: var(--space-xl);
}

/* Text */
.text-center {
  text-align: center;
}
.text-uppercase {
  text-transform: uppercase;
}
.text-white {
  color: var(--c-white);
}
.text-muted {
  color: var(--c-text-muted);
}

/* ==========================================================================
   HEADER.CSS - Шапка (минималистичный современный стиль)
   ========================================================================== */

/* ========== Бегущая строка ========== */
.header .tf-marquee {
  background: #333;
  color: #fff;
  height: var(--marquee-height);
  overflow: hidden;
  font-size: 13px;
  text-align: center;
  width: 100%;
  display: flex;
  align-items: center;
  transition: height 0.3s ease, opacity 0.3s ease;
}

/* Скрываем бегущую строку при is-sticky */
.header.is-sticky .tf-marquee {
  height: 0;
  opacity: 0;
  padding: 0; /* Убираем padding, чтобы не было пустого места */
  overflow: hidden;
  pointer-events: none;
}

.tf-marquee .marquee-wrapper {
  display: flex;
  width: 100%;
}

.tf-marquee .initial-child-container {
  display: flex;
  align-items: center;
  animation: marquee 30s linear infinite;
  white-space: nowrap;
}

.tf-marquee .marquee-child-item {
  padding: 0 16px 0 0;
}

.tf-marquee .marquee-child-item p {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
}

@keyframes marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* ========== HEADER - structure ========== */
.header {
  position: sticky; /* Нативный sticky для обычных страниц */
  top: -1px; /* Компенсация возможного gap */
  left: 0;
  right: 0;
  z-index: 1000;
  width: 100%;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* На главной странице - всегда fixed */
body.is-homepage .header {
  position: fixed;
}

/* Spacer только для главной */
body.is-homepage #header-spacer {
  display: block;
  /* height устанавливается через JS */
}

/* Spacer не нужен - используется нативный CSS sticky */

/* На главной спейсер не нужен - hero под header */
body.is-homepage #header-spacer {
  height: 0 !important;
}

/* На главной: прозрачный до скролла */
body.is-homepage .header.at-top {
  background: transparent;
}

/* На главной: белый после скролла */
body.is-homepage .header.is-sticky {
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* На других страницах: всегда белый */
body:not(.is-homepage) .header {
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}

/* ========== HEADER-MAIN ========== */
.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  height: var(--header-main-height);
  margin: 0 auto;
  position: relative;
  transition: background 0.3s ease, border-bottom 0.3s ease;
}

/* На главной at-top: полупрозрачный фон */
body.is-homepage .header .header-main {
  background: rgb(0 0 0 / 22%);
}

/* На главной is-sticky: белый фон */
body.is-homepage .header.is-sticky .header-main {
  background: #fff;
  border-bottom: none; /* Убрана граница */
}

/* На других страницах: белый фон */
body:not(.is-homepage) .header-main {
  background: #fff;
  border-bottom: none; /* Убрана граница */
}

/* ========== ЦВЕТА элементов ========== */

/* На главной at-top: белые элементы */
body.is-homepage .header.at-top .header-logo {
  color: #fff;
  transition: color 0.3s ease;
}

body.is-homepage .header.at-top .header-menu-toggle span {
  background: #fff;
  transition: background 0.3s ease;
}

body.is-homepage .header.at-top .header-action svg {
  stroke: #fff;
  transition: stroke 0.3s ease;
}

body.is-homepage .header.at-top .header-menu-link {
  color: #fff;
  transition: color 0.3s ease;
}

/* На главной is-sticky: черные элементы */
body.is-homepage .header.is-sticky .header-logo {
  color: #000;
}

body.is-homepage .header.is-sticky .header-menu-toggle span {
  background: #000;
}

body.is-homepage .header.is-sticky .header-action svg {
  stroke: #000;
}

body.is-homepage .header.is-sticky .header-menu-link {
  color: #000;
}

/* На других страницах: всегда черные элементы */
body:not(.is-homepage) .header-logo {
  color: #000;
}

body:not(.is-homepage) .header-menu-toggle span {
  background: #000;
}

body:not(.is-homepage) .header-action svg {
  stroke: #000;
}

body:not(.is-homepage) .header-menu-link {
  color: #000;
}

/* ========== LAYOUT ========== */
/* Левая часть */
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-menu-toggle {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 24px;
  height: 24px;
}
.header-menu-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: #000;
  transition: all 0.3s ease;
}
/* Белые полоски только на главной странице */
body.is-homepage .header-menu-toggle span {
  background: #fff;
}
.header-menu-toggle:hover span {
  background: #666;
}
body.is-homepage .header-menu-toggle:hover span {
  background: rgba(255, 255, 255, 0.7);
}

/* Логотип */
.header-logo {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 400;
  color: #000;
  letter-spacing: 0.5px;
  transition: color 0.3s ease;
}
/* Белый логотип только на главной странице */
body.is-homepage .header-logo {
  color: #fff;
}
.header-logo:hover {
  color: #666;
}
body.is-homepage .header-logo:hover {
  color: rgba(255, 255, 255, 0.8);
}

/* Правая часть */
.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}
.header-lang {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: #000;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s ease;
}
.header-lang:hover {
  background: #f5f5f5;
}

.header-action {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: #000;
  transition: color 0.3s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Белые иконки только на главной странице */
body.is-homepage .header-action {
  color: #fff;
}
.header-action:hover {
  color: #666;
}
body.is-homepage .header-action:hover {
  color: rgba(255, 255, 255, 0.7);
}
.header-action svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.5;
  stroke: currentColor;
}

.header-cart-count,
.count-box {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #e74c3c; /* Червоний */
  color: #fff;
  font-size: 10px;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  line-height: 1;
  padding: 2px;
}

/* Навигация (мобильное меню)
   ВАЖНО: ограничиваем правила только мобильными ширинами,
   чтобы на десктопе header-nav оставалась видимой (меню в шапке). */
@media (max-width: 991px) {
  .header-nav {
    position: fixed;
    top: 0;
    left: -100%;
    width: 300px;
    max-width: 85%;
    height: 100vh;
    background: #fff;
    z-index: 2000;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    /* Скрываем меню по умолчанию для предотвращения мигания на мобильных */
    visibility: hidden;
    opacity: 0;
    /* Переходы применяются только после загрузки CSS */
    transition: left 0.3s ease, visibility 0s 0.3s, opacity 0.3s ease;
  }
  .header-nav.is-open {
    left: 0;
    visibility: visible;
    opacity: 1;
    transition: left 0.3s ease, visibility 0s, opacity 0.3s ease;
  }
}
.header-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #f0f0f0;
}
.header-nav-close {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  font-size: 24px;
  color: #000;
}

.header-menu {
  padding: 0;
  margin: 0;
  list-style: none;
}
.header-menu-item {
  border-bottom: 1px solid #f0f0f0;
}
.header-menu-link {
  display: block;
  padding: 16px 20px;
  color: #000;
  font-size: 15px;
  text-decoration: none;
  transition: background 0.2s ease;
}
.header-menu-link:hover {
  background: #f5f5f5;
  color: #000;
}

.header-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1500;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.header-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

/* Desktop */
@media (min-width: 992px) {
  .header-nav {
    position: static;
    width: auto;
    max-width: none;
    height: auto;
    box-shadow: none;
    overflow: visible;
    flex: 1;
    margin: 0 40px;
  }
  .header-nav-header {
    display: none;
  }
  .header-menu {
    display: flex;
    gap: 32px;
    justify-content: center;
  }
  .header-menu-item {
    border: none;
  }
  .header-menu-link {
    padding: 0;
    font-size: 14px;
    letter-spacing: 0.3px;
    color: #000;
    transition: color 0.3s ease;
  }
  /* Белое меню только на главной странице */
  body.is-homepage .header-menu-link {
    color: #fff;
  }
  .header-menu-link:hover {
    background: transparent;
    color: #666;
  }
  body.is-homepage .header-menu-link:hover {
    color: rgba(255, 255, 255, 0.7);
  }
  .header-menu-toggle {
    display: none;
  }
  .header-overlay {
    display: none;
  }
}

/* Mobile Toolbar (знизу екрану) */
.tf-toolbar-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #e5e5e5;
  z-index: 1000;
  display: none;
}

.toolbar-item {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 12px 8px;
}

.toolbar-item a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #000;
  text-decoration: none;
}

.toolbar-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.toolbar-icon svg {
  width: 24px;
  height: 24px;
  stroke: #000;
}

.toolbar-label {
  font-size: 11px;
  color: #666;
}

.toolbar-icon .cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #000;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 0 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

@media (max-width: 767px) {
  .tf-toolbar-bottom {
    display: flex;
  }

  .header-main {
    padding: 12px 16px;
  }
  .header-logo {
    font-size: 20px;
  }
  .header-right {
    gap: 12px;
  }
  .header-action svg {
    width: 20px;
    height: 20px;
  }
}

/* ==========================================================================
   SCROLL TO TOP BUTTON
   ========================================================================== */
#scroll-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#scroll-top:hover {
  background: #333;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

#scroll-top svg {
  width: 24px;
  height: 24px;
}

/* Показываем кнопку при прокрутке */
#scroll-top.show {
  display: flex;
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile */
@media (max-width: 768px) {
  #scroll-top {
    width: 45px;
    height: 45px;
    bottom: 20px;
    right: 20px;
  }

  #scroll-top svg {
    width: 20px;
    height: 20px;
  }
}

/* ==========================================================================
   OFFCANVAS - Базовые стили для скрытия меню при загрузке (в critical.css)
   Эти стили загружаются синхронно и применяются ПЕРВЫМИ, до загрузки offcanvas.css
   ========================================================================== */

/* 
  Скрываем offcanvas и backdrop по умолчанию для предотвращения "мигания" при загрузке.
  Эти правила применяются мгновенно, до того как offcanvas.js начнет работу.
*/
.offcanvas {
  visibility: hidden;
}
.offcanvas-backdrop {
  opacity: 0;
  visibility: hidden;
}

/* 
  Устанавливаем правильный z-index, чтобы offcanvas всегда был выше фона.
  Используем .show, так как этот класс добавляется при открытии.
*/
.offcanvas.show {
  z-index: 4000 !important;
}
.offcanvas-backdrop.show {
  z-index: 3000 !important;
}

/* HERO BANNER CLS FIX */
.hero-banner {
  position: relative;
  width: 100%;
  overflow: hidden;
  z-index: 1;
  aspect-ratio:  800 / 1920; /* Desktop aspect ratio */
}
@media (max-width: 767px) {
  .hero-banner {
    aspect-ratio: 600 / 800; /* Mobile aspect ratio */
  }
}
.hero-banner picture,
.hero-banner img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
