:root {
  --bg: #f6f5f0;
  --paper: #ffffff;
  --ink: #1c2530;
  --ink-2: #4a5563;
  --muted: #7a8391;
  --line: #e3e1d8;
  --accent: #0f766e;
  --accent-2: #115e59;
  --accent-soft: #e3f1ef;
  --warn: #b45309;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 40, .05), 0 4px 16px rgba(20, 30, 40, .05);
  --serif: "PT Serif", Charter, "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PT Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.65 var(--sans); }
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-2); }
.wrap { max-width: 1180px; margin: 0 auto; padding-inline: 20px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: #fff; padding: 8px 12px; z-index: 10; }
.muted { color: var(--muted); }

/* ---------- header ---------- */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
/* лабораторная "миллиметровка" */
.site-header { background-image: linear-gradient(rgba(15,118,110,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(15,118,110,.05) 1px, transparent 1px); background-size: 22px 22px; }
.header-row { display: flex; align-items: center; gap: 24px; padding-block: 16px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.brand-tile { position: relative; display: grid; place-items: center; width: 64px; height: 64px; background: var(--accent); color: #fff; border-radius: 6px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); flex: none; }
.brand-tile small { position: absolute; top: 3px; left: 6px; font: 600 10px/1 var(--mono); opacity: .85; }
.brand-tile b { font: 700 28px/1 var(--serif); margin-top: 4px; }
.brand-tile i { position: absolute; bottom: 4px; font: 9px/1 var(--sans); font-style: normal; opacity: .85; letter-spacing: .02em; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font: 700 26px/1.1 var(--serif); letter-spacing: -.01em; }
.brand-text em { font-style: normal; color: var(--muted); font-size: 14px; }
.brand.small .brand-tile { width: 44px; height: 44px; }
.brand.small .brand-tile b { font-size: 19px; }
.brand.small .brand-text strong { font-size: 19px; }

.search { position: relative; margin-left: auto; width: min(360px, 100%); }
.search input { width: 100%; font: inherit; font-size: 15px; padding: 10px 14px 10px 38px; border: 1px solid var(--line); border-radius: 999px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237a8391' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E") no-repeat 14px 50%; }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.search-results { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 420px; overflow: auto; padding: 6px; }
.search-results a { display: block; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--ink); font-size: 15px; line-height: 1.35; }
.search-results a small { display: block; color: var(--muted); font-size: 12px; }
.search-results a:hover, .search-results a.active { background: var(--accent-soft); }
.search-results .empty { padding: 10px; color: var(--muted); font-size: 14px; }
.menu-btn { display: none; font: 600 14px var(--sans); border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 9px 12px; color: var(--ink); cursor: pointer; }

.main-nav { background: var(--ink); }
.main-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 2px; margin-block: 0; }
.main-nav a { display: block; color: #e6ecef; text-decoration: none; padding: 11px 14px; font-size: 15px; font-weight: 500; border-bottom: 3px solid transparent; }
.main-nav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.main-nav a[aria-current] { border-bottom-color: #5eead4; color: #fff; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 36px; padding-block: 28px 56px; }
.layout.no-side { grid-template-columns: minmax(0, 1fr); max-width: 820px; }
main { min-width: 0; }

/* ---------- tiles ---------- */
.tile { --c: var(--accent); position: relative; display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 6px; background: var(--c); color: #fff; flex: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,.16); }
.tile small { position: absolute; top: 3px; left: 5px; font: 600 10px/1 var(--mono); opacity: .8; }
.tile b { font: 700 22px/1 var(--serif); }
.tile.big { width: 84px; height: 84px; }
.tile.big small { font-size: 12px; top: 5px; left: 7px; }
.tile.big b { font-size: 34px; }

.chip { --c: var(--accent); display: inline-block; font-size: 13px; font-weight: 600; line-height: 1; padding: 6px 10px; border-radius: 999px; text-decoration: none; color: var(--c); background: color-mix(in srgb, var(--c) 11%, white); }
.chip:hover { color: var(--c); background: color-mix(in srgb, var(--c) 18%, white); }

/* ---------- hero / home ---------- */
.hero { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 28px; margin-bottom: 32px; box-shadow: var(--shadow); }
.hero h1 { font: 700 34px/1.15 var(--serif); margin: 0 0 8px; letter-spacing: -.01em; }
.hero h1 span { color: var(--accent); }
.hero p { margin: 0 0 22px; color: var(--ink-2); }
.cat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.cat-tile { --c: var(--accent); position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 108px; padding: 10px; border-radius: 8px; background: var(--c); color: #fff; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.cat-tile:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 6px 16px color-mix(in srgb, var(--c) 35%, transparent); }
.cat-tile small { position: absolute; top: 7px; left: 9px; font: 600 11px/1 var(--mono); opacity: .85; }
.cat-tile b { font: 700 30px/1 var(--serif); margin-bottom: 6px; }
.cat-tile span { font-size: 12.5px; line-height: 1.25; font-weight: 500; }
.section-title, .list-title { font: 700 26px/1.2 var(--serif); margin: 0 0 18px; }
.list-title small { font: 400 15px var(--sans); color: var(--muted); margin-left: 8px; }
.subcats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

/* ---------- cards ---------- */
.cards { display: grid; gap: 14px; }
.card { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 20px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.card-thumb { display: grid; place-items: center; height: 170px; border-radius: 7px; overflow: hidden; background: #eef0ec; }
.card-thumb img { width: 100%; height: 100%; min-height: 0; object-fit: cover; }
.card-body h2 { font: 700 21px/1.25 var(--serif); margin: 6px 0; }
.card-body h2 a { color: var(--ink); text-decoration: none; }
.card-body h2 a:hover { color: var(--accent); }
.card-body p { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.55; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--muted); font-size: 14px; }

.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 28px; }
.pager a, .pager span { min-width: 40px; text-align: center; padding: 8px 12px; border-radius: 8px; font-size: 15px; text-decoration: none; }
.pager a { background: var(--paper); border: 1px solid var(--line); color: var(--ink); }
.pager a:hover { border-color: var(--accent); color: var(--accent); }
.pager .current { background: var(--accent); color: #fff; font-weight: 600; }
.pager .gap { color: var(--muted); min-width: 0; padding-inline: 4px; }

/* ---------- breadcrumbs ---------- */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 16px; padding: 0; font-size: 14px; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 6px; color: #b7bcc3; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- post ---------- */
.post { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 32px 40px 40px; box-shadow: var(--shadow); }
.post-head { display: flex; gap: 20px; align-items: center; margin-bottom: 22px; }
.post-head h1 { font: 700 36px/1.15 var(--serif); margin: 0 0 10px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.lead-img { margin: 0 0 24px; }
.lead-img img { display: block; margin: 0 auto; border-radius: 8px; max-height: 440px; width: auto; }
.toc { background: var(--accent-soft); border-radius: var(--radius); padding: 14px 20px; margin: 0 0 26px; }
.toc summary { cursor: pointer; font-weight: 700; font-family: var(--serif); font-size: 18px; }
.toc ol { margin: 10px 0 0; padding-left: 20px; columns: 2 260px; column-gap: 32px; font-size: 15px; }
.toc li { break-inside: avoid; margin: 2px 0; }
.toc li.h3 { margin-left: 14px; list-style: none; }
.toc li.h3::before { content: "– "; color: var(--muted); }
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }

.prose { font-size: 18px; line-height: 1.72; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1em; }
.prose h2 { font: 700 27px/1.25 var(--serif); margin: 1.8em 0 .6em; padding-top: .6em; border-top: 1px solid var(--line); }
.prose h3 { font: 700 22px/1.3 var(--serif); margin: 1.5em 0 .5em; }
.prose h4 { font-size: 18px; margin: 1.3em 0 .4em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.1em; }
.prose li { margin: .25em 0; }
.prose li::marker { color: var(--accent); }
.prose img { display: block; margin: 1.2em auto; border-radius: 6px; }
.prose blockquote { margin: 1.4em 0; padding: 14px 20px; background: #fbf7ec; border-left: 4px solid var(--warn); border-radius: 0 8px 8px 0; color: #3b3326; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose sub, .prose sup { font-size: .72em; line-height: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.table-wrap { overflow-x: auto; margin: 1.3em 0; border: 1px solid var(--line); border-radius: 8px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.45; }
.prose td, .prose th { border-bottom: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.prose td + td, .prose th + th { border-left: 1px solid var(--line); }
.prose tr:first-child td { background: #f1f4f3; font-weight: 600; }
.prose tr:last-child td { border-bottom: 0; }
.prose td p { margin: 0; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 22px 0; }
.post-nav a { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; text-decoration: none; color: var(--ink); font-family: var(--serif); font-weight: 700; line-height: 1.3; }
.post-nav a small { display: block; font: 500 13px var(--sans); color: var(--muted); margin-bottom: 4px; }
.post-nav a:hover { border-color: var(--accent); }
.post-nav .next { text-align: right; }

.related h2 { font: 700 22px var(--serif); margin: 30px 0 14px; }
.related-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.related-grid a { display: flex; align-items: center; gap: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; text-decoration: none; color: var(--ink); font-weight: 600; line-height: 1.3; }
.related-grid a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- sidebar ---------- */
.sidebar { display: flex; flex-direction: column; gap: 18px; }
.box { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.box h2 { font: 700 19px var(--serif); margin: 0 0 12px; }
.cat-list, .link-list { list-style: none; margin: 0; padding: 0; }
.cat-list a { display: flex; align-items: center; gap: 10px; padding: 6px 8px; margin: 0 -8px; border-radius: 6px; text-decoration: none; color: var(--ink); font-size: 15.5px; }
.cat-list a:hover, .cat-list .active > a { background: var(--accent-soft); }
.cat-list .sub a { padding-left: 34px; font-size: 14.5px; color: var(--ink-2); }
.cat-list .dot { --c: var(--accent); width: 12px; height: 12px; border-radius: 3px; background: var(--c); flex: none; }
.cat-list .count { margin-left: auto; font: 12px var(--mono); color: var(--muted); }
.link-list li { padding: 7px 0; border-top: 1px solid var(--line); line-height: 1.35; font-size: 15px; }
.link-list li:first-child { border-top: 0; padding-top: 0; }
.link-list a { color: var(--ink); text-decoration: none; }
.link-list a:hover { color: var(--accent); text-decoration: underline; }
.more { font-weight: 600; text-decoration: none; }

/* ---------- footer ---------- */
.site-footer { background: var(--ink); color: #c9d1d6; padding-top: 36px; }
.site-footer a { color: #e6ecef; text-decoration: none; }
.site-footer a:hover { color: #5eead4; }
.footer-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 40px; }
.site-footer .brand-text strong { color: #fff; }
.site-footer .brand-text em, .site-footer .muted { color: #9aa5ad; }
.site-footer h2 { font: 700 16px var(--sans); color: #fff; margin: 0 0 12px; text-transform: uppercase; letter-spacing: .06em; }
.footer-cats { list-style: none; padding: 0; margin: 0; columns: 3 170px; font-size: 15px; }
.footer-cats li { padding: 3px 0; }
.copyright { border-top: 1px solid rgba(255,255,255,.1); margin-top: 28px; padding-block: 16px; font-size: 14px; color: #8b969e; }

.notfound { text-align: center; padding: 60px 0; }
.notfound h1 { font: 700 34px var(--serif); margin: 18px 0 8px; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .wrap { padding-inline: 16px; }
  .header-row { flex-wrap: wrap; gap: 12px; }
  .brand-tile { width: 50px; height: 50px; }
  .brand-tile b { font-size: 22px; }
  .brand-tile i { display: none; }
  .brand-text strong { font-size: 22px; }
  .search { order: 3; width: 100%; }
  .menu-btn { display: block; margin-left: auto; }
  .main-nav { display: none; }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; padding-block: 6px; }
  .hero { padding: 20px; }
  .hero h1 { font-size: 26px; }
  .cat-tiles { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .cat-tile { min-height: 92px; }
  .card { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 12px; }
  .card-body h2 { font-size: 18px; }
  .card-body p { display: none; }
  .post { padding: 20px 18px 26px; border-radius: 10px; }
  .post-head { gap: 14px; align-items: flex-start; }
  .post-head .tile.big { width: 58px; height: 58px; }
  .post-head .tile.big b { font-size: 24px; }
  .post-head h1 { font-size: 26px; }
  .prose { font-size: 16.5px; }
  .prose h2 { font-size: 22px; }
  .prose h3 { font-size: 19px; }
  .post-nav, .related-grid { grid-template-columns: 1fr; }
  .post-nav .next { text-align: left; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
}
@media print {
  .site-header, .sidebar, .site-footer, .post-nav, .related, .toc { display: none; }
  .layout { display: block; }
  .post { border: 0; box-shadow: none; padding: 0; }
}
@media (max-width: 720px) {
  .brand { flex: 1 1 0; min-width: 0; }
  .header-row { flex-wrap: wrap; }
  .brand-text em { line-height: 1.25; }
  .brand-text em { font-size: 12.5px; }
  .menu-btn { margin-left: 0; }
}

/* выноски [attention] */
.prose .callout { --c: #b45309; --bgc: #fbf7ec; margin: 1.4em 0; padding: 14px 20px 14px 52px; position: relative; background: var(--bgc); border-left: 4px solid var(--c); border-radius: 0 8px 8px 0; }
.prose .callout::before { content: "!"; position: absolute; left: 16px; top: 14px; width: 22px; height: 22px; border-radius: 50%; background: var(--c); color: #fff; font: 700 14px/22px var(--sans); text-align: center; }
.prose .callout > :last-child { margin-bottom: 0; }
.prose .callout-green { --c: #15803d; --bgc: #eef7f0; }
.prose .callout-green::before { content: "✓"; }
.prose .callout-red { --c: #b91c1c; --bgc: #fcf0f0; }
.prose .callout-blue { --c: #1d4ed8; --bgc: #eff4fd; }
.prose .callout-blue::before { content: "i"; }

/* правки: компактнее текст статей, списки, миниатюры в похожих */
.prose { font-size: 17px; line-height: 1.68; }
.prose h2 { font-size: 25px; }
.prose h3 { font-size: 20.5px; }
.prose h4 { font-size: 17px; }
.prose ul, .prose ol { margin: .2em 0 1em; }
.prose li { margin: .12em 0; }
.prose li > p { margin: 0; }
.related-grid .rel-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; flex: none; }
.brand-tile b { margin-top: 0; }
@media (max-width: 720px) {
  .prose { font-size: 16px; }
  .prose h2 { font-size: 21px; }
  .prose h3 { font-size: 18px; }
}

/* блок "Сайт поддерживают" — без разделителей */
.support .link-list li { border-top: 0; padding: 3px 0; }

/* логотип: только «Хи», крупнее */
.site-header .brand-tile b { font-size: 34px; margin-top: 0; }
@media (max-width: 720px) { .site-header .brand-tile b { font-size: 27px; } }
