/* ==========================================================================
   NINA NEK — Психологическое Таро | Стили дизайн-системы (Production Ready)
   ========================================================================== */

/* 1. CSS Переменные и Токены (согласно DESIGN.md) */
:root {
  /* Палитра Бумаги и Фона */
  --color-paper-base: #F9F7F2;
  --color-paper-surface: #FFFFFF;
  --color-paper-muted: #EAE4D9;
  --color-surface: #fbf9f4;
  --color-surface-dim: #dbdad5;
  --color-surface-container: #f0eee9;
  --color-surface-container-low: #f5f3ee;
  --color-surface-container-high: #eae8e3;
  --color-surface-container-highest: #e4e2dd;
  
  /* Темные оттенки Зеленого Леса (Deep Forest) */
  --color-forest-deep: #183124;
  --color-forest-rich: #13271D;
  
  /* Благородное Золото и Охра (Ochre Gold) */
  --color-ochre-gold: #C88A3B;
  --color-ochre-hover: #B3792E;
  --color-primary-fixed: #ffddb9;
  --color-primary-fixed-dim: #feb965;
  
  /* Текстовые оттенки (Ink) */
  --color-ink-dark: #16201A;
  --color-ink-body: #36423B;
  --color-ink-muted: #68766F;
  --color-on-surface-variant: #514538;
  --color-tertiary-fixed-dim: #bccabd;
  
  /* Границы и разделители */
  --color-border-hairline: #E3DCCF;
  --color-border-forest: rgba(255, 255, 255, 0.12);
  
  /* Типографика */
  --font-serif: 'EB Garamond', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Тени */
  --shadow-sm: 0 1px 3px rgba(24, 49, 36, 0.04), 0 1px 2px rgba(24, 49, 36, 0.02);
  --shadow-md: 0 4px 16px rgba(24, 49, 36, 0.06), 0 2px 4px rgba(24, 49, 36, 0.03);
  --shadow-lg: 0 12px 32px rgba(24, 49, 36, 0.08), 0 4px 8px rgba(24, 49, 36, 0.04);
  --shadow-card: 0 20px 40px -15px rgba(24, 49, 36, 0.12), 0 4px 12px rgba(24, 49, 36, 0.04);
  --shadow-gold: 0 20px 40px -10px rgba(200, 138, 59, 0.25);
  
  /* Радиусы */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.25rem;
  --radius-full: 9999px;
  
  /* Переходы */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 2. Базовый сброс и глобальные стили */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-paper-base);
  color: var(--color-ink-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection {
  background-color: rgba(200, 138, 59, 0.25);
  color: var(--color-ink-dark);
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Стилизация скроллбара */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-paper-base);
}

::-webkit-scrollbar-thumb {
  background: var(--color-paper-muted);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-ochre-gold);
}

/* 3. Типографические утилиты */
.font-serif { font-family: var(--font-serif); }
.font-sans { font-family: var(--font-sans); }

.font-display {
  font-family: var(--font-serif);
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 400;
}

.font-headline-lg {
  font-family: var(--font-serif);
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 400;
}

.font-headline-md {
  font-family: var(--font-serif);
  font-size: clamp(24px, 3vw, 28px);
  line-height: 1.3;
  font-weight: 400;
}

.font-headline-sm {
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1.35;
  font-weight: 500;
}

.font-label-caps {
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 16px;
  letter-spacing: 0.14em;
  font-weight: 600;
  text-transform: uppercase;
}

.font-label-md {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
}

.font-body-lg { font-size: 18px; line-height: 28px; }
.font-body-md { font-size: 15px; line-height: 24px; }
.font-body-sm { font-size: 13px; line-height: 20px; }

