/* Стройзнайка. Образ: рулетка строителя — жёлтая мерная лента как акцент,
   миллиметровая шкала под шапкой, цифры и расчёты на первом плане. */

@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(/assets/fonts/golos-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(/assets/fonts/golos-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(/assets/fonts/unbounded-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(/assets/fonts/unbounded-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: light;
  --paper: #f5f6f3;
  --surface: #ffffff;
  --ink: #1c2326;
  --muted: #5a666a;
  --line: #dde2df;
  --tape: #f4c419;
  --tape-soft: #fbedb0;
  --link: #0d5e66;
  --on-tape: #1c2326;

  --font-display: "Unbounded", "Arial Black", "Segoe UI", sans-serif;
  --font-body: "Golos Text", "Segoe UI", Roboto, Arial, sans-serif;

  --step--1: .875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.5rem;
  --step-3: clamp(1.6rem, 3.2vw, 2.1rem);
  --step-4: clamp(1.9rem, 4.6vw, 3rem);

  --radius: 10px;
  --measure: 70ch;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #131819;
    --surface: #1a2123;
    --ink: #e6ebe9;
    --muted: #9ba7aa;
    --line: #2b3437;
    --tape: #f2c230;
    --tape-soft: #3b3416;
    --link: #74c7cc;
    --on-tape: #1c2326;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
}
img, svg { max-width: 100%; }
a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--tape); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; text-wrap: balance; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }

.wrap {
  max-width: 1160px;
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 50; background: var(--surface); padding: 8px 12px; }

/* ---------- Шапка ---------- */
.site-header { background: var(--surface); position: relative; }
.site-header .wrap { display: flex; align-items: center; gap: 24px; padding-block: 14px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo svg { width: 38px; height: 38px; flex: none; }
.logo b { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; letter-spacing: -.02em; }
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-left: auto; }
.nav a { color: var(--ink); text-decoration: none; font-size: .95rem; padding-block: 4px; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { border-bottom-color: var(--tape); }
@media (max-width: 860px) {
  .nav { margin-left: 0; width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .nav a { white-space: nowrap; }
}
/* Миллиметровая шкала рулетки */
.ruler {
  height: 14px;
  background:
    repeating-linear-gradient(90deg, var(--on-tape) 0 1px, transparent 1px 50px) bottom / 100% 12px no-repeat,
    repeating-linear-gradient(90deg, var(--on-tape) 0 1px, transparent 1px 25px) bottom / 100% 8px no-repeat,
    repeating-linear-gradient(90deg, var(--on-tape) 0 1px, transparent 1px 5px) bottom / 100% 4px no-repeat,
    var(--tape);
  opacity: .95;
}

/* ---------- Общие блоки ---------- */
main { padding-block: 32px 64px; }
.eyebrow { font-size: var(--step--1); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.lede { font-size: var(--step-1); color: var(--muted); max-width: 60ch; line-height: 1.55; }
.section { display: grid; gap: 24px; padding-block: 40px 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.section-head h2 { font-size: var(--step-2); }

/* ---------- Главная ---------- */
.hero { display: grid; gap: 18px; padding-block: 24px 16px; max-width: 820px; }
.hero h1 { font-size: var(--step-4); }
.hero h1 mark { background: linear-gradient(transparent 58%, var(--tape) 58% 92%, transparent 92%); color: inherit; padding-inline: .05em; }

.cats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 860px) { .cats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .cats { grid-template-columns: 1fr; } }
.cat-card {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: start;
  padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink);
  transition: border-color .15s, transform .15s;
}
.cat-card:hover { border-color: var(--tape); transform: translateY(-2px); }
.cat-card .ico { grid-row: span 2; width: 48px; height: 48px; border-radius: 10px; background: var(--tape-soft); display: grid; place-items: center; }
.cat-card .ico svg { width: 28px; height: 28px; stroke: var(--ink); }
.cat-card b { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.cat-card span { color: var(--muted); font-size: var(--step--1); }

/* ---------- Список статей ---------- */
.posts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; }
@media (max-width: 760px) { .posts { grid-template-columns: 1fr; } }
.post { display: grid; gap: 6px; align-content: start; padding-block: 20px; border-top: 1px solid var(--line); }
.post .meta { font-size: var(--step--1); color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.post .meta a { color: var(--muted); }
.post h3 { font-size: 1.15rem; }
.post h3 a { color: var(--ink); text-decoration: none; }
.post h3 a:hover { color: var(--link); text-decoration: underline; }
.post p { color: var(--muted); }

/* ---------- Раздел ---------- */
.cat-head { display: grid; gap: 14px; padding-block: 8px 8px; max-width: 820px; }
.cat-head h1 { font-size: var(--step-4); }

/* ---------- Хлебные крошки ---------- */
.crumbs { font-size: var(--step--1); color: var(--muted); }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--line); }
.crumbs a { color: var(--muted); }

/* ---------- Статья ---------- */
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 56px; align-items: start; }
@media (max-width: 980px) { .article-layout { grid-template-columns: 1fr; gap: 24px; } }
.article-head { display: grid; gap: 16px; padding-block: 12px 24px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.article-head h1 { font-size: var(--step-4); }
.article-meta { display: flex; gap: 8px 20px; flex-wrap: wrap; font-size: var(--step--1); color: var(--muted); }
.article-meta .tag { background: var(--tape); color: var(--on-tape); padding: 2px 10px; border-radius: 999px; text-decoration: none; font-weight: 600; }

.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; font-size: .95rem; }
.toc b { display: block; font-family: var(--font-display); font-weight: 600; font-size: .9rem; margin-bottom: 10px; }
.toc ol { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--link); text-decoration: underline; }
/* колонка справа тянется на всю высоту статьи, а её содержимое едет вместе со страницей */
.article-aside { align-self: stretch; }
.aside-sticky {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 16px);
  display: grid; gap: 20px;
  max-height: calc(100vh - 32px); overflow-y: auto; scrollbar-width: thin;
}
.toc a.on { color: var(--link); font-weight: 600; }
.side-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; font-size: .92rem; }
.side-list b { display: block; font-family: var(--font-display); font-weight: 600; font-size: .9rem; margin-bottom: 10px; }
.side-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.side-list a { color: var(--ink); text-decoration: none; line-height: 1.35; }
.side-list a:hover { color: var(--link); text-decoration: underline; }
.side-list .all { display: inline-block; margin-top: 12px; color: var(--link); font-weight: 600; }
.toc-inline { display: none; margin-bottom: 8px; }
@media (max-width: 980px) { .article-aside { display: none; } .toc-inline { display: block; } }

