/**
 * Три визуальные темы сайта, переключаются в шапке.
 * Все остальные файлы стилей читают только семантические токены отсюда.
 *
 *  forest  — «Тёплый лес»: тёмная лесная база + янтарный акцент (по умолчанию)
 *  light   — «Светлый премиум»: светлая база, медный акцент, фото доминируют
 *  bright  — «Яркий контраст»: глубокий синий + жёлтый, капслок, максимум внимания
 */

:root,
html[data-theme='forest'] {
  /* Базовые поверхности */
  --paper: #f6f4ec;
  --paper-2: #ece9dd;
  --surface: #ffffff;

  /* Текст на светлом */
  --ink: #10231a;
  --ink-rgb: 16 35 26;

  /* Тёмные секции */
  --dark: #0d1f17;
  --dark-rgb: 13 31 23;
  --dark-2: #101c16;
  --veil-rgb: 8 18 13;

  /* Текст на тёмном / фото */
  --on-dark: #f7f4ec;
  --on-dark-rgb: 247 244 236;

  /* Акцент — единственный яркий цвет */
  --accent: #e9a73c;
  --accent-rgb: 233 167 60;
  --accent-ink: #201503;
  --accent-deep: #4f7a5d;

  /* Статусы участков */
  --free: #4f9a68;
  --reserved: #c4892c;
  --sold: #b85a4a;

  /* Форма */
  --radius: 14px;
  --radius-sm: 10px;
  --btn-radius: 999px;
  --photo-radius: 12px;
  --photo-border: 1px solid rgb(var(--ink-rgb) / 0.1);

  /* Типографика */
  --font: 'Montserrat', Arial, sans-serif;
  --display: 'Montserrat', Arial, sans-serif;
  --head-case: none;
  --head-weight: 700;
  --head-track: -0.02em;

  /* Плотность вуали на фото (0 — фото как есть, 1 — почти чёрное) */
  --veil-top: 0.14;
  --veil-bottom: 0.62;
  --veil-side: 0.5;

  /* Подсветка светлых секций */
  --glow: radial-gradient(900px 460px at 0% 0%, #e7efe2, transparent 62%);
  --hero-filter: saturate(1.06) contrast(1.03) brightness(1.06);
}

/* ---------- Светлый премиум ---------- */
html[data-theme='light'] {
  --paper: #faf7f1;
  --paper-2: #f0e9dd;
  --surface: #ffffff;

  --ink: #1d1a15;
  --ink-rgb: 29 26 21;

  --dark: #241f1a;
  --dark-rgb: 36 31 26;
  --dark-2: #2b251e;
  --veil-rgb: 24 19 14;

  --on-dark: #fbf8f2;
  --on-dark-rgb: 251 248 242;

  --accent: #b8632c;
  --accent-rgb: 184 99 44;
  --accent-ink: #fff6ee;
  --accent-deep: #8a6a45;

  --free: #4b8a5f;
  --reserved: #b8862f;
  --sold: #a85445;

  --radius: 20px;
  --radius-sm: 14px;
  --btn-radius: 999px;
  --photo-radius: 20px;
  --photo-border: 1px solid rgb(var(--ink-rgb) / 0.08);

  --head-case: none;
  --head-weight: 600;
  --head-track: -0.025em;

  --veil-top: 0.08;
  --veil-bottom: 0.5;
  --veil-side: 0.4;

  --glow: radial-gradient(900px 460px at 100% 0%, #f3e7d6, transparent 60%);
  --hero-filter: saturate(1.1) contrast(1.02) brightness(1.12);
}

/* ---------- Яркий контраст ---------- */
html[data-theme='bright'] {
  --paper: #f4f6fa;
  --paper-2: #e4e9f2;
  --surface: #ffffff;

  --ink: #101a2c;
  --ink-rgb: 16 26 44;

  --dark: #0e1b30;
  --dark-rgb: 14 27 48;
  --dark-2: #0a1424;
  --veil-rgb: 6 12 22;

  --on-dark: #ffffff;
  --on-dark-rgb: 255 255 255;

  --accent: #ffc531;
  --accent-rgb: 255 197 49;
  --accent-ink: #14202f;
  --accent-deep: #2f5b9a;

  --free: #3fa06a;
  --reserved: #e0a521;
  --sold: #d1584a;

  --radius: 6px;
  --radius-sm: 4px;
  --btn-radius: 6px;
  --photo-radius: 6px;
  --photo-border: 1px solid rgb(var(--ink-rgb) / 0.12);

  --head-case: uppercase;
  --head-weight: 800;
  --head-track: -0.01em;

  --veil-top: 0.2;
  --veil-bottom: 0.68;
  --veil-side: 0.55;

  --glow: radial-gradient(900px 460px at 0% 0%, #dfe7f6, transparent 62%);
  --hero-filter: saturate(1.12) contrast(1.08) brightness(1.04);
}

/* ---------- Переключатель тем ---------- */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgb(var(--on-dark-rgb) / 0.28);
  border-radius: 999px;
  flex-shrink: 0;
}
.theme-switch button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  background: transparent;
  display: inline-grid;
  place-items: center;
  transition: transform 0.18s ease;
}
.theme-switch button::before {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.18);
  background: var(--dot, #fff);
}
.theme-switch button:hover { transform: scale(1.12); }
.theme-switch button[aria-pressed='true'] {
  box-shadow: 0 0 0 2px rgb(var(--on-dark-rgb) / 0.85);
}
.theme-switch button[data-theme-key='forest'] {
  --dot: linear-gradient(135deg, #1a3a2c 50%, #e9a73c 50%);
}
.theme-switch button[data-theme-key='light'] {
  --dot: linear-gradient(135deg, #faf7f1 50%, #b8632c 50%);
}
.theme-switch button[data-theme-key='bright'] {
  --dot: linear-gradient(135deg, #0e1b30 50%, #ffc531 50%);
}

/* Строка в мобильном меню — на десктопе скрыта */
.theme-switch-row {
  display: none;
}
.theme-switch-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.78;
}

@media (max-width: 960px) {
  /* Убираем переключатель из основной полосы шапки */
  .theme-switch--bar {
    display: none !important;
  }

  .theme-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 2px;
    padding-top: 14px;
    border-top: 1px solid rgb(var(--on-dark-rgb) / 0.2);
  }

  .theme-switch--menu {
    padding: 3px;
    gap: 2px;
  }

  .theme-switch--menu button {
    width: 24px;
    height: 24px;
  }

  .theme-switch--menu button::before {
    width: 14px;
    height: 14px;
  }
}

@media (min-width: 961px) {
  .theme-switch-row {
    display: none !important;
  }
}

/* ---------- Тематические структурные различия ---------- */

/* Светлый премиум: секции «условия» и «финал» становятся светлыми,
   а фото работают как крупные плашки внутри светлой сетки. */
html[data-theme='light'] .promise {
  background: var(--paper);
}
html[data-theme='light'] .infra { background: var(--paper-2); }
html[data-theme='light'] .finance-fade {
  background: linear-gradient(180deg, transparent 0%, var(--paper-2) 100%);
}
html[data-theme='light'] .section-wave {
  color: var(--paper-2);
}

/* Яркий контраст: заглавные заголовки, плотные плашки, жёсткая сетка */
html[data-theme='bright'] .kicker {
  color: var(--accent);
  font-weight: 800;
}
html[data-theme='bright'] .btn-light {
  background: var(--accent);
  color: var(--accent-ink);
}
html[data-theme='bright'] .btn-dark {
  background: var(--accent);
  color: var(--accent-ink);
}
html[data-theme='bright'] .hero-brand,
html[data-theme='bright'] .story-copy h2,
html[data-theme='bright'] .promise-head h2,
html[data-theme='bright'] .map-intro h2,
html[data-theme='bright'] .finance-inner h2,
html[data-theme='bright'] .infra-head h2,
html[data-theme='bright'] .finale-copy h2,
html[data-theme='bright'] .team-head h2,
html[data-theme='bright'] .projects-intro h2 {
  text-transform: uppercase;
  font-weight: 800;
  line-height: 0.92;
}
html[data-theme='bright'] .promise {
  background: var(--paper);
  color: var(--ink);
}
html[data-theme='bright'] .promise-item {
  border-color: rgb(var(--ink-rgb) / 0.14);
}
html[data-theme='bright'] .promise-list {
  border-top-color: rgb(var(--ink-rgb) / 0.14);
}
html[data-theme='bright'] .promise-item p {
  color: rgb(var(--ink-rgb) / 0.68);
}
html[data-theme='bright'] .promise-item .n { color: var(--ink); }
