/* Публичный сайт. Цвета взяты из сводной таблицы: тёмные чернила, сетка ячеек
   и охра выделенной ячейки — та же, что подсвечена на кубе на главной. */
:root {
  --ink: #172036;
  --ink-2: #3a455c;
  --muted: #5e6a80;
  --grid: #d6dce6;
  --paper: #f4f6f9;
  --white: #ffffff;
  --ochre: #e3a21a;
  --ochre-ink: #8a5a00;
  --slice: #f7e6bd;
  --ok: #1f7a5c;
  --err: #b42318;

  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, "PT Serif", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;

  --wrap: 1140px;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body { margin: 0; background: var(--white); color: var(--ink); font: 17px/1.6 var(--sans); }
img, svg { max-width: 100%; }
a { color: var(--ink); text-decoration-color: var(--ochre); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--ochre-ink); }
:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.005em; }
h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); line-height: 1.1; }
h2 { font-size: clamp(1.45rem, 2.4vw, 1.85rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.muted, .meta { color: var(--muted); }
.meta { font-size: .9rem; margin: 0; }
.lead { font-size: 1.2rem; line-height: 1.55; color: var(--ink-2); max-width: 40em; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 50; background: var(--white); padding: 8px 12px; }
main:focus { outline: none; }

/* ---- кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  font: 600 1rem/1 var(--sans); padding: .85em 1.3em; border-radius: var(--radius);
  background: var(--ink); color: var(--white); border: 2px solid var(--ink); text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--ink-2); border-color: var(--ink-2); color: var(--white); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--paper); color: var(--ink); border-color: var(--ink); }
.btn--light { background: var(--ochre); border-color: var(--ochre); color: var(--ink); }
.btn--light:hover { background: #f0b53a; border-color: #f0b53a; color: var(--ink); }
.btn--small { padding: .6em 1em; font-size: .92rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ---- шапка */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--grid); }
.top__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 700 1.25rem/1 var(--serif); text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand__mark { width: 30px; height: 30px; color: var(--ink); }
.brand__cell { fill: var(--ochre); }
.nav { display: flex; align-items: center; gap: 22px; }
.nav a:not(.btn) { text-decoration: none; font-weight: 500; color: var(--ink-2); padding: 6px 0; border-bottom: 2px solid transparent; }
.nav a:not(.btn):hover, .nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ochre); }
.adminbar { background: var(--slice); font-size: .9rem; padding: 8px 0; }

/* ---- главная: первый экран */
.hero { background: var(--paper); border-bottom: 1px solid var(--grid); }
.hero__inner { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; align-items: center; padding-top: 64px; padding-bottom: 56px; }
.hero h1 { max-width: 13em; }
.hero__figure { margin: 0; }
.hero__figure figcaption { font-size: .9rem; color: var(--muted); max-width: 30em; margin: 8px auto 0; text-align: center; }

