/* ============================================================================
   ТеплоРасчёт — дизайн-система
   Порядок: токены → база → каркас → компоненты → страницы → адаптив → печать
   ========================================================================= */

/* ---------------------------------------------------------------- 1. Токены */

:root {
  /* Фирменные цвета */
  --brand-50:  #eef6ff;
  --brand-100: #d8ebfd;
  --brand-200: #b3d7fa;
  --brand-300: #7dbaf3;
  --brand-400: #4a97e0;
  --brand-500: #2478c4;
  --brand-600: #125ea3;
  --brand-700: #0d4a82;
  --brand-800: #0c3c69;
  --brand-900: #0c3155;

  /* Акцент «тепло» */
  --accent-100: #ffeedd;
  --accent-300: #ffc08a;
  --accent-500: #f97316;
  --accent-600: #e8590c;
  --accent-700: #b8460a;

  /* Смысловые */
  --ok-500:   #0f9d67;
  --ok-100:   #e3f7ee;
  --warn-500: #d97706;
  --warn-100: #fdf3e0;
  --bad-500:  #dc2626;
  --bad-100:  #fdeaea;
  --info-500: #2478c4;
  --info-100: #eaf3fd;

  /* Категории */
  --cat-heat:  #e8590c;
  --cat-vent:  #2478c4;
  --cat-insul: #0f9d67;

  /* Поверхности и текст (светлая тема) */
  --bg:            #ffffff;
  --bg-soft:       #f7f9fc;
  --bg-muted:      #eef3f9;
  --surface:       #ffffff;
  --surface-alt:   #fbfcfe;
  --border:        #e0e8f1;
  --border-strong: #c8d5e4;
  --text:          #0d1726;
  --text-soft:     #46536b;
  --text-mute:     #6d7d94;
  --text-invert:   #ffffff;

  /* Тени */
  --shadow-xs: 0 1px 2px rgba(13, 23, 38, .06);
  --shadow-sm: 0 1px 3px rgba(13, 23, 38, .08), 0 1px 2px rgba(13, 23, 38, .04);
  --shadow-md: 0 4px 12px rgba(13, 23, 38, .08), 0 1px 3px rgba(13, 23, 38, .05);
  --shadow-lg: 0 12px 32px rgba(13, 23, 38, .12), 0 2px 8px rgba(13, 23, 38, .06);

  /* Радиусы */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 999px;

  /* Типографика */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          "Noto Sans", Arial, "PT Sans", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Segoe UI Mono",
               Consolas, "Liberation Mono", monospace;
  --fs-xs: .78rem;
  --fs-sm: .875rem;
  --fs-base: 1rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 1.875rem;
  --fs-3xl: 2.25rem;
  --fs-4xl: 2.75rem;

  /* Ритм */
  --gap-1: .25rem;
  --gap-2: .5rem;
  --gap-3: .75rem;
  --gap-4: 1rem;
  --gap-5: 1.5rem;
  --gap-6: 2rem;
  --gap-7: 3rem;
  --gap-8: 4rem;

  --container: 1200px;
  --article-w: 760px;
  --header-h: 64px;
}

[data-theme="dark"] {
  --bg:            #0a0f18;
  --bg-soft:       #0e1520;
  --bg-muted:      #131d2b;
  --surface:       #111a27;
  --surface-alt:   #0f1824;
  --border:        #1e2b3d;
  --border-strong: #2c3d54;
  --text:          #e7eefa;
  --text-soft:     #a7b7cd;
  --text-mute:     #7b8ca4;

  --brand-50:  #0f2135;
  --brand-100: #12304d;
  --brand-200: #17466f;
  --brand-500: #4da3e8;
  --brand-600: #6bb6f0;
  --brand-700: #8ec8f5;

  --accent-100: #35210f;
  --accent-500: #ff8a3d;
  --accent-600: #ffa05f;
  --accent-700: #ffb884;

  --ok-100:   #10291f;
  --warn-100: #2c2110;
  --bad-100:  #2e1414;
  --info-100: #10233a;

  --cat-heat:  #ff8a3d;
  --cat-vent:  #4da3e8;
  --cat-insul: #34d399;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .5);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, .55);
}

/* ------------------------------------------------------------------ 2. База */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.015em; margin: 0; font-weight: 700; }

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

::selection { background: var(--brand-200); color: var(--brand-900); }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.container--narrow { max-width: 900px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--brand-700); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--r-md) 0;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------------------------------------------------------------- 3. Каркас */

