/* Оптимизированные стили с улучшенной производительностью */

/* Базовые переменные */
:root {
  --primary-color: #e11d48;
  --animation-fast: 0.2s;
  --animation-normal: 0.3s;
  --animation-slow: 0.6s;
  --easing: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Основные стили */
html {
  scroll-behavior: smooth;
  margin: 0;
  padding: 0;
  background-color: #000;
  min-height: 100%;
  scroll-padding-top: 104px;
}

body {
  background-color: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 104px 0 0 0;
  min-height: 100vh;
}

/* Стили для хедера */
.header-top-bar {
  height: 40px;
  background: #18181b;
  border-bottom: 1px solid #3f3f46;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
}

.header-main {
  height: 64px;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(63, 63, 70, 0.3);
  position: fixed;
  top: 40px;
  left: 0;
  right: 0;
  z-index: 40;
}

/* Мобильное меню */
#mobile-nav {
  top: 104px !important;
}

/* Адаптивные стили для хедера */
@media (max-width: 768px) {
  body {
    padding-top: 86px;
  }
  
  html {
    scroll-padding-top: 94px;
  }
  
  .header-top-bar {
    height: 36px;
  }
  
  .header-main {
    height: 58px;
    top: 36px;
  }
  
  #mobile-nav {
    top: 94px !important;
  }
}

@media (max-width: 480px) {
  body {
    padding-top: 82px;
  }
  
  html {
    scroll-padding-top: 88px;
  }
  
  .header-top-bar {
    height: 32px;
  }
  
  .header-main {
    height: 56px;
    top: 32px;
  }
  
  #mobile-nav {
    top: 88px !important;
  }
}

.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Оптимизированные анимации */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 30px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulse-optimized {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

/* GPU-ускоренные элементы */
.gpu-accelerated {
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Оптимизированные переходы */
.transition-optimized {
  transition: transform var(--animation-normal) var(--easing),
              opacity var(--animation-normal) var(--easing);
}

/* Hover эффекты только для десктопа */
@media (min-width: 1025px) {
  .hover-lift {
    transition: transform var(--animation-normal) var(--easing);
  }
  
  .hover-lift:hover {
    transform: translate3d(0, -5px, 0);
  }
}

/* Формы */
.form-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 6px;
  border: 1px solid #3f3f46;
  background-color: #27272a;
  color: white;
  font-size: 16px;
  transition: border-color var(--animation-normal) var(--easing);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.1);
}

/* Кнопки */
.btn-primary {
  background-color: var(--primary-color);
  color: white;
  padding: 12px 24px;
  border-radius: 6px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--animation-normal) var(--easing);
}

.btn-primary:hover {
  background-color: #be185d;
  transform: translateY(-1px);
}

/* Модальные окна */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--animation-normal) var(--easing),
              visibility var(--animation-normal) var(--easing);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: #1f1f23;
  border-radius: 8px;
  padding: 2rem;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translate3d(0, 0, 0);
  transition: transform var(--animation-normal) var(--easing);
}

.modal-overlay.active .modal-content {
  transform: scale(1) translate3d(0, 0, 0);
}

/* Ленивая загрузка изображений */
.lazy-image {
  opacity: 0;
  transition: opacity var(--animation-slow) var(--easing);
}

.lazy-image.loaded {
  opacity: 1;
}

/* Скелетон загрузки */
.skeleton {
  background: linear-gradient(90deg, #27272a 25%, #3f3f46 50%, #27272a 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Кастомный курсор - только для десктопа */
@media (min-width: 1025px) {
  .custom-cursor {
    position: fixed;
    width: 24px;
    height: 24px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transition: transform var(--animation-fast) var(--easing);
    opacity: 0;
  }
  
  .custom-cursor.hover {
    transform: scale(1.5);
    border-color: #fff;
  }
}

/* Галерея */
.gallery-tab {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid #3f3f46;
  background-color: transparent;
  color: #d4d4d8;
  cursor: pointer;
  transition: all var(--animation-normal) var(--easing);
}

.gallery-tab:hover {
  border-color: var(--primary-color);
  color: white;
}

.gallery-tab.active {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

/* Социальные иконки */
.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  transition: transform var(--animation-normal) var(--easing);
  text-decoration: none;
}

.social-icon:hover {
  transform: translateY(-2px);
}

/* Статистика */
.stats-number {
  font-variant-numeric: tabular-nums;
  will-change: contents;
}

/* Адаптивность */
@media (max-width: 768px) {
  body {
    padding-top: 86px;
  }
  
  html {
    scroll-padding-top: 94px;
  }
  
  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  /* Упрощенные анимации для мобильных */
  .hover-lift:hover {
    transform: none;
  }
  
  .parallax-element {
    transform: none !important;
  }
  
  .social-icon {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 480px) {
  body {
    padding-top: 82px;
  }
  
  html {
    scroll-padding-top: 88px;
  }
  
  .container {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  
  .form-input {
    font-size: 16px; /* Предотвращает зум на iOS */
  }
}

/* Отключение анимаций для слабых устройств */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Высокий контраст */
@media (prefers-contrast: high) {
  .text-zinc-400 {
    color: #a1a1aa;
  }
  
  .border-zinc-700 {
    border-color: #52525b;
  }
}

/* Критические стили для первого экрана */
.hero-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  will-change: transform;
}

.hero-content {
  position: relative;
  z-index: 10;
  max-width: 100%;
}

/* Оптимизация для печати */
@media print {
  .fixed,
  .floating-contacts,
  #mobile-nav,
  .cookie-banner {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
}

/* Доступность */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Индикатор загрузки */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Уведомления */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #1f1f23;
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1001;
  transform: translateX(100%);
  transition: transform var(--animation-normal) var(--easing);
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  border-left: 4px solid #22c55e;
}

.toast.error {
  border-left: 4px solid #ef4444;
}

/* Стили для анимации заголовка */
.hero-title .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.hero-title .word.animate {
  opacity: 1;
  transform: translateY(0);
}

/* Стили для печати */
.stamp {
  opacity: 0;
  transform: scale(0) rotate(12deg);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.stamp-inner {
  position: relative;
  background: #e11d48;
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 4px 15px rgba(225, 29, 72, 0.4);
}

.stamp-inner::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #e11d48, #dc2626);
  border-radius: 10px;
  z-index: -1;
}

.stamp-border {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border: 2px dashed #e11d48;
  border-radius: 12px;
  opacity: 0.6;
}

/* Анимация появления слов */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.word-line {
  overflow: hidden;
}

/* Адаптивные стили для заголовка */
@media (max-width: 768px) {
  .stamp {
    position: static !important;
    margin: 10px auto;
    display: block;
    text-align: center;
  }
  
  .hero-title {
    font-size: 2.5rem !important;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2rem !important;
  }
  
  .stamp-inner {
    font-size: 10px;
    padding: 6px 12px;
  }
}