:root {
  --paper: #f5f6f3;
  --surface: #ffffff;
  --ink: #17212c;
  --muted: #56616c;
  --line: #d8ddd8;
  --pine: #1f5c46;
  --pine-strong: #174836;
  --pine-soft: #e2ece6;
  --on-pine: #ffffff;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --wrap: 1120px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12181f;
    --surface: #19212a;
    --ink: #e8ece9;
    --muted: #9aa5ae;
    --line: #2c3742;
    --pine: #5fb592;
    --pine-strong: #7cc9a8;
    --pine-soft: #1c2f28;
    --on-pine: #0d1612;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--pine); text-underline-offset: 3px; }
a:hover { color: var(--pine-strong); }
:focus-visible { outline: 3px solid var(--pine); outline-offset: 3px; border-radius: 3px; }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.015em; }
p { margin: 0; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; background: var(--surface); padding: 8px 12px; z-index: 100; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.125rem; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand small { display: block; font-weight: 400; font-size: 0.75rem; color: var(--muted); line-height: 1.2; }
.nav { display: flex; align-items: center; gap: 28px; }
.nav a { color: var(--ink); text-decoration: none; font-size: 0.95rem; }
.nav a:hover { color: var(--pine); }
.nav-links { display: flex; gap: 28px; }
@media (max-width: 820px) { .nav-links { display: none; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 22px; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; font-size: 0.975rem; text-decoration: none;
  border: 1.5px solid var(--pine); cursor: pointer;
}
.btn-primary { background: var(--pine); color: var(--on-pine); }
.btn-primary:hover { background: var(--pine-strong); border-color: var(--pine-strong); color: var(--on-pine); }
.btn-ghost { background: transparent; color: var(--pine); }
.btn-ghost:hover { background: var(--pine-soft); }
.nav .btn { padding: 9px 16px; color: var(--on-pine); }
.nav .btn:hover { color: var(--on-pine); }

/* Hero */
.hero { padding: 72px 0 80px; }
.hero .wrap { display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: start; }
.hero h1 { font-size: clamp(2.2rem, 4.6vw, 3.5rem); font-weight: 800; max-width: 17ch; text-wrap: balance; }
.hero-lead { margin-top: 22px; font-size: 1.1875rem; color: var(--muted); max-width: 34em; }
.hero-actions { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; }
.hero-note { margin-top: 20px; font-size: 0.9rem; color: var(--muted); }

.ledger { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.ledger h2 { font-size: 1rem; font-weight: 700; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.ledger ul { list-style: none; margin: 0; padding: 0; }
.ledger li { display: grid; grid-template-columns: 1fr auto 0.8fr; gap: 14px; align-items: center; padding: 15px 22px; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.ledger li:last-child { border-bottom: 0; }
.ledger .pain { color: var(--muted); }
.ledger .arrow { color: var(--pine); width: 18px; height: 18px; }
.ledger .fix { font-weight: 600; }
.ledger-foot { padding: 14px 22px; background: var(--pine-soft); font-size: 0.9rem; }

@media (max-width: 900px) {
  .hero { padding: 48px 0 56px; }
  .hero .wrap { grid-template-columns: 1fr; gap: 40px; }
}
@media (max-width: 520px) {
  .ledger li { grid-template-columns: 1fr; gap: 4px; }
  .ledger .arrow { display: none; }
}

/* Sections */
.section { padding: 88px 0; border-top: 1px solid var(--line); }
.section-head { max-width: 40em; margin-bottom: 48px; }
.section-head h2 { font-size: clamp(1.75rem, 3vw, 2.375rem); font-weight: 800; }
.section-head p { margin-top: 14px; color: var(--muted); }
@media (max-width: 700px) { .section { padding: 60px 0; } }

/* Services */
.services { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 56px; }
.service { padding: 28px 0; border-top: 1px solid var(--line); }
.service h3 { font-size: 1.25rem; font-weight: 700; }
.service p { margin-top: 10px; color: var(--muted); }
.service .eg { margin-top: 12px; font-size: 0.925rem; color: var(--ink); }
.service .eg span { color: var(--muted); }
.service.lead-service { grid-column: 1 / -1; background: var(--pine-soft); border: 0; border-radius: var(--radius-lg); padding: 32px; margin-bottom: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 48px; }
.service.lead-service h3 { font-size: 1.5rem; }
.service.lead-service p { margin-top: 0; color: var(--ink); }
.service.lead-service ul { margin: 0; padding-left: 1.1em; }
.service.lead-service li { margin: 4px 0; }
@media (max-width: 760px) {
  .services { grid-template-columns: 1fr; }
  .service.lead-service { grid-template-columns: 1fr; padding: 24px; }
}

/* Steps */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding-top: 52px; }
.steps li::before {
  content: counter(step);
  position: absolute; top: 0; left: 0;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--pine); color: var(--on-pine); font-weight: 700;
}
.steps li:not(:last-child)::after {
  content: ""; position: absolute; top: 18px; left: 48px; right: -20px; height: 1.5px; background: var(--line);
}
.steps h3 { font-size: 1.125rem; font-weight: 700; }
.steps p { margin-top: 8px; color: var(--muted); font-size: 0.975rem; }
@media (max-width: 860px) {
  .steps { grid-template-columns: 1fr 1fr; }
  .steps li::after { display: none; }
}
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }

/* About */
.about { display: grid; grid-template-columns: 1.2fr 1fr; gap: 56px; align-items: start; }
.about-text p + p { margin-top: 16px; }
.about-text p { max-width: 36em; }
.facts { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.facts li { padding: 16px 0; border-bottom: 1px solid var(--line); }
.facts strong { display: block; font-weight: 700; }
.facts span { color: var(--muted); font-size: 0.95rem; }
.stack { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 8px; }
.stack li { list-style: none; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.9rem; background: var(--surface); }
.stack { padding: 0; }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; gap: 36px; } }

/* Contact */
.contact { background: var(--ink); color: var(--paper); border-top: 0; }
.contact .section-head p { color: color-mix(in srgb, var(--paper) 72%, transparent); }
.contact-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.contact-item .contact-strong { margin-top: 8px; font-size: 1rem; font-weight: 600; color: inherit; }
.contact-item { border: 1px solid color-mix(in srgb, var(--paper) 22%, transparent); border-radius: var(--radius-lg); padding: 24px; }
.contact-item h3 { font-size: 1rem; font-weight: 600; color: color-mix(in srgb, var(--paper) 70%, transparent); }
.contact-item a { display: inline-block; margin-top: 8px; color: var(--paper); font-size: 1.1875rem; font-weight: 700; word-break: break-word; }
.contact-item a:hover { color: var(--pine-soft); }
.contact-item p { margin-top: 8px; font-size: 0.925rem; color: color-mix(in srgb, var(--paper) 70%, transparent); }
@media (prefers-color-scheme: dark) {
  .contact { background: var(--surface); color: var(--ink); }
  .contact .section-head p, .contact-item h3, .contact-item p { color: var(--muted); }
  .contact-item { border-color: var(--line); }
  .contact-item a { color: var(--ink); }
}
@media (max-width: 1000px) { .contact-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .contact-grid { grid-template-columns: 1fr; } }

/* Footer */
.site-footer { padding: 40px 0 48px; font-size: 0.875rem; color: var(--muted); }
.site-footer .wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.site-footer dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; }
.site-footer dt { color: var(--muted); }
.site-footer dd { margin: 0; color: var(--ink); }
@media (max-width: 760px) { .site-footer .wrap { grid-template-columns: 1fr; } }