.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: var(--gap-5);
}

.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.logo:hover { text-decoration: none; }
.logo__mark {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-600), var(--accent-500) 55%, var(--brand-500));
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 2px 8px rgba(232, 89, 12, .28);
}
.logo__mark svg { width: 20px; height: 20px; }
.logo__text { display: flex; flex-direction: column; line-height: 1.1; }
.logo__name { font-weight: 800; font-size: 1.08rem; color: var(--text); letter-spacing: -.02em; }
.logo__tag { font-size: .68rem; color: var(--text-mute); letter-spacing: .02em; }

.nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav__link {
  padding: 8px 13px; border-radius: var(--r-sm); font-size: var(--fs-sm);
  font-weight: 600; color: var(--text-soft); text-decoration: none;
  transition: background .15s, color .15s; white-space: nowrap;
}
.nav__link:hover { background: var(--bg-muted); color: var(--text); text-decoration: none; }
.nav__link[aria-current="true"] { color: var(--brand-600); background: var(--brand-50); }

.header-actions { display: flex; align-items: center; gap: 6px; margin-left: var(--gap-3); }

.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  border-radius: var(--r-sm); cursor: pointer; padding: 0;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--bg-muted); color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; }

.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.nav-toggle { display: none; }

.site-main { min-height: 60vh; padding-bottom: var(--gap-8); }

/* ----------------------------------------------------------------- 4. Hero */

.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--brand-900) 0%, var(--brand-700) 48%, var(--brand-600) 100%);
  color: #fff; padding: 68px 0 76px;
}
.hero::before {
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image:
    linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 70% at 70% 30%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 70% 30%, #000 20%, transparent 78%);
}
.hero::after {
  content: ""; position: absolute; width: 620px; height: 620px; right: -180px; top: -240px;
  background: radial-gradient(circle, rgba(249,115,22,.42), transparent 62%);
  pointer-events: none;
}
.hero__inner { position: relative; z-index: 1; max-width: 840px; }
.hero h1 {
  font-size: clamp(1.9rem, 4.2vw, 2.9rem); font-weight: 800;
  letter-spacing: -.03em; margin-bottom: var(--gap-4); color: #fff;
}
.hero p {
  font-size: clamp(1rem, 1.6vw, 1.19rem); color: rgba(255,255,255,.86);
  margin: 0 0 var(--gap-6); max-width: 660px; line-height: 1.6;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--gap-3); }
.hero__stats {
  display: flex; flex-wrap: wrap; gap: var(--gap-6);
  margin-top: var(--gap-7); padding-top: var(--gap-5);
  border-top: 1px solid rgba(255,255,255,.16);
}
.hero__stat b { display: block; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.hero__stat span { font-size: var(--fs-sm); color: rgba(255,255,255,.72); }

/* --------------------------------------------------------------- 5. Кнопки */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 650;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .1s, box-shadow .15s;
  white-space: nowrap; font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }

