/* ==========================================================================
   Хроники Рэкласта — прототип
   Направление «Летопись». Тёмная тема основная, светлая — по data-theme.
   Разделы: 1 токены · 2 база · 3 шапка/подвал · 4 типографика
            5 кнопки и чипы · 6 карточки сущностей · 7 цитаты
            8 спойлеры · 9 шкала времени · 10 фильтры · 11 термины
            12 поиск · 13 глоссарий · 14 связи · 15 телефон
   ========================================================================== */

/* 1 · Токены ------------------------------------------------------------- */

:root {
  --bg: #12100E;
  --surface: #17140F;
  --surface-2: #1F1B15;
  --surface-3: #221E1A;
  --line: #2A241E;
  --line-2: #332D26;
  --line-3: #40382E;
  --text: #EDE6DA;
  --text-2: #B6ADA0;
  --text-3: #8E8578;
  --text-4: #6E6659;

  --gold: #C9A227;
  --gold-bright: #E8C866;
  --gold-dim: #6E5F3A;
  --gold-bg: #2C2417;
  --gold-line: #4A3D22;
  --gold-mark: #3A2E12;
  --gold-mark-text: #F0DFA4;

  --ember: #D4674A;
  --ember-line: #6B3626;
  --ember-bg: #191210;

  --on-gold: #12100E;

  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Literata", Georgia, "Times New Roman", serif;
  --font-ui: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --wrap: 1344px;
  --gutter: 48px;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.6);
}

:root[data-theme="light"] {
  --bg: #F6F2E9;
  --surface: #FFFCF5;
  --surface-2: #EFE9DC;
  --surface-3: #FFFCF5;
  --line: #E2DACA;
  --line-2: #D2C7B2;
  --line-3: #BFB29A;
  --text: #1A1713;
  --text-2: #4B4439;
  --text-3: #6B6354;
  --text-4: #857C6B;

  --gold: #8A6A11;
  --gold-bright: #6E5409;
  --gold-dim: #A99668;
  --gold-bg: #F2E7C8;
  --gold-line: #D6C186;
  --gold-mark: #F3E2A8;
  --gold-mark-text: #3A2E12;

  --ember: #9E3517;
  --ember-line: #D3A08D;
  --ember-bg: #FBEDE7;

  --on-gold: #FFFCF5;
  --shadow: 0 14px 34px rgba(60, 46, 20, 0.18);
}

/* 2 · База --------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-bright); }

img { max-width: 100%; display: block; }

:where(button, a, input, select, summary):focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.vh {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.page { display: flex; flex-direction: column; min-height: 100vh; }
.page > main { flex-grow: 1; }

.cols { display: flex; gap: 64px; align-items: flex-start; }
.cols__main { flex-grow: 1; min-width: 0; }
.cols__side { width: 300px; flex-shrink: 0; position: sticky; top: 24px; }
.cols__rail { width: 248px; flex-shrink: 0; }

/* 3 · Шапка и подвал ----------------------------------------------------- */

.site-header {
  display: flex; align-items: center; gap: 28px;
  height: 76px; padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky; top: 0; z-index: 40;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand__name {
  font-family: var(--font-display); font-size: 23px; font-weight: 600;
  color: var(--text); letter-spacing: 0.02em;
}

.nav { display: flex; gap: 26px; }
.nav a { font-family: var(--font-ui); font-size: 15px; color: var(--text-2); }
.nav a[aria-current="page"] {
  color: var(--gold-bright);
  border-bottom: 1px solid var(--gold);
  padding-bottom: 2px;
}

.spacer { flex-grow: 1; }

.search-box {
  display: flex; align-items: center; gap: 10px;
  width: 300px; height: 40px; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--line-2);
}
.search-box input {
  flex-grow: 1; min-width: 0; background: transparent; border: 0; outline: none;
  color: var(--text); font-family: var(--font-ui); font-size: 14px;
}
.search-box--big { width: 100%; max-width: 840px; height: 64px; padding: 0 20px; border-color: var(--gold-line); }
.search-box--big input { font-size: 20px; }

.toggle-group { display: flex; align-items: center; gap: 9px; }
.toggle-group__label {
  font-family: var(--font-ui); font-size: 11px; color: var(--text-3);
  letter-spacing: 0.08em; text-transform: uppercase;
}

.site-footer {
  margin-top: 64px; padding: 32px var(--gutter) 40px;
  border-top: 1px solid var(--line);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 40px;
}
.site-footer p { margin: 0; max-width: 640px; font-size: 14px; line-height: 1.6; color: var(--text-3); }
.site-footer nav { display: flex; gap: 24px; }
.site-footer nav a { font-family: var(--font-ui); font-size: 14px; color: var(--text-2); }

/* 4 · Типографика -------------------------------------------------------- */

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; color: var(--text); margin: 0; }

