/* ============ Палитра и базовые токены ============ */
:root {
  --bg: #0f1424;
  --bg-2: #161c31;
  --bg-3: #1d2540;
  --ink: #f2ecdc;
  --ink-2: #b9b3a3;
  --gold: #d9a441;
  --gold-2: #f3d38a;
  --red: #c8202f;
  --red-2: #e0483f;
  --blue: #4fb3e8;
  --green: #6fbf73;
  --line: rgba(243, 211, 138, 0.18);
  --radius: 18px;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --maxw: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--serif); line-height: 1.12; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(2.6rem, 6vw, 4.8rem); font-weight: 900; letter-spacing: -.01em; }
h1 em { font-style: italic; color: var(--gold-2); }
h2 { font-size: clamp(1.9rem, 4vw, 3rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
a { color: var(--gold-2); }
ul { padding-left: 1.1em; margin: 0; }
b { font-weight: 700; }
svg { display: block; }

.container { width: min(var(--maxw), 100% - 2.5rem); margin-inline: auto; }
.eyebrow {
  text-transform: uppercase; letter-spacing: .22em; font-size: .75rem; font-weight: 700;
  color: var(--gold); margin-bottom: .8em;
}
.section { padding: clamp(4rem, 9vw, 7.5rem) 0; position: relative; }
.section--alt { background: var(--bg-2); }
.section__lead { font-size: 1.15rem; color: var(--ink-2); max-width: 62ch; margin-bottom: 2.5rem; }

/* ============ Reveal-анимации ============ */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ============ Прогресс и навигация ============ */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60; background: transparent; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--red), var(--gold-2)); transition: width .1s linear; }

.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem 1.25rem;
  background: rgba(15, 20, 36, .78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav__brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); font-family: var(--serif); font-weight: 700; font-size: 1.05rem; }