/* 4. Цветовые классы */
.text-forest-deep { color: var(--color-forest-deep); }
.text-ochre-gold { color: var(--color-ochre-gold); }
.text-ink-dark { color: var(--color-ink-dark); }
.text-ink-body { color: var(--color-ink-body); }
.text-ink-muted { color: var(--color-ink-muted); }
.text-on-primary { color: #ffffff; }
.text-paper-surface { color: var(--color-paper-surface); }
.text-paper-base { color: var(--color-paper-base); }
.text-tertiary-fixed-dim { color: var(--color-tertiary-fixed-dim); }
.text-on-surface-variant { color: var(--color-on-surface-variant); }

.bg-paper-base { background-color: var(--color-paper-base); }
.bg-paper-surface { background-color: var(--color-paper-surface); }
.bg-paper-muted { background-color: var(--color-paper-muted); }
.bg-surface-container { background-color: var(--color-surface-container); }
.bg-surface-container-low { background-color: var(--color-surface-container-low); }
.bg-forest-deep { background-color: var(--color-forest-deep); }
.bg-forest-rich { background-color: var(--color-forest-rich); }
.bg-ochre-gold { background-color: var(--color-ochre-gold); }

.border-border-hairline { border-color: var(--color-border-hairline); }
.border-forest { border-color: var(--color-border-forest); }

/* 5. Макет и Контейнеры */
.container-custom {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

@media (max-width: 640px) {
  .container-custom {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}

/* 6. Стили компонентов */

/* Шапка сайта */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 50;
  background-color: rgba(249, 247, 242, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(227, 220, 207, 0.6);
  box-shadow: 0 1px 8px rgba(24, 49, 36, 0.03);
  transition: all var(--transition-normal);
}

.site-header.scrolled {
  background-color: rgba(249, 247, 242, 0.98);
  box-shadow: 0 4px 20px rgba(24, 49, 36, 0.06);
}

.header-inner {
  height: 5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-link {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-on-surface-variant);
  transition: color var(--transition-fast);
  position: relative;
}

.nav-link:hover, .nav-link.active {
  color: var(--color-forest-deep);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-ochre-gold);
  transition: width var(--transition-normal);
}

.nav-link:hover::after, .nav-link.active::after {
  width: 100%;
}

/* Мобильное меню */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: var(--radius-md);
}

.mobile-menu-btn span {
  display: block;
  height: 2px;
  width: 100%;
  background-color: var(--color-forest-deep);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.mobile-menu-btn.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mobile-menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.mobile-nav-drawer {
  display: none;
  position: fixed;
  top: 5rem;
  left: 0;
  width: 100%;
  background-color: var(--color-paper-base);
  border-bottom: 1px solid var(--color-border-hairline);
  box-shadow: 0 10px 30px rgba(24, 49, 36, 0.08);
  padding: 1.5rem;
  flex-direction: column;
  gap: 1.25rem;
  z-index: 49;
  animation: slideDown 0.3s ease-out;
}

.mobile-nav-drawer.open {
  display: flex;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1023px) {
  .mobile-menu-btn { display: flex; }
}

/* Кнопки */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-full);
  background-color: var(--color-forest-deep);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(24, 49, 36, 0.12);
  transition: all var(--transition-normal);
}

.btn-primary:hover {
  background-color: var(--color-forest-rich);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(24, 49, 36, 0.18);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  background-color: var(--color-paper-surface);
  border: 1px solid var(--color-border-hairline);
  color: var(--color-ink-dark);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.btn-secondary:hover {
  background-color: var(--color-paper-muted);
  border-color: var(--color-ochre-gold);
}

.btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  border-radius: var(--radius-full);
  background-color: var(--color-ochre-gold);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(200, 138, 59, 0.25);
  transition: all var(--transition-normal);
}

.btn-gold:hover {
  background-color: var(--color-ochre-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(200, 138, 59, 0.35);
}

/* Карточки и сетки */
.card-surface {
  background-color: var(--color-paper-surface);
  border: 1px solid var(--color-border-hairline);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.card-surface:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(200, 138, 59, 0.4);
  transform: translateY(-2px);
}

/* Интерактивная левитирующая карта Таро в Hero (спокойная и плавная) */
.tarot-hero-card {
  position: relative;
}

/* Мягкое статичное свечение за картой (без мерцания и пульсаций) */
.tarot-glow {
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle at center, rgba(200, 138, 59, 0.2) 0%, rgba(24, 49, 36, 0.06) 50%, transparent 70%);
  border-radius: var(--radius-full);
  filter: blur(24px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.85;
}

/* Задняя теневая подложка */
.tarot-hero-card-backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 1rem;
  background-color: rgba(234, 228, 217, 0.75);
  border: 1px solid rgba(227, 220, 207, 0.85);
  animation: tarotBackdropLevitate 7s ease-in-out infinite;
  transition: transform 0.4s ease, background-color 0.4s ease;
}