.btn--primary { background: var(--accent-600); color: #fff; box-shadow: 0 2px 10px rgba(232,89,12,.3); }
.btn--primary:hover { background: var(--accent-700); color: #fff; }

.btn--light { background: #fff; color: var(--brand-800); }
.btn--light:hover { background: #eef4fb; color: var(--brand-900); }

.btn--ghost { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.28); }
.btn--ghost:hover { background: rgba(255,255,255,.18); color: #fff; }

.btn--outline { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn--outline:hover { background: var(--bg-muted); color: var(--text); }

.btn--sm { padding: 7px 13px; font-size: var(--fs-xs); }
.btn--block { width: 100%; }

/* ------------------------------------------------------------- 6. Секции */

.section { padding: var(--gap-8) 0 0; }
.section--tight { padding-top: var(--gap-7); }

.section-head { margin-bottom: var(--gap-5); max-width: 720px; }
.section-head h2 {
  font-size: clamp(1.4rem, 2.4vw, 1.85rem); font-weight: 750; letter-spacing: -.025em;
  display: flex; align-items: center; gap: 12px;
}
.section-head h2 .ico { width: 26px; height: 26px; flex-shrink: 0; }
.section-head p { margin: 8px 0 0; color: var(--text-soft); font-size: var(--fs-base); }
.section-head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--gap-4); max-width: none; }
.section-head--row > div { max-width: 720px; }
.section-head .ico--heat { color: var(--cat-heat); }
.section-head .ico--vent { color: var(--cat-vent); }
.section-head .ico--insul { color: var(--cat-insul); }
.section-head .ico--calc { color: var(--brand-500); }

/* --------------------------------------------------------------- 7. Карточки */

.cards { display: grid; gap: var(--gap-4); }
.cards--3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.cards--2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 22px; text-decoration: none; color: inherit;
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.card:hover {
  border-color: var(--brand-300); box-shadow: var(--shadow-md);
  transform: translateY(-2px); text-decoration: none;
}
.card__icon {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  margin-bottom: 14px; flex-shrink: 0;
  background: var(--brand-50); color: var(--brand-600);
}
.card__icon svg { width: 22px; height: 22px; }
.card__icon--heat { background: color-mix(in srgb, var(--cat-heat) 12%, transparent); color: var(--cat-heat); }
.card__icon--vent { background: color-mix(in srgb, var(--cat-vent) 12%, transparent); color: var(--cat-vent); }
.card__icon--insul { background: color-mix(in srgb, var(--cat-insul) 12%, transparent); color: var(--cat-insul); }

.card h3 { font-size: 1.06rem; font-weight: 700; margin-bottom: 7px; color: var(--text); }
.card p { margin: 0; font-size: var(--fs-sm); color: var(--text-soft); line-height: 1.55; }
.card__meta {
  margin-top: auto; padding-top: 14px; display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-xs); color: var(--text-mute); font-weight: 600;
}
.card__meta svg { width: 14px; height: 14px; }

.card--tool { background: linear-gradient(180deg, var(--surface), var(--surface-alt)); }
.card--tool .card__badge {
  position: absolute; top: 16px; right: 16px; font-size: .62rem; font-weight: 750;
  letter-spacing: .06em; text-transform: uppercase; color: var(--accent-600);
  background: var(--accent-100); padding: 3px 8px; border-radius: var(--r-full);
}

/* ------------------------------------------------------ 8. Список публикаций */

.post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--gap-3); }
.post-list--2 { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }

.post-item a {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); text-decoration: none; color: inherit;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.post-item a:hover { border-color: var(--brand-300); box-shadow: var(--shadow-sm); text-decoration: none; }
.post-item__body { min-width: 0; flex: 1; }
.post-item__title {
  display: block; font-weight: 640; font-size: var(--fs-base); color: var(--text);
  line-height: 1.4; margin-bottom: 4px;
}
.post-item__desc {
  display: block; font-size: var(--fs-sm); color: var(--text-soft);
  line-height: 1.5; margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-item__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  font-size: var(--fs-xs); color: var(--text-mute);
}
.post-item__meta svg { width: 13px; height: 13px; vertical-align: -2px; }
.post-item__dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .5; }
.post-item__icon {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center;
  background: var(--bg-muted); color: var(--text-mute); margin-top: 2px;
}
.post-item__icon svg { width: 18px; height: 18px; }
.post-item__icon--heat { background: color-mix(in srgb, var(--cat-heat) 12%, transparent); color: var(--cat-heat); }
.post-item__icon--vent { background: color-mix(in srgb, var(--cat-vent) 12%, transparent); color: var(--cat-vent); }
.post-item__icon--insul { background: color-mix(in srgb, var(--cat-insul) 12%, transparent); color: var(--cat-insul); }

/* ----------------------------------------------------------- 9. Хлебные крошки */

.breadcrumbs { padding: var(--gap-4) 0 0; }
.breadcrumbs ol {
  list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap;
  align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-mute);
}
.breadcrumbs li { display: flex; align-items: center; gap: 6px; }
.breadcrumbs a { color: var(--text-soft); }
.breadcrumbs a:hover { color: var(--brand-600); }
.breadcrumbs svg { width: 13px; height: 13px; opacity: .6; }

/* --------------------------------------------------------------- 10. Статья */

.article-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 260px;
  gap: var(--gap-7); align-items: start; padding-top: var(--gap-5);
}
.article { min-width: 0; max-width: var(--article-w); }

.article-header { margin-bottom: var(--gap-5); }
.article-header h1 {
  font-size: clamp(1.65rem, 3.4vw, 2.3rem); font-weight: 800;
  letter-spacing: -.03em; margin-bottom: var(--gap-4); line-height: 1.22;
}
.article-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  font-size: var(--fs-sm); color: var(--text-mute);
}
.article-meta__item { display: inline-flex; align-items: center; gap: 6px; }
.article-meta svg { width: 15px; height: 15px; }

