/* Нормоконтроль · визуальный язык «чертёжного листа»:
   светлая тема — ватман и графит, тёмная — синька. */
:root {
  --paper: #f4f1e8;          /* ватман */
  --sheet: #fbfaf6;          /* лист */
  --grid-minor: rgba(30, 60, 90, .045);
  --grid-major: rgba(30, 60, 90, .085);
  --ink: #1a2230;            /* графит */
  --ink-2: #485263;
  --muted: #6b7381;
  --line: #1a2230;           /* основная линия чертежа */
  --line-soft: #d9d4c6;
  --accent: #1d4e89;         /* чертёжный синий */
  --accent-ink: #ffffff;
  --accent-soft: #e3ebf5;
  --crit: #b8321a;           /* красный карандаш нормоконтролёра */
  --crit-soft: #f8e6e1;
  --warn: #8a5a00;           /* охра */
  --warn-soft: #f6ecd6;
  --ok: #2c6e45;
  --ok-soft: #e2efe6;
  --focus: #1d4e89;
  --serif-doc: "Times New Roman", Times, "Liberation Serif", serif;
  --sans: "Golos Text", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Consolas", ui-monospace, monospace;
  --r: 4px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1d30;        /* синька */
    --sheet: #13263d;
    --grid-minor: rgba(160, 200, 240, .05);
    --grid-major: rgba(160, 200, 240, .1);
    --ink: #e7eef6;
    --ink-2: #b6c4d4;
    --muted: #8fa2b8;
    --line: #9fbbd8;
    --line-soft: #29425f;
    --accent: #8cbcf0;
    --accent-ink: #0e1d30;
    --accent-soft: #1c3756;
    --crit: #ff8f7a;
    --crit-soft: #3b2226;
    --warn: #efc16a;
    --warn-soft: #36301f;
    --ok: #86d4a3;
    --ok-soft: #1b3a32;
    --focus: #8cbcf0;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100dvh; color: var(--ink); font: 400 16px/1.6 var(--sans);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px, 8px 8px, 8px 8px;
}
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .wrap { padding: 0 32px; } }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -60px; background: var(--ink); color: var(--paper); padding: 10px 14px; z-index: 100; border-radius: var(--r); }
.skip:focus { top: 12px; }

/* ---------- header */
.top { border-bottom: 1.5px solid var(--line); background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 20; }
.top__in { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; min-height: 44px; }
.brand__mark { display: grid; place-items: center; width: 38px; height: 30px; border: 1.5px solid var(--line);
  font: 700 14px/1 var(--mono); letter-spacing: .04em; }
.brand__name { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand__code { font: 500 12px/1 var(--mono); color: var(--muted); padding-left: 12px; border-left: 1px solid var(--line-soft); }
.top__nav a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; font-size: 15px; color: var(--ink); text-decoration: none; border-bottom: 1.5px solid transparent; }
.top__nav a:hover { border-bottom-color: var(--ink); }

/* ---------- hero */
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: start; padding: 64px 0 40px; }
.overline { font: 500 12px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--accent); margin: 0 0 18px;
  display: flex; align-items: center; gap: 10px; }
.overline::before { content: ""; width: 28px; height: 1.5px; background: currentColor; }
.hero h1 { font-weight: 800; font-size: clamp(34px, 5vw, 58px); line-height: 1.02; letter-spacing: -.03em; margin: 0 0 22px; text-wrap: balance; }
.lead { font-size: 18px; line-height: 1.6; color: var(--ink-2); margin: 0 0 30px; max-width: 34em; }
.hero__facts { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--line); }
.hero__facts li { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); color: var(--ink-2); font-size: 15px; }
.hero__facts b { font: 700 15px/1.5 var(--mono); color: var(--ink); }

/* ---------- sheet (форма загрузки как лист с рамкой) */
.sheet { background: var(--sheet); border: 1px solid var(--line-soft); padding: 14px 14px 18px 34px; position: relative;
  box-shadow: 0 1px 0 var(--line-soft), 6px 6px 0 color-mix(in srgb, var(--ink) 7%, transparent); }
.sheet__frame { border: 1.5px solid var(--line); display: grid; grid-template-rows: 1fr auto; min-height: 380px; }
.drop { display: grid; justify-items: center; align-content: center; gap: 6px; text-align: center; padding: 36px 20px; cursor: pointer;
  position: relative; transition: background-color .2s var(--ease); }
