/* ============================================
   Freudin Ψ - Main Stylesheet
   Warm Light Theme — Psychology Marketplace
   (psyfreud.com)
   --------------------------------------------
   ВАЖНО: все имена CSS-переменных и классов
   сохранены из предыдущей (тёмной) версии.
   Изменены только значения. Новые токены
   тёплой темы добавлены в конце :root.
   ============================================ */

/* ---- CSS Custom Properties ---- */
:root {
  /* Colors (бывш. индиго/фиолет → тёплая палитра по брифу) */
  --primary: #6F8465;        /* Шалфей — основной акцент (ссылки, иконки, focus) */
  --primary-light: #93A488;  /* Светлый шалфей */
  --primary-dark: #57684F;   /* Мох — hover для акцентных ссылок */
  --secondary: #C0693E;      /* Терракота — второй акцент (бывш. фиолет) */
  --accent: #6F8465;         /* Шалфей (по брифу accent = sage) */
  --gold: #C29A4B;           /* Тёплая охра — рейтинги, мелкие акценты */
  --gold-light: #D9BC7C;     /* Светлая охра */
  --success: #5F8A6E;        /* Спокойный зелёный */
  --warning: #B98A2E;        /* Мягкий янтарный */
  --danger: #A85448;         /* Приглушённый кирпичный */

  /* Backgrounds */
  --bg-base: #FAF7F1;        /* Тёплый фарфор — основной фон */
  --bg-body: #FAF7F1;
  --bg-surface: #FFFFFF;     /* Белый — карточки, модальные окна */
  --bg-surface-light: #F3EDE3; /* Льняной — чередующиеся секции */
  --bg-glass: rgba(255, 255, 255, 0.78); /* «Стекло» на светлой теме */

  /* Text */
  --text-primary: #33302B;   /* Тёплый графит (AAA на фоне) */
  --text-secondary: #4F4A42; /* Основной текст абзацев */
  --text-muted: #6E675D;     /* Какао-серый (AA) */
  --text-dim: #8A8378;       /* Самый светлый — только подсказки */

  /* Borders */
  --border-subtle: #E6DFD3;  /* Песочный — рамки карточек */
  --border-medium: #D8CFBE;  /* Более заметная рамка */
  --border-glow: rgba(111, 132, 101, 0.35); /* Шалфейное свечение */

  /* Gradients (имена сохранены; значения — спокойные тональные) */
  --gradient-primary: linear-gradient(135deg, #6F8465 0%, #57684F 100%);
  --gradient-psi: linear-gradient(135deg, #6F8465 0%, #57684F 100%);
  --gradient-hero: linear-gradient(180deg, #FAF7F1 0%, #F3EDE3 100%);
  --gradient-mesh: radial-gradient(ellipse at 20% 50%, rgba(111, 132, 101, 0.07) 0%, transparent 50%),
                    radial-gradient(ellipse at 80% 20%, rgba(194, 154, 75, 0.05) 0%, transparent 50%),
                    radial-gradient(ellipse at 50% 80%, rgba(192, 105, 62, 0.04) 0%, transparent 50%);

  /* Typography */
  --font-body: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Lora', Georgia, 'Times New Roman', serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Layout */
  --container-max: 1280px;
  --container-narrow: 768px;
  --header-height: 72px;

  /* Effects — округлее и мягче, чем в тёмной теме */
  --radius-sm: 0.5rem;
  --radius-md: 0.875rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(51, 48, 43, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(51, 48, 43, 0.08), 0 2px 4px -2px rgba(51, 48, 43, 0.04);
  --shadow-lg: 0 12px 32px -8px rgba(51, 48, 43, 0.12), 0 4px 8px -4px rgba(51, 48, 43, 0.06);
  --shadow-glow: 0 8px 30px rgba(111, 132, 101, 0.15);
  --shadow-glow-hover: 0 12px 40px rgba(111, 132, 101, 0.22);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;

  /* ---- Новые токены тёплой темы (из research-brief) ---- */
  --bg-surface-warm: #F3EDE3;   /* Льняной — футер, чередующиеся секции */
  --bg-tint-sage: #EEF2E9;      /* Шалфейный туман — плашки «это безопасно» */
  --cta: #C0693E;               /* Терракота — первичные кнопки */
  --cta-hover: #A8562F;         /* Обожжённая глина — hover/focus CTA */
  --info: #6E7F8A;              /* Нейтральный серо-голубой */
  --success-bg: #EAF2EB;
  --warning-bg: #FBF3E0;
  --danger-bg: #F9ECEA;
  --info-bg: #EDF2F4;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Страховка от горизонтального скролла (основные причины устранены ниже) */
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  font-family: var(--font-body);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  overflow-x: clip;
  min-height: 100vh;
}

/* Длинные слова/ссылки не должны распирать вёрстку */
p, a, li, blockquote, td, th, summary,
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: anywhere;
}

/* Блокировка скролла страницы при открытом мобильном меню */
body.menu-open {
  overflow: hidden;
}

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

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

img, video {
  display: block;
}

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h4 { font-size: clamp(1.1rem, 2vw, 1.35rem); }

p {
  color: var(--text-secondary);
}

/* По брифу градиентный текст запрещён — класс сохранён,
   но теперь даёт однотонный шалфейный цвет */
.text-gradient {
  color: var(--primary-dark);
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: currentColor;
  background-clip: unset;
}

.text-muted {
  color: var(--text-muted);
}

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.section {
  padding: var(--space-4xl) 0;
  position: relative;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.section-header h2 {
  margin-bottom: var(--space-md);
}

.section-header p {
  max-width: 600px;
  margin: 0 auto;
  color: var(--text-muted);
}

/* ---- Header ---- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-height);
  background: rgba(250, 247, 241, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-base);
}

.header.scrolled {
  background: rgba(250, 247, 241, 0.96);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--bg-tint-sage);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.1rem;
}

/* Freudin Ψ logo: Ψ в шалфейном круге, спокойная статичная версия */
.logo-icon.logo-psi {
  border-radius: 50%;
  background: var(--bg-tint-sage);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.logo-icon.logo-psi svg {
  width: 100%;
  height: 100%;
  display: block;
}

.logo .logo-text {
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.nav-links {
  display: flex;
  gap: var(--space-lg);
}

.nav-link {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition-fast);
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary-dark);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width var(--transition-base);
  border-radius: var(--radius-full);
}

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

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: var(--space-sm);
}

.mobile-menu-btn span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: all var(--transition-base);
}

/* ---- Hero ---- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  padding-top: var(--header-height);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: var(--gradient-hero);
  z-index: -3;
}

/* Статичный едва заметный тёплый отблеск (анимация убрана по брифу) */
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 75% 30%, rgba(111, 132, 101, 0.08) 0%, transparent 55%),
              radial-gradient(ellipse at 20% 80%, rgba(194, 154, 75, 0.06) 0%, transparent 50%);
}

