/* ============================================================
   КРУГ ВЛАСТИ — стили главной страницы
   Слои (z-index): стена лиц (0) → оверлей (1) → герой (5) →
                   навигация (10) → модальное окно (20)
   ============================================================ */

:root {
  --bg: #0b0806;
  --red: #e0263e;
  --red-soft: rgba(224, 38, 62, .55);
  --text: #e8e0d2;
  --muted: #a99f8c;
  --font-display: Georgia, 'Times New Roman', serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  overflow-x: hidden;
}

/* ===== Стена кубов-инфографики ===== */
#cube-wall {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: grid;
  /* количество колонок задаёт app.js через CSS-переменную */
  grid-template-columns: repeat(var(--cols, 12), 1fr);
  align-content: start;
  overflow: hidden;      /* нижний ряд может выйти за экран — обрезаем */
}

/* Куб: пиктограмма (или крупная цифра) + подпись.
   Акцентный цвет темы приходит из JS через переменную --accent. */
.cube {
  /* СТРОГО одинаковые квадраты: ширина колонки равная (1fr),
     а aspect-ratio привязывает высоту к ширине — содержимое
     (длина подписи и т.п.) на размер не влияет */
  aspect-ratio: 1 / 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(232, 224, 210, .06);
  background:
    radial-gradient(circle at 30% 25%, rgba(232, 224, 210, .04), transparent 70%);
  opacity: 0;                          /* появление и смена кубов — через opacity */
  transition: opacity .6s ease;        /* длительность синхронизирована с FADE в app.js */
}

.cube.is-visible { opacity: 1; }

.cube svg {
  width: 44%;
  height: auto;
  opacity: .85;
}

.cube__stat {
  font-size: clamp(15px, 1.8vw, 24px);
  color: var(--accent, var(--muted));
  letter-spacing: .05em;
  line-height: 1;
}

.cube__label {
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-align: center;
  color: var(--accent, var(--muted));
  opacity: .65;
}

/* ===== Тёмный оверлей поверх кубов ===== */
#overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 45%,
    rgba(11, 8, 6, .55) 0%,
    rgba(11, 8, 6, .78) 68%,
    rgba(11, 8, 6, .90) 100%
  );
}

/* ===== Навигация ===== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 48px;
}

.nav__logo {
  letter-spacing: .35em;
  font-size: 14px;
  color: var(--muted);
  user-select: none;
  cursor: pointer;          /* клик по логотипу возвращает доску на лицевую сторону */
}

.nav nav { display: flex; gap: 36px; }

.nav__link {
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  letter-spacing: .25em;
  text-transform: uppercase;
  padding: 6px 2px;
  position: relative;
  transition: color .3s;
}

.nav__link::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  height: 1px; width: 0;
  background: var(--red);
  transition: width .35s ease;
}

