/* AlemLab — корпоративный сайт.
   Мир: лист проектной документации (ГОСТ-стиль): рамки, штампы,
   размерные линии, реестры. Холодная бумага, тушь, штамп-красный,
   синий карандаш аннотаций. PT Sans Narrow / PT Sans / PT Mono. */

:root {
  --paper: #F5F4EF;
  --paper-deep: #EFEDE6;
  --desk: #E2E0D7;
  --ink: #1B1D21;
  --ink-soft: #454A52;
  --line: #CFCDC3;
  --stamp: #C2261F;
  --draft: #2A46C8;
  --disp: "PT Sans Narrow", "Arial Narrow", sans-serif;
  --body: "PT Sans", system-ui, sans-serif;
  --mono: "PT Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font: 400 17px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--ink); color: var(--paper); }

a:focus-visible, .btn:focus-visible, .logo:focus-visible {
  outline: 3px solid var(--draft);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip {
  position: absolute;
  left: 16px; top: -60px;
  z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: 10px 18px;
  font: 700 15px var(--body);
  text-decoration: none;
  transition: top .15s ease-out;
}
.skip:focus { top: 12px; }

.mono { font-family: var(--mono); }

/* китайская версия: гарнитура с поддержкой CJK */
html[lang="zh-CN"] {
  --disp: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --body: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", monospace;
}

/* ---------- лист по ширине стола ---------- */

.frame {
  max-width: 1520px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-inline: 1.5px solid var(--ink);
}

main { flex: 1; }

section { scroll-margin-top: 76px; }

/* ---------- навигация ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 12px clamp(16px, 3vw, 44px);
  background: var(--paper);
  border-bottom: 1.5px solid var(--ink);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}

.logo-mark {
  font: 700 15px/1 var(--disp);
  letter-spacing: .1em;
  background: var(--ink);
  color: var(--paper);
  padding: 5px 8px 4px;
}

.logo-name {
  font: 700 21px/1 var(--disp);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.nav-links {
  display: flex;
  gap: 22px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-links a {
  font: 400 12.5px/1 var(--mono);
  letter-spacing: .04em;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  padding: 6px 0;
}
.nav-links a:hover { color: var(--ink); }

/* ---------- кнопки и ссылки ---------- */

.btn {
  display: inline-block;
  font: 700 17px/1 var(--disp);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 14px 30px 13px;
  background: var(--ink);
  color: var(--paper);
  border: 1.5px solid var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .16s ease-out, border-color .16s ease-out;
}
.btn:hover { background: var(--stamp); border-color: var(--stamp); }
.btn:active { transform: translateY(1px); }

.btn-small { font-size: 14px; padding: 9px 18px 8px; }
.nav .btn-small { margin-left: auto; }
.nav-links + .btn-small { margin-left: 0; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
}
.btn-ghost:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.text-link {
  font: 700 17px/1.3 var(--body);
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
  transition: color .15s ease-out;
}
.text-link:hover { color: var(--ink); text-decoration-color: var(--stamp); }

/* ---------- лист-секция ---------- */

.sheet {
  position: relative;
  margin: 48px clamp(12px, 2.5vw, 44px);
  border: 1.5px solid var(--ink);
  background: var(--paper);
  padding: clamp(30px, 4.5vw, 64px) clamp(20px, 4vw, 64px);
}

/* поле подшивки слева, как у чертёжного листа */
.sheet::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 52px;
  width: 1px;
  background: var(--line);
}

.sheet-tag {
  position: absolute;
  top: 0;
  right: clamp(18px, 3vw, 44px);
  transform: translateY(-50%);
  background: var(--paper);
  border: 1.5px solid var(--ink);
  padding: 5px 14px 4px;
  font: 400 12px/1 var(--mono);
  letter-spacing: .08em;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* ---------- типографика ---------- */

h1, h2, h3 {
  font-family: var(--disp);
  text-transform: uppercase;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.5rem, 5.4vw, 4.7rem);
  line-height: .99;
  margin: 0 0 24px;
  max-width: 21ch;
}

h2 {
  font-size: clamp(1.6rem, 3.1vw, 2.5rem);
  line-height: 1.04;
  margin: 0;
  max-width: 30ch;
}

p { max-width: 68ch; margin: 0 0 1em; }

.lede {
  font-size: 1.22rem;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 62ch;
  margin: 22px 0 0;
}

.note {
  font: 400 12.5px/1.6 var(--mono);
  color: var(--ink-soft);
  margin: 20px 0 0;
}

/* ---------- размерная линия ---------- */

.dim {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 26px 0 6px;
  max-width: 460px;
  color: var(--draft);
}

.dim-line {
  position: relative;
  flex: 1;
  height: 1px;
  background: var(--draft);
}
.dim-line::before, .dim-line::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 1px;
  height: 9px;
  background: var(--draft);
}
.dim-line::before { left: 0; }
.dim-line::after { right: 0; }