/* Основной левитирующий корпус карты */
.tarot-hero-card-inner {
  will-change: transform, box-shadow;
  animation: tarotLevitate 7s ease-in-out infinite;
  transition: transform 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
  position: relative;
  z-index: 2;
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* Интерактивный hover эффект */
.tarot-hero-card:hover .tarot-hero-card-inner {
  transform: translateY(-8px);
  box-shadow: 0 20px 38px -10px rgba(200, 138, 59, 0.22), 0 6px 16px rgba(24, 49, 36, 0.05);
  border-color: rgba(200, 138, 59, 0.5);
}

.tarot-hero-card:hover .tarot-hero-card-backdrop {
  transform: translate3d(10px, 12px, 0) rotate(-1.5deg);
  background-color: rgba(234, 228, 217, 0.9);
}

/* Ключевые кадры плавной, спокойной левитации */
@keyframes tarotLevitate {
  0%, 100% {
    transform: translate3d(0, 0px, 0);
    box-shadow: 0 14px 28px -8px rgba(24, 49, 36, 0.08), 0 4px 10px rgba(24, 49, 36, 0.03);
  }
  50% {
    transform: translate3d(0, -8px, 0);
    box-shadow: 0 20px 36px -10px rgba(200, 138, 59, 0.16), 0 8px 18px rgba(24, 49, 36, 0.05);
  }
}

@keyframes tarotBackdropLevitate {
  0%, 100% {
    transform: translate3d(8px, 8px, 0) rotate(-1.5deg);
  }
  50% {
    transform: translate3d(10px, 13px, 0) rotate(-2.2deg);
  }
}

/* Интерактивный Квиз */
.quiz-option-btn {
  width: 100%;
  text-align: left;
  padding: 1.125rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-hairline);
  background-color: var(--color-paper-base);
  transition: all var(--transition-fast);
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
}

.quiz-option-btn:hover {
  border-color: var(--color-ochre-gold);
  background-color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(200, 138, 59, 0.08);
}

.quiz-option-btn.selected {
  border-color: var(--color-ochre-gold);
  background-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(200, 138, 59, 0.2);
}

/* Аккордеон FAQ */
details.faq-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 1.25rem;
  transition: border-color var(--transition-fast);
}

details.faq-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--color-paper-surface);
  transition: color var(--transition-fast);
}

details.faq-item summary::-webkit-details-marker {
  display: none;
}

details.faq-item summary:hover {
  color: var(--color-ochre-gold);
}

details.faq-item[open] summary .faq-icon {
  transform: rotate(180deg);
}

.faq-icon {
  transition: transform var(--transition-normal);
  color: var(--color-ochre-gold);
}

/* Поля форм (строгий оверрайд Tailwind Forms и браузерного автозаполнения) */
.form-input,
.form-select,
.form-textarea,
input.form-input,
select.form-select,
textarea.form-textarea,
#session-booking-form input[type="text"],
#session-booking-form select,
#session-booking-form textarea {
  width: 100% !important;
  padding: 0.875rem 1rem !important;
  border-radius: var(--radius-md) !important;
  background-color: #11261B !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  color: #FFFFFF !important;
  font-size: 15px !important;
  line-height: 1.4 !important;
  outline: none !important;
  box-shadow: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
input.form-input:focus,
select.form-select:focus,
textarea.form-textarea:focus,
#session-booking-form input[type="text"]:focus,
#session-booking-form select:focus,
#session-booking-form textarea:focus {
  background-color: #163224 !important;
  border-color: #C88A3B !important;
  color: #FFFFFF !important;
  box-shadow: 0 0 0 3px rgba(200, 138, 59, 0.25) !important;
  outline: none !important;
}

