/* ИнфоМиграция - Monocle-адаптация. См. DESIGN.md */

:root {
  --paper: #fdfcf3;
  --paper-warm: #fdfbe4;
  --surface: #ffffff;
  --ink: #111111;
  --ink-soft: #211d1c;
  --rule: #d9d9d9;
  --caption: #6e6e6e;
  --mute: #b3b3b3;
  --signal: #ffc500;
  --myth: #9a9a9a;

  --font-serif: "Spectral", "Georgia", serif;
  --font-sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Courier New", monospace;

  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 60px;
}

* { box-sizing: border-box; }

html {
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--signal); color: var(--ink); }

img {
  max-width: 100%;
  height: auto;
  display: block;
  outline: 1px solid oklch(0 0 0 / 0.1);
}

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  inset-inline-start: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  z-index: 100;
  font-family: var(--font-sans);
}
.skip-link:focus { inset-inline-start: 8px; top: 8px; }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
  padding-top: env(safe-area-inset-top);
}

.header-row {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 20px;
}

.wordmark {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.wordmark span { background: var(--signal); padding: 0 4px; }

.main-nav {
  display: flex;
  gap: 2px;
  margin-inline-start: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }

.main-nav a {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  padding: 10px 10px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
@media (hover: hover) and (pointer: fine) {
  .main-nav a:hover { border-bottom-color: var(--signal); }
}
.main-nav a:active { background: var(--paper-warm); }
.main-nav a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.issue-tag {
  display: none;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--caption);
  white-space: nowrap;
}
@media (min-width: 900px) { .issue-tag { display: block; } }

/* мобильная шапка: логотип строкой выше, навигация - полной строкой ниже,
   все шесть ссылок видны без обрезки и без горизонтального скролла */
@media (max-width: 699px) {
  :root { --header-h: 100px; }
  .header-row { flex-wrap: wrap; gap: 0 16px; padding-block: 10px 0; }
  .main-nav { flex: 1 1 100%; margin-inline-start: 0; justify-content: space-between; }
  .main-nav a { padding: 8px 1px; min-height: 40px; font-size: 12.5px; }
}
/* узкие экраны: навигация сеткой 3x2, чтобы ничего не упиралось в край */
@media (max-width: 380px) {
  :root { --header-h: 140px; }
  .main-nav { display: grid; grid-template-columns: repeat(3, 1fr); overflow: visible; }
  .main-nav a { justify-content: center; padding: 8px 4px; }
}

/* ---------- type ---------- */

h1, h2, h3 {
  font-family: var(--font-serif);
  letter-spacing: -0.01em;
  line-height: 1.1;
  text-wrap: balance;
  margin: 0;
}

h2 {
  font-size: clamp(28px, 4.5vw, 44px);
  font-weight: 700;
  margin-bottom: 16px;
}

h3 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }

.eyebrow {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  color: var(--caption);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--ink);
}

.section-lede {
  font-size: 18px;
  line-height: 1.6;
  max-width: 65ch;
  color: var(--ink-soft);
  margin: 0 0 32px;
  text-wrap: pretty;
}

/* ---------- hero ---------- */

.hero {
  padding: clamp(48px, 8vh, 96px) 0 clamp(40px, 6vh, 72px);
  border-bottom: 1px solid var(--rule);
}

.hero-title {
  font-size: clamp(48px, 10vw, 120px);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.02;
  margin-bottom: 24px;
}

.lede {
  font-family: var(--font-serif);
  font-size: clamp(19px, 2.4vw, 25px);
  line-height: 1.4;
  max-width: 34em;
  color: var(--ink-soft);
  margin: 0 0 40px;
  text-wrap: pretty;
}

.hero-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 40px;
}
@media (min-width: 700px) { .hero-stats { grid-template-columns: repeat(3, 1fr); } }

.stat {
  padding: 20px 0;
  border-top: 1px solid var(--rule);
}
@media (min-width: 700px) {
  .stat { padding: 24px 24px 24px 0; border-top: 0; }
  .stat + .stat { border-inline-start: 1px solid var(--rule); padding-inline-start: 24px; }
}

