/* === Шрифт ===
   Manrope — копия из основного dapamoga (тот же файл, два subset через
   unicode-range). Self-hosted ради PWA-offline, приватности и строгого CSP. */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("./fonts/manrope-cyrillic.woff2") format("woff2-variations"),
       url("./fonts/manrope-cyrillic.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: 200 800;
  font-display: swap;
  src: url("./fonts/manrope-latin.woff2") format("woff2-variations"),
       url("./fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

[hidden] { display: none !important; }

:root {
  /* === Палитра — те же warm-paper токены что и у dapamoga.
     Один visual language на два сабпроекта. */
  --bg: #faf9f7;
  --card: #ffffff;
  --card-soft: #f5f3ee;
  --ink: #1a1815;
  --ink-soft: #3d3a35;
  --muted: #6a655c;
  --line: #e8e4dc;
  --line-soft: #efebe3;
  --accent: #c41e3a;
  --accent-dark: #8e0e1e;
  --accent-soft: #fdf0f2;

  /* === Stage цвета — каждый этап получает свой оттенок акцента в orderbadge.
     Помогает мысленно «закреплять» прогресс по шагам. */
  --stage-1: #1e4dba;  /* pre — синий, спокойствие подготовки */
  --stage-2: #b45309;  /* entry — жжёный оранжевый, urgency */
  --stage-3: #6d28d9;  /* post-mz — фиолетовый, бумажная рутина */
  --stage-4: #0f766e;  /* settling — teal, обустройство */
  --stage-5: #15803d;  /* months — зелёный, рост */
  --stage-6: #be185d;  /* post-decision — magenta, результат */

  /* === Pitfall / decision цвета === */
  --warn: #b45309;
  --warn-bg: #fef3e0;
  --decision: #6d28d9;
  --decision-bg: #f3eafe;
  --ongoing: #0f766e;
  --ongoing-bg: #e6f5f3;

  /* === Type scale === */
  --fs-micro:   0.6875rem;
  --fs-caption: 0.75rem;
  --fs-small:   0.8125rem;
  --fs-base:    0.9375rem;
  --fs-body:    1rem;
  --fs-h5:      1.0625rem;
  --fs-h4:      1.1875rem;
  --fs-h3:      1.375rem;
  --fs-h2:      1.625rem;
  --fs-display: clamp(2rem, 4.5vw, 2.5rem);

  /* === Spacing scale === */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;

  /* === Радиусы === */
  --radius:     14px;
  --radius-sm:  8px;
  --radius-lg:  18px;
  --radius-pill: 999px;

  /* === Тени (warm brown оттенок) === */
  --shadow: 0 1px 2px rgba(60, 45, 30, 0.05), 0 4px 12px rgba(60, 45, 30, 0.06);
  --shadow-hover: 0 2px 6px rgba(60, 45, 30, 0.08), 0 12px 28px rgba(60, 45, 30, 0.10);

  /* === Анимации === */
  --motion-fast: 0.12s ease;
  --motion: 0.18s ease;
}

/* === Dark theme === */
html[data-theme="dark"] {
  --bg: #14110d;
  --card: #1c1814;
  --card-soft: #221d18;
  --ink: #f0eadf;
  --ink-soft: #c9c1b3;
  --muted: #8a8174;
  --line: #2d2820;
  --line-soft: #24201b;
  --accent-soft: #2e1a14;
  --warn-bg: #3a2a0a;
  --decision-bg: #2a1d4d;
  --ongoing-bg: #0f3a32;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 6px 18px rgba(0, 0, 0, 0.45);
  --shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.6), 0 12px 28px rgba(0, 0, 0, 0.55);
}
html[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
html[data-theme="dark"] .flag-bar {
  background: linear-gradient(
    to bottom,
    #f0e4cd 0 33.33%,
    var(--accent) 33.33% 66.66%,
    #f0e4cd 66.66% 100%
  );
}
html[data-theme="dark"] .site-header { background: var(--card); border-bottom-color: var(--line); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, "Helvetica Neue", system-ui, sans-serif;
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.55;
  font-feature-settings: "kern", "liga", "calt", "ss01";
  font-variant-ligatures: common-ligatures contextual;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  text-wrap: pretty;
}

h1, h2, h3, h4, h5 {
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 18px;
}

::selection {
  background: var(--accent);
  color: #fff;
  text-shadow: none;
}

a {
  color: var(--accent-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--motion-fast);
}
a:hover { color: var(--accent); }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ===== Header ===== */
.site-header {
  background: var(--card);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.flag-bar {
  height: 6px;
  background: linear-gradient(
    to bottom,
    #ffffff 0 33.33%,
    var(--accent) 33.33% 66.66%,
    #ffffff 66.66% 100%
  );
  border-bottom: 1px solid var(--line);
}
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  padding: 12px 0 6px;
}
.masthead {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 14px;
  align-items: baseline;
  flex: 1;
  min-width: 0;
}
.brand {
  margin: 0;
  font-size: 1.625rem;
  font-weight: 800;
  letter-spacing: -0.028em;
  line-height: 1;
}
.brand a {
  color: var(--ink);
  text-decoration: none;
}
.brand-sub {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.875em;
  letter-spacing: -0.01em;
}
.brand-tagline {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.3;
  min-width: 0;
}
.header-side {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
/* Cross-link к dapamoga + кнопка библиотеки — pill-стили в шапке.
   Используется и для <a>, и для <button> (через .header-link-btn). */
.header-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--card-soft);
  color: var(--ink);
  text-decoration: none;
  font-size: var(--fs-small);
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--motion-fast), border-color var(--motion-fast);
  font-family: inherit;
  cursor: pointer;
}
.header-link:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}
.header-link-btn {
  /* кнопка-стиль выравниваем с <a> */
  line-height: 1;
}
.site-header-meta {
  padding: 0 0 10px;
}
.meta-line {
  margin: 0;
  font-size: var(--fs-caption);
  color: var(--muted);
  line-height: 1.5;
}
.meta-advice {
  font-style: italic;
  color: var(--muted);
}