.nav__link:hover { color: #fff; }
.nav__link:hover::after { width: 100%; }

/* Призыв к действию «Войти в круг»: акцентный красный, как ссылка-кнопка */
.nav__link--cta { color: var(--red); text-decoration: none; }
.nav__link--cta::after { background: var(--red); }
.nav__link--cta:hover { color: #ff5a72; }

/* ===== Доска (3D-поворот между героем и страницей) ===== */
/* Сцена задаёт перспективу — от неё зависит «глубина» поворота доски */
.stage {
  position: relative;
  z-index: 5;
  perspective: 1800px;
}

/* Поворот «через ребро»: JS доворачивает доску до 90° (в этот момент она
   видна в торец и содержимое неразличимо), подменяет видимую сторону и
   доводит поворот с противоположного края. Так не нужны preserve-3d и
   backface-visibility — их ломает mix-blend-mode гравюры внутри 3D-контекста.
   Длительности поворотов задаёт JS инлайн (PageBoard.DURATION / 2). */
.board {
  position: relative;
  transition: transform .45s cubic-bezier(.45, .05, .2, 1);
}

.board__front { position: relative; }

.board__back {
  position: absolute;
  top: 0; left: 0; right: 0;
  /* Ровно высота окна, а не всей доски: герой может быть выше экрана,
     и центрирование по доске уводило бы панель из видимой области.
     JS при открытии дополнительно скроллит окно к верху. */
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 84px 20px 28px;
}

/* Скрытая сторона доски (hidden ставит JS); класс+атрибут по специфичности
   перекрывают display:flex оборотной стороны */
.board__face[hidden] { display: none; }

/* ===== Герой-блок ===== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 96px 20px 60px;
}

.hero__tree {
  width: min(78vw, 540px);
  position: relative;
}

/* Инлайн-эмблема «люди у костра»: прозрачный SVG ложится штриховым
   рисунком поверх затемнённой стены кубов; анимация пламени — внутри SVG. */
.hero__tree svg {
  width: 100%;
  height: auto;
  display: block;
  position: relative;
  z-index: 1;
}

/* Красное «дыхание» за костром: псевдоэлемент под SVG усиливает ореол
   пламени. opacity/transform вместо анимации drop-shadow — дёшево для GPU. */
.hero__tree::before {
  content: '';
  position: absolute;
  left: 50%;                 /* центр свечения совпадает с костром на эмблеме */
  top: 51%;
  width: 46%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle,
    rgba(224, 38, 62, .42) 0%,
    rgba(224, 38, 62, .14) 45%,
    transparent 70%);
  animation: heartGlow 3s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

/* Кристалл на новой гравюре уже прокрашен красным в самом изображении,
   поэтому отдельная multiply-подкраска не нужна — достаточно свечения. */

@keyframes heartGlow {
  0%, 100% { opacity: .45; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 1;   transform: translate(-50%, -50%) scale(1.15); }
}

.hero__title {
  margin-top: 26px;
  font-size: clamp(22px, 3.4vw, 38px);
  font-weight: 400;
  letter-spacing: .12em;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .8);
}

.hero__subtitle {
  margin-top: 14px;
  max-width: 560px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  font-style: italic;
  text-shadow: 0 2px 16px rgba(0, 0, 0, .8);
}

/* ===== Панель страницы (оборотная сторона доски) ===== */
.page-panel {
  position: relative;
  width: min(700px, 100%);
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  background: #14100b;
  border: 1px solid rgba(224, 38, 62, .25);
  box-shadow: 0 0 60px rgba(224, 38, 62, .12);
  padding: 46px 50px;
}

.page-panel__close {
  position: absolute;
  top: 14px; right: 18px;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  transition: color .3s, transform .3s;
}

.page-panel__close:hover { color: var(--red); transform: rotate(90deg); }

.page-panel__title {
  font-weight: 400;
  font-size: 26px;
  letter-spacing: .08em;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(224, 38, 62, .3);
}

/* Типографика контента, приходящего из CMS (Quill HTML) */
.page-panel__body { line-height: 1.75; font-size: 16px; color: #d9d1c2; }
.page-panel__body p { margin: 0 0 14px; }
.page-panel__body h2, .page-panel__body h3 { font-weight: 400; margin: 22px 0 10px; color: var(--text); }
.page-panel__body a { color: var(--red); text-decoration: underline; text-underline-offset: 3px; }
.page-panel__body a:hover { color: #ff5a72; }
.page-panel__body img { max-width: 100%; height: auto; display: block; margin: 16px 0; }
.page-panel__body ul, .page-panel__body ol { margin: 0 0 14px 22px; }
.page-panel__body blockquote {
  margin: 18px 0;
  padding: 4px 0 4px 18px;
  border-left: 2px solid var(--red);
  color: var(--muted);
  font-style: italic;
}

/* ===== Панель-рамка портала «Круг» (iframe на обороте доски) ===== */
.page-panel--frame {
  width: min(780px, 100%);
  max-height: calc(100vh - 120px);
  padding: 38px 12px 12px;   /* сверху — место под крестик закрытия */
  overflow: hidden;
}

.circle-frame {
  display: block;
  width: 100%;
  height: min(76vh, 680px);
  border: 0;
  border-radius: 6px;
  background: #0b0806;
}

/* ===== Форма обратной связи (раздел «Контакты») ===== */
.cform {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(224, 38, 62, .3);
}

.cform__row { margin-bottom: 12px; }

.cform__row--split {
  display: flex;
  gap: 12px;
}
.cform__row--split .cform__input { flex: 1; min-width: 0; }

.cform__input {
  width: 100%;
  background: #0e0b07;
  border: 1px solid rgba(232, 224, 210, .18);
  border-radius: 4px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 11px 13px;
  transition: border-color .25s, box-shadow .25s;
}

.cform__input::placeholder { color: #6f6656; }

.cform__input:focus {
  outline: none;
  border-color: var(--red-soft);
  box-shadow: 0 0 0 3px rgba(224, 38, 62, .12);
}

.cform__textarea { resize: vertical; min-height: 96px; line-height: 1.6; }

/* Honeypot: убираем из виду и людей, и скринридеров, но оставляем в DOM */
.cform__hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.cform__foot {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
}

.cform__submit {
  background: var(--red);
  color: #fff;
  border: 0;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 11px 26px;
  cursor: pointer;
  transition: background .25s, opacity .25s;
}

.cform__submit:hover { background: #ff3a54; }
.cform__submit:disabled { opacity: .55; cursor: default; }

.cform__status { font-size: 14px; color: var(--muted); }
.cform__status.is-ok { color: #7fc98a; }
.cform__status.is-error { color: #ff6b7e; }

/* ===== Копирайт в подвале ===== */
.site-copyright {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 6;
  text-align: center;
  padding: 12px 20px;
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--muted);
  opacity: .7;
  pointer-events: none;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .9);
}

/* ===== Мобильная адаптация ===== */
@media (max-width: 640px) {
  .nav { padding: 18px 20px; flex-direction: column; gap: 12px; }
  .nav nav { gap: 20px; }
  .nav__link { font-size: 11px; letter-spacing: .18em; }
  .hero { padding-top: 130px; }
  .board__back { padding: 120px 14px 30px; }
  .page-panel { padding: 34px 24px; }
}