.stat-num {
  display: block;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(44px, 7vw, 72px);
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.stat-unit { font-size: 0.45em; font-weight: 700; margin-inline-start: 2px; }

.stat-label {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  color: var(--caption);
  max-width: 24ch;
}

.hero-figure,
.split-figure {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 10px;
}
.hero-figure img,
.split-figure img { outline: 1px solid oklch(0 0 0 / 0.1); }

.section-dark .split-figure { background: #1a1916; border-color: #3a3835; }
.section-dark .split-figure img { outline-color: oklch(1 0 0 / 0.15); }

/* ---------- sections ---------- */

.section {
  padding: clamp(56px, 9vh, 110px) 0;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: calc(var(--header-h) + 12px);
}
.quiz-section {
  padding: clamp(56px, 9vh, 110px) 0;
  background: var(--paper-warm);
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: calc(var(--header-h) + 12px);
}

/* ---------- quiz ---------- */

.quiz-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: clamp(20px, 4vw, 36px);
  max-width: 640px;
}

.quiz-progress {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--caption);
  margin: 0 0 14px;
}

.quiz-statement {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.3;
  margin: 0 0 20px;
  min-height: 2.6em;
}

.quiz-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--ink);
}
@media (hover: hover) and (pointer: fine) {
  .btn-ghost:hover { background: var(--paper-warm); }
}
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.is-picked { outline: 3px solid var(--signal); outline-offset: 2px; }

.quiz-feedback { margin-top: 20px; border-top: 1px solid var(--rule); padding-top: 16px; }
.quiz-verdict {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 22px;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.quiz-verdict::before {
  content: "";
  width: 12px;
  height: 12px;
  flex: none;
  border: 1px solid var(--ink);
}
.quiz-verdict.ok::before { background: var(--signal); }
.quiz-verdict.miss::before { background: var(--myth); }
.quiz-explain { margin: 0 0 16px; max-width: 56ch; }
.quiz-score {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(40px, 7vw, 64px);
  margin: 0 0 10px;
  background: linear-gradient(transparent 55%, var(--signal) 55%);
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

.btn {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 4px;
  padding: 14px 28px;
  min-height: 48px;
  cursor: pointer;
  transition: background 0.15s ease-out, color 0.15s ease-out;
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--ink-soft); }
}
.btn:active { transform: scale(0.96); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.quiz-answer {
  margin-top: 24px;
  border-top: 1px solid var(--rule);
  padding-top: 20px;
}
.quiz-answer[hidden] { display: none; }

.quiz-answer-num {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(56px, 9vw, 88px);
  line-height: 1;
  letter-spacing: -0.01em;
  background: linear-gradient(transparent 55%, var(--signal) 55%);
  display: inline-block;
  font-variant-numeric: tabular-nums;
}
.quiz-answer-text { margin: 12px 0 0; max-width: 52ch; }

.quiz-verdict { font-family: var(--font-mono); font-size: 13px; color: var(--caption); margin: 8px 0 0; }

/* ---------- chart cards ---------- */

.chart-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: clamp(16px, 3vw, 32px);
  margin-top: 8px;
}

.chart-title { margin-bottom: 16px; }

.chart { width: 100%; height: auto; }

.chart-note {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--caption);
  margin: 16px 0 0;
  border-top: 1px solid var(--rule);
  padding-top: 12px;
}