/* ===== Main wrap ===== */
main.wrap {
  padding-top: 22px;
  padding-bottom: 40px;
}

.section-title {
  margin: 0 0 12px;
  font-size: var(--fs-h4);
  font-weight: 700;
  color: var(--ink);
}

/* ===== Path selector ===== */
.path-selector {
  margin-bottom: 28px;
}
.path-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.path-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--motion), box-shadow var(--motion),
              transform var(--motion-fast), background var(--motion-fast);
}
.path-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.path-card[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow);
}
.path-title {
  margin: 0;
  font-size: var(--fs-h5);
  font-weight: 700;
  color: var(--ink);
}
.path-summary {
  margin: 0;
  font-size: var(--fs-base);
  color: var(--ink-soft);
  line-height: 1.5;
}
.path-when {
  margin: 0;
  font-size: var(--fs-small);
  color: var(--muted);
  font-style: italic;
}

/* ===== Stages nav ===== */
.stages-nav {
  display: flex;
  gap: 6px;
  margin: 0 0 22px;
  padding: 4px;
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--muted) transparent;
}
.stage-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--motion-fast), color var(--motion-fast);
}
.stage-tab:hover {
  background: var(--card);
  color: var(--ink);
}
.stage-tab[aria-pressed="true"] {
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
  box-shadow: var(--shadow);
}
.stage-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: var(--fs-caption);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.stage-tab[aria-pressed="true"] .stage-order {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.stage-title { line-height: 1; }

/* ===== Stage view ===== */
.stage-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.stage-header {
  margin: 0 0 4px;
}
.stage-h2 {
  margin: 0;
  font-size: var(--fs-h2);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.stage-estimated {
  margin: 4px 0 0;
  font-size: var(--fs-small);
  color: var(--muted);
  font-style: italic;
}
.stage-empty {
  padding: 24px;
  background: var(--card-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  margin: 0;
}

/* ===== Node card ===== */
.node-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  scroll-margin-top: 80px;  /* для якорей */
}
.node-title-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: 0 0 6px;
}
.node-title {
  margin: 0;
  font-size: var(--fs-h4);
  font-weight: 700;
  color: var(--ink);
  flex: 1;
  min-width: 0;
}
.node-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-micro);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}
.node-badge-decision {
  background: var(--decision-bg);
  color: var(--decision);
}
.node-badge-ongoing {
  background: var(--ongoing-bg);
  color: var(--ongoing);
}
html[data-theme="dark"] .node-badge-decision { color: #c7a3ff; }
html[data-theme="dark"] .node-badge-ongoing  { color: #6ee7c5; }

.node-summary {
  margin: 0 0 10px;
  font-size: var(--fs-base);
  color: var(--ink-soft);
  line-height: 1.55;
}

/* === Howto pills внутри ноды — открывают модалку с шпаргалкой === */
.node-howtos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: 0 0 12px;
  padding: 10px 12px;
  background: var(--card-soft);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--muted);
}
.node-howtos-label {
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 2px;
}
.howto-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  color: var(--accent-dark);
  font-family: inherit;
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--motion-fast), color var(--motion-fast);
}
.howto-pill::before {
  content: "?";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 0.75em;
  font-weight: 700;
}
.howto-pill:hover {
  background: var(--accent);
  color: #fff;
}
.howto-pill:hover::before {
  background: #fff;
  color: var(--accent);
}
.node-eligibility {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 10px;
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: var(--fs-small);
  color: var(--ink-soft);
}
.node-meta-line {
  margin: 0 0 8px;
  font-size: var(--fs-small);
  color: var(--muted);
}

