/* Что не так — стили сайта. Без внешних шрифтов и CDN: быстро и без внешних запросов. */
:root {
  --bg: #faf8f4; --surface: #ffffff; --ink: #15171c; --muted: #5f6672; --line: #e8e3d9;
  --accent: #ff5a36; --accent-ink: #ffffff; --accent-soft: #fff0ea; --mark: #ffe58a;
  --code-bg: #f3efe7; --shadow: 0 1px 2px rgba(30,25,15,.05), 0 12px 28px -14px rgba(30,25,15,.22);
  --radius: 18px; --w: 1140px; --wr: 720px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --serif: Charter, "Iowan Old Style", "PT Serif", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1014; --surface: #171a21; --ink: #eceef2; --muted: #9ba3b0; --line: #262b35;
    --accent: #ff7455; --accent-soft: #2b1b16; --mark: #5c4b10; --code-bg: #12151b;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 28px -14px rgba(0,0,0,.6); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1014; --surface: #171a21; --ink: #eceef2; --muted: #9ba3b0; --line: #262b35;
  --accent: #ff7455; --accent-soft: #2b1b16; --mark: #5c4b10; --code-bg: #12151b;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 28px -14px rgba(0,0,0,.6); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans);
  font-size: 17px; line-height: 1.6; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent); text-underline-offset: .18em; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--mark); color: var(--ink); }
.wrap { width: min(100% - 40px, var(--w)); margin-inline: auto; }
.wrap.narrow, .narrow { width: min(100% - 40px, var(--wr)); }
.muted { color: var(--muted); }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0; }

/* ---------- шапка ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.bar { display: flex; align-items: center; gap: 18px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; letter-spacing: -0.02em; font-size: 1.15rem; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: var(--accent-ink);
  background: linear-gradient(140deg, var(--accent), #ff8a3d); font-size: 1.25rem; font-weight: 900;
  box-shadow: 0 6px 14px -6px var(--accent); transform: rotate(-6deg);
}
.nav { display: flex; gap: 4px; margin-left: 12px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 7px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .94rem; white-space: nowrap; }
.nav a:hover, .nav a[aria-current] { color: var(--ink); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.search-mini { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding-left: 14px; }
.search-mini input { border: 0; background: transparent; color: var(--ink); font: inherit; font-size: .92rem; width: 130px; padding: 7px 4px; outline: none; }
.search-mini button, .icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 999px; background: transparent;
  color: var(--muted); cursor: pointer;
}
.search-mini button:hover, .icon-btn:hover { color: var(--ink); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.menu-btn { display: none; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; } :root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .i-sun { display: block; } :root:not([data-theme="light"]) .i-moon { display: none; } }
.progress { position: fixed; inset: 0 auto auto 0; height: 3px; width: 0; background: var(--accent); z-index: 60; transition: width .1s linear; }

/* ---------- кнопки, пилюли ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  box-shadow: 0 8px 18px -10px var(--accent); transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 22px -10px var(--accent); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--accent); }
.pill {
  --pc: var(--accent); display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: .78rem; font-weight: 700; text-decoration: none;
  letter-spacing: .01em; color: color-mix(in srgb, var(--pc) 88%, var(--ink)); background: color-mix(in srgb, var(--pc) 14%, transparent);
}
.pill:hover { background: color-mix(in srgb, var(--pc) 24%, transparent); }
.pill.big { font-size: .95rem; padding: 7px 15px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: .86rem; }

/* ---------- герой ---------- */
.hero { padding: 64px 0 24px; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto auto; width: 520px; height: 520px; z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 26%, transparent), transparent);
}
.eyebrow { margin: 0 0 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; color: var(--accent); }
.hero h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); font-weight: 850; letter-spacing: -0.04em; }
.hero h1 .q { color: var(--accent); display: inline-block; transform: rotate(8deg) translateY(-2px); margin-left: .04em; }
.lead { font-size: clamp(1.1rem, 2.2vw, 1.3rem); color: var(--muted); max-width: 40em; margin: 16px 0 0; line-height: 1.5; }
.hero-search { display: flex; gap: 10px; margin-top: 28px; max-width: 560px; }
.hero-search input {
  flex: 1; min-width: 0; padding: 13px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font: inherit; box-shadow: var(--shadow);
}
.hero-search input:focus { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 26px 0 0; }