/* Floating orbs — отключены по брифу (спокойный hero вместо шоу).
   Классы сохранены, элементы скрыты. */
.hero-orbs {
  display: none;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0;
}

.orb-1 { width: 340px; height: 340px; top: -8%; left: -6%; }
.orb-2 { width: 280px; height: 280px; bottom: 5%; right: -4%; }
.orb-3 { width: 200px; height: 200px; top: 40%; left: 55%; }

/* ---- Marquee (therapy directions ticker) ---- */
.marquee {
  overflow: hidden;
  padding: var(--space-lg) 0;
  background: var(--bg-surface-warm);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.marquee-track {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  width: max-content;
  animation: marquee-scroll 36s linear infinite;
}

.marquee:hover .marquee-track {
  animation-play-state: paused;
}

.marquee-item {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color var(--transition-fast);
}

.marquee-item:hover {
  color: var(--gold);
}

.marquee-sep {
  color: var(--secondary);
  font-size: 0.9rem;
  opacity: 0.7;
}

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

/* ---- Scroll-reveal fallback (no GSAP) ---- */
.reveal-pending {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-pending.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Ripple keyframes (JS-driven) ---- */
@keyframes ripple-effect {
  to { transform: scale(2.4); opacity: 0; }
}

.hero-particles {
  display: none; /* частицы отключены по брифу */
}

.hero-content {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-4xl) var(--space-lg);
  width: 100%;
  position: relative;
  z-index: 1;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-3xl);
  align-items: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-tint-sage);
  border: 1px solid var(--border-subtle);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  color: var(--primary-dark);
  margin-bottom: var(--space-lg);
}