.t-hero { font-size: clamp(48px, 7vw, 104px); line-height: 0.98; letter-spacing: -0.01em; }
.t-page { font-size: clamp(38px, 4.5vw, 62px); line-height: 1; }
.t-chapter { font-size: clamp(36px, 5vw, 76px); line-height: 1.03; }
.t-section { font-size: clamp(30px, 3vw, 40px); }
.t-card { font-size: 26px; line-height: 1.15; }

.eyebrow {
  font-family: var(--font-ui); font-size: 11px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold);
}
.eyebrow--mute { color: var(--text-3); }

.lead { font-size: 20px; line-height: 1.65; color: var(--text-2); text-wrap: pretty; }
.note { font-family: var(--font-ui); font-size: 13px; line-height: 1.55; color: var(--text-3); }
.name-en { font-family: var(--font-ui); font-size: 12px; color: var(--text-3); letter-spacing: 0.03em; }
.mono { font-family: var(--font-mono); font-size: 13px; }

.prose p { margin: 0 0 26px; font-size: 19px; line-height: 1.78; color: var(--text); text-wrap: pretty; }
.prose p.dim { color: var(--text-2); }
.prose .dropcap::first-letter {
  float: left; font-family: var(--font-display); font-size: 86px; line-height: 0.78;
  color: var(--gold); padding: 6px 14px 0 0;
}

mark { background: var(--gold-mark); color: var(--gold-mark-text); padding: 0 3px; }

.rule { height: 1px; background: var(--line); border: 0; margin: 0; }

.section-head {
  display: flex; align-items: baseline; gap: 16px;
  border-bottom: 1px solid var(--line-2); padding-bottom: 12px; margin-bottom: 24px;
}

/* 5 · Кнопки и чипы ------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 48px; padding: 0 22px;
  font-family: var(--font-ui); font-size: 15px; font-weight: 500;
  background: transparent; border: 1px solid var(--line-3); color: var(--text);
  cursor: pointer;
}
.btn:hover { border-color: var(--gold-line); color: var(--text); }
.btn--primary { background: var(--gold); border-color: var(--gold); color: var(--on-gold); font-weight: 600; }
.btn--primary:hover { background: var(--gold-bright); border-color: var(--gold-bright); color: var(--on-gold); }
.btn--spoiler { border-color: var(--ember-line); color: var(--ember); }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: 13px; }
.btn--block { width: 100%; }

.seg { display: flex; border: 1px solid var(--line-2); background: var(--surface-2); }
.seg__btn {
  min-height: 38px; padding: 0 14px; background: transparent; border: 0;
  border-left: 1px solid var(--line-2);
  font-family: var(--font-ui); font-size: 13px; font-weight: 500;
  color: var(--text-3); cursor: pointer;
}
.seg__btn:first-child { border-left: 0; }
.seg__btn[aria-pressed="true"], .seg__btn.is-on { background: var(--gold-bg); color: var(--gold-bright); }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 11px;
  background: var(--surface-2); border: 1px solid var(--line-2);
  font-family: var(--font-ui); font-size: 12px; color: var(--text-2);
}
.chip--game { background: var(--gold-bg); border-color: var(--gold-line); color: var(--gold-bright); font-weight: 500; }
.chip--draft { background: transparent; border-style: dashed; color: var(--text-3); }
.chip--spoiler { background: transparent; border-color: var(--ember-line); color: var(--ember); font-weight: 500; }
.chip--lg { height: 32px; padding: 0 13px; font-size: 13px; }
.chip__dot { width: 5px; height: 5px; background: currentColor; transform: rotate(45deg); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.chip-remove { background: none; border: 0; color: inherit; opacity: 0.7; cursor: pointer; font: inherit; padding: 0; }
.chip-remove:hover { opacity: 1; }

/* 6 · Карточки сущностей ------------------------------------------------- */

.grid { display: grid; gap: 20px; }
.grid--6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.e-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  color: inherit;
}
.e-card:hover { border-color: var(--gold-line); }
.e-card__body { padding: 15px 16px 17px; display: flex; flex-direction: column; gap: 5px; }
.e-card__name { font-family: var(--font-display); font-size: 25px; line-height: 1.15; color: var(--text); }
.e-card__sum { margin-top: 7px; font-size: 14px; line-height: 1.55; color: var(--text-2); }
.e-card__meta { margin-top: 6px; font-family: var(--font-ui); font-size: 12px; font-weight: 500; color: var(--text-2); }
.e-card__chips { display: flex; gap: 6px; margin-top: 11px; flex-wrap: wrap; }
.e-card__chips .chip { height: 24px; padding: 0 9px; font-size: 11px; }