.page-head { padding: 44px 0 8px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, color-mix(in srgb, var(--pc, var(--accent)) 8%, transparent), transparent); }
.page-head h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; }
.page-head .lead { margin-bottom: 26px; }
.page-head .hero-search { margin-bottom: 30px; }
.h-emoji { margin-right: 12px; }
.crumbs { display: flex; gap: 8px; font-size: .86rem; color: var(--muted); margin-bottom: 14px; flex-wrap: wrap; }
.crumbs a { text-decoration: none; } .crumbs a:hover { color: var(--accent); }

/* ---------- карточки ---------- */
.section { padding: 36px 0 64px; }
.section-title { font-size: 1.5rem; margin-bottom: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 26px; }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .18s ease, box-shadow .18s ease; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-cover { text-decoration: none; display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--code-bg); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .card-cover img { transform: scale(1.04); }
.ph { display: grid; place-items: center; width: 100%; height: 100%; position: relative; overflow: hidden;
  background: linear-gradient(135deg, hsl(var(--h) 88% 62%), hsl(calc(var(--h) + 42) 82% 52%)); }
.ph::before { content: ""; position: absolute; inset: 0; background:
  radial-gradient(circle at 18% 22%, rgba(255,255,255,.35), transparent 42%),
  radial-gradient(circle at 85% 90%, rgba(0,0,0,.18), transparent 50%); }
