/* =========================================================
   base.css: общий каркас и компоненты для всех 6 тем.
   Mobile-first. Без JS, без внешних шрифтов. Размер текста >= 16px,
   интерактивные элементы >= 44px. Цвета и формы берутся из переменных
   (см. themes.css); значения ниже это запасные (тема finance).
   ========================================================= */

:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --text: #1b2a3a;
  --muted: #4d5d6e;
  --accent: #1f5f8b;
  --accent-ink: #ffffff;
  --accent-soft: #e4eef6;
  --border: #d5dee8;
  --radius: 8px;
  --radius-lg: 12px;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head: var(--font-body);
  --head-weight: 700;
  --head-style: normal;
  --head-transform: none;
  --head-tracking: 0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06);
  --maxw: 60rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.65 var(--font-body);
  overflow-wrap: break-word;
}
img { display: block; max-width: 100%; height: auto; }
p, ul, ol, dl, figure, table { margin: 0 0 1rem; }
h1, h2, h3 {
  margin: 0 0 .6em;
  font-family: var(--font-head);
  font-weight: var(--head-weight);
  font-style: var(--head-style);
  text-transform: var(--head-transform);
  letter-spacing: var(--head-tracking);
  line-height: 1.2;
}
h1 { font-size: clamp(1.75rem, 6.5vw, 2.75rem); }
h2 { font-size: clamp(1.375rem, 5vw, 1.875rem); }
h3 { font-size: 1.1875rem; }
a { color: var(--accent); text-underline-offset: .18em; }
a:focus-visible, .btn:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: .5rem; top: -4rem; z-index: 10;
  background: var(--surface); color: var(--text);
  padding: .75rem 1rem; border-radius: var(--radius);
}
.skip:focus { top: .5rem; }

/* ---------- контейнеры ---------- */
.wrap, .section {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 1rem;
}
.section { padding-block: 2rem; }
.section + .section { border-top: 1px solid var(--border); }
.section :where(p, ul, ol, .note) { max-width: 42rem; }

/* ---------- шапка ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar__in {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 3.5rem;
}
.brand {
  display: inline-flex; align-items: center; min-height: 44px;
  font-family: var(--font-head); font-weight: var(--head-weight);
  font-size: 1.125rem; color: var(--text); text-decoration: none;
}
.lang {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; min-width: 44px; padding-inline: .75rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none; font-weight: 600;
}

/* ---------- первый экран ---------- */
.hero {
  display: grid;
  gap: 1.25rem;
  padding-block: 1.5rem 2rem;
  grid-template-areas: "head" "media" "cta";
}
.hero__head { grid-area: head; }
.hero__media {
  grid-area: media; margin: 0;
  background: var(--accent-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 2 / 3;
  max-width: 24rem;
  width: 100%;
  justify-self: center;
}
.hero__media img { width: 100%; height: 100%; object-fit: cover; }
.hero__cta { grid-area: cta; margin: 0; }
.lede { font-size: 1.1875rem; color: var(--muted); margin-bottom: 0; max-width: 34rem; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: .75rem 1.5rem;
  background: var(--accent); color: var(--accent-ink);
  border-radius: var(--radius);
  font-weight: 700; font-size: 1rem; line-height: 1.2;
  text-decoration: none; text-align: center;
}
.btn:hover { filter: brightness(1.08); }
.hero__cta .btn, .card .btn { width: 100%; }

/* ---------- заметки ---------- */
.note {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-block: 1rem;
}
.note--plain { margin-top: 0; }
.note p:last-child { margin-bottom: 0; }

/* ---------- чек-лист (нативные чекбоксы, без JS) ---------- */
.checklist { list-style: none; padding: 0; }
.checklist li { border-bottom: 1px solid var(--border); }
.checklist label {
  display: flex; align-items: flex-start; gap: .75rem;
  min-height: 44px; padding: .6rem 0; cursor: pointer;
}
.checklist input {
  flex: none; width: 1.5rem; height: 1.5rem; margin: .125rem 0 0;
  accent-color: var(--accent);
}

/* ---------- шаги ---------- */
.steps { list-style: none; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 0 0 1.1rem 3.25rem; min-height: 2.5rem; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700;
}
.steps strong { display: block; }

/* ---------- материалы / простой список ---------- */
.materials { padding-left: 1.25rem; }
.materials li { padding-block: .2rem; }
.materials li::marker { color: var(--accent); }

/* ---------- таблицы (план / сравнение): на телефоне карточками ---------- */
.table { width: 100%; border-collapse: collapse; }
.table caption { text-align: left; font-weight: 700; padding-bottom: .5rem; }
.table th, .table td { text-align: left; vertical-align: top; padding: .6rem .75rem; border-bottom: 1px solid var(--border); }
.table thead th { background: var(--accent-soft); }
@media (max-width: 40rem) {
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table, .table tbody, .table tr, .table td, .table th { display: block; width: 100%; }
  .table tr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .75rem; padding: .25rem 0; }
  .table td, .table th { border: 0; padding: .35rem .85rem; }
  .table td::before {
    content: attr(data-label);
    display: block; font-weight: 700; color: var(--muted);
  }
}