.prose { max-width: var(--measure); display: grid; gap: 18px; }
.prose > h2 { font-size: var(--step-3); margin-top: 28px; scroll-margin-top: 20px; }
.prose > h3 { font-size: var(--step-1); margin-top: 10px; scroll-margin-top: 20px; }
.prose ul, .prose ol { margin: 0; padding-left: 1.4em; display: grid; gap: 8px; }
.prose li::marker { color: var(--muted); }
.prose ul li::marker { color: var(--tape); content: "■  "; font-size: .7em; }
.prose strong { font-weight: 600; }
.lead-in { font-size: var(--step-1); line-height: 1.55; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.prose table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.prose th { text-align: left; font-weight: 600; background: var(--tape-soft); padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: bottom; }
.prose td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose tr:last-child td { border-bottom: 0; }
@media (max-width: 520px) {
  .prose table { font-size: .875rem; }
  .prose th, .prose td { padding: 8px 10px; }
}

.note { border-radius: var(--radius); padding: 16px 18px 16px 20px; background: var(--surface); border: 1px solid var(--line); position: relative; overflow: hidden; }
.note::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; }
.note b.note-label { display: block; font-family: var(--font-display); font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.note-tip::before { background: var(--tape); }
.note-warn { background: color-mix(in srgb, #d6452f 8%, var(--surface)); }
.note-warn::before { background: #d6452f; }
.note-example::before { background: var(--link); }
.note-example { font-variant-numeric: tabular-nums; }

.photo { margin: 8px 0; display: grid; gap: 8px; }
.photo img { width: 100%; height: auto; border-radius: var(--radius); background: var(--line); }
.photo figcaption { font-size: var(--step--1); color: var(--muted); }

.faq { display: grid; gap: 12px; }
.prose > h3.faq-q { margin-top: 14px; font-size: 1.1rem; }

.related { display: grid; gap: 4px; margin-top: 40px; padding-top: 24px; border-top: 4px solid var(--tape); }
.related h2 { font-size: var(--step-2); margin-bottom: 4px; }

.ad { margin-block: 8px; min-height: 0; }
.ad:empty { display: none; }

.disclaimer { font-size: var(--step--1); color: var(--muted); max-width: var(--measure); padding-top: 16px; }

/* ---------- Простые страницы ---------- */
.page { max-width: var(--measure); display: grid; gap: 18px; }
.page h1 { font-size: var(--step-4); margin-bottom: 8px; }
.page h2 { font-size: var(--step-2); margin-top: 16px; }
.page ul { margin: 0; padding-left: 1.4em; display: grid; gap: 6px; }

.notfound { display: grid; gap: 18px; padding-block: 40px; max-width: 640px; }
.notfound .big { font-family: var(--font-display); font-size: clamp(4rem, 14vw, 8rem); font-weight: 700; line-height: 1; color: var(--tape); }

/* ---------- Подвал ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); font-size: .95rem; }
.site-footer .wrap { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; padding-block: 40px 32px; }
@media (max-width: 760px) { .site-footer .wrap { grid-template-columns: 1fr; gap: 24px; } }
.site-footer h2 { font-size: .9rem; margin-bottom: 10px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-footer a { color: var(--ink); text-decoration: none; }
.site-footer a:hover { color: var(--link); text-decoration: underline; }
.site-footer p { color: var(--muted); }
.footer-note { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 18px; color: var(--muted); font-size: var(--step--1); }

/* ---------- Плашка про cookies ---------- */
.cookie {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: var(--ink); color: var(--paper); font-size: var(--step--1);
  display: flex; gap: 12px 20px; align-items: center; justify-content: center; flex-wrap: wrap;
}
.cookie[hidden] { display: none; }
.cookie a { color: var(--tape); }
.cookie button { font: 600 .9rem var(--font-body); background: var(--tape); color: var(--on-tape); border: 0; border-radius: 6px; padding: 8px 16px; cursor: pointer; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .site-header, .site-footer, .ad, .cookie, .article-aside { display: none !important; } }

/* ---------- Страницы раздела ---------- */
.pager { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a, .pager span { min-width: 40px; height: 40px; display: inline-grid; place-items: center; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.pager a:hover { border-color: var(--tape); }
.pager span[aria-current] { background: var(--tape); border-color: var(--tape); color: var(--on-tape); }
.cat-head h1 .pg { color: var(--muted); font-size: .55em; font-weight: 500; }

/* ---------- Поиск ---------- */
.search-link { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--ink); border: 1px solid var(--line); flex: none; }
.search-link:hover { border-color: var(--tape); background: var(--tape-soft); }
@media (max-width: 860px) { .site-header .wrap { position: relative; } .search-link { position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); top: 14px; } }
.search-form { display: flex; gap: 8px; max-width: 640px; }
.search-form input { flex: 1; min-width: 0; font: inherit; font-size: 1rem; padding: 12px 16px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.search-form input:focus { outline: none; border-color: var(--tape); }
.search-form button { font: 600 1rem var(--font-body); padding: 0 20px; border: 0; border-radius: var(--radius); background: var(--tape); color: var(--on-tape); cursor: pointer; }
.search-form.big input { font-size: 1.1rem; padding: 14px 18px; }
.search-page { max-width: 820px; }
.posts.one { grid-template-columns: 1fr; }
.post mark { background: var(--tape-soft); color: inherit; padding: 0 .1em; border-radius: 2px; }