.drop::after { content: ""; position: absolute; inset: 16px; border: 1.5px dashed var(--line-soft); transition: border-color .2s var(--ease); pointer-events: none; }
.drop:hover::after, .drop.is-over::after { border-color: var(--accent); }
.drop.is-over { background: var(--accent-soft); }
.drop:focus-within::after { border-color: var(--focus); border-style: solid; }
.drop.has-file::after { border-style: solid; border-color: var(--accent); }
.drop__icon { width: 46px; height: 46px; color: var(--accent); margin-bottom: 8px; transition: transform .25s var(--ease); }
.drop:hover .drop__icon { transform: translateY(-3px); }
.drop__title { font-weight: 700; font-size: 18px; word-break: break-word; max-width: 100%; }
.drop__hint { font-size: 14px; color: var(--muted); }

/* основная надпись с полями формы */
.stamp-form { display: grid; grid-template-columns: 1fr 1fr 64px; border-top: 1.5px solid var(--line); }
.cell { margin: 0; padding: 8px 10px 10px; border: 0; border-right: 1px solid var(--line); min-width: 0; display: grid; gap: 6px; align-content: start; }
.cell__label { font: 500 11px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0; }
.cell--type { grid-column: 1; }
.cell--profile { grid-column: 2 / span 2; border-right: 0; }
.cell--code { grid-column: 1 / span 2; border-top: 1px solid var(--line); }
.cell--sheet { border-top: 1px solid var(--line); border-right: 0; text-align: center; }
.code { font: 500 italic 15px/1.3 var(--mono); color: var(--ink-2); }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; min-height: 40px; font-weight: 600; font-size: 14px; cursor: pointer; transition: background-color .15s, color .15s; }
.seg label + label span { border-left: 1px solid var(--line); }
.seg input:checked + span { background: var(--ink); color: var(--sheet); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -4px; }
select { width: 100%; min-height: 42px; font: 500 14px var(--sans); color: var(--ink); background: var(--sheet); border: 1px solid var(--line);
  border-radius: 0; padding: 0 34px 0 10px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 22px;
  font: 600 16px/1 var(--sans); border-radius: var(--r); border: 1.5px solid transparent; cursor: pointer; text-decoration: none;
  transition: background-color .15s, border-color .15s, transform .1s; touch-action: manipulation; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn--primary { width: 100%; margin-top: 16px; background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 85%, var(--ink)); }