/* ---------- шаблон, который читатель переписывает себе ---------- */
.template-box {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  max-width: 42rem;
}
.template-box dl { margin: 0; }
.template-box dt { font-weight: 700; margin-top: .75rem; }
.template-box dt:first-child { margin-top: 0; }
.template-box dd { margin: 0; padding: .5rem 0; border-bottom: 1px solid var(--border); color: var(--muted); }

/* ---------- карточки: рекомендации и «Ещё по теме» ---------- */
.disclose-short { font-weight: 600; max-width: 42rem; }
.cards { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.card {
  display: flex; flex-direction: column; gap: .5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0; }
.card p { margin: 0; }
.card .btn { margin-top: auto; }
.badge {
  align-self: flex-start;
  background: var(--accent-soft); color: var(--text);
  border-radius: 999px; padding: .15rem .75rem;
  font-weight: 600; font-size: 1rem;
}
.helps { color: var(--muted); }
.helps b { color: var(--text); }
.card--nolink { background: transparent; box-shadow: none; border-style: dashed; }
.card--nolink .nolink { color: var(--muted); font-style: italic; }
.related { min-height: 44px; justify-content: center; text-decoration: none; color: var(--text); }
.related.is-soon { border-style: dashed; background: transparent; box-shadow: none; }
.related .soon { color: var(--muted); }

/* ---------- подвал ---------- */
.footer { border-top: 1px solid var(--border); background: var(--surface); padding-block: 1.5rem 2.5rem; margin-top: 1rem; }
.footer nav { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.footer nav a { display: inline-flex; align-items: center; min-height: 44px; }
.footer p { color: var(--muted); margin-bottom: .5rem; }

/* ---------- юридические страницы ---------- */
.legal { padding-block: 1.5rem 2rem; max-width: 46rem; }
.legal h2 { margin-top: 1.5rem; font-size: 1.375rem; }
.legal .draft {
  background: #fff4d6; color: #4a3600; border: 1px solid #e3c978;
  border-radius: var(--radius); padding: .75rem 1rem;
}
.legal .jump { display: flex; gap: .75rem; margin-bottom: 1rem; }
.legal .jump a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 1rem; border: 1px solid var(--border); border-radius: var(--radius); }

/* ---------- широкие экраны ---------- */
@media (min-width: 48rem) {
  .hero {
    grid-template-columns: minmax(0, 1fr) 22rem;
    grid-template-areas: "head media" "cta media";
    grid-template-rows: auto 1fr;
    column-gap: 2.5rem;
    align-items: start;
    padding-block: 2.5rem 3rem;
  }
  .hero__media { justify-self: end; }
  .hero__cta { align-self: start; }
  .hero__cta .btn { width: auto; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
  .section { padding-block: 2.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