.dim-label {
  font: 400 12px/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---------- герой ---------- */

.sheet-hero { margin-top: 56px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 6fr);
  gap: clamp(36px, 5vw, 76px);
  align-items: start;
}

.hero-lede {
  font-size: 1.24rem;
  line-height: 1.5;
  max-width: 56ch;
  margin: 26px 0 0;
}

.hero-cta {
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
  margin-top: 32px;
}

.hero-facts {
  margin: 36px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--ink);
  font-size: 13px;
  letter-spacing: .02em;
  color: var(--ink-soft);
}

.hero-scheme { margin: 0; }

.hero-scheme svg {
  display: block;
  width: 100%;
  height: auto;
}

/* чертёжная графика схемы (класс может стоять и на группе, и на самом элементе) */
.dr rect,
rect.dr {
  fill: var(--paper-deep);
  stroke: var(--ink);
  stroke-width: 1.6;
}
.dr line,
.dr path,
line.dr,
path.dr {
  stroke: var(--ink);
  stroke-width: 1.6;
  fill: none;
}
.dr text {
  font: 400 12.5px var(--mono);
  fill: var(--ink);
  text-anchor: middle;
  letter-spacing: .02em;
}
text.an {
  font: 400 11.5px var(--mono);
  fill: var(--draft);
  text-anchor: middle;
  letter-spacing: .03em;
}
.dash { stroke-dasharray: 5 5; }

/* штамп согласования — единственная красная графика */
.stamp rect {
  fill: none;
  stroke: var(--stamp);
}
.stamp rect:first-of-type { stroke-width: 2.2; }
.stamp rect:last-of-type { stroke-width: 1.2; }
.stamp text {
  font: 700 17px var(--disp);
  fill: var(--stamp);
  text-anchor: middle;
  letter-spacing: .16em;
}
.stamp {
  transform: rotate(-3.5deg);
  transform-origin: 300px 291px;
  opacity: .94;
}

/* рисование схемы штрихом — один авторский момент страницы */
@media (prefers-reduced-motion: no-preference) {
  .js .dr rect,
  .js rect.dr,
  .js .dr line,
  .js line.dr,
  .js .dr path:not(.dash),
  .js path.dr:not(.dash) {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: draw .85s cubic-bezier(.25, .6, .2, 1) forwards;
  }
  .js rect.d1 { animation-delay: .1s; animation-duration: 1s; }
  .js rect.d2 { animation-delay: .38s; animation-duration: 1s; }
  .js rect.d3 { animation-delay: .66s; animation-duration: 1s; }
  .js rect.d4 { animation-delay: .94s; animation-duration: 1s; }
  .js line.d5 { animation-delay: .8s; animation-duration: .3s; }
  .js line.d6 { animation-delay: 1.08s; animation-duration: .3s; }
  .js line.d7 { animation-delay: 1.36s; animation-duration: .3s; }
  .js line.d9 { animation-delay: 1.55s; animation-duration: .6s; }
  .js .d8 { opacity: 0; animation: appear .5s ease-out 1.8s forwards; }

  /* подписи проявляются, когда под ними начертилась графика */
  .js .dr text, .js text.an {
    opacity: 0;
    animation: textin .4s ease-out forwards;
  }
  .js .d1 text { animation-delay: .75s; }
  .js .d2 text { animation-delay: 1s; }
  .js .d3 text { animation-delay: 1.28s; }
  .js .d4 text { animation-delay: 1.56s; }
  .js text.an:nth-of-type(1) { animation-delay: .85s; }
  .js text.an:nth-of-type(2) { animation-delay: 1.13s; }
  .js text.an:nth-of-type(3) { animation-delay: 1.41s; }
  .js text.an:nth-of-type(4) { animation-delay: 1.9s; }
  .js text.an:nth-of-type(5) { animation-delay: 2s; }
  .js g.dim-svg text.an:nth-of-type(1) { animation-delay: 2.05s; }

  .js .stamp { opacity: 0; animation: appear .45s ease-out 2.2s forwards; }
}

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes appear { to { opacity: .94; } }
@keyframes textin { to { opacity: 1; } }

.hero-scheme figcaption {
  font: 400 12px/1.6 var(--mono);
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 14px;
}

/* ---------- определения (спецификации) ---------- */

.spec-list {
  margin: 40px 0 0;
  border-top: 1.5px solid var(--ink);
}

.spec-row {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 6px 36px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.spec-row dt {
  font: 700 13px/1.6 var(--mono);
  letter-spacing: .12em;
}

.spec-row dd {
  margin: 0;
  max-width: 72ch;
}

/* ---------- таблицы-реестры ---------- */

.table-scroll {
  overflow-x: auto;
  margin-top: 30px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 15.5px;
  line-height: 1.5;
}

thead th {
  font: 700 14px/1.3 var(--disp);
  text-transform: uppercase;
  letter-spacing: .07em;
  text-align: left;
  padding: 12px 24px 12px 0;
  border-top: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
}

tbody td {
  padding: 16px 24px 16px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: 1.5px solid var(--ink); }

td.mono, th.mono {
  font: 400 13px/1.5 var(--mono);
  white-space: nowrap;
}

td.strong {
  font: 700 17px/1.3 var(--disp);
  text-transform: none;
  letter-spacing: .01em;
}

td.st {
  font: 400 12px/1.5 var(--mono);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-soft);
  white-space: nowrap;
}