.portrait {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
  height: 206px;
}
.portrait--sm { height: 176px; }
.portrait--lg { height: 330px; border: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.portrait__mono { font-family: var(--font-display); font-size: 52px; line-height: 1; color: var(--gold-dim); }
.portrait--lg .portrait__mono { font-size: 78px; }
.portrait__label {
  font-family: var(--font-ui); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-4);
}
.portrait svg { color: var(--line-3); }

.row-card {
  display: flex; align-items: center; gap: 18px;
  padding: 16px 20px; background: var(--surface); border: 1px solid var(--line);
  color: inherit;
}
.row-card:hover { border-color: var(--gold-line); }
.row-card__grow { flex-grow: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack--sm { gap: 8px; }

/* 7 · Цитаты ------------------------------------------------------------- */

.quote {
  margin: 0 0 16px; padding: 28px 32px 22px;
  background: var(--surface); border: 1px solid var(--line);
  position: relative;
}
.quote::before {
  content: "«";
  position: absolute; top: 6px; left: 15px;
  font-family: var(--font-display); font-size: 66px; line-height: 1;
  color: var(--gold-mark);
}
.quote__text {
  margin: 0 0 16px; position: relative;
  font-family: var(--font-display); font-size: 27px; line-height: 1.45;
  color: var(--text); font-style: italic;
}
.quote__orig {
  margin: 0 0 16px; padding: 15px 17px;
  background: var(--surface-2); border-left: 2px solid var(--line-2);
  font-size: 15px; line-height: 1.6; color: var(--text-3); font-style: italic;
}
.quote__missing {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; padding: 11px 14px; border: 1px dashed var(--line-2);
  font-family: var(--font-ui); font-size: 13px; color: var(--text-3);
}
.quote__tlnote {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 0 0 16px; padding: 11px 14px; border-left: 2px solid var(--gold-dim);
  background: var(--surface-2);
  font-family: var(--font-ui); font-size: 13px; line-height: 1.55; color: var(--text-2);
}
.quote__tlnote svg { flex: none; margin-top: 2px; }
.quote__tlnote b { color: var(--gold-bright); font-weight: 600; }
.quote__meta {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-top: 14px; border-top: 1px solid var(--line);
}
.quote__who { font-family: var(--font-ui); font-size: 14px; font-weight: 500; color: var(--text); }
.quote__src { font-family: var(--font-ui); font-size: 12px; color: var(--text-3); }
.quote__label {
  font-family: var(--font-ui); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-3);
}
.quote--dialogue::before { content: none; }
.quote__line { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.quote__line:last-of-type { border-bottom: 0; padding-left: 42px; }
.quote__speaker { display: block; font-family: var(--font-ui); font-size: 13px; font-weight: 500; color: var(--gold-bright); margin-bottom: 6px; }

.avatar {
  width: 34px; height: 40px; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 17px; color: var(--gold-dim);
}
.avatar--lg { width: 44px; height: 52px; font-size: 20px; }

.book-row { border: 1px solid var(--line); background: var(--surface); }
.book-row > summary {
  list-style: none; cursor: pointer;
  padding: 18px 22px; display: flex; align-items: center; gap: 14px;
}
.book-row > summary::-webkit-details-marker { display: none; }
.book-row__title { font-family: var(--font-display); font-size: 24px; color: var(--text); }
.book-row__body { padding: 0 22px 22px; font-size: 17px; line-height: 1.72; color: var(--text-2); }

.disclosure { border: 1px solid var(--line); background: var(--surface); margin-bottom: 14px; }
.disclosure > summary {
  list-style: none; cursor: pointer; padding: 16px 22px;
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-ui); font-size: 15px; font-weight: 500; color: var(--gold-bright);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure__body { padding: 0 22px 20px 46px; }
.disclosure__body p { margin: 0; font-size: 17px; line-height: 1.72; color: var(--text-2); }
.disclosure > summary svg { transition: transform 0.15s ease; transform: rotate(-90deg); }
.disclosure[open] > summary svg { transform: none; }

/* 8 · Спойлеры ----------------------------------------------------------- */

.spoiler__lock { display: none; }
.spoiler.is-locked > .spoiler__body { display: none !important; }
.spoiler.is-locked > .spoiler__lock {
  display: flex; align-items: center; gap: 18px;
  border: 1px solid var(--ember-line); background: var(--ember-bg);
  padding: 20px 24px;
}
.spoiler__lock p { margin: 0; flex-grow: 1; font-size: 15px; line-height: 1.6; color: var(--text-2); }
.spoiler__lock strong { display: block; font-family: var(--font-ui); font-size: 15px; color: var(--ember); margin-bottom: 6px; }
.spoiler__lock svg { flex-shrink: 0; color: var(--ember); }

.card-lock { display: none; }
.spoiler-card.is-locked .portrait { filter: blur(6px); }
.spoiler-card.is-locked .e-card__body > :not(.card-lock) { display: none; }
.spoiler-card.is-locked .card-lock { display: flex; flex-direction: column; gap: 9px; }
.card-lock__label { font-family: var(--font-ui); font-size: 12px; font-weight: 500; color: var(--ember); }
.card-lock__text { font-size: 13px; line-height: 1.5; color: var(--text-3); }

/* 9 · Шкала времени ------------------------------------------------------ */

.tl { margin: 0; padding: 0; list-style: none; }
.tl__item { display: flex; }
.tl__year {
  width: 118px; flex-shrink: 0; text-align: right; padding: 22px 20px 0 0;
  font-family: var(--font-ui); font-size: 14px; font-weight: 500; color: var(--text-2);
}
.tl__rail { width: 25px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; }
.tl__node { width: 9px; height: 9px; background: var(--gold); transform: rotate(45deg); margin-top: 26px; }
.tl__item--key .tl__node { width: 13px; height: 13px; margin-top: 24px; }
.tl__item--hidden .tl__node { background: transparent; border: 1px solid var(--ember-line); }
.tl__line { flex-grow: 1; width: 1px; background: var(--line); }
.tl__body { flex-grow: 1; padding: 18px 0 30px 20px; min-width: 0; }
.tl__title { display: block; font-family: var(--font-display); font-size: 28px; color: var(--text); margin-bottom: 8px; }
.tl__item--key .tl__title { font-size: 32px; }
.tl__sum { display: block; font-size: 16px; line-height: 1.65; color: var(--text-2); max-width: 720px; }

.era-band {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; background: var(--gold-bg); border: 1px solid var(--gold-line);
  margin-bottom: 20px;
}
.era-band strong { font-family: var(--font-ui); font-size: 15px; font-weight: 500; color: var(--gold-bright); }
.era-band span { font-family: var(--font-ui); font-size: 13px; color: var(--text-2); }

.era-list { margin: 0; padding: 0; list-style: none; }
.era-list li { display: flex; gap: 16px; padding: 13px 0; border-top: 1px solid var(--line); }
.era-list li:last-child { border-bottom: 1px solid var(--line); }
.era-list__year { width: 112px; white-space: nowrap; flex-shrink: 0; font-family: var(--font-ui); font-size: 12px; font-weight: 500; color: var(--text-3); padding-top: 3px; }
.era-list__name { font-family: var(--font-display); font-size: 22px; color: var(--text); }
.era-list li.is-here { background: var(--gold-bg); }

/* 10 · Фильтры ----------------------------------------------------------- */

.facet { margin-bottom: 26px; }
.facet__head {
  font-family: var(--font-ui); font-size: 11px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3);
  margin-bottom: 12px;
}
.facet__item {
  display: flex; align-items: center; gap: 11px; min-height: 36px; cursor: pointer;
  font-family: var(--font-ui); font-size: 15px; color: var(--text);
}
.facet__item input { width: 15px; height: 15px; accent-color: var(--gold); }
.facet__item span:first-of-type { flex-grow: 1; }
.facet__count { font-size: 13px; color: var(--text-3); }
.facet__item input:disabled + span { color: var(--text-3); }