.article-lead {
  font-size: 1.1rem; color: var(--text-soft); line-height: 1.62;
  padding-left: 16px; border-left: 3px solid var(--accent-500);
  margin: 0 0 var(--gap-6);
}

.article-figure { margin: var(--gap-6) 0; }
.article-figure img, .article-figure svg {
  width: 100%; border-radius: var(--r-lg); border: 1px solid var(--border);
  background: var(--surface);
}
.article-figure figcaption {
  margin-top: 10px; font-size: var(--fs-sm); color: var(--text-mute);
  text-align: center; line-height: 1.5;
}

/* Типографика контента */
.prose { font-size: var(--fs-md); }
.prose > * + * { margin-top: var(--gap-4); }
.prose p { margin: 0; line-height: 1.72; }
.prose h2 {
  font-size: clamp(1.28rem, 2.3vw, 1.6rem); font-weight: 750; letter-spacing: -.025em;
  margin-top: var(--gap-7); padding-top: var(--gap-2); scroll-margin-top: calc(var(--header-h) + 20px);
}
.prose h3 {
  font-size: 1.16rem; font-weight: 700; margin-top: var(--gap-5);
  scroll-margin-top: calc(var(--header-h) + 20px);
}
.prose h4 { font-size: 1.02rem; font-weight: 700; margin-top: var(--gap-5); }
.prose ul, .prose ol { margin: 0; padding-left: 1.4em; }
.prose li { margin-bottom: 7px; line-height: 1.65; }
.prose li > ul, .prose li > ol { margin-top: 7px; }
.prose li::marker { color: var(--brand-500); font-weight: 600; }
.prose strong { font-weight: 700; color: var(--text); }
.prose code {
  font-family: var(--font-mono); font-size: .88em; padding: 2px 6px;
  background: var(--bg-muted); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--brand-700); white-space: nowrap;
}
.prose hr { border: 0; border-top: 1px solid var(--border); margin: var(--gap-6) 0; }
.prose a { text-decoration: underline; text-decoration-color: var(--brand-200); text-underline-offset: 2px; }
.prose a:hover { text-decoration-color: var(--brand-500); }

/* Таблицы */
.table-wrap {
  position: relative;
  overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md);
  -webkit-overflow-scrolling: touch;
  /* «Тени прокрутки»: проявляются у краёв, только когда есть горизонтальная прокрутка */
  background:
    linear-gradient(90deg, var(--surface) 30%, rgba(255,255,255,0)) left center / 48px 100% no-repeat,
    linear-gradient(270deg, var(--surface) 30%, rgba(255,255,255,0)) right center / 48px 100% no-repeat,
    radial-gradient(farthest-side at 0 50%, rgba(15,23,42,.14), rgba(15,23,42,0)) left center / 20px 100% no-repeat,
    radial-gradient(farthest-side at 100% 50%, rgba(15,23,42,.14), rgba(15,23,42,0)) right center / 20px 100% no-repeat,
    var(--surface);
  background-attachment: local, local, scroll, scroll, local;
}
.prose table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.prose thead th {
  background: var(--bg-muted); font-weight: 700; text-align: left;
  padding: 11px 14px; border-bottom: 1px solid var(--border-strong);
  white-space: nowrap; color: var(--text); font-size: var(--fs-sm);
}
.prose tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:nth-child(even) { background: var(--surface-alt); }
.prose tbody tr:hover { background: var(--brand-50); }
.prose td, .prose th { font-variant-numeric: tabular-nums; }

/* Блоки кода */
.code-block { position: relative; }
.code-block pre {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  background: var(--brand-900); color: #dbeafe; border-radius: var(--r-md);
  font-family: var(--font-mono); font-size: .84rem; line-height: 1.6;
}
[data-theme="dark"] .code-block pre { background: #060b13; color: #cfe3f8; }
.code-lang {
  position: absolute; top: 8px; right: 12px; font-size: .64rem; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(255,255,255,.4); font-family: var(--font-mono);
}

/* Цитаты */
.prose blockquote {
  margin: 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--border-strong);
  color: var(--text-soft); font-style: italic;
}
.prose blockquote p + p { margin-top: 10px; }

/* ------------------------------------------------------------- 11. Врезки */