.nda-row td { color: var(--ink-soft); }
.nda-row td.strong { font-style: italic; font-weight: 700; }

/* ---------- стадии процесса ---------- */

.stages {
  list-style: none;
  margin: 42px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1.5px solid var(--ink);
}

.stage {
  border-left: 1px solid var(--line);
  padding: 24px 26px 10px;
}
.stage:first-child { border-left: 0; padding-left: 0; }

.stage-code {
  display: block;
  font-size: 12px;
  letter-spacing: .1em;
  color: var(--draft);
  margin-bottom: 12px;
}

.stage h3 {
  font-size: 23px;
  margin: 0 0 10px;
}

.stage p {
  font-size: .99rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- форма связи ---------- */

.cform { margin-top: 34px; }

.cform-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
}

.cform-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 18px;
}

.cform-field > span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-soft);
}

.cform input,
.cform textarea {
  font: 400 16px/1.5 var(--body);
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 0;
  padding: 12px 14px;
  width: 100%;
}

.cform textarea { resize: vertical; }

.cform input:focus-visible,
.cform textarea:focus-visible {
  outline: 3px solid var(--draft);
  outline-offset: 2px;
}

.cform .hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.cform-status { min-height: 1.2em; margin-top: 14px; }
.cform-status.ok { color: var(--ink); }
.cform-status.fail { color: var(--stamp); }

.cta-actions .btn[type="submit"] {
  font: inherit;
  cursor: pointer;
}

/* ---------- согласование (CTA) ---------- */

.sheet-cta { background: var(--paper-deep); }

.cta-actions {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 34px;
}

.sheet-cta .note { margin-top: 28px; }

/* ---------- титульный блок (штамп ГОСТ) ---------- */

.tblock {
  margin: 0 clamp(12px, 2.5vw, 44px) 44px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
}

.tblock-grid {
  display: grid;
  grid-template-columns: 2fr 1.4fr 1.1fr .9fr;
}

.tblock-cell {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px 22px 15px;
  border-right: 1px solid var(--line);
  font-size: .97rem;
}
.tblock-cell:last-child { border-right: 0; }

.tblock-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-soft);
}

.tblock-cell a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.tblock-cell a:hover { color: var(--stamp); }

.tblock-base {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  border-top: 1.5px solid var(--ink);
  padding: 12px 22px;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ---------- переключатель языка ---------- */

.lang {
  display: flex;
  gap: 6px;
}

.lang a {
  font: 400 12.5px/1 var(--mono);
  color: var(--ink-soft);
  text-decoration: none;
  padding: 7px 10px;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.lang a:hover { color: var(--ink); border-color: var(--ink); }

.lang a[aria-current] {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--paper-deep);
}

/* ---------- частые вопросы ---------- */

.faq dd .strong {
  font: 700 17px/1.35 var(--disp);
  text-transform: none;
}

.faq .spec-row dd { font-size: 1rem; }

/* ---------- адаптив ---------- */

@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; }
  .hero-scheme { max-width: 640px; }
}

@media (max-width: 900px) {
  .stages { grid-template-columns: 1fr; }
  .stage {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 20px 0 12px;
  }
  .stage:first-child { border-top: 0; padding-top: 22px; }

  .tblock-grid { grid-template-columns: 1fr 1fr; }
  .tblock-cell { border-bottom: 1px solid var(--line); }
  .tblock-cell:nth-child(2n) { border-right: 0; }
}

@media (max-width: 820px) {
  section { scroll-margin-top: 116px; }
  .sheet { margin-block: 36px; }
  .sheet::before { display: none; }

  .cform-grid { grid-template-columns: 1fr; gap: 0; }

  .spec-row { grid-template-columns: 1fr; gap: 8px; }
  .spec-row dt { letter-spacing: .1em; }

  .nav { gap: 14px; flex-wrap: wrap; }
  .nav-links {
    display: flex;
    order: 4;
    flex-basis: 100%;
    margin-left: 0;
    padding-bottom: 4px;
  }
  .nav .lang { order: 2; margin-left: auto; }
  .nav .btn-small { order: 3; margin-left: 0; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .hero-cta { gap: 18px; }
  .cta-actions .btn { width: 100%; text-align: center; }
  .tblock-grid { grid-template-columns: 1fr; }
  .tblock-cell { border-right: 0; }
  .sheet-tag { font-size: 10.5px; padding: 4px 10px 3px; }
  .dim-label { white-space: normal; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .text-link, .skip { transition: none; }
}