.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 26px;
}
.toolbar__count { font-family: var(--font-ui); font-size: 14px; color: var(--text-2); }

select {
  height: 38px; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--line-2);
  color: var(--text); font-family: var(--font-ui); font-size: 14px;
}

.side-nav { display: flex; flex-direction: column; }
.side-nav a {
  padding: 9px 0 9px 14px; border-left: 2px solid var(--line);
  font-size: 15px; color: var(--text-2);
}
.side-nav a.is-on { border-left-color: var(--gold); color: var(--text); }

.panel { border: 1px solid var(--line); background: var(--surface); padding: 20px 22px; }
.panel__head {
  font-family: var(--font-ui); font-size: 11px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3);
  margin-bottom: 14px;
}
.panel--dashed { border-style: dashed; background: transparent; }
.panel--dashed p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-3); }

/* 11 · Термины ----------------------------------------------------------- */

.term { color: var(--text); border-bottom: 1px dotted var(--gold); cursor: help; }
.term:hover, .term[aria-expanded="true"] { color: var(--gold-bright); border-bottom-style: solid; }

.term-pop {
  position: absolute; z-index: 60; width: 320px;
  background: var(--surface-3); border: 1px solid var(--line-2);
  box-shadow: var(--shadow); padding: 16px;
  display: none; gap: 14px;
}
.term-pop.is-open { display: flex; }
.term-pop__thumb {
  width: 56px; height: 68px; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 24px; color: var(--gold-dim);
}
.term-pop__name { font-family: var(--font-display); font-size: 22px; line-height: 1.1; color: var(--text); }
.term-pop__sub { font-family: var(--font-ui); font-size: 11px; color: var(--text-3); margin-top: 4px; }
.term-pop__gloss { font-size: 14px; line-height: 1.5; color: var(--text-2); margin-top: 8px; }
.term-pop__link { display: inline-block; font-family: var(--font-ui); font-size: 12px; font-weight: 500; margin-top: 8px; }

