/**
 * СТИЛЬ КОНТЕНТНОГО САЙТА. Один файл на все страницы, кэшируется браузером.
 *
 * Задача: человек приходит из поиска на статью, потом открывает приложение — и не
 * должен почувствовать, что попал в другое место. Поэтому палитра, шрифты и фон здесь
 * те же, что в приложении (client/src/styles.css).
 *
 * ⚠️ Сайт — ДЕСКТОПНЫЙ в первую очередь (в отличие от приложения, которое мобильное):
 * из поиска приходят и с ноутбуков. Колонка текста ограничена по ширине для читаемости,
 * а боковая навигация появляется только там, где для неё есть место.
 */

/* Шрифты — самохост, те же, что в приложении: заголовки Manrope, текст Nunito Sans.
   Без CDN: работает офлайн и там, где чужие домены недоступны. */
@font-face {
  font-family: 'Manrope'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/site/fonts/manrope-cyrillic-700-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/site/fonts/manrope-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/site/fonts/manrope-cyrillic-400-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/site/fonts/manrope-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Nunito Sans'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/site/fonts/nunito-sans-cyrillic-400-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Nunito Sans'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/site/fonts/nunito-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Nunito Sans'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/site/fonts/nunito-sans-cyrillic-600-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Nunito Sans'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/site/fonts/nunito-sans-latin-600-normal.woff2') format('woff2');
}

:root {
  --bg: #0b0820;
  --ink: #efeaff;
  --dim: rgba(239, 234, 255, 0.66);
  --faint: rgba(239, 234, 255, 0.42);
  --gold: #e7c873;
  --gold-deep: #b8923f;
  --violet: #8b6bd8;
  --line: rgba(255, 255, 255, 0.13);
  --card: rgba(255, 255, 255, 0.05);
  --shell: 1180px;
  --text-col: 44rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 400 17px/1.7 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Фон — тот же космос, что в приложении. Фиксируем: при прокрутке длинной статьи
   картинка стоит на месте, и страница не «едет» под текстом. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background: url('/site/bg.webp') center / cover no-repeat;
  opacity: 0.5;
}
/* Затемнение поверх фона: без него длинный текст на картинке нечитаем. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(11, 8, 32, 0.62) 0%, rgba(11, 8, 32, 0.9) 55%, var(--bg) 100%);
}

h1, h2, h3 { font-family: 'Manrope', system-ui, sans-serif; font-weight: 700; line-height: 1.15; }
a { color: var(--gold); text-decoration-color: rgba(231, 200, 115, 0.4); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--gold); }

/* ── Шапка ────────────────────────────────────────────────────────────────── */
.hdr {
  position: sticky; top: 0; z-index: 10;
  background: rgba(11, 8, 32, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.hdr__in {
  max-width: var(--shell); margin: 0 auto; padding: 12px 22px;
  display: flex; align-items: center; gap: 18px;
}
.hdr__logo {
  font-family: 'Manrope', sans-serif; font-weight: 700; font-size: 19px;
  color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 9px;
}
.hdr__logo img { width: 28px; height: 28px; border-radius: 50%; }
.hdr__nav { display: none; gap: 20px; margin-left: 8px; }
.hdr__nav a { color: var(--dim); text-decoration: none; font-size: 15px; }
.hdr__nav a:hover, .hdr__nav a[aria-current] { color: var(--ink); }
.hdr__side { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.langs { display: flex; gap: 8px; }
.langs a {
  font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--faint); text-decoration: none; padding: 4px 8px; border-radius: 8px;
}
.langs a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.07); }
.langs a[aria-current] { color: var(--bg); background: var(--gold); }
.hdr__cta {
  display: none; padding: 9px 18px; border-radius: 999px; font-size: 15px; font-weight: 600;
  color: #2b1c00; text-decoration: none; background: linear-gradient(180deg, #fff, var(--gold));
}

/* ── Каркас страницы ──────────────────────────────────────────────────────── */
.shell { max-width: var(--shell); margin: 0 auto; padding: 0 22px 90px; }
.hero { padding: 54px 0 30px; max-width: 52rem; }
.hero h1 { font-size: clamp(32px, 5.4vw, 54px); margin: 0 0 18px; }
.hero .lead { font-size: clamp(18px, 2.2vw, 21px); color: var(--ink); margin: 0; }
.hero .lead strong { color: var(--gold); font-weight: 600; }