.hero-badge .dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.hero h1 {
  margin-bottom: var(--space-lg);
  line-height: 1.1;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xl);
  max-width: 500px;
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  gap: var(--space-2xl);
  margin-top: var(--space-3xl);
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-visual-inner {
  position: relative;
  width: 400px;
  max-width: 100%;
  height: 400px;
}

.floating-card {
  position: absolute;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: var(--shadow-lg);
  animation: float 6s ease-in-out infinite;
}

.floating-card:nth-child(1) {
  top: 0;
  right: 0;
  animation-delay: 0s;
}

.floating-card:nth-child(2) {
  bottom: 20%;
  left: 0;
  animation-delay: -2s;
}

.floating-card:nth-child(3) {
  bottom: 0;
  right: 20%;
  animation-delay: -4s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(1deg); }
}

/* ---- Footer ---- */
.footer {
  background: var(--bg-surface-warm);
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-3xl) 0 var(--space-xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr));
  gap: var(--space-2xl);
  margin-bottom: var(--space-3xl);
}

.footer-brand p {
  color: var(--text-muted);
  margin-top: var(--space-md);
  font-size: 0.9rem;
  max-width: 300px;
}

.footer-title {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.footer-link {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--primary-dark);
}

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.footer-bottom p {
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ---- Responsive ---- */
/* Планшет: навигация не помещается — включаем бургер-меню */
@media (max-width: 1024px) {
  .nav {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero p {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-stats {
    justify-content: center;
  }

  .hero-visual {
    display: none;
  }

  .section {
    padding: var(--space-3xl) 0;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Крупный телефон */
@media (max-width: 768px) {
  .container,
  .container-narrow,
  .header-inner {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .hero {
    min-height: auto;
    padding-bottom: var(--space-3xl);
  }

  .hero-content {
    padding: var(--space-3xl) var(--space-md);
  }

  .hero-stats {
    gap: var(--space-lg);
    margin-top: var(--space-2xl);
  }

  .marquee-item {
    font-size: 1rem;
  }

  .section {
    padding: var(--space-2xl) 0;
  }

  .section-header {
    margin-bottom: var(--space-2xl);
  }

  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: var(--space-xl);
  }

  .footer-brand p {
    margin-left: auto;
    margin-right: auto;
  }

  .footer-links {
    align-items: center;
  }
}

/* Малый телефон */
@media (max-width: 480px) {
  .hero-badge {
    font-size: 0.78rem;
  }

  .hero p {
    font-size: 1rem;
  }

  /* Кнопки действий — на всю ширину */
  .hero-actions .btn,
  .profile-actions .btn {
    width: 100%;
    white-space: normal; /* длинные подписи переносятся, а не распирают кнопку */
  }

  .hero-stats {
    gap: var(--space-md);
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .footer-bottom {
    justify-content: center;
    text-align: center;
  }
}

/* Гамбургер → крестик при открытом меню (класс .menu-open ставит JS) */
body.menu-open .mobile-menu-btn span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

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

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

/* ---- Utility ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Таблицы: горизонтальный скролл внутри обёртки вместо переполнения страницы */
table {
  max-width: 100%;
  border-collapse: collapse;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.table-scroll > table {
  min-width: 560px;
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .marquee-track {
    animation: none !important;
  }

  .reveal-pending {
    opacity: 1;
    transform: none;
  }
}
