/* ═══════════════════════════════════════════════════════════════════
   theme.css — The Compound Family
   ЕДИНЫЙ файл темы для всего сайта.
   Подключать на КАЖДОЙ странице ПОСЛЕ fonts.css:
     <link rel="stylesheet" href="fonts.css">
     <link rel="stylesheet" href="theme.css">
   Версия: 1.0 | 2026
═══════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════
   1. CSS ПЕРЕМЕННЫЕ — ТЁМНАЯ ТЕМА (по умолчанию)
═══════════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  /* Фоны */
  --bg:        #0a0c0f;
  --surface:   #111318;
  --surface2:  #161b22;
  --surface3:  #1c2230;

  /* Границы */
  --border:    #1e2430;
  --border2:   #2a3345;

  /* Текст */
  --text:      #e8edf3;
  --text2:     #8b949e;
  --text3:     #484f58;

  /* Алиасы (для обратной совместимости со старыми страницами) */
  --muted:     #8b949e;
  --dim:       #484f58;

  /* Навигация и UI */
  --nav-bg:      rgba(10,12,15,0.88);
  --about-bg:    #111318;
  --shadow:      rgba(0,0,0,0.5);
  --toggle-track:#2a313c;
  --logo-bg:     #0d1117;
  --input-bg:    #0d1117;
}

/* ═══════════════════════════════════════════════════════════════════
   2. CSS ПЕРЕМЕННЫЕ — СВЕТЛАЯ ТЕМА
═══════════════════════════════════════════════════════════════════ */
[data-theme="light"] {
  /* Фоны */
  --bg:        #f4f6f9;
  --surface:   #ffffff;
  --surface2:  #eef0f4;
  --surface3:  #e4e8ef;

  /* Границы */
  --border:    #dde1e8;
  --border2:   #c8cdd8;

  /* Текст */
  --text:      #111318;
  --text2:     #4a5568;
  --text3:     #9aa3b2;

  /* Алиасы */
  --muted:     #4a5568;
  --dim:       #9aa3b2;

  /* Навигация и UI */
  --nav-bg:      rgba(244,246,249,0.92);
  --about-bg:    #ffffff;
  --shadow:      rgba(0,0,0,0.08);
  --toggle-track:#dde1e8;
  --logo-bg:     #1a1f2e;
  --input-bg:    #f4f6f9;
}

/* ═══════════════════════════════════════════════════════════════════
   3. ГЛОБАЛЬНЫЕ ПЕРЕМЕННЫЕ — не зависят от темы
═══════════════════════════════════════════════════════════════════ */
:root {
  /* Основной акцент — зелёный */
  --accent:        #3fb950;
  --accent-dim:    rgba(63,185,80,0.12);
  --accent-border: rgba(63,185,80,0.25);

  /* YouTube красный — только для YT кнопок */
  --yt-red:       #ff0000;
  --yt-red-hover: #cc0000;

  /* Золотой — для монетизации и выделений */
  --gold:         #d4a843;
  --gold-dim:     rgba(212,168,67,0.10);
  --gold-border:  rgba(212,168,67,0.25);

  /* Красный — ошибки, отрицательные значения */
  --red:          #f85149;
  --red-dim:      rgba(248,81,73,0.12);
  --red-border:   rgba(248,81,73,0.25);

  /* Синий — ссылки, информация */
  --blue:         #58a6ff;
  --blue-dim:     rgba(88,166,255,0.12);
  --blue-border:  rgba(88,166,255,0.25);

  /* Жёлтый/янтарный — предупреждения */
  --amber:        #e3b341;
  --amber-dim:    rgba(227,179,65,0.12);
  --amber-border: rgba(227,179,65,0.25);

  /* Сценарии DCF — используются в valuation.html и dcf.html */
  --bear:         #f85149;
  --bear-dim:     rgba(248,81,73,0.08);
  --bear-border:  rgba(248,81,73,0.25);
  --base:         #3fb950;
  --base-dim:     rgba(63,185,80,0.08);
  --base-border:  rgba(63,185,80,0.25);
  --bull:         #58a6ff;
  --bull-dim:     rgba(88,166,255,0.08);
  --bull-border:  rgba(88,166,255,0.25);

  /* Алиасы цветов для обратной совместимости */
  --green:        #3fb950;
  --green-dim:    rgba(63,185,80,0.12);
  --green-border: rgba(63,185,80,0.25);
  --green-val:    #3fb950;
  --gold-val:     #d4a843;

  /* Шрифты */
  --display: 'Playfair Display', Georgia, serif;
  --body:    'DM Sans', system-ui, sans-serif;
  --mono:    'DM Mono', 'JetBrains Mono', 'Courier New', monospace;
  --sans:    'DM Sans', system-ui, sans-serif;  /* алиас для обратной совместимости */
}