.btn--primary:disabled { opacity: .42; cursor: not-allowed; }
.btn--primary.is-loading .btn__label::before { content: ""; display: inline-block; width: 16px; height: 16px; margin-right: 10px; vertical-align: -3px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn--ghost { background: var(--sheet); color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--ink); color: var(--sheet); }
.privacy { margin: 12px 0 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
@keyframes spin { to { transform: rotate(360deg); } }

.status { margin: 8px 0 24px; padding: 14px 16px; border-left: 3px solid var(--accent); background: var(--sheet); font-weight: 500; }
.status.is-error { border-left-color: var(--crit); color: var(--crit); background: var(--crit-soft); }

/* ---------- итог: основная надпись + штамп */
.result { padding-top: 24px; scroll-margin-top: 80px; }
.titleblock { display: grid; grid-template-columns: 300px 1fr; background: var(--sheet); border: 1.5px solid var(--line); }
.titleblock__stamp { display: grid; place-items: center; padding: 28px 20px; border-right: 1.5px solid var(--line); }
.verdict-stamp { --c: var(--crit); color: var(--c); border: 3px double var(--c); padding: 12px 18px 10px; text-align: center; transform: rotate(-4deg);
  font: 700 13px/1.25 var(--mono); text-transform: uppercase; letter-spacing: .1em; animation: stamp .45s var(--ease) both .1s; max-width: 240px; }
.verdict-stamp.is-ok { --c: var(--ok); }
.verdict-stamp strong { display: block; font: 800 22px/1.1 var(--sans); letter-spacing: .02em; margin: 6px 0 4px; }
.verdict-stamp small { display: block; font-size: 10.5px; letter-spacing: .14em; opacity: .85; }
@keyframes stamp { from { opacity: 0; transform: rotate(-4deg) scale(1.35); } 60% { opacity: 1; transform: rotate(-4deg) scale(.96); } to { opacity: 1; transform: rotate(-4deg) scale(1); } }
.titleblock__grid { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; }
.tb { padding: 12px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.tb:nth-child(4n) { border-right: 0; }
.tb:nth-last-child(-n+4) { border-bottom: 0; }
.tb dt { font: 500 11px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.tb dd { margin: 0; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.tb--file { grid-column: span 4; border-right: 0; }
.tb--file dd { font: 500 italic 16px/1.4 var(--mono); }
.tb--big dd { font: 800 34px/1 var(--sans); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tb--crit dd { color: var(--crit); }
.tb--warn dd { color: var(--warn); }
.tb--ok dd { color: var(--ok); }
.tb dd small { display: block; font: 500 12px/1.4 var(--sans); color: var(--muted); letter-spacing: 0; margin-top: 6px; }

/* ---------- отчёт */
.report { display: grid; grid-template-columns: 250px 1fr; gap: 40px; margin-top: 36px; align-items: start; }
.toc { position: sticky; top: 84px; }
.toc__title { font: 500 12px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 10px; padding-bottom: 10px; border-bottom: 1.5px solid var(--line); }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a { display: flex; align-items: baseline; gap: 6px; min-height: 36px; padding: 6px 0; color: var(--ink); text-decoration: none; font-size: 15px; }
.toc a:hover .toc__name { text-decoration: underline; text-underline-offset: 3px; }
.toc__dots { flex: 1; border-bottom: 1.5px dotted var(--line-soft); transform: translateY(-4px); min-width: 12px; }
.toc__n { font: 500 13px/1 var(--mono); }
.toc__n .c { color: var(--crit); font-weight: 700; }
.toc__n .w { color: var(--warn); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1.5px solid var(--line); }
.chips { display: flex; border: 1px solid var(--line); }
.chip { min-height: 42px; padding: 0 16px; font: 600 14px/1 var(--sans); background: var(--sheet); color: var(--ink); border: 0; cursor: pointer; transition: background-color .15s, color .15s; }
.chip + .chip { border-left: 1px solid var(--line); }
.chip:hover { background: var(--accent-soft); }
.chip.is-active { background: var(--ink); color: var(--sheet); }
.chip .n { font: 500 12px var(--mono); margin-left: 8px; opacity: .75; }

.group { scroll-margin-top: 90px; }
.group__head { display: flex; align-items: baseline; gap: 14px; margin: 34px 0 10px; }
.group__num { font: 700 14px/1 var(--mono); color: var(--accent); }
.group__title { font-weight: 800; font-size: 22px; letter-spacing: -.01em; margin: 0; }

.issue { background: var(--sheet); border: 1px solid var(--line-soft); border-left: 4px solid var(--c, var(--warn)); margin-bottom: 8px; }
.issue--critical { --c: var(--crit); }
.issue--warning { --c: var(--warn); }
.issue > summary { list-style: none; display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center; padding: 14px 16px 14px 12px; cursor: pointer; min-height: 56px; }
.issue > summary::-webkit-details-marker { display: none; }
.issue > summary:hover { background: color-mix(in srgb, var(--c) 6%, transparent); }
.issue__code { font: 700 13px/1 var(--mono); color: var(--muted); }
.issue__title { font-weight: 600; font-size: 16px; line-height: 1.35; min-width: 0; }
.sev { display: inline-flex; align-items: center; gap: 6px; font: 700 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--c); margin-bottom: 5px; }
.sev svg { width: 12px; height: 12px; }
.issue__count { display: flex; align-items: center; gap: 12px; font: 500 13px/1 var(--mono); color: var(--ink-2); white-space: nowrap; }
.issue__count::after { content: ""; width: 9px; height: 9px; border-right: 1.75px solid var(--ink); border-bottom: 1.75px solid var(--ink); transform: rotate(45deg) translateY(-3px); transition: transform .2s var(--ease); }
.issue[open] .issue__count::after { transform: rotate(-135deg) translateY(-1px); }
.issue__body { padding: 4px 20px 20px 66px; animation: reveal .25s var(--ease); }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.rule { margin: 0 0 10px; color: var(--ink-2); font-size: 15px; max-width: 70ch; }
.src { display: inline-block; font: 500 12px/1.4 var(--mono); color: var(--accent); border: 1px solid currentColor; padding: 3px 8px; margin-bottom: 14px; }
.fix { margin: 0 0 16px; padding: 12px 14px; background: var(--ok-soft); font-size: 15px; max-width: 75ch; }
.fix b { color: var(--ok); font-weight: 700; }
.occ { width: 100%; border-collapse: collapse; font-size: 14px; }
.occ th { text-align: left; font: 500 11px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px 10px; border-bottom: 1.5px solid var(--line); }
.occ td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.occ__loc { width: 26%; font: 500 12.5px/1.45 var(--mono); color: var(--ink-2); }
.occ__frag { font-family: var(--serif-doc); font-size: 15.5px; line-height: 1.45; overflow-wrap: anywhere; }
.occ__det { width: 32%; color: var(--c); font-weight: 600; }
.more { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.empty { padding: 36px 20px; text-align: center; background: var(--sheet); border: 1px dashed var(--line-soft); color: var(--ink-2); margin-top: 24px; }

.passed { margin-top: 28px; border-top: 1.5px solid var(--line); }
.passed summary { cursor: pointer; padding: 14px 0; font-weight: 700; color: var(--ok); list-style-position: inside; min-height: 44px; }
.passed ul { margin: 0 0 12px; padding: 0; list-style: none; columns: 2; column-gap: 32px; font-size: 14px; color: var(--ink-2); }
.passed li { break-inside: avoid; padding: 5px 0 5px 22px; position: relative; }
.passed li::before { content: ""; position: absolute; left: 2px; top: 10px; width: 9px; height: 5px; border-left: 1.75px solid var(--ok); border-bottom: 1.75px solid var(--ok); transform: rotate(-45deg); }
.passed li span { color: var(--muted); }
.disclaimer { font-size: 13px; color: var(--muted); margin: 20px 0 0; max-width: 80ch; }

/* ---------- правила */
.rules { padding: 64px 0 0; scroll-margin-top: 70px; }
.rules h2 { font-weight: 800; font-size: clamp(28px, 4vw, 40px); letter-spacing: -.02em; margin: 0 0 8px; }
.rules__lead { color: var(--ink-2); margin: 0 0 24px; max-width: 60ch; }
.rules__grid h3 { font: 700 13px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin: 30px 0 10px; padding-bottom: 8px; border-bottom: 1.5px solid var(--line); }
.rules__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0; border-left: 1px solid var(--line-soft); border-top: 1px solid var(--line-soft); }
.rule-item { background: var(--sheet); padding: 14px 16px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); font-size: 14px; color: var(--ink-2); }
.rule-item b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.rule-item .src { margin: 8px 0 0; }

.foot { margin-top: 80px; border-top: 1.5px solid var(--line); padding: 24px 0 40px; font-size: 13px; color: var(--muted); }
.foot p { margin: 0 0 6px; max-width: 90ch; }

/* ---------- появление */
.hero__text > *, .sheet { animation: rise .6s var(--ease) both; }
.hero__text > :nth-child(2) { animation-delay: .06s; }
.hero__text > :nth-child(3) { animation-delay: .12s; }
.hero__text > :nth-child(4) { animation-delay: .18s; }
.sheet { animation-delay: .14s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .verdict-stamp { transform: rotate(-4deg); }
}

/* ---------- адаптив */
@media (max-width: 1023px) {
  .hero { grid-template-columns: 1fr; gap: 36px; padding-top: 40px; }
  .report { grid-template-columns: 1fr; }
  .toc { display: none; }
  .titleblock { grid-template-columns: 1fr; }
  .titleblock__stamp { border-right: 0; border-bottom: 1.5px solid var(--line); padding: 22px; }
}
@media (max-width: 640px) {
  .brand__code { display: none; }
  .lead { font-size: 16px; }
  .hero__facts li { grid-template-columns: 72px 1fr; }
  .sheet { padding: 10px 10px 14px 20px; }
  .sheet__frame { min-height: 340px; }
  .stamp-form { grid-template-columns: 1fr 56px; }
  .cell--type { grid-column: 1 / span 2; border-right: 0; }
  .cell--profile { grid-column: 1 / span 2; border-top: 1px solid var(--line); }
  .cell--code { grid-column: 1; }
  .titleblock__grid { grid-template-columns: repeat(2, 1fr); }
  .tb:nth-child(4n) { border-right: 1px solid var(--line); }
  .tb:nth-child(2n+1):not(.tb--file) { border-right: 0; }
  .tb:nth-last-child(-n+4) { border-bottom: 1px solid var(--line); }
  .tb:nth-last-child(-n+2) { border-bottom: 0; }
  .tb--file { grid-column: span 2; }
  .tb--big dd { font-size: 28px; }
  .toolbar .btn, .chips { width: 100%; }
  .chip { flex: 1; padding: 0 8px; }
  .issue > summary { grid-template-columns: 1fr auto; }
  .issue__code { display: none; }
  .issue__body { padding: 4px 14px 16px; }
  .occ thead { display: none; }
  .occ tr { display: grid; border-bottom: 1px solid var(--line-soft); padding: 8px 0; }
  .occ td { border: 0; padding: 2px 0; width: auto; }
  .passed ul { columns: 1; }
}