.callout {
  display: flex; gap: 13px; padding: 15px 18px; border-radius: var(--r-md);
  border: 1px solid; font-size: var(--fs-base); line-height: 1.62;
}
.callout__icon { flex-shrink: 0; width: 20px; height: 20px; margin-top: 2px; }
.callout__body { min-width: 0; }
.callout__body > * + * { margin-top: 8px; }
.callout__body p { margin: 0; }
.callout__body ul, .callout__body ol { margin: 8px 0 0; padding-left: 1.3em; }
.callout__body code { background: rgba(255,255,255,.55); }

.callout--info { background: var(--info-100); border-color: color-mix(in srgb, var(--info-500) 32%, transparent); }
.callout--info .callout__icon { color: var(--info-500); }
.callout--warn { background: var(--warn-100); border-color: color-mix(in srgb, var(--warn-500) 34%, transparent); }
.callout--warn .callout__icon { color: var(--warn-500); }
.callout--tip { background: var(--ok-100); border-color: color-mix(in srgb, var(--ok-500) 32%, transparent); }
.callout--tip .callout__icon { color: var(--ok-500); }
.callout--formula {
  background: var(--brand-50); border-color: color-mix(in srgb, var(--brand-500) 30%, transparent);
  font-family: var(--font-mono); font-size: .93rem;
}
.callout--formula .callout__icon { color: var(--brand-600); }

/* ------------------------------------------------------------ 12. Калькулятор */

.calc {
  margin: var(--gap-6) 0; border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface); overflow: hidden; box-shadow: var(--shadow-sm);
}
.calc__head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 18px 22px; background: linear-gradient(135deg, var(--brand-800), var(--brand-600));
  color: #fff;
}
.calc__head-icon {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center;
  background: rgba(255,255,255,.16);
}
.calc__head-icon svg { width: 19px; height: 19px; }
.calc__title { font-size: 1.08rem; font-weight: 700; margin: 0; color: #fff; line-height: 1.3; }
.calc__subtitle { margin: 4px 0 0; font-size: var(--fs-xs); color: rgba(255,255,255,.75); }
.calc__subtitle a { color: rgba(255,255,255,.9); text-decoration: underline; }

.calc__body { padding: 22px; }
.calc__fields {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 18px;
}
.calc-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.calc-field--full { grid-column: 1 / -1; }
.calc-field__label {
  font-size: var(--fs-sm); font-weight: 650; color: var(--text-soft);
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.calc-field__unit {
  font-size: var(--fs-xs); color: var(--text-mute); font-weight: 600;
  font-family: var(--font-mono);
}
.calc-field__input, .calc-field__select {
  width: 100%; padding: 10px 12px; font-size: var(--fs-base); font-family: inherit;
  color: var(--text); background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); transition: border-color .15s, box-shadow .15s;
  font-variant-numeric: tabular-nums;
}
.calc-field__input:focus, .calc-field__select:focus {
  outline: none; border-color: var(--brand-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 18%, transparent);
}
.calc-field__select {
  appearance: none; cursor: pointer; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236d7d94' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 15px;
}
.calc-field__hint { font-size: var(--fs-xs); color: var(--text-mute); line-height: 1.45; }
.calc-field__input.is-invalid { border-color: var(--bad-500); }

.calc__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; align-items: center; }
.calc__actions .btn--primary { padding: 12px 26px; font-size: var(--fs-base); }

.calc__result {
  margin-top: 22px; padding: 20px; border-radius: var(--r-md);
  background: var(--bg-soft); border: 1px solid var(--border);
}
.calc__result:empty { display: none; }

.calc-primary {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px;
  padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px dashed var(--border-strong);
}
.calc-primary__label { font-size: var(--fs-sm); font-weight: 650; color: var(--text-soft); width: 100%; }
.calc-primary__value {
  font-size: clamp(1.9rem, 4.5vw, 2.5rem); font-weight: 800; letter-spacing: -.03em;
  color: var(--brand-700); font-variant-numeric: tabular-nums; line-height: 1;
}
[data-theme="dark"] .calc-primary__value { color: var(--brand-600); }
.calc-primary__unit { font-size: 1.15rem; font-weight: 700; color: var(--text-soft); }
.calc-primary__hint { width: 100%; font-size: var(--fs-xs); color: var(--text-mute); }