/* ═══════════════════════════════════════════════════════════════════
   4. СБРОС И БАЗОВЫЕ СТИЛИ
═══════════════════════════════════════════════════════════════════ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  min-height: 100vh;
  /* overflow-x НЕ ставим на body — это ломает position:sticky в Safari/Chrome */
  transition: background 0.3s, color 0.3s;
}
/* overflow-x скрываем на обёртке, не на body */
.wrap {
  overflow-x: hidden;
}

/* Фоновый градиент — атмосфера страницы */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 15% 0%,  rgba(63,185,80,0.05)  0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 85% 100%, rgba(212,168,67,0.04) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════════
   5. DISCLAIMER BAR — предупреждение под nav
   НЕ sticky — прокручивается вместе со страницей
═══════════════════════════════════════════════════════════════════ */
.disclaimer-bar {
  background: rgba(63,185,80,0.08);
  border-bottom: 1px solid rgba(63,185,80,0.25);
  padding: 10px 24px;
  /* НЕ sticky, НЕ fixed — просто часть потока страницы */
  /* Показывается под nav-spacer, прокручивается вместе со страницей */
  transition: background 0.3s;
}
.disclaimer-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.disclaimer-bar-icon {
  font-size: 14px;
  color: var(--accent);
  flex-shrink: 0;
}
.disclaimer-bar-text {
  font-size: 12px;
  color: var(--text2);
  font-family: var(--mono);
  flex: 1;
  line-height: 1.5;
}
.disclaimer-bar-text strong { color: var(--text); }
.disclaimer-bar-text a     { color: var(--accent); text-decoration: none; }
.disclaimer-bar-text a:hover { text-decoration: underline; }
.disclaimer-bar-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.disclaimer-bar-close:hover { color: var(--text2); }

/* Logo banner removed — nav contains brand name */

/* ═══════════════════════════════════════════════════════════════════
   7. НАВИГАЦИЯ
═══════════════════════════════════════════════════════════════════ */
nav {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 10px 32px !important;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px); /* Safari */
  position: fixed;  /* fixed — гарантированно остаётся видимым всегда */
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--nav-bg);
  transition: background 0.3s, border-color 0.3s;
}
/* Компенсация высоты fixed nav — чтобы контент не прятался под ним */
.nav-spacer {
  height: 57px; /* высота nav */
  flex-shrink: 0;
}

/* Лого в nav */
.nav-logo        { flex-shrink: 0; }
.nav-logo-link   { display: flex; align-items: center; }
.nav-logo-img    { height: 36px; width: auto; object-fit: contain; }
.nav-logo-text   {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}
.nav-logo-text:hover  { color: var(--accent); }

/* Ссылки nav */
.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  font-size: 13px;
  color: var(--text2);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
  white-space: nowrap;
}
.nav-links a:hover  { color: var(--text); }
.nav-links a.active { color: var(--text); font-weight: 600; }

/* YouTube кнопка Subscribe */
.nav-cta {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--yt-red);
  color: #fff !important;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600 !important;
  font-size: 13px !important;
  transition: background 0.15s !important;
  white-space: nowrap;
  text-decoration: none;
}
.nav-cta:hover { background: var(--yt-red-hover) !important; }

.yt-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   8. ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ
═══════════════════════════════════════════════════════════════════ */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 10px 5px 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text2);
  font-family: var(--mono);
  transition: border-color 0.15s, background 0.3s;
  white-space: nowrap;
}
.theme-toggle:hover { border-color: var(--accent); }

/* Обратная совместимость — некоторые страницы используют .theme-toggle-btn */
.theme-toggle-btn { }
.theme-toggle-btn:hover { border-color: var(--accent); }

.toggle-track {
  width: 28px;
  height: 15px;
  border-radius: 8px;
  background: var(--toggle-track);
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
[data-theme="light"] .toggle-track { background: var(--accent); }

.toggle-thumb {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
[data-theme="light"] .toggle-thumb { transform: translateX(13px); }

/* ═══════════════════════════════════════════════════════════════════
   9. ПЕРЕКЛЮЧАТЕЛЬ ЯЗЫКА
═══════════════════════════════════════════════════════════════════ */
.lang-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text2);
  font-family: var(--mono);
  transition: border-color 0.15s, background 0.3s;
  white-space: nowrap;
}
.lang-toggle:hover { border-color: var(--blue); }