.nav__seal { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ffe9a8, #b8862b 70%); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--gold); }
.nav__links { list-style: none; display: flex; gap: .2rem; margin: 0; padding: 0; }
.nav__links a { display: block; padding: .45rem .8rem; border-radius: 999px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .9rem; transition: .2s; }
.nav__links a:hover, .nav__links a.is-active { color: var(--ink); background: rgba(243, 211, 138, .12); }
.nav__toggle { display: none; background: none; border: 0; padding: .4rem; cursor: pointer; }
.nav__toggle span { display: block; width: 24px; height: 2px; background: var(--ink); margin: 5px 0; transition: .3s; }
@media (max-width: 820px) {
  .nav__toggle { display: block; }
  .nav__links { position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; background: var(--bg-2); border-bottom: 1px solid var(--line); padding: .6rem; display: none; }
  .nav__links.is-open { display: flex; }
}

/* ============ Hero ============ */
.hero { position: relative; overflow: hidden; padding: clamp(3rem, 8vw, 6rem) 0 3rem; }
.hero__bg { position: absolute; inset: 0; pointer-events: none; }
.hero__rays {
  position: absolute; inset: -30% -10% auto auto; width: 70vw; height: 70vw; max-width: 900px; max-height: 900px;
  background: conic-gradient(from 180deg, transparent 0 8deg, rgba(217,164,65,.09) 8deg 12deg, transparent 12deg 30deg, rgba(217,164,65,.06) 30deg 34deg, transparent 34deg 60deg, rgba(217,164,65,.09) 60deg 64deg, transparent 64deg 100deg, rgba(217,164,65,.06) 100deg 104deg, transparent 104deg);
  border-radius: 50%; filter: blur(2px); animation: spin 90s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hero__grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(243,211,138,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(243,211,138,.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 30% 40%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000 0%, transparent 70%);
}
.hero__inner { position: relative; display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: center; }
.hero__sub { font-family: var(--serif); font-size: 1.5rem; margin-top: -.4rem; }
.hero__sub .years { color: var(--gold-2); margin-left: .5rem; white-space: nowrap; }
.hero__lead { font-size: 1.2rem; max-width: 52ch; color: var(--ink-2); }
.hero__quote { margin: 1.4rem 0 1.8rem; padding-left: 1.1rem; border-left: 3px solid var(--red); font-family: var(--serif); font-style: italic; font-size: 1.08rem; color: var(--ink); max-width: 55ch; }
.hero__quote cite { display: block; font-style: normal; font-family: var(--sans); font-size: .82rem; color: var(--ink-2); margin-top: .5rem; }
.btn {
  display: inline-flex; align-items: center; gap: .6rem; padding: .85rem 1.5rem; border-radius: 999px;
  background: var(--red); color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .02em;
  box-shadow: 0 10px 30px rgba(200,32,47,.35); transition: transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(200,32,47,.45); }

.hero__figure { display: flex; justify-content: center; }
.seal { width: min(100%, 420px); filter: drop-shadow(0 20px 50px rgba(217,164,65,.25)); }
.seal__ring { fill: none; stroke: var(--gold); stroke-width: 2; }
.seal__ring--outer { stroke-width: 5; stroke: var(--gold-2); }
.seal__text { font-family: var(--sans); font-size: 15px; font-weight: 700; letter-spacing: .18em; fill: var(--gold-2); }
.seal__rays { transform-origin: 210px 210px; animation: spin 40s linear infinite; }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; margin-top: 3.5rem; position: relative; }
.stat { background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1rem; text-align: center; }
.stat b { display: block; font-family: var(--serif); font-size: 2.6rem; color: var(--gold-2); line-height: 1; margin-bottom: .35rem; }
.stat span { font-size: .85rem; color: var(--ink-2); line-height: 1.3; display: block; }
@media (max-width: 960px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__figure { order: -1; }
  .seal { width: min(70%, 320px); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats .stat:last-child { grid-column: span 2; }
}

/* ============ Эпоха ============ */
.epoch-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 2rem; align-items: start; }
@media (max-width: 960px) { .epoch-grid { grid-template-columns: 1fr; } }
.map { margin: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #0f1a2e; }
.map__svg { width: 100%; height: auto; font-family: var(--sans); }
.map figcaption { padding: .8rem 1.1rem; font-size: .85rem; color: var(--ink-2); background: var(--bg-3); }
.map__land { fill: #2a3450; stroke: #46557a; stroke-width: 2; }
.map__water { fill: #1d4f7a; }
.map__river { fill: none; stroke: #1d4f7a; stroke-width: 6; stroke-linecap: round; }
.map__river--big { stroke-width: 9; }
.map__lbl { font-size: 13px; fill: var(--ink); font-weight: 600; }
.map__lbl--water { fill: #8cc7ee; font-weight: 500; font-style: italic; text-anchor: middle; }
.map__lbl.small, .city text.small { font-size: 11px; }
.map__note { font-size: 11px; fill: var(--ink-2); text-anchor: middle; letter-spacing: .1em; text-transform: uppercase; }
.city circle { fill: var(--gold-2); stroke: var(--bg); stroke-width: 2; }
.city text { font-size: 13px; fill: var(--ink); font-weight: 700; }
.city--horde circle { fill: var(--red-2); }
.threat path { fill: none; stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 6 5; animation: dash 1.4s linear infinite; }
.threat--west path { stroke: var(--blue); }
.threat--east path { stroke: var(--red-2); }
.threat text { font-size: 13px; font-weight: 700; }
.threat--west text { fill: #9ad6f7; }
.threat--east text { fill: #ff9c94; }
@keyframes dash { to { stroke-dashoffset: -22; } }

.forces { display: grid; gap: 1rem; }
.force { background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.4rem; position: relative; border-left-width: 5px; }
.force--west { border-left-color: var(--blue); }
.force--east { border-left-color: var(--red-2); }
.force--inner { border-left-color: var(--gold); }
.force__icon { width: 34px; height: 34px; margin-bottom: .6rem; }
.force--west .force__icon { color: var(--blue); }
.force--east .force__icon { color: var(--red-2); }
.force--inner .force__icon { color: var(--gold-2); }
.force h3 { font-size: 1.2rem; }
.force ul { list-style: none; padding: 0; display: grid; gap: .3rem; font-size: .95rem; color: var(--ink-2); }
.force ul b { color: var(--ink); }
.force__aim { margin: .9rem 0 0; font-weight: 700; font-size: .9rem; color: var(--gold-2); }
.force__aim i { font-style: italic; }

/* ============ Хроника ============ */
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 2.5rem; }
.chip { border: 1px solid var(--line); background: transparent; color: var(--ink-2); padding: .5rem 1.1rem; border-radius: 999px; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; transition: .2s; }
.chip:hover { color: var(--ink); }
.chip.is-active { background: var(--gold-2); color: var(--bg); border-color: var(--gold-2); }
.chip--life.is-active { background: var(--gold-2); }
.chip--epoch.is-active { background: var(--blue); border-color: var(--blue); }

.tl { list-style: none; padding: 0; margin: 0; position: relative; }
.tl::before { content: ''; position: absolute; left: 120px; top: 0; bottom: 0; width: 2px; background: linear-gradient(var(--gold), var(--red) 60%, var(--gold-2)); opacity: .5; }
.tl__item { display: grid; grid-template-columns: 96px 1fr; gap: 3rem; padding: .9rem 0; position: relative; transition: opacity .3s, transform .3s; }
.tl__item::before {
  content: ''; position: absolute; left: 120px; top: 1.7rem; width: 14px; height: 14px; border-radius: 50%;
  transform: translateX(-6px); background: var(--gold-2); box-shadow: 0 0 0 5px var(--bg-2);
}
.tl__item[data-kind="epoch"]::before { background: var(--blue); }
.tl__item--key::before { width: 20px; height: 20px; transform: translate(-9px, -3px); background: var(--red); box-shadow: 0 0 0 5px var(--bg-2), 0 0 0 9px rgba(200,32,47,.25); }
.tl__item.is-hidden { display: none; }
.tl__year { text-align: right; font-family: var(--serif); font-weight: 700; font-size: 1.35rem; color: var(--gold-2); line-height: 1.15; padding-top: .9rem; }
.tl__item[data-kind="epoch"] .tl__year { color: var(--blue); }
.tl__card { background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.4rem 1.2rem 4.4rem; position: relative; }
.tl__item--key .tl__card { border-color: rgba(200,32,47,.55); background: linear-gradient(135deg, rgba(200,32,47,.16), var(--bg-3) 55%); }
.tl__item[data-kind="epoch"] .tl__card { background: linear-gradient(135deg, rgba(79,179,232,.1), var(--bg-3) 50%); }
.tl__icon { position: absolute; left: 1.2rem; top: 1.25rem; width: 34px; height: 34px; color: var(--gold-2); }
.tl__item[data-kind="epoch"] .tl__icon { color: var(--blue); }
.tl__item--key .tl__icon { color: var(--red-2); }
.tl__card h3 { font-size: 1.2rem; }
.tl__card p { margin: 0; color: var(--ink-2); font-size: .98rem; }
.tl__card p b, .tl__card p i { color: var(--ink); }
.tl__link { display: inline-block; margin-top: .6rem; font-size: .85rem; font-weight: 700; text-decoration: none; }
@media (max-width: 700px) {
  .tl::before, .tl__item::before { left: 10px; }
  .tl__item { grid-template-columns: 1fr; gap: .3rem; padding-left: 2rem; }
  .tl__year { text-align: left; padding-top: 0; font-size: 1.1rem; }
  .tl__year br { display: none; }
}

/* ============ Наследие ============ */
.legacy { display: flex; gap: 1rem; overflow-x: auto; padding: .5rem calc((100vw - min(var(--maxw), 100vw - 2.5rem)) / 2) 1.5rem; scroll-snap-type: x mandatory; scrollbar-width: thin; scrollbar-color: var(--gold) transparent; cursor: grab; }
.legacy.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.legacy::-webkit-scrollbar { height: 8px; }
.legacy::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 999px; }
.lg { flex: 0 0 280px; scroll-snap-align: start; background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; position: relative; overflow: hidden; user-select: none; }
.lg::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--gold); opacity: .5; }
.lg--accent::after { background: var(--red-2); opacity: 1; }
.lg svg { width: 30px; height: 30px; color: var(--gold-2); margin-bottom: 1rem; }
.lg--accent svg { color: var(--red-2); }
.lg b { display: block; font-family: var(--serif); font-size: 2rem; color: var(--gold-2); line-height: 1; margin-bottom: .5rem; }
.lg--accent b { color: #ffb3ad; }
.lg h3 { font-size: 1.1rem; }
.lg p { margin: 0; font-size: .9rem; color: var(--ink-2); }

/* ============ Footer ============ */
.footer { padding: 3rem 0 3.5rem; border-top: 1px solid var(--line); color: var(--ink-2); font-size: .9rem; }
.footer p { margin-bottom: .5rem; }
.footer__src { font-size: .8rem; opacity: .8; }
.footer__top { display: inline-block; margin-top: 1rem; font-weight: 700; text-decoration: none; }