/* === Steps — always-visible numbered blocks для пошаговых процедур ===
   Не accordion: в crisis reference ничего не прячем за клик. Иерархия через
   pill-label (А/Б/В), bold title и spacing. Каждый блок — отдельная <section>
   с лёгким контрастом фона от карточки. */
.node-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}
.step {
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.step-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.step-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-pill);
  font-size: var(--fs-caption);
  font-weight: 700;
  flex-shrink: 0;
}
.step-title {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}
.step-body {
  font-size: var(--fs-base);
  color: var(--ink-soft);
}
.step-text {
  margin: 0 0 8px;
  line-height: 1.55;
}
.step-bullets {
  margin: 0;
  padding-left: 20px;
  line-height: 1.55;
}
.step-bullets li {
  margin-bottom: 3px;
}
.step-bullets li::marker {
  color: var(--accent);
}
.step-note {
  margin: 10px 0 0;
  padding: 8px 10px;
  background: var(--card);
  border-left: 3px solid var(--muted);
  border-radius: var(--radius-sm);
  font-size: var(--fs-small);
  color: var(--ink-soft);
  line-height: 1.5;
}
html[data-theme="dark"] .step-note {
  background: var(--bg);
}
.step-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.step-attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 500;
  text-decoration: none;
  transition: border-color var(--motion-fast), background var(--motion-fast);
}
.step-attachment::before {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.7em;
  letter-spacing: 0.05em;
}
.step-attachment.att-doc::before    { content: "DOC"; }
.step-attachment.att-image::before  { content: "IMG"; }
.step-attachment.att-link::before   { content: "LINK"; }
.step-attachment:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* === Sections inside node === */
.node-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.node-section-title {
  margin: 0 0 6px;
  font-size: var(--fs-caption);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.node-checklist {
  margin: 0;
  padding-left: 20px;
  font-size: var(--fs-base);
  color: var(--ink-soft);
}
.node-checklist li {
  margin-bottom: 4px;
  line-height: 1.5;
}
.node-checklist li::marker {
  color: var(--accent);
}

/* === Helpers — deep-link к dapamoga === */
.node-helpers {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 14px;
  border-top: none;
}
html[data-theme="dark"] .node-helpers {
  background: rgba(196, 30, 58, 0.1);
}
.node-helpers .node-section-title {
  color: var(--accent-dark);
}
html[data-theme="dark"] .node-helpers .node-section-title {
  color: #ff7e7e;
}
.helper-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.helper-item {
  font-size: var(--fs-base);
  color: var(--ink-soft);
  line-height: 1.4;
}
.helper-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  color: var(--accent-dark);
  font-weight: 600;
  text-decoration: none;
  transition: background var(--motion-fast), color var(--motion-fast);
}
.helper-link::after {
  content: "→";
  font-size: 0.85em;
  opacity: 0.6;
}
.helper-link:hover {
  background: var(--accent);
  color: #fff;
}
.helper-link:hover::after {
  opacity: 1;
}