/* 12 · Поиск ------------------------------------------------------------- */

.results { display: flex; flex-direction: column; gap: 30px; }
.results__group-head {
  font-family: var(--font-ui); font-size: 11px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold);
  margin-bottom: 14px;
}
.result__title { display: block; font-family: var(--font-display); font-size: 26px; color: var(--text); margin-bottom: 3px; }
.result__sub { display: block; font-family: var(--font-ui); font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.result__snippet { display: block; font-size: 15px; line-height: 1.5; color: var(--text-2); }
.didyoumean { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; font-size: 16px; color: var(--text-2); }
.didyoumean a { font-family: var(--font-display); font-size: 26px; border-bottom: 1px solid var(--gold); }
.empty { padding: 40px 0; font-size: 17px; color: var(--text-3); }

/* 13 · Глоссарий --------------------------------------------------------- */

.alpha { display: flex; flex-wrap: wrap; gap: 10px; }
.alpha a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 1px solid var(--line-2);
  font-family: var(--font-ui); font-size: 16px; font-weight: 500; color: var(--text-2);
}
.alpha a.is-on { background: var(--gold-bg); border-color: var(--gold-line); color: var(--gold-bright); }

.letter { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.letter span { font-family: var(--font-display); font-size: 44px; line-height: 1; color: var(--gold-dim); }
.letter i { flex-grow: 1; height: 1px; background: var(--line); }

.glossary { margin: 0 0 36px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; }
.glossary > div { padding: 16px 0; border-top: 1px solid var(--line); }
.glossary dt { display: flex; align-items: baseline; gap: 10px; margin-bottom: 7px; }
.glossary dt b { font-family: var(--font-display); font-size: 26px; font-weight: 600; color: var(--text); }
.glossary dd { margin: 0; font-size: 15px; line-height: 1.6; color: var(--text-2); }
.glossary dd + dd { margin-top: 10px; display: flex; gap: 7px; flex-wrap: wrap; }

.calendar { border: 1px solid var(--gold-line); background: var(--gold-bg); padding: 26px 30px; }
.calendar__cols { display: flex; gap: 40px; }
.calendar__cols > div { flex-grow: 1; flex-basis: 0; }
.calendar b { display: block; font-family: var(--font-display); font-size: 30px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.calendar p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--text-2); }

/* 14 · Связи ------------------------------------------------------------- */

.graph { background: var(--surface); border: 1px solid var(--line); padding: 20px; }
.graph svg { width: 100%; height: auto; }
.rel-list { margin: 0; padding: 0; list-style: none; }
.rel-list li { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.rel-list li:last-child { border-bottom: 1px solid var(--line); }
.rel-list__dot { width: 8px; height: 8px; flex-shrink: 0; }
.rel-list__name { font-family: var(--font-display); font-size: 23px; color: var(--text); flex-grow: 1; }
.rel-list__type { font-family: var(--font-ui); font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; }

/* 15 · Телефон ----------------------------------------------------------- */

.tabbar { display: none; }
.menu-btn, .nav-toggle { display: none; }

@media (max-width: 900px) {
  :root { --gutter: 16px; }
  body { font-size: 17px; }

  .site-header { height: 56px; padding: 0 10px; gap: 8px; }
  .site-header .nav,
  .site-header .search-box,
  .site-header .toggle-group__label { display: none; }
  .brand__name { font-size: 19px; }
  .menu-btn {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; background: transparent; border: 0; cursor: pointer;
  }

  body.nav-open .site-header .nav {
    display: flex; flex-direction: column; gap: 0;
    position: absolute; top: 56px; left: 0; right: 0; z-index: 45;
    background: var(--surface); border-bottom: 1px solid var(--line);
  }
  body.nav-open .site-header .nav a { padding: 15px 16px; border-bottom: 1px solid var(--line); }
  body.nav-open .site-header .nav a:last-child { border-bottom: 0; }

  .cols { flex-direction: column; gap: 28px; }
  .cols__side, .cols__rail { width: 100%; position: static; }

  .grid--6, .grid--4, .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--2 { grid-template-columns: minmax(0, 1fr); }
  .glossary { grid-template-columns: minmax(0, 1fr); }
  .calendar__cols { flex-direction: column; gap: 18px; }

  .prose p { font-size: 18px; }
  .prose .dropcap::first-letter { font-size: 66px; padding: 5px 11px 0 0; }

  .quote { padding: 22px 18px 16px; }
  .quote__text { font-size: 22px; }
  .quote__line:last-of-type { padding-left: 30px; }

  .tl__item { gap: 14px; }
  .tl__year { width: auto; text-align: left; padding: 0; }
  .tl__item { flex-wrap: wrap; }
  .tl__rail { display: none; }
  .tl__body { padding: 0 0 24px 0; border-left: 1px solid var(--line); padding-left: 16px; }
  .tl__title { font-size: 24px; }
  .tl__item--key .tl__title { font-size: 28px; }

  .graph { display: none; }

  .side-nav { flex-direction: row; overflow-x: auto; }
  .side-nav a { border-left: 0; border-bottom: 2px solid var(--line); white-space: nowrap; padding: 10px 14px; }
  .side-nav a.is-on { border-bottom-color: var(--gold); }

  .site-footer { flex-direction: column; gap: 20px; padding-bottom: 100px; }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    height: 70px; border-top: 1px solid var(--line); background: var(--surface);
  }
  .tabbar a {
    flex-grow: 1; flex-basis: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    color: var(--text-3); font-family: var(--font-ui); font-size: 11px; font-weight: 500;
  }
  .tabbar a[aria-current="page"] { color: var(--gold-bright); }

  .term-pop {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto;
    border-left: 0; border-right: 0; border-bottom: 0;
    padding: 20px 16px 26px;
  }
}

