/* Дім&Енергія: стили сайта. Цвета заданы токенами, тёмная тема включается по настройкам устройства. */
:root {
  --bg: #eef2f2; --bg-glow: #bfe3ea; --surface: #ffffff; --surface-2: #f6f9f9;
  --ink: #0c2229; --muted: #4f676f; --line: #d0dcdd;
  --accent: #0a7a8f; --accent-ink: #ffffff;
  --repair: #a85d00; --heat: #c2400f; --power: #0a7a8f;
  --sponsored-bg: #fff1cf; --sponsored-ink: #664200;
  --font-display: "Unbounded", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07161b; --bg-glow: #0f4a58; --surface: #0e2830; --surface-2: #0b2027;
    --ink: #e8f1f2; --muted: #8fa9b0; --line: #1b3a44;
    --accent: #4fd1e8; --accent-ink: #052028;
    --repair: #f5b14a; --heat: #ff8a5c; --power: #4fd1e8;
    --sponsored-bg: #3a2c0c; --sponsored-ink: #f3d489;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background-color: var(--bg); color: var(--ink); font: 16px/1.65 var(--font-body);
  background-image: radial-gradient(900px 520px at 88% -4%, color-mix(in srgb, var(--bg-glow) 55%, transparent), transparent 70%);
  background-repeat: no-repeat;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: env(safe-area-inset-top, 0px) 0;
}
img { max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.wrap { max-width: 1120px; margin: 0 auto; }
main.wrap { padding-bottom: 56px; min-height: 60vh; }
section { scroll-margin-top: 84px; }

/* шапка */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); margin: 0 calc(50% - 50vw); padding: 0 max(16px, env(safe-area-inset-left, 0px)); }
.top .bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; padding-block: 14px; }
.logo { display: flex; align-items: center; gap: 10px; font: 500 17px/1 var(--font-display); letter-spacing: -0.02em; text-decoration: none; }
.logo svg { width: 28px; height: 28px; flex: none; }
.logo b { color: var(--accent); font-weight: 500; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 24px; margin-left: auto; font-size: 14px; font-weight: 500; }
.top nav a { text-decoration: none; color: var(--muted); padding: 4px 0; }
.top nav a:hover { color: var(--ink); }
.lang { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.lang a { font: 600 12px var(--font-body); letter-spacing: 0.04em; padding: 7px 12px; text-decoration: none; color: var(--muted); }
.lang a[aria-current="true"] { background: var(--ink); color: var(--bg); }

/* типографика */
.eyebrow { font: 600 12px var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
h1 { font: 500 clamp(28px, 4.2vw, 46px)/1.12 var(--font-display); letter-spacing: -0.035em; margin: 14px 0 18px; text-wrap: balance; overflow-wrap: anywhere; }
h2.sec { font: 500 clamp(22px, 3vw, 30px)/1.15 var(--font-display); letter-spacing: -0.03em; margin: 0; }
.lead { color: var(--muted); font-size: 18px; margin: 0 0 24px; max-width: 60ch; }
.sub { color: var(--muted); font-size: 15px; margin: 6px 0 0; }
.sec-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.btn { display: inline-block; font: 600 14px var(--font-body); padding: 13px 22px; border-radius: 10px; text-decoration: none; border: 1px solid var(--ink); }
.btn.pri { background: var(--ink); color: var(--bg); }
.btn.sec { background: transparent; color: var(--ink); border-color: var(--line); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.empty { color: var(--muted); }

/* главная */
.hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 40px; align-items: center; padding-block: 56px 48px; }
.hero > * { min-width: 0; }
.diagram { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px 18px 10px; box-shadow: 0 24px 60px -30px color-mix(in srgb, var(--accent) 45%, transparent); }
.diagram .cap { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); padding: 0 4px 6px; }
.diagram .cap b { font: 600 12px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.diagram svg { display: block; width: 100%; height: auto; font-family: var(--font-body); }
.node { fill: var(--surface-2); stroke: var(--line); stroke-width: 1.5; }
.dl { font-size: 12.5px; font-weight: 600; fill: var(--ink); text-anchor: middle; }
.flow { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 6 8; }
.back { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 2 7; stroke-linecap: round; opacity: .8; }
.ic { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ia { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.ifill { fill: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .flow { animation: flow 1.1s linear infinite; }
  @keyframes flow { to { stroke-dashoffset: -28; } }
  .post, .rubric, .author { transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
  .post:hover, .rubric:hover, .author:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -24px color-mix(in srgb, var(--rc, var(--mc, var(--accent))) 60%, transparent); }
}
.r-repair { --rc: var(--repair); } .r-heat { --rc: var(--heat); } .r-power { --rc: var(--power); }

.cover { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; margin-bottom: 56px; }
.cover > * { min-width: 0; }
.cover .body { padding: clamp(22px, 4vw, 40px); display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.cover .eyebrow { color: var(--rc); }
.cover h2 { font: 500 clamp(22px, 3vw, 30px)/1.2 var(--font-display); letter-spacing: -0.03em; margin: 0; text-wrap: balance; }
.cover h2 a { text-decoration: none; }
.cover p { margin: 0; color: var(--muted); }
.cover .thumb { border-bottom: 0; border-right: 1px solid var(--line); display: flex; align-items: center; aspect-ratio: auto; min-height: 220px; }

.thumb { --grid: color-mix(in srgb, var(--rc) 16%, transparent); background-color: color-mix(in srgb, var(--rc) 9%, var(--surface)); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 20px 20px; border-bottom: 1px solid var(--line); }
.thumb svg { display: block; width: 100%; height: auto; }
.thumb.photo { background: var(--surface-2); aspect-ratio: 32 / 15; overflow: hidden; }
.thumb.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover .thumb.photo { aspect-ratio: auto; }

.rubrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; margin-bottom: 64px; }
.rubric { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 12px; text-decoration: none; min-width: 0; }
.rubric:hover { border-color: var(--rc); }
.rubric .rtop { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.rubric .bar { width: 40px; height: 4px; background: var(--rc); border-radius: 2px; }
.rubric .cnt { font: 500 12px var(--font-body); color: var(--muted); font-variant-numeric: tabular-nums; }
.rubric h3 { font: 500 19px/1.25 var(--font-display); letter-spacing: -0.02em; margin: 0; }
.rubric p { margin: 0; color: var(--muted); font-size: 14px; }
.rubric ul { margin: auto 0 0; padding: 8px 0 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.rubric li { font-size: 12px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }

.feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 20px; margin-bottom: 64px; }
.post { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.post .post-body { padding: 4px 22px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.post .thumb { margin-bottom: 8px; }
.cat { font: 600 11px var(--font-body); letter-spacing: 0.09em; text-transform: uppercase; color: var(--rc); }
.cat a { text-decoration: none; }
.post h3 { font: 600 18px/1.35 var(--font-body); letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
.post h3 a { text-decoration: none; }
.post h3 a:hover { text-decoration: underline; }
.post p { margin: 0; color: var(--muted); font-size: 14px; }
.meta { margin-top: auto; padding-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 12px; color: var(--muted); }
.by { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; text-decoration: none; }
.mono { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font: 600 10px var(--font-body); background: var(--mc, var(--ink)); color: var(--bg); flex: none; }
.tag-sp { background: var(--sponsored-bg); color: var(--sponsored-ink); padding: 2px 8px; border-radius: 4px; font-weight: 600; }

.authors { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; margin-bottom: 40px; }
.author { background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 10px; min-width: 0; text-decoration: none; }
.author .mono { width: 48px; height: 48px; font: 500 15px var(--font-display); }
.author h3 { font: 500 17px/1.25 var(--font-display); letter-spacing: -0.02em; margin: 6px 0 0; }
.role { font: 600 11px var(--font-body); letter-spacing: 0.09em; text-transform: uppercase; color: var(--mc, var(--muted)); }
.author p { margin: 0; color: var(--muted); font-size: 14px; }

/* внутренние страницы */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 13px; color: var(--muted); padding-block: 24px 8px; }
.crumbs a { text-decoration: none; } .crumbs a:hover { text-decoration: underline; }
.page-head { padding-block: 16px 32px; }
.page-head .bar { width: 48px; height: 5px; border-radius: 3px; background: var(--rc); }
.author-head { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; padding-block: 16px 32px; }
.author-head .mono { width: 72px; height: 72px; font: 500 22px var(--font-display); }
.author-head h1 { margin: 6px 0 8px; }
.author-head .lead { margin: 0; }

.article { max-width: 760px; margin: 0 auto; padding-bottom: 24px; }
.article .art-head { padding-block: 8px 8px; }
.article h1 { font-size: clamp(26px, 3.6vw, 38px); margin: 10px 0 14px; }
.article .lead { font-size: 19px; margin-bottom: 16px; }
.article .thumb { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin: 18px 0 24px; }
.sp-note { background: var(--sponsored-bg); color: var(--sponsored-ink); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.draft-note { background: var(--sponsored-bg); color: var(--sponsored-ink); border-radius: 10px; padding: 10px 14px; font-size: 14px; max-width: 760px; margin: 0 auto 12px; }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; margin-bottom: 24px; font-size: 15px; }
.toc b { font: 600 12px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.toc ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.toc a { text-decoration: none; } .toc a:hover { text-decoration: underline; }

.prose { font-size: 17px; line-height: 1.75; min-width: 0; }
.prose > * { margin-block: 0 1.1em; }
.prose h2 { font: 500 24px/1.25 var(--font-display); letter-spacing: -0.03em; margin-top: 2em; text-wrap: balance; scroll-margin-top: 90px; }
.prose h3 { font: 600 19px/1.35 var(--font-body); margin-top: 1.6em; margin-bottom: .5em; scroll-margin-top: 90px; }
.prose h4 { font: 600 16px/1.4 var(--font-body); margin-top: 1.4em; }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose ul, .prose ol { padding-left: 1.3em; display: grid; gap: .45em; }
.prose blockquote { margin-inline: 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--rc, var(--accent)); color: var(--muted); }
.prose figure { margin-inline: 0; }
.prose figure img { border-radius: 12px; display: block; }
.prose figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.prose code { font-size: .92em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.prose pre { overflow-x: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.prose pre code { background: none; border: 0; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin-block: 2em; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.5; min-width: 480px; }
.prose th, .prose td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font: 600 12px var(--font-body); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
.prose tr:last-child td { border-bottom: 0; }

.authorbox { display: flex; gap: 16px; max-width: 760px; margin: 24px auto 56px; padding: 20px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; }
.authorbox .mono { width: 52px; height: 52px; font: 500 16px var(--font-display); }
.authorbox .nm { font: 500 17px var(--font-display); letter-spacing: -0.02em; text-decoration: none; }
.authorbox p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.related .sec { margin-bottom: 20px; }
.notfound { padding-block: 72px; max-width: 560px; }

/* подвал */
.foot { border-top: 1px solid var(--line); background: var(--surface-2); padding: 40px max(16px, env(safe-area-inset-left, 0px)) calc(32px + env(safe-area-inset-bottom, 0px)); margin: 0 calc(50% - 50vw); font-size: 14px; color: var(--muted); }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 28px; }
.foot .logo { color: var(--ink); margin-bottom: 10px; }
.foot p { margin: 0; max-width: 34ch; }
.foot h4 { font: 600 12px var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink); margin: 0 0 10px; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.foot a { text-decoration: none; } .foot a:hover { text-decoration: underline; color: var(--ink); }
.foot-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; }