/* === Pitfalls === */
.node-pitfalls {
  background: var(--warn-bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 14px;
  border-top: none;
}
.node-pitfalls .node-section-title {
  color: var(--warn);
}
html[data-theme="dark"] .node-pitfalls .node-section-title {
  color: #ecc579;
}
.pitfall-list {
  margin: 0;
  padding-left: 18px;
  font-size: var(--fs-base);
  color: var(--ink-soft);
}
.pitfall-list li {
  margin-bottom: 4px;
  line-height: 1.5;
}
.pitfall-list li::marker {
  color: var(--warn);
}

/* === Why critical (для banking nodes) === */
.node-why {
  background: var(--card-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 14px;
  border-top: none;
}
.node-why p {
  margin: 0;
  font-size: var(--fs-base);
  color: var(--ink-soft);
  line-height: 1.55;
}

/* === Next stage hint === */
.next-stage-hint {
  margin-top: 8px;
  display: flex;
  justify-content: center;
}
.next-stage-btn {
  padding: 10px 20px;
  background: var(--ink);
  color: var(--card);
  border: none;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: var(--fs-base);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--motion-fast), transform var(--motion-fast);
}
.next-stage-btn:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

/* ===== Modal (для howto-шпаргалок и библиотеки) =====
   Простая overlay-модалка с backdrop + центрированной панелью.
   Закрывается: Esc, клик в backdrop, клик в ×. Body-scroll блокируется
   через JS (document.body.style.overflow = "hidden"). */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 16px;
  overflow-y: auto;
  /* fade-in при показе */
  animation: modalFadeIn 0.18s ease;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 17, 13, 0.55);
  backdrop-filter: blur(2px);
  cursor: pointer;
}
.modal-panel {
  position: relative;
  width: 100%;
  max-width: 720px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  overflow: hidden;
  /* slide-up при показе */
  animation: modalSlideUp 0.22s ease;
}
@keyframes modalSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  flex-shrink: 0;
}
.modal-title {
  margin: 0;
  font-size: var(--fs-h4);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.015em;
}
.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--motion-fast), color var(--motion-fast);
}
.modal-close:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.modal-body {
  padding: 16px 18px 22px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.howto-summary {
  margin: 0 0 16px;
  font-size: var(--fs-base);
  color: var(--ink-soft);
  line-height: 1.55;
}

/* === Библиотека шпаргалок (открывается через кнопку «Шпаргалки» в шапке) === */
.library-intro {
  margin: 0 0 18px;
  font-size: var(--fs-base);
  color: var(--ink-soft);
  line-height: 1.55;
}
.library-cat {
  margin-bottom: 22px;
}
.library-cat:last-child {
  margin-bottom: 0;
}
.library-cat-title {
  margin: 0 0 10px;
  font-size: var(--fs-caption);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.library-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--motion-fast), background var(--motion-fast),
              transform var(--motion-fast);
}
.library-card:hover {
  border-color: var(--accent);
  background: var(--card);
  transform: translateY(-1px);
}
.library-card-title {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--ink);
}
.library-card-summary {
  font-size: var(--fs-small);
  color: var(--muted);
  line-height: 1.4;
}

/* ===== Footer ===== */
.site-footer {
  background: transparent;
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 14px 0;
  font-size: var(--fs-caption);
  text-align: center;
  margin-top: 40px;
}
.site-footer .wrap { padding: 0 18px; }

/* ===== Адаптив ===== */
@media (max-width: 720px) {
  .wrap { padding: 0 14px; }
  .site-header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 0 6px;
  }
  .header-side { width: 100%; justify-content: flex-end; }
  .masthead { grid-template-columns: 1fr; gap: 2px; }
  .brand { font-size: 1.375rem; }
  .brand-tagline { font-size: 0.8125rem; line-height: 1.35; }

  .path-cards { grid-template-columns: 1fr; }
  .path-card { padding: 14px 16px; }

  .stages-nav {
    margin-bottom: 18px;
    /* Затухание справа сигналит «можно скроллить» */
    mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent 100%);
  }
  .stage-tab { padding: 7px 11px; font-size: var(--fs-small); }

  .stage-h2 { font-size: 1.375rem; }

  .node-card { padding: 14px 16px; }
  .node-title { font-size: var(--fs-h5); }
}

@media (max-width: 420px) {
  .wrap { padding: 0 12px; }
  .brand { font-size: 1.25rem; }
  .flag-bar { height: 5px; }
  .meta-line { display: none; }  /* мобильно — скрываем длинный дисклеймер */
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
