/* ===== БАЗОВЫЕ СТИЛИ ===== */
body {
  font-family: var(--font-display);
  font-weight: 300;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

/* Скрываем #site до конца preloader */
#site {
  visibility: hidden;
  opacity: 0;
}

/* Плавный скролл к якорям */
html {
  scroll-padding-top: 80px;
}

/* Типографика заголовков */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 300;
  letter-spacing: 0.05em;
  line-height: 1.1;
  text-wrap: balance;
}

/* Арабские элементы */
.arabic {
  font-family: var(--font-arabic);
  direction: ltr; /* каллиграфия всегда LTR — декор */
}

/* Золотая тонкая линия-разделитель */
.divider {
  width: 60px;
  height: 0.5px;
  background: var(--maroon-light);
  margin: 32px auto;
  transform-origin: left;
}

/* Тег-бейдж */
.tag {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--maroon);
  border: 0.5px solid var(--maroon-line-solid);
  padding: 7px 14px;
  border-radius: 0;
}

/* Базовая outline-кнопка — эталон "веса" для всех CTA сайта */
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: var(--text-button);
  font-weight: 400;
  letter-spacing: var(--ls-button);
  text-transform: uppercase;
  color: var(--maroon);
  border: 1px solid var(--maroon);
  padding: 18px 40px;
  min-height: 48px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: color 0.4s var(--ease-gold), transform 0.15s ease-out;
}

/* emilkowalski: кнопки должны чувствовать нажатие */
.btn-outline:active {
  transform: scale(0.97);
}

.btn-outline::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--maroon);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease-gold);
}

.btn-outline:hover::before {
  transform: scaleX(1);
}

.btn-outline:hover {
  color: var(--ink);
}

.btn-outline span {
  position: relative;
  z-index: 1;
}

/* Секции — базовый padding. Только низ: одинаковый зазор между секциями
   формируется padding-bottom предыдущей секции (а не суммой низа+верха соседних) */
section {
  padding: 0 var(--pad-x) var(--sp-section);
  position: relative;
}

/* Зерно-оверлей (grain) */
.grain-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 300px 300px;
}

/* Grain на светлых секциях — добавляет атмосферу и глубину (frontend-design) */
#about::before,
#services::before,
#process::before,
#reviews::before,
#contact::before,
#footer::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 300px 300px;
}

/* Focus-visible — keyboard accessibility (WCAG 2.4.7) */
:focus-visible {
  outline: 1.5px solid var(--maroon);
  outline-offset: 3px;
}

/* Отключаем outline для mouse-кликов, сохраняем для клавиатуры */
:focus:not(:focus-visible) {
  outline: none;
}

/* Skip link для keyboard-навигации (WCAG 2.4.1) */
.skip-link {
  position: fixed;
  top: -100%;
  left: 16px;
  z-index: 9999;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--maroon);
  padding: 12px 20px;
  text-decoration: none;
  transition: top 0s;
}

.skip-link:focus {
  top: 16px;
}

/* prefers-reduced-motion — упрощаем все анимации */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Мобиль базовые правки --- */
@media (max-width: 767px) {
  section {
    padding: 0 var(--pad-x) var(--sp-section-mob);
  }
}

/* --- 320px — самые маленькие экраны --- */
@media (max-width: 374px) {
  .btn-outline {
    padding: 12px 20px;
    font-size: 11px;
  }
}

/* View Transitions API — плавный fade при смене языка */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) { animation: fade-out 0.3s ease; }
::view-transition-new(root) { animation: fade-in  0.3s ease; }

@keyframes fade-out { from { opacity: 1 } to { opacity: 0 } }
@keyframes fade-in  { from { opacity: 0 } to { opacity: 1 } }