.cols { display: block; }
.doc { max-width: var(--text-col); }
.doc h2 { font-size: clamp(22px, 3vw, 30px); margin: 46px 0 14px; }
.doc h2:first-child { margin-top: 26px; }
.doc p { margin: 0 0 16px; }
.doc ul { margin: 0 0 18px; padding-left: 22px; }
.doc li { margin-bottom: 8px; }
.doc small { color: var(--faint); }

/* Оглавление сбоку — только на широком экране, где есть свободное поле. */
.toc { display: none; }

/* ── Таблицы: главный формат этих страниц ────────────────────────────────── */
.tw {
  overflow-x: auto; margin: 0 0 22px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--card);
}
table { border-collapse: collapse; width: 100%; font-size: 15.5px; min-width: 460px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
th { color: var(--gold); font-weight: 600; font-size: 13px; letter-spacing: 0.05em; text-transform: uppercase; }

/* ── Карточки, врезки, вопросы ───────────────────────────────────────────── */
.card {
  border: 1px solid var(--line); border-radius: 18px; background: var(--card);
  padding: 20px 22px; margin: 0 0 20px;
}
.faq { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; padding: 15px 0; font-weight: 600; font-size: 17px;
  list-style: none; display: flex; align-items: baseline; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: '+'; color: var(--gold); font-size: 20px; line-height: 1; }
.faq[open] summary::before { content: '–'; }
.faq p { margin: 0 0 16px 26px; color: var(--dim); }

/* ── Призыв в приложение ─────────────────────────────────────────────────── */
.appbox {
  margin: 46px 0 0; padding: 30px; border-radius: 22px; max-width: var(--text-col);
  border: 1px solid rgba(231, 200, 115, 0.28);
  background: radial-gradient(120% 140% at 0% 0%, rgba(139, 107, 216, 0.28), rgba(255, 255, 255, 0.04));
}
.appbox h2 { margin: 0 0 8px; font-size: 24px; }
.appbox p { margin: 0 0 18px; color: var(--dim); }
.cta {
  display: inline-block; padding: 15px 30px; border-radius: 999px; font-weight: 700;
  color: #2b1c00; text-decoration: none; background: linear-gradient(180deg, #fff, var(--gold));
  box-shadow: 0 10px 30px rgba(231, 200, 115, 0.22);
}
.cta:hover { filter: brightness(1.05); }

/* ── Соседние страницы ───────────────────────────────────────────────────── */
.more { margin: 54px 0 0; }
.more h2 { font-size: 22px; margin: 0 0 16px; }
.more__grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.more__card {
  display: block; padding: 18px 20px; border-radius: 16px; text-decoration: none;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
.more__card:hover { border-color: rgba(231, 200, 115, 0.45); }
.more__card b { display: block; font-family: 'Manrope', sans-serif; margin-bottom: 4px; }
.more__card span { color: var(--faint); font-size: 15px; }

footer { max-width: var(--shell); margin: 0 auto; padding: 28px 22px 60px; color: var(--faint); font-size: 14.5px; border-top: 1px solid var(--line); }
footer a { color: var(--dim); }

/* ── Планшет ─────────────────────────────────────────────────────────────── */
@media (min-width: 720px) {
  .hdr__nav { display: flex; }
  .hdr__cta { display: inline-block; }
  .more__grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Десктоп: оглавление появляется сбоку, текст остаётся узким ──────────── */
@media (min-width: 1060px) {
  .cols { display: grid; grid-template-columns: minmax(0, var(--text-col)) 1fr; gap: 60px; align-items: start; }
  .toc {
    display: block; position: sticky; top: 86px; font-size: 15px;
    border-left: 1px solid var(--line); padding-left: 20px;
  }
  .toc b { display: block; color: var(--faint); font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 12px; }
  .toc a { display: block; color: var(--dim); text-decoration: none; padding: 5px 0; }
  .toc a:hover { color: var(--gold); }
  .more__grid { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