@media (max-width: 560px) {
  .grid--6, .grid--4, .grid--3, .grid--2 { grid-template-columns: minmax(0, 1fr); }
  .toolbar { gap: 8px; }
}

@media print {
  .site-header, .tabbar, .cols__rail, .term-pop { display: none; }
  body { background: #fff; color: #000; }
}

/* 16 · Главы из базы, сюжет, медиа --------------------------------------- */

.prose h2 { font-size: clamp(28px, 3vw, 38px); margin: 56px 0 18px; scroll-margin-top: 20px; }
.prose h3 { font-size: 27px; margin: 40px 0 14px; scroll-margin-top: 20px; }
.prose h4 { font-size: 22px; margin: 30px 0 12px; scroll-margin-top: 20px; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { margin: 0 0 26px; padding-left: 26px; font-size: 18px; line-height: 1.72; }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--gold-dim); }
.prose strong { color: var(--text); font-weight: 600; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.prose blockquote {
  margin: 0 0 26px; padding: 16px 22px; border-left: 2px solid var(--gold-line);
  background: var(--surface); color: var(--text-2); font-size: 17px; line-height: 1.7;
}
.prose blockquote p { font-size: inherit; margin: 0 0 10px; color: inherit; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 28px; font-size: 15px; line-height: 1.5; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
.prose th { font-family: var(--font-ui); font-size: 13px; font-weight: 600; color: var(--text-2); background: var(--surface); }
.prose code { font-family: var(--font-mono); font-size: 0.86em; color: var(--text-2); }
.prose a { color: var(--gold-bright); }
.prose a.term { color: var(--text); }
.prose .src-doc { margin: 64px 0 22px; padding-top: 26px; border-top: 2px solid var(--gold); }
.prose .src-doc:first-child { margin-top: 0; }

.diagram { margin: 0 0 30px; padding: 18px; border: 1px solid var(--line); background: var(--surface); overflow-x: auto; }
.diagram pre.mermaid { margin: 0; background: none; color: var(--text-3); font-size: 12px; white-space: pre; }
.diagram pre.mermaid[data-processed] { display: flex; justify-content: center; }
.diagram__cap { font-family: var(--font-ui); font-size: 12px; color: var(--text-3); margin-top: 10px; }

.spoiler.story-block { margin: 0 0 30px; }
.spoiler.story-block > .spoiler__body { border-left: 2px solid var(--ember-line); padding-left: 20px; }
.spoiler.story-block > .spoiler__body > .story-label {
  display: inline-block; font-family: var(--font-ui); font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ember); margin-bottom: 12px;
}

.avatar--img { overflow: hidden; padding: 0; }
.avatar--img img { width: 100%; height: 100%; object-fit: cover; }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.term-pop__thumb img { width: 100%; height: 100%; object-fit: cover; }
.portrait__credit { margin-top: 10px; }

.quote__sig { margin: -6px 0 14px; font-family: var(--font-ui); font-size: 13px; color: var(--text-3); }
.quote__note { margin: 0 0 12px; font-family: var(--font-ui); font-size: 13px; color: var(--gold-bright); }
.quote__link { font-family: var(--font-ui); font-size: 13px; color: var(--text-4); margin-left: 6px; }
.quote__link:hover { color: var(--gold-bright); }
.is-target { outline: 1px solid var(--gold); outline-offset: 6px; }
.quote-embed__lead { font-family: var(--font-ui); font-size: 13px; color: var(--gold-bright); margin: 0 0 10px; }

.tl__item--bg .tl__title { font-size: 23px; color: var(--text-2); }
.tl__title a { color: inherit; border-bottom: 1px dotted var(--gold); }

.video { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border: 1px solid var(--line); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-thumb {
  display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 16 / 9;
  background: var(--surface-2) center / cover no-repeat; border: 1px solid var(--line); cursor: pointer;
}

.bullets { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.bullets li { position: relative; padding-left: 30px; font-size: 19px; line-height: 1.6; }
.bullets li::before { content: "—"; color: var(--gold); position: absolute; left: 0; top: 0; }
.e-card__chips .chip, .era-list .chip, .panel .chip-row .chip, .chip--lg {
  height: auto; min-height: 24px; padding-top: 3px; padding-bottom: 3px; line-height: 1.35; white-space: normal;
}
.chip-row { flex-wrap: wrap; }

.src-list { margin: 0; padding: 0; list-style: none; font-family: var(--font-ui); font-size: 12px; line-height: 1.6; color: var(--text-3); word-break: break-word; }

@media (max-width: 900px) {
  .prose h2 { margin-top: 44px; }
  .prose ul, .prose ol { font-size: 17px; }
  .diagram { padding: 10px; }
}

@media (max-width: 900px) {
  .cols { align-items: stretch; }
  .cols > * { width: 100%; max-width: 100% !important; min-width: 0; }
  .spoiler.is-locked > .spoiler__lock { flex-wrap: wrap; padding: 16px; }
  .bullets li { font-size: 17px; }
}

/* 17 · Шрифт для чтения + атмосфера оформлением --------------------------
   Решение 2026-09-17: текст и интерфейс — Golos Text (шрифт для долгого чтения
   с экрана), заголовки и имена — PT Serif. Атмосферу дают орнаменты, рамки
   и фон, а не декоративный шрифт. */

:root, :root[data-theme="light"] {
  --font-display: "PT Serif", Georgia, "Times New Roman", serif;
  --font-body: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ui: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --orn: var(--gold-line);
}

body {
  font-size: 17px; line-height: 1.7;
  background:
    radial-gradient(ellipse 120% 70% at 50% -10%, rgba(201, 162, 39, 0.07), transparent 60%),
    radial-gradient(ellipse 90% 60% at 50% 110%, rgba(212, 103, 74, 0.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
:root[data-theme="light"] body {
  background:
    radial-gradient(ellipse 120% 70% at 50% -10%, rgba(138, 106, 17, 0.08), transparent 60%),
    var(--bg);
}

h1, h2, h3 { font-weight: 700; letter-spacing: -0.005em; }
.t-hero { font-size: clamp(40px, 5.6vw, 76px); line-height: 1.05; letter-spacing: -0.01em; }
.t-page { font-size: clamp(32px, 3.8vw, 48px); line-height: 1.1; }
.t-chapter { font-size: clamp(30px, 4vw, 54px); line-height: 1.12; }
.t-section { font-size: clamp(24px, 2.4vw, 30px); }
.brand__name { font-size: 19px; letter-spacing: 0.01em; }
.e-card__name { font-size: 20px; font-weight: 700; line-height: 1.25; }
.era-list__name { font-size: 17px; font-weight: 400; line-height: 1.4; }
.tl__title { font-size: 21px; font-weight: 700; line-height: 1.3; }
.tl__item--key .tl__title { font-size: 24px; }
.tl__item--bg .tl__title { font-size: 18px; }
.term-pop__name { font-size: 19px; font-weight: 700; }
.book-row__title { font-size: 19px; font-weight: 700; }
.lead { font-size: 19px; }
.prose p { font-size: 17.5px; line-height: 1.75; }
.prose ul, .prose ol { font-size: 17px; }
.prose h2 { font-size: clamp(24px, 2.6vw, 30px); }
.prose h3 { font-size: 21px; }
.prose h4 { font-size: 18px; }
.quote__text { font-size: 19px; line-height: 1.65; }
.bullets li { font-size: 17.5px; }

/* орнамент под главными заголовками: линия — ромб — линия */
.t-hero::after, .t-page::after, .t-chapter::after, .entity-title::after {
  content: ""; display: block; width: 176px; height: 14px; margin-top: 18px;
  background: var(--gold);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 176 14'%3E%3Cpath d='M0 7h70M106 7h70' stroke='black' stroke-width='1'/%3E%3Cpath d='M88 1l6 6-6 6-6-6z' fill='none' stroke='black' stroke-width='1.2'/%3E%3Cpath d='M88 4.5l2.5 2.5-2.5 2.5-2.5-2.5z' fill='black'/%3E%3Ccircle cx='76' cy='7' r='1.3' fill='black'/%3E%3Ccircle cx='100' cy='7' r='1.3' fill='black'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 176 14'%3E%3Cpath d='M0 7h70M106 7h70' stroke='black' stroke-width='1'/%3E%3Cpath d='M88 1l6 6-6 6-6-6z' fill='none' stroke='black' stroke-width='1.2'/%3E%3Cpath d='M88 4.5l2.5 2.5-2.5 2.5-2.5-2.5z' fill='black'/%3E%3Ccircle cx='76' cy='7' r='1.3' fill='black'/%3E%3Ccircle cx='100' cy='7' r='1.3' fill='black'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* ромб перед заголовками разделов */
.section-head::before {
  content: ""; width: 8px; height: 8px; flex-shrink: 0; align-self: center;
  border: 1px solid var(--gold); transform: rotate(45deg);
}
.prose h2::before {
  content: ""; display: inline-block; width: 9px; height: 9px; margin: 0 14px 0 2px;
  border: 1px solid var(--gold); background: var(--gold-bg); transform: translateY(-4px) rotate(45deg);
}

/* уголки у панелей, цитат и карточек */
.panel, .quote, .e-card, .calendar, .spoiler.is-locked > .spoiler__lock {
  background-image:
    linear-gradient(var(--orn), var(--orn)), linear-gradient(var(--orn), var(--orn)),
    linear-gradient(var(--orn), var(--orn)), linear-gradient(var(--orn), var(--orn)),
    linear-gradient(var(--orn), var(--orn)), linear-gradient(var(--orn), var(--orn)),
    linear-gradient(var(--orn), var(--orn)), linear-gradient(var(--orn), var(--orn));
  background-repeat: no-repeat;
  background-size: 16px 2px, 2px 16px, 16px 2px, 2px 16px, 16px 2px, 2px 16px, 16px 2px, 2px 16px;
  background-position: top left, top left, top right, top right, bottom left, bottom left, bottom right, bottom right;
}
.panel, .calendar { --orn: var(--gold-line); }
.quote { --orn: var(--gold-dim); position: relative; }
.e-card { --orn: var(--line-3); }
.e-card:hover { --orn: var(--gold); }
.spoiler.is-locked > .spoiler__lock { --orn: var(--ember); }

/* большая кавычка у цитаты — из стилей прототипа, шрифт для неё PT Serif */
.quote::before { font-family: "PT Serif", Georgia, serif; color: var(--gold-dim); opacity: 0.6; }

/* буквица в начале главы */
#text > p:first-child::first-letter,
#text > .src-doc + p::first-letter {
  float: left; font-family: var(--font-display); font-weight: 700; font-size: 3.3em; line-height: 0.9;
  color: var(--gold); padding: 4px 12px 0 0;
}

/* разделитель вместо простой линии */
.prose hr {
  border: 0; height: 14px; margin: 44px auto; width: 220px;
  background:
    linear-gradient(var(--line-3), var(--line-3)) left center / 90px 1px no-repeat,
    linear-gradient(var(--line-3), var(--line-3)) right center / 90px 1px no-repeat,
    radial-gradient(circle, var(--gold) 0 2px, transparent 2.5px) center / 14px 14px no-repeat,
    radial-gradient(circle, var(--gold-dim) 0 1.5px, transparent 2px) calc(50% - 16px) center / 10px 10px no-repeat,
    radial-gradient(circle, var(--gold-dim) 0 1.5px, transparent 2px) calc(50% + 16px) center / 10px 10px no-repeat;
}

/* золотая нить под шапкой и над подвалом */
.site-header { border-bottom: 0; box-shadow: 0 1px 0 var(--line); }
.site-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-line) 20%, var(--gold) 50%, var(--gold-line) 80%, transparent);
}
.site-footer { position: relative; border-top: 0; }
.site-footer::before {
  content: ""; position: absolute; left: var(--gutter); right: var(--gutter); top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-line), transparent);
}

/* блок «если совсем коротко» и шапка персонажа — как страница летописи */
.chapter-lead, .entity-hero {
  position: relative;
  background: linear-gradient(180deg, rgba(201, 162, 39, 0.05), transparent 70%);
}

.eyebrow { letter-spacing: 0.16em; }
.btn { letter-spacing: 0.01em; }

@media (max-width: 900px) {
  .t-hero { font-size: clamp(34px, 9vw, 44px); }
  .prose p { font-size: 17px; }
}

/* цитаты из игры — PT Serif (решение 2026-09-17) */
.quote__text, .quote__orig, .book-row__body, .prose blockquote, .quote--dialogue .quote__text {
  font-family: "PT Serif", Georgia, "Times New Roman", serif;
}
.quote__text { font-size: 19px; line-height: 1.6; font-style: normal; }
.quote__orig { font-style: italic; }
.book-row__body { font-size: 17px; line-height: 1.7; }
.quote:not(.quote--dialogue) { padding-left: 58px; }
.quote::before { font-size: 46px; top: 14px; left: 16px; }
.quote--dialogue::before { display: none; }
.brand__name { white-space: nowrap; }
@media (max-width: 900px) {
  .quote:not(.quote--dialogue) { padding-left: 18px; }
  .quote::before { display: none; }
}