.form-input:not(:focus),
.form-select:not(:focus),
.form-textarea:not(:focus),
#session-booking-form input:not(:focus),
#session-booking-form select:not(:focus),
#session-booking-form textarea:not(:focus) {
  background-color: #11261B !important;
  color: #FFFFFF !important;
}

.form-input::placeholder,
.form-textarea::placeholder,
#session-booking-form input::placeholder,
#session-booking-form textarea::placeholder {
  color: rgba(255, 255, 255, 0.55) !important;
  opacity: 1 !important;
}

/* Браузерный Autofill (Chrome, Safari, iOS, Samsung) */
#session-booking-form input:-webkit-autofill,
#session-booking-form input:-webkit-autofill:hover, 
#session-booking-form input:-webkit-autofill:focus,
#session-booking-form input:-webkit-autofill:active,
#session-booking-form textarea:-webkit-autofill,
#session-booking-form textarea:-webkit-autofill:hover,
#session-booking-form textarea:-webkit-autofill:focus,
#session-booking-form select:-webkit-autofill {
  -webkit-text-fill-color: #FFFFFF !important;
  -webkit-box-shadow: 0 0 0px 1000px #11261B inset !important;
  box-shadow: 0 0 0px 1000px #11261B inset !important;
  caret-color: #FFFFFF !important;
  background-color: #11261B !important;
  color: #FFFFFF !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}

.form-select option {
  background-color: #13271D !important;
  color: #FFFFFF !important;
  padding: 8px 12px !important;
}

/* Уведомление об успешной отправке (Toast) */
.toast-notification {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
  max-width: 400px;
  background-color: var(--color-forest-rich);
  border: 1px solid var(--color-ochre-gold);
  color: var(--color-paper-surface);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-xl);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.toast-notification.show {
  transform: translateY(0);
  opacity: 1;
}

/* Кнопка «Наверх» */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background-color: var(--color-forest-deep);
  color: var(--color-paper-surface);
  box-shadow: 0 4px 16px rgba(24, 49, 36, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal), transform var(--transition-normal);
  border: 1px solid var(--color-border-forest);
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  background-color: var(--color-ochre-gold);
  transform: translateY(-2px);
}

/* ==========================================================================
   7. Спокойная и плавная система анимаций (Smooth & Calm)
   ========================================================================== */

/* Элементы с мягким, естественным появлением при скролле (без мерцания) */
.reveal-init {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease,
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal-active {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* Мягкая задержка для заголовков */
.reveal-heading {
  transition-duration: 0.75s;
}

/* Спокойная задержка для карточек */
.reveal-card {
  transition-duration: 0.7s;
  transition-delay: calc(var(--card-index, 0) * 60ms);
}

/* Плавная интерактивность карточек при наведении */
.card-surface,
.quiz-option-btn,
.interactive-card {
  position: relative;
  transition: transform 0.3s ease,
              box-shadow 0.3s ease,
              border-color 0.3s ease;
}

.card-surface:hover,
.quiz-option-btn:hover,
.interactive-card:hover {
  transform: translateY(-3px);
  border-color: rgba(200, 138, 59, 0.35);
  box-shadow: 0 12px 28px -6px rgba(24, 49, 36, 0.08),
              0 4px 10px rgba(24, 49, 36, 0.02);
}

/* Спокойный отклик иконок в карточках */
.card-surface:hover .material-symbols-outlined,
.quiz-option-btn:hover .material-symbols-outlined,
.interactive-card:hover .material-symbols-outlined {
  color: var(--color-ochre-gold);
  transition: color 0.3s ease;
}

/* Статичный благородный акцент для рекомендуемого тарифа (без мерцания) */
.border-2.border-ochre-gold {
  position: relative;
  box-shadow: 0 8px 24px -4px rgba(200, 138, 59, 0.12);
}

/* Учет настроек пользователя для уменьшения движения */
@media (prefers-reduced-motion: reduce) {
  .reveal-init {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .tarot-hero-card-inner,
  .tarot-hero-card-backdrop {
    animation: none !important;
  }
}