/* 404 */
.notfound { min-height: 60vh; display: grid; place-items: center; text-align: center; padding: 80px 0; }
.notfound h1 { font-size: 2.5rem; font-weight: 800; }
.notfound p { margin: 16px 0 28px; color: var(--muted); }

.btn { white-space: nowrap; }
@media (max-width: 440px) {
  .brand small { display: none; }
  .nav .btn { padding: 8px 12px; font-size: 0.9rem; }
}

/* Cookie consent */
.consent {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 50;
  max-width: 720px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 16px 20px; border-radius: var(--radius-lg);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(15, 25, 35, 0.18);
  font-size: 0.925rem;
}
.consent p { flex: 1 1 300px; }
.consent-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.consent .btn { padding: 9px 16px; font-size: 0.9rem; }

/* Text page */
.doc { padding: 56px 0 80px; }
.doc .wrap { max-width: 760px; }
.doc h1 { font-size: clamp(1.75rem, 3vw, 2.25rem); font-weight: 800; }
.doc h2 { font-size: 1.2rem; font-weight: 700; margin-top: 36px; }
.doc p, .doc li { margin-top: 12px; }
.doc ul { padding-left: 1.2em; margin: 0; }
.doc .meta { color: var(--muted); margin-top: 12px; }

/* Blog */
.doc .lead { font-size: 1.1875rem; color: var(--muted); margin-top: 16px; }
.doc h3 { font-size: 1.05rem; font-weight: 700; margin-top: 24px; }
.doc ol { padding-left: 1.3em; margin: 0; }
.doc strong { color: var(--ink); }
.posts { list-style: none; padding: 0; margin-top: 32px; border-top: 1px solid var(--line); }
.posts li { padding: 22px 0; border-bottom: 1px solid var(--line); margin: 0; }
.posts a { font-size: 1.25rem; font-weight: 700; text-decoration: none; color: var(--ink); }
.posts a:hover { color: var(--pine); }
.posts p { margin-top: 6px; color: var(--muted); }
.cta-box { margin-top: 48px; padding: 28px; border-radius: var(--radius-lg); background: var(--pine-soft); }
.cta-box h2 { margin-top: 0; }
.cta-box .btn { margin: 8px 8px 0 0; }

