/* Общие стили обоих сайтов. Сначала телефон (от 320 px), потом шире через min-width.
   Цвета каждого сайта уточняются в static/<код сайта>/site.css. */

/* Оформление в стиле админки: светло-серый фон, белые карточки с мягкой тенью.
   Тёмная тема включается сама, если она выбрана в настройках телефона. */
:root {
  --blue: #1B2A49;
  --red: #C8102E;
  --red-dark: #A00D25;
  --khaki: #4B5320;
  --accent: var(--blue);      /* цвет акцентов в разделах, меняется на сайте */
  --bg: #F3F5F9;
  --bg-alt: #E9EDF3;
  --card: #FFFFFF;
  --card-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --card-shadow-hover: 0 2px 4px rgba(16, 24, 40, .08), 0 14px 32px rgba(16, 24, 40, .18);
  --text: #1C2333;
  --heading: #1B2A49;
  --link: #1F4FA3;
  --muted: #4A5263;
  --border: #CFD5DF;
  --input-bg: #FFFFFF;
  --header-bg: #1B2A49;
  --sticky-bg: rgba(255, 255, 255, .96);
  --focus: #F2A900;
  --radius: 14px;             /* карточки и окно формы */
  --radius-sm: 10px;          /* кнопки и поля */
  --sticky-h: 72px;
}

/* Тёмная тема: по настройке системы, если человек не выбрал тему кнопкой в шапке,
   или по кнопке (атрибут data-theme="dark" у <html>). Значения в обоих блоках одинаковые. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --blue: #2C4170;          /* светлее, чтобы синие элементы были видны на тёмном фоне */
    --red: #D4213D;
    --khaki: #66712F;
    --bg: #0B1220;
    --bg-alt: #101A2C;
    --card: #131C2E;
    --card-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .25);
    --card-shadow-hover: 0 2px 4px rgba(0, 0, 0, .5), 0 16px 40px rgba(0, 0, 0, .45);
    --text: #E6EAF2;
    --heading: #F2F5FA;
    --link: #8AB4FF;
    --muted: #A3ADBF;
    --border: #2B3854;
    --input-bg: #0F1729;
    --header-bg: #0F1830;
    --sticky-bg: rgba(11, 18, 32, .96);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --blue: #2C4170;          /* светлее, чтобы синие элементы были видны на тёмном фоне */
  --red: #D4213D;
  --khaki: #66712F;
  --bg: #0B1220;
  --bg-alt: #101A2C;
  --card: #131C2E;
  --card-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .25);
  --card-shadow-hover: 0 2px 4px rgba(0, 0, 0, .5), 0 16px 40px rgba(0, 0, 0, .45);
  --text: #E6EAF2;
  --heading: #F2F5FA;
  --link: #8AB4FF;
  --muted: #A3ADBF;
  --border: #2B3854;
  --input-bg: #0F1729;
  --header-bg: #0F1830;
  --sticky-bg: rgba(11, 18, 32, .96);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 1rem;           /* 16 px: меньше нельзя, иначе iOS приближает поля формы */
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  padding-bottom: var(--sticky-h);   /* место под кнопку внизу экрана */
  overflow-x: hidden;
}

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

h1, h2, h3 { line-height: 1.2; color: var(--heading); margin: 0 0 .75rem; letter-spacing: -.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.25rem; margin-top: 1.5rem; }
p { margin: 0 0 1rem; }

a { color: var(--link); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 8px; top: 8px; z-index: 100; background: #fff; padding: 12px; }

/* Заглушки: явно видно, чего не хватает */
.todo {
  display: inline-block;
  background: #FFF3CD;
  color: #5C4400;
  border: 1px dashed #B58900;
  border-radius: 4px;
  padding: 0 .35em;
  font-weight: normal;
}

/* Полоса цветов флага */
.flag-stripe {
  height: 6px;
  background: linear-gradient(to bottom, #fff 0 33.3%, #0039A6 33.3% 66.6%, var(--red) 66.6% 100%);
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 24px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform .1s, background-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 2px 8px rgba(200, 16, 46, .25); }
.btn-primary:hover { background: var(--red-dark); }
.btn-primary:disabled { opacity: .6; cursor: wait; }
.btn-lg { min-height: 56px; font-size: 1.125rem; padding: 14px 32px; }
.btn-block { display: flex; width: 100%; }

/* ---------- Шапка ---------- */
.site-header { background: var(--header-bg); color: #fff; }
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  padding-bottom: 8px;
}
.logo {
  color: #fff;
  font-weight: 700;
  font-size: 1.125rem;
  text-decoration: none;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, .6);
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.menu-toggle[hidden] { display: none; }
.menu-icon, .menu-icon::before, .menu-icon::after {
  display: block; width: 20px; height: 2px; background: #fff; position: relative;
}
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; }
.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }

.main-nav { width: 100%; }
.main-nav ul { list-style: none; margin: 0; padding: 0; }
.main-nav a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 4px;
  color: #fff;
  text-decoration: none;
  border-top: 1px solid rgba(255, 255, 255, .15);
}
/* С JS меню на телефоне скрыто за кнопкой «Меню»; без JS просто видно списком */
.js .main-nav { display: none; }
.js .main-nav.is-open { display: block; }


/* ---------- Разделы ---------- */
.hero {
  background: var(--header-bg);
  color: #fff;
  padding: 40px 0 48px;
}
.hero { position: relative; overflow: hidden; }
.hero-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 60% 30%;
}
/* Тёмная подложка, чтобы текст на фото читался */
.hero-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(27, 42, 73, .9), rgba(27, 42, 73, .55));
}
.hero-inner { position: relative; z-index: 1; }
.hero h1 { color: #fff; }
.hero-lead { font-size: 1.25rem; }
.hero-actions { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.hero-phone { font-size: 1.25rem; font-weight: 700; }
.hero-contact { margin: 0; }

.section { padding: 40px 0; }
.section-alt { background: var(--bg-alt); }
.section-dark { background: var(--header-bg); color: #fff; }
.section-dark .section-title { color: #fff; }

.section-title { padding-bottom: 10px; border-bottom: 4px solid var(--red); display: inline-block; margin-bottom: 1.5rem; }

/* Карточки как на дашборде админки: белые, скруглённые, с мягкой тенью */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.card {
  background: var(--card);
  color: var(--text);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--card-shadow);
  min-width: 0;
}
.card-number {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.02em;
  color: var(--heading);
  margin-bottom: .35rem;
  overflow-wrap: anywhere;
}
.card-title {
  font-weight: 700;
  font-size: .875rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-top: 0;
}
.card-address { color: var(--muted); }
.card .checklist { margin: 0; }

/* Места службы: карточка приподнимается при наведении, появляется кнопка «Войсковые части».
   На телефоне наведения нет, поэтому там кнопка видна всегда. */
.card-place {
  display: flex;
  flex-direction: column;
  transition: transform .2s ease-out, box-shadow .2s ease-out;
}
.card-place > .checklist { margin-bottom: 16px; }
@media (hover: hover) and (pointer: fine) {
  .card-place:hover { transform: translateY(-4px); box-shadow: var(--card-shadow-hover); }
}

/* Телефон: крупная ссылка для звонка одним нажатием */
.phone {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  font-weight: 700;
  white-space: nowrap;
}
.site-header .phone, .hero .phone { color: #fff; }
.site-header .header-phone { display: none; }   /* на телефоне номер есть на первом экране */

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 16px; }
.step {
  counter-increment: step;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 16px;
}
.step p { margin: 0; }
.step::before {
  content: counter(step);
  flex: 0 0 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step p { padding-top: 10px; }
.section-dark .step::before { background: var(--red); }

.checklist { padding-left: 1.25rem; }
.checklist li { margin-bottom: .5rem; }

/* Вопросы: каждый в своей карточке */
.faq { display: grid; gap: 12px; }
.faq details {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 0 20px;
}
.faq summary {
  min-height: 56px;
  padding: 12px 0;
  font-weight: 700;
  color: var(--heading);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  flex: 0 0 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-alt);
  color: var(--heading);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.faq details[open] summary::after { content: "−"; }
.faq details.is-closing summary::after { content: "+"; }   /* во время плавного закрытия (site.js) */
.faq details p { padding-bottom: 16px; margin: 0; }

.cta { text-align: center; }
.cta .section-title { display: table; margin: 0 auto 24px; }

.text-page { max-width: 760px; }

/* ---------- Подвал ---------- */
.site-footer { background: var(--header-bg); color: #fff; }
.site-footer a { color: #fff; }
.footer-inner { padding-top: 32px; padding-bottom: 32px; display: grid; gap: 24px; }
.footer-title { font-weight: 700; font-size: 1.125rem; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links a { display: inline-flex; align-items: center; min-height: 48px; }

/* ---------- Кнопка внизу экрана (телефон) ---------- */
.sticky-cta {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  padding: 12px 16px;
  background: var(--sticky-bg);
  box-shadow: 0 -2px 12px rgba(16, 24, 40, .12);
}

/* ---------- Всплывающая форма ---------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 16, 30, .7);
  overflow-y: auto;
}
.modal:target, .modal.is-open { display: block; }
.modal-box {
  background: var(--card);
  color: var(--text);
  min-height: 100%;
  padding: 16px;
  animation: modal-in .15s ease-out;
}
@keyframes modal-in { from { opacity: 0; } to { opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.modal-head h2 { margin: 0; }
.modal-close {
  flex: 0 0 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  line-height: 1;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--bg-alt); }
body.modal-open { overflow: hidden; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; margin-bottom: 4px; }
.field input[type="text"], .field input[type="tel"], .field select, .field textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--input-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--link); }
.field-hint { color: var(--muted); font-size: .9rem; margin: 4px 0 0; }
.field-error { color: var(--red); font-weight: 700; margin: 4px 0 0; }
.optional { font-weight: normal; color: var(--muted); }

.field-check { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.field-check input { width: 24px; height: 24px; margin: 2px 0 0; flex: 0 0 24px; }
.field-check label { flex: 1; font-weight: normal; }
.field-check .field-error { flex-basis: 100%; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-status { margin-top: 12px; font-weight: 700; color: var(--red); }
.field [aria-invalid="true"] { border-color: var(--red); }
.form-success { padding: 24px 0; }
.form-success-title { font-size: 1.5rem; font-weight: 800; color: var(--heading); }

/* ---------- Крупные блоки главной (по образцу contract.mos.ru) ---------- */
.site-header { position: sticky; top: 0; z-index: 60; }
.section, .hero { scroll-margin-top: 72px; }

.btn-outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .75); }
.btn-outline:hover { background: rgba(255, 255, 255, .12); border-color: #fff; }

.hero-lead { margin-bottom: 1.5rem; }
.hero-amount { margin: 0 0 20px; }
.hero-amount-label {
  margin: 0;
  font-size: .875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .85;
}
.hero-amount-value {
  margin: 0 0 .25rem;
  font-size: clamp(2rem, 10vw, 2.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.02em;
}
.hero-amount-note { max-width: 40em; opacity: .9; }
.hero-facts { list-style: none; margin: 0 0 24px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.hero-facts li {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .3);
  font-weight: 700;
}
.hero-actions { flex-wrap: wrap; }

/* Иконки в карточках */
.icon {
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  fill: none;
  stroke: var(--red);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}
.card-fact .card-number { font-size: 1.75rem; }
.card-heading { font-size: 1.25rem; margin-top: 0; }

/* Выплаты: крупные суммы по городам */
.pay-grid { display: grid; gap: 16px; }
.pay-card {
  background: var(--card);
  border-radius: var(--radius);
  border-top: 6px solid var(--red);
  box-shadow: var(--card-shadow);
  padding: 24px;
}
.pay-city {
  margin: 0 0 16px;
  font-size: 1.5rem;
}
.pay-label {
  margin: 0;
  font-size: .875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.pay-value {
  margin: 0 0 16px;
  font-size: clamp(2rem, 10vw, 2.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--heading);
  overflow-wrap: anywhere;
}
.pay-value-sm { font-size: 1.75rem; margin-bottom: 4px; }
.pay-value span { font-size: 1rem; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.pay-extra { color: var(--red); font-weight: 700; }
.pay-note { color: var(--muted); margin-top: 16px; margin-bottom: 0; }

/* Требования и документы рядом */
.req-grid { display: grid; gap: 16px; }
.req-grid .card { border-top-color: var(--red); }
.req-grid h3 { margin-top: 0; }

.cta-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 16px 24px; }
.cta .phone { color: #fff; font-size: 1.25rem; }
.cta .phone-name { opacity: .85; }
/* Несколько консультантов: каждый номер на своей строке */
.phones { display: inline-flex; flex-direction: column; gap: 14px; }

.footer-note { grid-column: 1 / -1; font-size: .9rem; opacity: .8; }
.footer-note p { margin: 0 0 .5rem; }

/* Черновые блоки: видны только при локальном запуске, пока владелец не проверит текст */
.draft {
  margin-top: 24px;
  padding: 16px;
  border: 2px dashed #B58900;
  border-radius: var(--radius);
  background: rgba(255, 243, 205, .5);
}
.draft-label {
  display: inline-block;
  margin: 0 0 12px;
  padding: 2px 10px;
  border-radius: 4px;
  background: #FFF3CD;
  color: #5C4400;
  font-size: .875rem;
  font-weight: 700;
}
.site-footer .draft { color: #fff; background: transparent; }

/* Быстрые переходы по разделам на первом экране */
/* На телефоне — одна строка с прокруткой вбок, чтобы не занимать первый экран */
.hero-links { display: flex; gap: 8px; margin: 0 -16px 24px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
.hero-links a { flex: none; }
.hero-links a {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 16px;
  border-radius: 999px; background: rgba(255, 255, 255, .14); color: #fff;
  text-decoration: none; font-weight: 700;
}
.hero-links a:hover { background: rgba(255, 255, 255, .26); }

.subsection-title { margin: 0 0 16px; font-size: 1.25rem; }
.pay-federal { margin-top: 40px; }
.cards + .subsection-title, .pay-note + .subsection-title { margin-top: 32px; }

/* Карточки с иллюстрацией (направления службы) */
.card.card-illus { padding: 0; overflow: hidden; }
.card-illus picture { display: block; }
.card-illus img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.card-illus-body { padding: 16px; }
.card-illus-body p { margin: 0; }

/* Карточка со списком и кнопкой «Ещё» */
.card-list .checklist { margin-bottom: 8px; }
/* Открытый «Ещё» удлиняет только свою карточку: соседние в ряду не растягиваются за ней */
.cards:has(.more[open]) { align-items: start; }
/* Надпись на кнопке: «Ещё» у закрытого списка, «Скрыть» у открытого */
.more .more-opened, .more[open] .more-closed { display: none; }
.more[open] .more-opened { display: inline; }
.more.is-closing .more-opened { display: none; }   /* во время плавного закрытия (site.js) уже пишем «Ещё» */
.more.is-closing .more-closed { display: inline; }
.more summary {
  display: inline-flex; align-items: center; min-height: 48px; cursor: pointer;
  color: var(--link); font-weight: 700;
}

/* Вкладки. Без JS видны все панели с подзаголовками */
.tab-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.tab-list[hidden] { display: none; }
.tab {
  min-height: 48px; padding: 0 20px; border: 2px solid var(--border); border-radius: 999px;
  background: var(--card); color: var(--text); font: inherit; font-weight: 700; cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab-panel + .tab-panel { margin-top: 32px; }
.js .tab-panel + .tab-panel { margin-top: 0; }
.js [data-tabs] .tab-panel-title { display: none; }
.tab-panel[hidden] { display: none; }
.tab-action { margin: 24px 0 0; }
.tab-phone .phone { font-size: 1.25rem; font-weight: 700; }
.faq-draft { border-style: dashed; }
.faq summary .draft-label { margin: 0 8px 0 0; }

/* Переключатель темы в шапке */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; margin-left: auto; padding: 0;
  background: transparent; color: #fff; cursor: pointer;
  border: 2px solid rgba(255, 255, 255, .6); border-radius: var(--radius-sm);
}
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { background: rgba(255, 255, 255, .12); }
.theme-toggle svg { width: 24px; height: 24px; }
.theme-toggle .i-sun { display: none; }
.theme-toggle[data-current="dark"] .i-sun { display: block; }
.theme-toggle[data-current="dark"] .i-moon { display: none; }
/* Смена темы: иконка поворачивается, новая тема расходится кругом от кнопки (main.js) */
.theme-toggle.is-animated svg { animation: theme-icon .5s ease-out; }   /* класс ставится при первом нажатии, чтобы не крутилась при загрузке */
@keyframes theme-icon { from { transform: rotate(-120deg) scale(.4); opacity: 0; } }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
/* Запасной вариант для браузеров без кругового перехода: цвета плавно перетекают */
.theme-fade, .theme-fade *, .theme-fade *::before, .theme-fade *::after {
  transition: background-color .45s ease, color .45s ease, border-color .45s ease, box-shadow .45s ease !important;
}
.logo { order: 0; flex: 1 1 0; min-width: 0; }  /* на узком экране название переносится, кнопки остаются в строке */
.theme-toggle { order: 1; }
.menu-toggle { order: 2; }
.main-nav { order: 3; }

/* Вводный абзац под заголовком раздела */
.section-lead { max-width: 46em; font-size: 1.125rem; margin-bottom: 24px; }
.section-dark .card .card-heading { color: var(--heading); }

/* Форма прямо на странице (сайт 1) */
.form-grid { display: grid; gap: 24px; align-items: start; }
.form-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--card-shadow);
  border-top: 4px solid var(--red); padding: 20px;
}
.form-card .form-success:focus { outline: none; }

/* Кнопка «Наверх»: слева внизу, на телефоне — над закреплённой кнопкой заявки */
.to-top {
  position: fixed; left: 16px; bottom: calc(var(--sticky-h) + 16px); z-index: 50;
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--header-bg); color: #fff; box-shadow: var(--card-shadow-hover);
  border: 2px solid rgba(255, 255, 255, .5);
}
.to-top[hidden] { display: none; }
.to-top { opacity: .85; }
.to-top:hover, .to-top:focus-visible { background: var(--blue); opacity: 1; }
.sticky-cta.is-hidden { display: none; }
.to-top svg { width: 26px; height: 26px; }

/* ---------- Планшет и ПК ---------- */
@media (min-width: 768px) {
  body { padding-bottom: 0; }
  .sticky-cta { display: none; }

  h1 { font-size: 2.5rem; }
  h2 { font-size: 2.5rem; }
  .card-heading, .subsection-title { font-size: 1.5rem; }

  .menu-toggle, .menu-toggle:not([hidden]) { display: none; }
  .main-nav, .js .main-nav { display: block; width: auto; }
  .main-nav ul { display: flex; gap: 8px; }
  .main-nav a { border-top: 0; padding: 0 8px; }
  .header-inner { flex-wrap: nowrap; }
  .site-header .header-phone { display: inline-flex; }
  .main-nav { order: 1; margin-left: auto; }
  .header-phone { order: 2; }
  .logo { flex: none; }
  .theme-toggle { order: 3; margin-left: 8px; flex: none; }

  .hero { padding: 72px 0 80px; }
  .hero-actions { flex-direction: row; align-items: center; gap: 24px; }
  .hero-links { flex-wrap: wrap; margin: 0 0 24px; padding: 0; overflow: visible; }

  .section { padding: 64px 0; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr 1fr; }

  h1 { font-size: 2.75rem; }
  .hero { padding: 88px 0 96px; }
  .hero-amount-value { font-size: 3.75rem; }
  .section { padding: 80px 0; }
  .section-title { margin-bottom: 2rem; }
  .pay-grid, .req-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .form-grid { grid-template-columns: 1fr 1fr; gap: 48px; }
  .form-card { padding: 32px; }
  .to-top { bottom: 24px; left: 24px; }
  .pay-card { padding: 32px; }
  .pay-value { font-size: 3rem; }
  .cards, .steps { gap: 24px; }
  .card { padding: 24px; }
  .site-header .header-phone { display: none; }
  .main-nav ul { gap: 0; }
  .main-nav a { padding: 0 10px; }
  .modal-box {
    min-height: 0;
    max-width: 560px;
    margin: 40px auto;
    padding: 24px;
    border-radius: var(--radius);
  }
}

/* Планшет: меню целиком не помещается в одну строку с названием — переносим его вниз */
@media (min-width: 768px) and (max-width: 1023px) {
  .header-inner { flex-wrap: wrap; }
  .theme-toggle { margin-left: auto; }
  .main-nav, .js .main-nav { order: 4; width: 100%; margin-left: 0; }
  .main-nav a { white-space: nowrap; }
}

@media (min-width: 1024px) {
  body { font-size: 1.125rem; }
  /* Размеры как на contract.mos.ru (замер 26.10.2026): h1 64, h2 48, заголовки карточек 28, текст карточек 20 */
  h1 { font-size: 4rem; max-width: 16em; }
  h2 { font-size: 3rem; }
  .card-heading, .subsection-title, .pay-city { font-size: 1.75rem; }
  .card p, .step p, .checklist, .faq summary, .faq details p, .section-lead { font-size: 1.25rem; }
  .hero { min-height: min(86vh, 820px); display: flex; align-items: center; }
  .hero-lead { font-size: 1.375rem; }
  .hero-amount-value { font-size: 4.75rem; }
  .cards { grid-template-columns: repeat(3, 1fr); }
  .cards-2 { grid-template-columns: repeat(2, 1fr); }
  .cards-pay, .cards-4 { grid-template-columns: repeat(4, 1fr); }
  .steps { grid-template-columns: repeat(4, 1fr); }
  .step { padding: 24px; flex-direction: column; }
  .step p { padding-top: 0; }
  .step::before { flex: none; width: 56px; height: 56px; }
}
@media (min-width: 1200px) {
  .site-header .header-phone { display: inline-flex; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