.calc-secondary {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 16px;
}
.calc-secondary__item {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
}
.calc-secondary__label { font-size: var(--fs-xs); color: var(--text-mute); line-height: 1.35; }
.calc-secondary__value {
  font-size: 1.02rem; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.calc-secondary__value span { font-size: var(--fs-xs); font-weight: 600; color: var(--text-mute); margin-left: 3px; }
.calc-secondary__item[data-state="ok"] { border-color: color-mix(in srgb, var(--ok-500) 45%, transparent); background: var(--ok-100); }
.calc-secondary__item[data-state="ok"] .calc-secondary__value { color: var(--ok-500); }
.calc-secondary__item[data-state="bad"] { border-color: color-mix(in srgb, var(--bad-500) 45%, transparent); background: var(--bad-100); }
.calc-secondary__item[data-state="bad"] .calc-secondary__value { color: var(--bad-500); }

.calc-status {
  margin-top: 14px; padding: 12px 14px; border-radius: var(--r-sm); font-size: var(--fs-sm);
  line-height: 1.55; border: 1px solid; display: flex; gap: 10px;
}
.calc-status svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 2px; }
.calc-status--ok { background: var(--ok-100); border-color: color-mix(in srgb, var(--ok-500) 34%, transparent); color: var(--text); }
.calc-status--ok svg { color: var(--ok-500); }
.calc-status--warn { background: var(--warn-100); border-color: color-mix(in srgb, var(--warn-500) 36%, transparent); color: var(--text); }
.calc-status--warn svg { color: var(--warn-500); }
.calc-status--bad { background: var(--bad-100); border-color: color-mix(in srgb, var(--bad-500) 36%, transparent); color: var(--text); }
.calc-status--bad svg { color: var(--bad-500); }

.calc-chart { margin-top: 18px; }
.calc-chart__title { font-size: var(--fs-sm); font-weight: 650; color: var(--text-soft); margin-bottom: 10px; }
.calc-chart svg { width: 100%; height: auto; overflow: visible; }