.cube { display: block; width: 100%; height: auto; max-width: 520px; margin: 0 auto; overflow: visible; }
.cube .c { stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }
.cube .c--top { fill: #ffffff; }
.cube .c--left { fill: #e9edf3; }
.cube .c--right { fill: #d3dae5; }
.cube .c--slice { fill: var(--slice); }
.cube .c--hit { fill: var(--ochre); }
.cube__axis { font: 600 15px var(--sans); fill: var(--ink-2); }
.cube__lead { stroke: var(--ink); stroke-width: 1.4; stroke-dasharray: 4 4; }
.cube__dot { fill: var(--ink); }
.cube__note rect { fill: var(--white); stroke: var(--ink); stroke-width: 1.4; }
.cube__note text { font: 14px var(--sans); fill: var(--ink-2); }
.cube__note .cube__value { font: 700 19px var(--serif); fill: var(--ink); }

/* Одно движение на странице: выделенная ячейка «загорается» после загрузки. */
@media (prefers-reduced-motion: no-preference) {
  .cube .c--hit { animation: hit 1.2s ease-out .4s both; }
  .cube__note, .cube__lead, .cube__dot { animation: note .5s ease-out 1.3s both; }
  @keyframes hit { from { fill: var(--slice); } to { fill: var(--ochre); } }
  @keyframes note { from { opacity: 0; } to { opacity: 1; } }
}

/* ---- блоки главной */
.block { padding: 72px 0; }
.block--tint { background: var(--paper); border-top: 1px solid var(--grid); border-bottom: 1px solid var(--grid); }
.block__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.block__head h2 { margin: 0; }
.more { font-weight: 600; white-space: nowrap; }

.services { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 48px; border-top: 2px solid var(--ink); }
.services__item { padding: 22px 0 18px; border-bottom: 1px solid var(--grid); }
.services__item h2, .services__item h3 { font-size: 1.3rem; margin-bottom: .35em; }
.services__item a { text-decoration: none; }
.services__item a:hover { text-decoration: underline; text-decoration-color: var(--ochre); }
.services__item p { margin: 0; color: var(--ink-2); max-width: 34em; }
.services--wide { margin-top: 8px; }

.steps { list-style: none; counter-reset: step; margin: 32px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 24px; }
.steps li { counter-increment: step; border-top: 2px solid var(--ink); padding-top: 14px; }
.steps li::before { content: counter(step); display: block; font: 700 1.9rem/1 var(--serif); color: var(--ochre-ink); margin-bottom: 10px; }
.steps h3 { font-size: 1.1rem; margin-bottom: .3em; }
.steps p { font-size: .95rem; color: var(--ink-2); margin: 0; }

.teasers { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; }
.teasers li { border-top: 1px solid var(--grid); padding-top: 18px; display: flex; flex-direction: column; }
.teasers h3 { font-size: 1.25rem; }
.teasers h3 a { text-decoration: none; }
.teasers h3 a:hover { text-decoration: underline; text-decoration-color: var(--ochre); }
.teasers p { color: var(--ink-2); }
.teasers .meta { margin-top: auto; }
.teasers__rubric { font-size: .88rem; font-weight: 600; color: var(--ochre-ink) !important; margin-bottom: .4em; }

.cta { background: var(--ink); color: var(--white); }
.cta__inner { display: flex; align-items: center; justify-content: space-between; gap: 32px; padding-top: 56px; padding-bottom: 56px; }
.cta h2 { color: var(--white); margin-bottom: .3em; }
.cta p { color: #c9d1de; margin: 0; max-width: 36em; }

/* ---- внутренние страницы */
.page { padding-top: 48px; padding-bottom: 80px; }
.page__head { max-width: 46em; margin-bottom: 36px; }
.page__head .meta { margin-top: -.4em; }
.crumbs { font-size: .92rem; margin-bottom: 18px; display: flex; gap: 8px; color: var(--muted); }
.crumbs a { color: var(--muted); }

.doc { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 64px; align-items: start; }
.doc__side { position: sticky; top: 96px; display: grid; gap: 28px; }
.sidecard { background: var(--paper); border: 1px solid var(--grid); border-left: 4px solid var(--ochre); border-radius: var(--radius); padding: 20px; }
.sidecard p { font-size: .95rem; color: var(--ink-2); }
.sidecard__title { font: 700 1.1rem/1.3 var(--serif); color: var(--ink) !important; margin-bottom: .4em; }
.sidelist__title { font-weight: 700; font-size: .95rem; margin-bottom: .5em; }
.sidelist ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--grid); }
.sidelist li a { display: block; padding: 5px 0 5px 14px; font-size: .93rem; text-decoration: none; color: var(--ink-2); margin-left: -1px; border-left: 2px solid transparent; }
.sidelist li a:hover { border-left-color: var(--ochre); color: var(--ink); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--grid); max-width: calc(100% - 344px); }
.pager__link { display: flex; flex-direction: column; gap: 4px; text-decoration: none; font: 700 1.1rem/1.3 var(--serif); }
.pager__link--next { text-align: right; grid-column: 2; }

/* ---- список статей */
.rubric-nav { display: flex; flex-wrap: wrap; gap: 10px; margin: -8px 0 40px; }
.rubric-nav a { border: 1px solid var(--grid); border-radius: 999px; padding: 6px 14px; text-decoration: none; font-size: .95rem; }
.rubric-nav a:hover { border-color: var(--ochre); }
.rubric { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 48px; padding: 32px 0; border-top: 2px solid var(--ink); }
.rubric__head p { color: var(--ink-2); font-size: .95rem; }
.toclist { margin: 0; padding: 0; list-style: none; counter-reset: art; }
.toclist li { counter-increment: art; display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--grid); }
.toclist li::before { content: counter(art) "."; font: 700 1.05rem var(--serif); color: var(--ochre-ink); }
.toclist li:first-child { padding-top: 0; }
.toclist a { text-decoration: none; display: grid; gap: 4px; }
.toclist__title { font: 700 1.15rem/1.3 var(--serif); }
.toclist a:hover .toclist__title { text-decoration: underline; text-decoration-color: var(--ochre); }
.toclist__summary { color: var(--ink-2); font-size: .95rem; }