/* Активный язык */
.lang-toggle.active-lang,
.lang-toggle.de-active {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-dim);
}

/* ═══════════════════════════════════════════════════════════════════
   10. HAMBURGER МЕНЮ (мобильное)
═══════════════════════════════════════════════════════════════════ */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.15s;
  z-index: 201;
}
.hamburger:hover { background: var(--surface2); }

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ═══════════════════════════════════════════════════════════════════
   11. FOOTER
═══════════════════════════════════════════════════════════════════ */
footer {
  border-top: 1px solid var(--border);
  padding: 36px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  transition: border-color 0.3s;
}
.footer-brand {
  font-family: var(--display);
  font-size: 14px;
  color: var(--text3);
}
.footer-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-links a {
  font-size: 13px;
  color: var(--text3);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--text2); }

.footer-support {
  color: var(--gold) !important;
  font-weight: 600;
}
.footer-support:hover { color: var(--text) !important; }

.footer-copy {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
}

/* BMC секция над footer */
#bmc-wbtn, .bmc-btn-container, [id^="bmc"] {
  z-index: 150 !important;
}

/* ═══════════════════════════════════════════════════════════════════
   12. ОБЩИЕ КОМПОНЕНТЫ UI
═══════════════════════════════════════════════════════════════════ */

/* Кнопки */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--yt-red);
  color: #fff;
  padding: 14px 26px;
  border-radius: 7px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-primary:hover {
  background: var(--yt-red-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(255,0,0,0.25);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: transparent;
  color: var(--text);
  padding: 14px 26px;
  border-radius: 7px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.btn-secondary:hover {
  border-color: var(--accent-border);
  background: var(--surface);
}

/* Карточки */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: border-color 0.2s, background 0.3s;
}
.card:hover { border-color: var(--border2); }

/* Разделитель */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  max-width: 1200px;
  margin: 0 auto;
}

/* Анимация появления */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Метки секций */
.section-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

/* Статусные цвета текста */
.text-up,
.val-up,
.positive { color: var(--accent) !important; }

.text-down,
.val-down,
.negative { color: var(--red) !important; }

.text-gold { color: var(--gold) !important; }
.text-blue { color: var(--blue) !important; }
.text-muted { color: var(--text2); }

/* ═══════════════════════════════════════════════════════════════════
   13. ФОРМЫ И ИНПУТЫ — общие стили
═══════════════════════════════════════════════════════════════════ */
input, select, textarea {
  background: var(--input-bg, var(--surface2));
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 14px;
  padding: 8px 12px;
  transition: border-color 0.15s, background 0.3s;
  outline: none;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}
input::placeholder {
  color: var(--text3);
}

/* ═══════════════════════════════════════════════════════════════════
   14. АДАПТИВНОСТЬ — breakpoints
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  #themeLabel { display: none; }
}

@media (max-width: 960px) {
  nav { padding: 10px 18px !important; }

  .hamburger { display: flex; }

  .nav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 8px 18px 14px;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  }
  .nav-links.open { display: flex; }

  .nav-links li {
    border-bottom: 1px solid var(--border2);
  }
  .nav-links li:last-child { border-bottom: none; }

  .nav-links a {
    padding: 11px 0;
    font-size: 14px;
    display: block;
  }

  .theme-toggle,
  .lang-toggle {
    margin: 8px 0;
    background: none;
    border: none;
    padding: 8px 0;
    border-radius: 0;
    justify-content: flex-start;
  }
  .theme-toggle:hover,
  .lang-toggle:hover { background: none; border-color: transparent; }

  .nav-cta {
    padding: 11px 0;
    background: none !important;
    color: var(--red) !important;
    border-radius: 0;
    justify-content: flex-start;
  }
  .nav-cta:hover { background: none !important; }

  .logo-banner { min-height: 90px; padding: 22px 20px; }
  .logo-banner-text { font-size: clamp(20px, 5vw, 32px); }
}

@media (max-width: 700px) {
  footer {
    flex-direction: column;
    gap: 16px;
    padding: 32px 24px;
    text-align: center;
  }
  .footer-links {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .nav-logo-img { height: 28px; }
}