/* ---- Рисунки и источники в статьях блога ---- */
:root { --warn: #b5532a; --warn-strong: #8f3e1d; --warn-soft: #f6e6dd; }
@media (prefers-color-scheme: dark) {
  :root { --warn: #e08a62; --warn-strong: #f0a882; --warn-soft: #33221b; }
}
.doc .fig { margin: 28px 0 8px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.doc .fig svg { display: block; width: 100%; height: auto; font-family: inherit; }
.doc .fig figcaption { margin-top: 12px; font-size: 0.875rem; color: var(--muted); }
.fig .f-soft { fill: var(--pine-soft); }
.fig .f-axis { stroke: var(--line); stroke-width: 1.5; }
.fig .f-edge { fill: none; stroke: var(--pine); stroke-width: 3; stroke-linejoin: round; }
.fig .f-pair { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 4 4; }
.fig .f-in, .fig g.f-in circle { fill: var(--pine); }
.fig .f-in2 { fill: var(--pine-strong); }
.fig .f-out, .fig g.f-out circle { fill: var(--warn); }
.fig .f-out2 { fill: var(--warn-strong); }
.fig .f-base { fill: var(--muted); opacity: 0.55; }
.fig text { fill: var(--ink); font-size: 15px; }
.fig .f-muted, .fig .f-muted text { fill: var(--muted); font-size: 14px; }
.fig .f-title { font-weight: 700; font-size: 16px; }
.fig .f-label { font-weight: 700; }
.fig .f-note { font-size: 14px; }
.fig .f-val { font-weight: 700; font-size: 15px; }
.doc .sources { font-size: 0.925rem; color: var(--muted); }
.doc .sources a { overflow-wrap: anywhere; }
@media (max-width: 560px) { .doc .fig { padding: 12px; } }