.ph i { font-style: normal; font-size: 3.6rem; font-weight: 900; color: rgba(255,255,255,.92); position: relative; text-shadow: 0 6px 24px rgba(0,0,0,.25); transform: rotate(-6deg); }
.card-body { display: flex; flex-direction: column; gap: 10px; padding: 20px 22px 22px; flex: 1; align-items: flex-start; }
.card-title { font-size: 1.28rem; font-weight: 750; line-height: 1.22; }
.card-title a { text-decoration: none; }
.card-title a::after { content: ""; position: absolute; inset: 0; } /* вся карточка кликабельна */
.card { position: relative; }
.pill { position: relative; z-index: 2; }
.card-excerpt { margin: 0; color: var(--muted); font-size: .98rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { margin-top: auto; padding-top: 4px; }
.card-hero { flex-direction: row; margin-bottom: 30px; }
.card-hero .card-cover { flex: 1.15; aspect-ratio: auto; min-height: 320px; }
.card-hero .card-body { flex: 1; justify-content: center; padding: 34px; gap: 14px; }
.card-hero .card-title { font-size: clamp(1.6rem, 3vw, 2.3rem); font-weight: 800; }
.card-hero .card-excerpt { font-size: 1.05rem; -webkit-line-clamp: 4; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 40px; gap: 12px; }

.empty { text-align: center; padding: 56px 20px; border: 2px dashed var(--line); border-radius: var(--radius); }
.empty h1, .empty h2 { margin: 12px 0 8px; font-size: 1.6rem; }
.empty-mark { font-size: 4.5rem; font-weight: 900; color: var(--accent); line-height: 1; display: inline-block; transform: rotate(-8deg); }
.empty .hero-search { margin: 24px auto; }
.results { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 22px; }
.results li { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.res-title { font-size: 1.25rem; font-weight: 750; text-decoration: none; }
.res-title:hover { color: var(--accent); }
.results p { margin: 6px 0; color: var(--muted); } .results mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }

/* ---------- статья ---------- */
.preview-bar { background: var(--mark); text-align: center; padding: 8px; font-size: .9rem; font-weight: 600; }
.post-head { padding: 44px 0 10px; }
.post-head h1 { font-size: clamp(2rem, 5.4vw, 3.3rem); font-weight: 820; letter-spacing: -0.035em; text-wrap: balance; }
.post-head .lead { font-size: clamp(1.15rem, 2.4vw, 1.35rem); }
.post-head .meta { margin-top: 22px; }
.post-cover { margin-top: 30px; }
.post-cover img { width: 100%; max-height: 520px; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }
.post-grid { display: grid; grid-template-columns: minmax(0, var(--wr)) 240px; gap: 64px; justify-content: center; padding-top: 30px; }
.post-side { position: relative; }
.toc-side { position: sticky; top: 92px; font-size: .9rem; }
.toc-title { font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.toc a { display: block; padding: 6px 10px; border-left: 2px solid var(--line); text-decoration: none; color: var(--muted); line-height: 1.35; }
.toc a:hover { color: var(--ink); } .toc a.active { color: var(--ink); border-left-color: var(--accent); font-weight: 650; }
.toc .l3 a { padding-left: 22px; font-size: .95em; }
.toc-inline { display: none; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px 16px 10px; margin-bottom: 26px; }
.toc-inline summary { cursor: pointer; font-weight: 750; padding: 10px 0; }

.prose { font-family: var(--serif); font-size: 1.16rem; line-height: 1.78; overflow-wrap: anywhere; }
.prose > * + * { margin-top: 1.25em; }
.prose h2, .prose h3, .prose h4 { font-family: var(--sans); scroll-margin-top: 90px; }
.prose h2 { font-size: 1.75rem; margin-top: 2.1em; font-weight: 800; }
.prose h3 { font-size: 1.32rem; margin-top: 1.8em; font-weight: 750; }
.prose h2 + *, .prose h3 + * { margin-top: .7em; }
.prose a { color: color-mix(in srgb, var(--accent) 80%, var(--ink)); font-weight: 500; text-decoration-thickness: 1.5px; }
.prose ul, .prose ol { padding-left: 1.4em; } .prose li + li { margin-top: .45em; }
.prose li::marker { color: var(--accent); font-weight: 700; }
.prose strong { font-weight: 700; }
.prose blockquote { margin-left: 0; padding: 4px 0 4px 22px; border-left: 4px solid var(--accent); color: var(--muted); font-style: italic; }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 2.4em 0; }
.prose img { border-radius: 14px; margin-inline: auto; box-shadow: var(--shadow); }
.prose figure { margin: 1.8em 0; } .prose figcaption { text-align: center; font: .88rem var(--sans); color: var(--muted); margin-top: 10px; }
.prose code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .86em; background: var(--code-bg); padding: .15em .4em; border-radius: 6px; border: 1px solid var(--line); }
.prose pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; overflow-x: auto; line-height: 1.55; }
.prose pre code { background: none; border: 0; padding: 0; font-size: .88rem; }
.prose table { width: 100%; border-collapse: collapse; font: .96rem/1.5 var(--sans); display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.prose th { background: var(--code-bg); font-weight: 700; }
.prose .footnotes { font: .9rem/1.6 var(--sans); color: var(--muted); }

/* блоки-подсказки: ::: tip / warn / note / steps */
.prose .tip, .prose .warn, .prose .note { font-family: var(--sans); font-size: 1rem; line-height: 1.6; padding: 16px 20px 16px 54px; border-radius: 14px; position: relative; border: 1px solid; }
.prose .tip::before, .prose .warn::before, .prose .note::before { position: absolute; left: 18px; top: 14px; font-size: 1.35rem; line-height: 1.4; }
.prose .tip { background: color-mix(in srgb, #22c55e 11%, transparent); border-color: color-mix(in srgb, #22c55e 40%, transparent); } .prose .tip::before { content: "💡"; }
.prose .warn { background: color-mix(in srgb, #f59e0b 13%, transparent); border-color: color-mix(in srgb, #f59e0b 45%, transparent); } .prose .warn::before { content: "⚠️"; }
.prose .note { background: color-mix(in srgb, #3b82f6 10%, transparent); border-color: color-mix(in srgb, #3b82f6 38%, transparent); } .prose .note::before { content: "ℹ️"; }
.prose .tip > :first-child, .prose .warn > :first-child, .prose .note > :first-child { margin-top: 0; }
.prose .tip > :last-child, .prose .warn > :last-child, .prose .note > :last-child { margin-bottom: 0; }
.prose .steps { font-family: var(--sans); font-size: 1.02rem; }
.prose .steps ol { list-style: none; counter-reset: s; padding: 0; display: grid; gap: 14px; }
.prose .steps ol > li { counter-increment: s; position: relative; padding: 14px 18px 14px 62px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin: 0; }
.prose .steps ol > li::before { content: counter(s); position: absolute; left: 16px; top: 12px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 800; }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 40px 0 0; }
.tags a { display: inline-block; padding: 5px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-size: .88rem; color: var(--muted); }
.tags a:hover { color: var(--accent); border-color: var(--accent); }
.cta { margin-top: 44px; padding: 30px; border-radius: var(--radius); color: #fff; background: linear-gradient(135deg, #1b1f2a, #2c1f3f 60%, #4a2344); position: relative; overflow: hidden; }
.cta::after { content: "?"; position: absolute; right: 24px; top: -30px; font-size: 11rem; font-weight: 900; color: rgba(255,255,255,.07); }
.cta h3 { font-size: 1.45rem; margin-bottom: 8px; } .cta p { margin: 0 0 18px; color: rgba(255,255,255,.8); max-width: 32em; }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; }
.prevnext a { display: block; padding: 16px 20px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; font-weight: 650; background: var(--surface); }
.prevnext a:hover { border-color: var(--accent); } .prevnext a.right { text-align: right; grid-column: 2; }
.prevnext span { display: block; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.related { padding-top: 0; }

/* ---------- подвал ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 20px; }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 40px; padding: 44px 0 26px; }
.foot-grid h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 14px; }
.foot-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; } .foot-grid a { text-decoration: none; } .foot-grid a:hover { color: var(--accent); }
.foot-about { max-width: 26em; margin: 14px 0 0; }
.foot-bottom { padding: 16px 0 32px; font-size: .86rem; border-top: 1px solid var(--line); }

/* ---------- адаптив ---------- */
@media (max-width: 1080px) {
  .post-grid { grid-template-columns: minmax(0, var(--wr)); gap: 0; } .post-side { display: none; } .toc-inline { display: block; }
}
@media (max-width: 860px) {
  .card-hero { flex-direction: column; } .card-hero .card-cover { min-height: 0; aspect-ratio: 16 / 10; } .card-hero .card-body { padding: 24px; }
  .foot-grid { grid-template-columns: 1fr 1fr; } .foot-grid > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  body { font-size: 16px; } .prose { font-size: 1.08rem; }
  .menu-btn { display: grid; } .search-mini { display: none; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; margin: 0; padding: 12px 20px 18px; background: var(--bg); border-bottom: 1px solid var(--line); }
  .nav.open { display: flex; } .nav a { padding: 12px; font-size: 1.05rem; }
  .bar { gap: 8px; } .brand { margin-right: auto; }
  .hero { padding-top: 38px; } .hero-search { flex-direction: column; } .hero-search .btn { width: 100%; }
  .prevnext { grid-template-columns: 1fr; } .prevnext a.right { grid-column: 1; text-align: left; }
  .cta { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .site-header, .site-footer, .progress, .post-side, .cta, .related, .prevnext { display: none !important; } body { background: #fff; color: #000; } }

/* ---------- кнопка в шапке, инлайн-CTA ---------- */
.btn.sm { padding: 7px 15px; font-size: .9rem; white-space: nowrap; }
.nav-cta { margin-left: 4px; }
@media (max-width: 760px) { .nav-cta { padding: 6px 12px; font-size: .84rem; } }
.prose .cta {
  font-family: var(--sans); font-size: 1.02rem; line-height: 1.55; padding: 22px 24px; border-radius: 16px; color: #fff;
  background: linear-gradient(135deg, #1b1f2a, #2c1f3f 60%, #4a2344); position: relative; overflow: hidden;
}
.prose .cta > * { position: relative; }
.prose .cta > :first-child { margin-top: 0; font-size: 1.2rem; }
.prose .cta > :last-child { margin-bottom: 0; }
.prose .cta a { display: inline-block; margin-top: 4px; padding: 9px 18px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 700; text-decoration: none; }
.prose .cta a:hover { filter: brightness(1.08); }