/* ---- текст статьи (общий с предпросмотром в «Управлении») */
.prose { font-size: 1.08rem; line-height: 1.72; max-width: 44em; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 1.55rem; margin: 1.8em 0 .55em; }
.prose h3 { font-size: 1.22rem; margin: 1.5em 0 .45em; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.05em; }
.prose li { margin: .3em 0; }
.prose li > p { margin: 0; }
.prose blockquote { margin: 1.4em 0; padding: .7em 1.1em; border-left: 4px solid var(--ochre); background: var(--paper); }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code { font-family: var(--mono); font-size: .86em; background: var(--paper); border: 1px solid var(--grid); padding: .08em .35em; border-radius: 4px; }
.prose pre { background: #1d2538; color: #e6eaf2; padding: 16px 18px; border-radius: var(--radius); overflow-x: auto; line-height: 1.55; font-size: .92rem; margin: 0 0 1.3em; }
.prose pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.prose table { border-collapse: collapse; width: 100%; font-size: .95rem; margin: 0 0 1.3em; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--grid); padding: 8px 11px; text-align: left; vertical-align: top; }
.prose th { background: var(--paper); font-weight: 600; }
.prose img { max-width: 100%; height: auto; }
.prose figure { margin: 1.7em 0; text-align: center; }
.prose figure img { display: inline-block; border: 1px solid var(--grid); border-radius: var(--radius); background: var(--white); }
.prose figcaption { font-size: .9rem; color: var(--muted); margin-top: .5em; }
.prose img.w-25 { width: 25%; } .prose img.w-50 { width: 50%; } .prose img.w-75 { width: 75%; }
.prose img.formula { display: inline-block; vertical-align: middle; max-height: 4em; border: 0; }
.prose hr { border: 0; border-top: 1px solid var(--grid); margin: 2em 0; }
.math-display { display: block; margin: 1.1em 0; overflow-x: auto; overflow-y: hidden; text-align: center; }
.math-inline:not(.math-ready), .math-display:not(.math-ready) { font-family: var(--mono); font-size: .92em; }
.prose .katex { font-size: 1.06em; }
.prose .katex-display { margin: 0; }

/* ---- контакты и форма */
.contacts { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 64px; align-items: start; }
.leadform, .leadform__done { max-width: 36em; }
.leadform h2, .leadform__done h2 { margin-bottom: .8em; }
.field { display: grid; gap: 6px; margin-bottom: 18px; }
.field label { font-weight: 600; font-size: .95rem; }
.field input, .field select, .field textarea {
  font: inherit; color: var(--ink); background: var(--white); border: 1px solid #b9c2d0; border-radius: var(--radius); padding: .65em .8em; width: 100%;
}
.field textarea { resize: vertical; min-height: 7em; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid var(--slice); border-color: var(--ochre-ink); }
.field [aria-invalid="true"] { border-color: var(--err); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-error { color: var(--err); font-weight: 500; min-height: 1em; }
.form-error:empty { display: none; }
.hint { font-size: .85rem; color: var(--muted); margin-top: 12px; }
.leadform__done { border-left: 4px solid var(--ok); padding: 8px 0 8px 20px; }
.contacts__side { background: var(--paper); border: 1px solid var(--grid); border-radius: var(--radius); padding: 24px; }
.contacts__list { margin: 0; display: grid; gap: 4px; }
.contacts__list dt { font-size: .88rem; color: var(--muted); margin-top: 12px; }
.contacts__list dt:first-child { margin-top: 0; }
.contacts__list dd { margin: 0; font-weight: 600; }

/* ---- подвал */
.foot { border-top: 1px solid var(--grid); background: var(--paper); padding: 40px 0 24px; font-size: .95rem; }
.foot__inner { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.foot__name { font: 700 1.15rem var(--serif); margin-bottom: .3em; }
.foot__muted { color: var(--muted); max-width: 22em; }
.foot__links, .foot__contacts { display: grid; gap: 6px; align-content: start; font-style: normal; }
.foot__links a, .foot__contacts a { text-decoration: none; }
.foot__links a:hover, .foot__contacts a:hover { text-decoration: underline; text-decoration-color: var(--ochre); }
.foot__legal { margin-top: 32px; color: var(--muted); font-size: .85rem; }

/* ---- адаптивность */
@media (max-width: 980px) {
  .hero__inner { grid-template-columns: 1fr; gap: 24px; padding-top: 40px; }
  .hero__figure { max-width: 520px; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
  .doc, .contacts { grid-template-columns: 1fr; gap: 40px; }
  .doc__side { position: static; }
  .pager { max-width: none; }
  .rubric { grid-template-columns: 1fr; gap: 12px; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .wrap { padding: 0 18px; }
  .nav { gap: 14px; }
  .nav .btn { display: none; }
  .services, .teasers { grid-template-columns: 1fr; gap: 0 0; }
  .teasers { gap: 28px; }
  .steps { grid-template-columns: 1fr; }
  .block { padding: 52px 0; }
  .cta__inner { flex-direction: column; align-items: flex-start; }
  .foot__inner { grid-template-columns: 1fr; gap: 20px; }
  .pager { grid-template-columns: 1fr; }
  .pager__link--next { grid-column: 1; text-align: left; }
  .prose img.w-25 { width: 50%; } .prose img.w-50, .prose img.w-75 { width: 100%; }
}
@media (max-width: 420px) {
  .brand span { font-size: 1.05rem; }
  .nav a:not(.btn) { font-size: .92rem; }
}