/* SVG chart bits */
.bar { fill: var(--ink); transform-box: fill-box; transform-origin: bottom; }
.bar.accent { fill: var(--signal); stroke: var(--ink); stroke-width: 1; }
.axis-label { font-family: var(--font-mono); font-size: 12px; fill: #6e6e6e; }
.bar-label { font-family: var(--font-mono); font-size: 12px; fill: #111111; }
.ref-line { stroke: #111111; stroke-width: 1; stroke-dasharray: 5 4; }
.ref-label { font-family: var(--font-mono); font-size: 11px; fill: #111111; }
.baseline { stroke: #111111; stroke-width: 1; }

/* ---------- fact strips ---------- */

.fact-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--ink);
  margin-top: 28px;
}
@media (min-width: 700px) { .fact-strip { grid-template-columns: repeat(3, 1fr); } }
.fact-strip:not(.hero-stats) { margin-bottom: 8px; }

.fact {
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  display: grid;
  gap: 4px;
  align-content: start;
}
@media (min-width: 700px) {
  .fact { padding: 18px 20px 18px 0; border-top: 0; }
  .fact + .fact { border-inline-start: 1px solid var(--rule); padding-inline-start: 20px; }
}
.fact b {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.fact span { font-size: 14px; color: var(--caption); }

/* ---------- flip cards ---------- */

.flip-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 700px) { .flip-grid { grid-template-columns: 1fr 1fr; gap: 20px; } }

.flip-card {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  perspective: 1200px;
  text-align: start;
  font: inherit;
  color: inherit;
  min-height: 280px;
  display: block;
}
.flip-card:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

.flip-inner {
  display: grid;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.2, 0, 0, 1);
  min-height: 280px;
}
.flip-card[aria-pressed="true"] .flip-inner { transform: rotateY(180deg); }

.flip-face {
  grid-area: 1 / 1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 24px;
  display: grid;
  align-content: space-between;
  gap: 16px;
  background: var(--surface);
  min-height: 280px;
}
.flip-front { background: var(--surface); }
.flip-back { transform: rotateY(180deg); background: var(--paper-warm); border-color: var(--ink); }

.flip-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  width: fit-content;
  padding: 4px 8px;
}
.myth-tag { color: var(--paper); background: var(--myth); }
.fact-tag { color: var(--ink); background: var(--signal); }

.flip-claim {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.25;
  color: var(--myth);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.flip-hint {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  width: fit-content;
  background: var(--paper);
}
.flip-hint::after { content: "→"; }

.flip-fact {
  font-size: 16px;
  line-height: 1.5;
}
.flip-fact::first-letter { initial-letter: 2; }

.flip-src {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--caption);
  border-top: 1px solid var(--rule);
  padding-top: 10px;
}

@media (hover: hover) and (pointer: fine) {
  .flip-card:hover .flip-inner { transform: rotateY(6deg); }
  .flip-card[aria-pressed="true"]:hover .flip-inner { transform: rotateY(174deg); }
}
.flip-card:active .flip-inner { transform: scale(0.98); }

/* ---------- timeline ---------- */

.section-dark {
  background: var(--ink);
  color: var(--paper);
}
.section-dark .eyebrow { color: var(--mute); }
.section-dark .eyebrow::before { background: var(--signal); }
.section-dark .section-lede { color: #d8d4c8; }
.section-dark .tl-item { border-color: #3a3835; }
.section-dark h3 { color: var(--paper); }

.timeline {
  list-style: none;
  margin: 32px 0 48px;
  padding: 0;
  display: grid;
}
.tl-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 20px 0;
  border-top: 1px solid var(--rule);
}
@media (min-width: 700px) {
  .tl-item { grid-template-columns: 140px 1fr; gap: 24px; }
}
.tl-year {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 15px;
  color: var(--signal);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tl-text { max-width: 62ch; color: inherit; }

/* ---------- splits ---------- */

.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: center;
  margin-top: 32px;
}
@media (min-width: 860px) {
  .split { grid-template-columns: 1fr 1fr; gap: 48px; }
  .split-reverse > .split-text { order: -1; }
}
.split-figure { margin: 0; }
.split-text p { margin: 0 0 16px; max-width: 58ch; }
.split-text h3 { margin-top: 24px; }
.split-text h3:first-child { margin-top: 0; }
.section-dark .split-text b { color: var(--signal); }

/* ---------- info cards ---------- */

.cards-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 8px;
}
@media (min-width: 860px) { .cards-3 { grid-template-columns: repeat(3, 1fr); gap: 20px; } }

.info-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 24px;
}
.info-card p { margin: 0; font-size: 15.5px; }
.info-card b { background: linear-gradient(transparent 60%, var(--signal) 60%); }

/* ---------- pull quote ---------- */

.pull-quote {
  margin: clamp(48px, 8vh, 80px) 0 0;
  padding: 0 0 0 24px;
  border-inline-start: 4px solid var(--signal);
}
.pull-quote p {
  font-family: var(--font-serif);
  font-size: clamp(24px, 3.6vw, 36px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  max-width: 26em;
  text-wrap: balance;
}
.pull-quote cite {
  font-family: var(--font-mono);
  font-size: 13px;
  font-style: normal;
  color: var(--caption);
}

/* ---------- sources ---------- */

.source-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 75ch;
}
.source-list li {
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  font-size: 15.5px;
  color: var(--ink-soft);
}
.source-list li:first-child { border-top-color: var(--ink); }

/* ---------- footer ---------- */

.site-footer {
  padding: 32px 0 calc(32px + env(safe-area-inset-bottom));
}
.footer-row {
  display: grid;
  gap: 8px;
}
.footer-note {
  margin: 0;
  font-size: 13.5px;
  color: var(--caption);
  max-width: 70ch;
}
.footer-meta {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--mute);
}

/* ---------- reveal animation ---------- */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s ease-out, transform 0.5s cubic-bezier(0.2, 0, 0, 1);
  }
  .reveal.in { opacity: 1; transform: none; }
  .bar { transition: transform 0.7s cubic-bezier(0.2, 0, 0, 1); transform: scaleY(0); }
  .chart.drawn .bar { transform: scaleY(1); }
}