.cbars { display: grid; gap: 12px; }
.cbar__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 5px; }
.cbar__label { font-size: var(--fs-sm); color: var(--text-soft); line-height: 1.35; }
.cbar__value { font-size: var(--fs-sm); font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cbar__track { height: 9px; border-radius: var(--r-full); background: var(--bg-muted); overflow: hidden; }
.cbar__fill {
  height: 100%; border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--brand-500), var(--brand-400));
  transition: width .35s ease;
}
.cbar:nth-child(2) .cbar__fill { background: linear-gradient(90deg, var(--accent-600), var(--accent-500)); }
.cbar:nth-child(3) .cbar__fill { background: linear-gradient(90deg, var(--ok-500), #34d399); }
.cbar:nth-child(4) .cbar__fill { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.cbar:nth-child(5) .cbar__fill { background: linear-gradient(90deg, var(--warn-500), #fbbf24); }

.calc-steps { margin-top: 16px; border-top: 1px dashed var(--border-strong); padding-top: 14px; }
.calc-steps summary {
  cursor: pointer; font-size: var(--fs-sm); font-weight: 650; color: var(--brand-600);
  list-style: none; display: inline-flex; align-items: center; gap: 7px; user-select: none;
}
.calc-steps summary::-webkit-details-marker { display: none; }
.calc-steps summary svg { width: 15px; height: 15px; transition: transform .18s; }
.calc-steps[open] summary svg { transform: rotate(90deg); }
.calc-steps__table { width: 100%; margin-top: 12px; border-collapse: collapse; font-size: var(--fs-sm); }
.calc-steps__table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.calc-steps__table tr:last-child td { border-bottom: 0; }
.calc-steps__table td:first-child { color: var(--text-soft); width: 40%; }
.calc-steps__table td:nth-child(2) {
  font-family: var(--font-mono); font-size: .8rem; color: var(--text-mute);
  word-break: break-word;
}
.calc-steps__table td:last-child { font-weight: 700; text-align: right; white-space: nowrap; }

.calc-note {
  margin-top: 14px; font-size: var(--fs-xs); color: var(--text-mute); line-height: 1.55;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.calc-note strong { color: var(--text-soft); }

.calc__foot {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 14px 22px; background: var(--bg-soft); border-top: 1px solid var(--border);
  font-size: var(--fs-xs); color: var(--text-mute);
}
.calc__foot .btn { margin-left: auto; }

.calc-error {
  margin-top: 16px; padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--bad-100); border: 1px solid color-mix(in srgb, var(--bad-500) 36%, transparent);
  color: var(--text); font-size: var(--fs-sm);
}

/* ------------------------------------------------------------- 13. Оглавление */

.toc { position: sticky; top: calc(var(--header-h) + 24px); font-size: var(--fs-sm); }
.toc__title {
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-mute); margin-bottom: 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.toc__list { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.toc__item a {
  display: block; padding: 6px 12px; color: var(--text-soft); line-height: 1.45;
  border-left: 2px solid transparent; margin-left: -2px; font-size: var(--fs-sm);
  transition: color .15s, border-color .15s;
}
.toc__item a:hover { color: var(--brand-600); text-decoration: none; }
.toc__item--3 a { padding-left: 24px; font-size: var(--fs-xs); }
.toc__item a.is-active { color: var(--brand-600); border-left-color: var(--brand-500); font-weight: 650; }
.toc__cta {
  margin-top: 18px; padding: 14px; border-radius: var(--r-md);
  background: var(--bg-soft); border: 1px solid var(--border);
}
.toc__cta p { margin: 0 0 10px; font-size: var(--fs-xs); color: var(--text-soft); line-height: 1.5; }

/* ------------------------------------------------------------------ 14. FAQ */

.faq { margin: var(--gap-6) 0; }
.faq__item {
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); margin-bottom: 10px; overflow: hidden;
}
.faq__q {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 15px 18px; cursor: pointer; font-weight: 650; font-size: var(--fs-base);
  list-style: none; color: var(--text); line-height: 1.45;
}
.faq__q::-webkit-details-marker { display: none; }
.faq__q:hover { background: var(--bg-soft); }
.faq__q svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 3px; color: var(--text-mute); transition: transform .2s; }
.faq__item[open] .faq__q svg { transform: rotate(180deg); }
.faq__a { padding: 0 18px 16px; color: var(--text-soft); font-size: var(--fs-base); line-height: 1.68; }
.faq__a > * + * { margin-top: 10px; }

/* --------------------------------------------------------------- 15. Прочее */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: 600;
  background: var(--bg-muted); color: var(--text-soft); text-decoration: none;
  border: 1px solid transparent;
}
.chip:hover { background: var(--brand-50); color: var(--brand-600); text-decoration: none; border-color: var(--brand-200); }

.related { margin-top: var(--gap-7); padding-top: var(--gap-5); border-top: 1px solid var(--border); }
.related h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: var(--gap-4); }

.pagination { display: flex; justify-content: center; gap: 6px; margin-top: var(--gap-6); list-style: none; padding: 0; }
.pagination a, .pagination span {
  min-width: 38px; height: 38px; display: grid; place-items: center; padding: 0 10px;
  border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface);
  color: var(--text-soft); font-size: var(--fs-sm); font-weight: 600; text-decoration: none;
}
.pagination a:hover { border-color: var(--brand-300); color: var(--brand-600); text-decoration: none; }
.pagination [aria-current="page"] { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

.notice {
  padding: 16px 18px; border-radius: var(--r-md); background: var(--bg-soft);
  border: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-soft); line-height: 1.6;
}
.notice > * + * { margin-top: 10px; }

.legal { max-width: 820px; }
.legal h2 { font-size: 1.25rem; margin-top: var(--gap-6); }
.legal ul { padding-left: 1.3em; }

/* ---------------------------------------------------------- 16. Поиск */

.search-open { overflow: hidden; }
.search-modal {
  position: fixed; inset: 0; z-index: 300; display: none;
  background: rgba(9, 15, 24, .55); backdrop-filter: blur(3px);
  padding: 12vh 20px 20px;
}
.search-modal.is-open { display: block; }
.search-box {
  max-width: 640px; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.search-box__input-row { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.search-box__input-row svg { width: 20px; height: 20px; color: var(--text-mute); flex-shrink: 0; }
.search-box input {
  flex: 1; border: 0; background: none; font-size: 1.05rem; font-family: inherit;
  color: var(--text); outline: none; padding: 4px 0;
}
.search-results { list-style: none; margin: 0; padding: 6px; max-height: 52vh; overflow-y: auto; }
.search-results li a {
  display: block; padding: 11px 14px; border-radius: var(--r-sm);
  text-decoration: none; color: inherit;
}
.search-results li a:hover, .search-results li a.is-active { background: var(--bg-muted); text-decoration: none; }
.search-results__title { font-weight: 640; font-size: var(--fs-base); color: var(--text); display: block; margin-bottom: 3px; }
.search-results__desc {
  font-size: var(--fs-xs); color: var(--text-mute); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.search-results__cat {
  font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--brand-600); display: block; margin-bottom: 3px;
}
.search-empty { padding: 28px 18px; text-align: center; color: var(--text-mute); font-size: var(--fs-sm); }

/* ---------------------------------------------------------- 17. Подвал */

.site-footer {
  margin-top: var(--gap-8); background: var(--brand-900); color: rgba(255,255,255,.72);
  font-size: var(--fs-sm);
}
[data-theme="dark"] .site-footer { background: #070c14; border-top: 1px solid var(--border); }
.footer__top {
  display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: var(--gap-6);
  padding: var(--gap-7) 0 var(--gap-6);
}
.footer__brand .logo__name { color: #fff; }
.footer__brand .logo__tag { color: rgba(255,255,255,.55); }
.footer__about { margin: 14px 0 0; line-height: 1.6; max-width: 340px; color: rgba(255,255,255,.6); font-size: var(--fs-xs); }
.footer__col h3 {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em;
  color: rgba(255,255,255,.5); font-weight: 700; margin-bottom: 14px;
}
.footer__col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.footer__col a { color: rgba(255,255,255,.78); text-decoration: none; font-size: var(--fs-sm); }
.footer__col a:hover { color: #fff; text-decoration: underline; }
.footer__bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px;
  padding: 18px 0 26px; border-top: 1px solid rgba(255,255,255,.12);
  font-size: var(--fs-xs); color: rgba(255,255,255,.5);
}
.footer__bottom a { color: rgba(255,255,255,.62); }

/* -------------------------------------------------------- 18. Адаптив */

@media (max-width: 1080px) {
  .article-layout { grid-template-columns: minmax(0, 1fr); gap: var(--gap-6); }
  .toc { display: none; }
}

@media (max-width: 900px) {
  .nav { display: none; }
  .nav-toggle { display: grid; }
  .site-header__inner { gap: 12px; }
  .logo { margin-right: auto; }

  .nav.is-open {
    display: flex; flex-direction: column; align-items: stretch; gap: 2px;
    position: fixed; top: var(--header-h); left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 12px 16px 18px; box-shadow: var(--shadow-lg);
    max-height: calc(100vh - var(--header-h)); overflow-y: auto;
  }
  .nav.is-open .nav__link { padding: 12px 14px; font-size: var(--fs-base); }

  .hero { padding: 48px 0 54px; }
  .hero__stats { gap: var(--gap-5); }
  .footer__top { grid-template-columns: 1fr 1fr; gap: var(--gap-5); }
  .footer__brand { grid-column: 1 / -1; }
  .calc__fields { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  :root { --header-h: 58px; }
  .logo__tag { display: none; }
  .container { padding: 0 15px; }
  .hero { padding: 38px 0 44px; }
  .hero__stat b { font-size: 1.3rem; }
  .section { padding-top: var(--gap-7); }
  .cards--3, .cards--2, .post-list--2 { grid-template-columns: 1fr; }
  .calc__body { padding: 18px 15px; }
  .calc__head { padding: 15px 16px; }
  .calc__foot { padding: 12px 15px; }
  .calc-secondary { grid-template-columns: 1fr 1fr; }
  .calc__actions .btn--primary { width: 100%; }
  .article-header h1 { font-size: 1.5rem; }
  .prose { font-size: 1rem; }
  .footer__top { grid-template-columns: 1fr; }
  .search-modal { padding: 6vh 12px 12px; }
}

@media (max-width: 420px) {
  .calc-secondary { grid-template-columns: 1fr; }
}

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

/* ----------------------------------------------------------- 19. Печать */

@media print {
  .site-header, .site-footer, .toc, .calc__actions, .calc__foot,
  .breadcrumbs, .related, .search-modal, .nav-toggle, .header-actions { display: none !important; }
  body { font-size: 11pt; color: #000; background: #fff; }
  .article-layout { display: block; }
  .article { max-width: none; }
  .calc { break-inside: avoid; box-shadow: none; border-color: #999; }
  .calc__head { background: #eee !important; color: #000 !important; }
  .calc__title, .calc__subtitle { color: #000 !important; }
  .prose a { text-decoration: none; color: #000; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
  .table-wrap { overflow: visible; }
  .callout { border-color: #999; background: #f7f7f7 !important; }
}
