:root {
  --steel: #e3e6ea;
  --paper: #f6f7f8;
  --ink: #1a2230;
  --graphite: #59636f;
  --signal: #f2c200;
  --signal-soft: #fbe58a;
  --rule: #c7ccd3;

  --display: "Tektur", "Arial Narrow", sans-serif;
  --body: "Onest", "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1180px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--steel);
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--signal);
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.08;
  margin: 0;
  letter-spacing: -0.01em;
}

section[id] { scroll-margin-top: 72px; }

/* Фон: работающий цех */
.factory-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  color: var(--ink);
  opacity: 0.085;
}

.factory-bg svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  stroke: currentColor;
}

.factory-bg svg > rect,
.factory-bg svg g:not(.f-rollers) > rect,
.factory-bg svg circle:not([fill="none"]) { stroke: none; }

.factory-bg .f-tape { fill: var(--steel); }

.factory-bg g,
.factory-bg use { transform-box: view-box; }

.f-hooks { animation: f-slide-180 7s linear infinite; }
.f-boxes { animation: f-slide-220 9s linear infinite; }

@keyframes f-slide-180 { to { transform: translateX(180px); } }
@keyframes f-slide-220 { to { transform: translateX(220px); } }

.f-gear-big   { transform-origin: 1300px 250px; animation: f-spin 14s linear infinite; }
.f-gear-small { transform-origin: 1196px 336px; animation: f-spin 9.33s linear infinite reverse; }
.f-gear-left  { transform-origin: 90px 560px;   animation: f-spin 18s linear infinite reverse; }

@keyframes f-spin { to { transform: rotate(360deg); } }

.f-ram { animation: f-press 2.4s cubic-bezier(.6, 0, .4, 1) infinite; }

@keyframes f-press {
  0%, 30%  { transform: translateY(0); }
  48%      { transform: translateY(92px); }
  56%      { transform: translateY(92px); }
  80%, 100% { transform: translateY(0); }
}

.f-arm1 { transform-origin: 985px 764px; animation: f-arm1 5s ease-in-out infinite; }
.f-arm2 { transform-origin: 985px 620px; animation: f-arm2 5s ease-in-out infinite; }

@keyframes f-arm1 {
  0%, 100% { transform: rotate(-14deg); }
  50%      { transform: rotate(16deg); }
}

@keyframes f-arm2 {
  0%, 100% { transform: rotate(10deg); }
  50%      { transform: rotate(48deg); }
}

.f-sparks { opacity: 0; animation: f-sparks 5s steps(1) infinite; }

@keyframes f-sparks {
  0%, 40%  { opacity: 0; }
  44%      { opacity: 1; }
  47%      { opacity: 0; }
  50%      { opacity: 1; }
  54%      { opacity: 0; }
  57%      { opacity: 1; }
  60%, 100% { opacity: 0; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Шапка */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px var(--gutter);
  background: rgba(227, 230, 234, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 20px;
  text-decoration: none;
  margin-right: auto;
}

.logo-mark {
  width: 22px;
  height: 22px;
  background: repeating-linear-gradient(-45deg, var(--ink) 0 4px, var(--signal) 4px 8px);
  border-radius: 3px;
}

.top-nav { display: flex; gap: 24px; font-size: 16px; white-space: nowrap; }
.logo { white-space: nowrap; }
.top-nav a { text-decoration: none; color: var(--graphite); }
.top-nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

/* Кнопки */
.btn {
  display: inline-block;
  padding: 16px 28px;
  background: var(--signal);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }

.btn-small { padding: 9px 18px; font-size: 15px; box-shadow: 3px 3px 0 var(--ink); }
.btn-ghost { background: var(--paper); }

.link-plain {
  font-weight: 500;
  color: var(--graphite);
  text-underline-offset: 5px;
}
.link-plain:hover { color: var(--ink); }

/* Первый экран */
.hero {
  padding: clamp(40px, 6vw, 72px) 0 0;
}

.hero-text {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.hero h1 {
  font-size: clamp(34px, 4.8vw, 64px);
  max-width: 21ch;
}

.hero-answer {
  max-width: 34em;
  margin: 28px 0 0;
  font-size: clamp(19px, 2vw, 23px);
  color: var(--ink);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  margin-top: 36px;
}

/* Конвейер */
.line {
  margin: clamp(48px, 6vw, 72px) 0 0;
  padding: 0;
}

.gantries {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  font-family: var(--display);
  font-weight: 500;
  font-size: 15px;
  color: var(--graphite);
}

.gantries span {
  position: relative;
  padding: 0 0 26px 12px;
  border-left: 2px solid var(--ink);
}

.gantries span::after {
  content: "";
  position: absolute;
  left: -2px;
  bottom: 0;
  width: 2px;
  height: 14px;
  background: var(--signal);
}

.belt {
  position: relative;
  overflow: hidden;
  background:
    repeating-linear-gradient(90deg, #2a3445 0 2px, #222b39 2px 46px);
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-image: repeating-linear-gradient(-45deg, var(--ink) 0 12px, var(--signal) 12px 24px) 10;
  padding: 26px 0;
}

.belt-track {
  display: flex;
  width: max-content;
  animation: roll 36s linear infinite;
}

.belt-set { display: flex; gap: 28px; padding-right: 28px; }

@keyframes roll {
  from { transform: translateX(-50%); }
  to   { transform: translateX(0); }
}

.item {
  position: relative;
  flex: none;
  width: 168px;
  height: 120px;
  padding: 16px;
  background: var(--paper);
  border-radius: 4px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item b {
  margin-top: auto;
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
}

.item-article i {
  display: block;
  height: 7px;
  border-radius: 2px;
  background: var(--rule);
}
.item-article i:nth-child(1) { width: 85%; background: var(--ink); }
.item-article i:nth-child(3) { width: 60%; }

.item-carousel .stack {
  position: relative;
  height: 52px;
  width: 62px;
  background: var(--signal);
  border-radius: 3px;
  box-shadow: 8px -6px 0 -1px var(--signal-soft), 16px -12px 0 -2px var(--rule);
  margin-top: 10px;
}

.item-video { background: var(--ink); color: var(--paper); }
.item-video .play {
  width: 0;
  height: 0;
  margin: 8px 0 0 4px;
  border-left: 30px solid var(--signal);
  border-top: 18px solid transparent;
  border-bottom: 18px solid transparent;
}

.line figcaption {
  max-width: var(--max);
  margin: 0 auto;
  padding: 16px var(--gutter) 0;
  font-size: 16px;
  color: var(--graphite);
}

/* Хук-табличка */
.sign {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(64px, 9vw, 104px) var(--gutter) 0;
}

.sign-plate {
  position: relative;
  padding: clamp(28px, 4vw, 48px) clamp(24px, 4vw, 56px) clamp(28px, 4vw, 48px) clamp(44px, 6vw, 88px);
  background: var(--signal);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 8px 8px 0 var(--ink);
  overflow: hidden;
}

.sign-plate::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: clamp(16px, 2.4vw, 28px);
  background: repeating-linear-gradient(-45deg, var(--ink) 0 10px, var(--signal) 10px 20px);
  border-right: 3px solid var(--ink);
}

.sign-hook {
  margin: 0;
  max-width: 30ch;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(24px, 3.1vw, 40px);
  line-height: 1.15;
}

.sign-answer {
  margin: 20px 0 0;
  max-width: 40em;
  font-size: clamp(17px, 1.7vw, 20px);
  font-weight: 500;
}

/* Как работает */
.how,
.plans,
.contact {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(72px, 10vw, 120px) var(--gutter) 0;
}

.how h2,
.plans h2 {
  font-size: clamp(30px, 4vw, 48px);
}

.steps {
  list-style: none;
  counter-reset: step;
  margin: 40px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 2px solid var(--ink);
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 28px 24px 0 0;
}

.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: -49px 0 20px;
  background: var(--signal);
  border: 2px solid var(--ink);
  border-radius: 50%;
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
}

.steps h3 { font-size: 21px; margin-bottom: 10px; }
.steps p { margin: 0; color: var(--graphite); font-size: 17px; max-width: 32ch; }

/* Тарифы */
.plans-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 40px;
}

.plans-head p { margin: 0; max-width: 34em; color: var(--graphite); font-size: 17px; }

.plan-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: 40px;
  align-items: end;
}

.plan {
  display: flex;
  flex-direction: column;
  padding: 28px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 10px;
}

.plan h3 { font-size: 23px; }

.plan-price {
  margin: 10px 0 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 27px;
  line-height: 1.1;
  white-space: nowrap;
}

.plan-for { margin: 10px 0 22px; color: var(--graphite); font-size: 15px; min-height: 4.6em; }

.blocks {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
}

.block {
  padding: 13px 16px;
  border-radius: 4px;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.35;
}

.block.new { background: var(--signal); }
.block.old {
  background: repeating-linear-gradient(-45deg, var(--steel) 0 8px, #d9dde2 8px 16px);
  color: var(--graphite);
  display: flex;
  align-items: flex-end;
  min-height: calc(var(--n, 1) * 48px + (var(--n, 1) - 1) * 6px);
}

.plan .btn { text-align: center; padding: 14px 10px; font-size: 16px; }

.plan-custom {
  align-self: stretch;
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.plan-custom .plan-for { color: #aab3bf; }

.custom-list {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 15px;
  line-height: 1.45;
}

.custom-list li {
  padding-left: 16px;
  border-left: 3px solid var(--signal);
}

.plan-custom .btn { box-shadow: 4px 4px 0 var(--signal); border-color: var(--signal); }
.plan-custom .btn:hover { box-shadow: 2px 2px 0 var(--signal); }

/* Сопровождение */
.care {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(64px, 8vw, 96px) var(--gutter) 0;
}

.care h2 { font-size: clamp(30px, 4vw, 48px); }

.care-list {
  list-style: none;
  margin: 36px 0 0;
  padding: 0;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 10px;
}

.care-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr) auto;
  gap: 8px 40px;
  align-items: baseline;
  padding: 26px 28px;
}

.care-row + .care-row { border-top: 1px solid var(--rule); }

.care-row h3 { font-size: 20px; }
.care-row p { margin: 0; color: var(--graphite); font-size: 16px; max-width: 46ch; }

.care-row .care-price {
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  color: var(--ink);
  white-space: nowrap;
  text-align: right;
}

/* Контакты */
.contact {
  padding-bottom: clamp(72px, 10vw, 120px);
}

.contact h2 {
  font-size: clamp(28px, 3.6vw, 44px);
  max-width: 22ch;
}

.contact-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 40px;
}

.contact-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 28px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  border-radius: 10px;
  border-left: 10px solid var(--signal);
  transition: background 0.15s ease;
}

.contact-link:hover { background: #263247; }

.contact-kind { color: #aab3bf; font-size: 16px; }
.contact-value {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(17px, 4.9vw, 32px);
  white-space: nowrap;
}

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 24px var(--gutter);
  border-top: 1px solid var(--rule);
  color: var(--graphite);
  font-size: 15px;
}

/* Адаптив */
@media (max-width: 920px) {
  .top-nav { display: none; }
}

@media (max-width: 1100px) {
  .plan-grid { grid-template-columns: repeat(2, 1fr); }
  .care-row { grid-template-columns: 1fr auto; }
  .care-row p:not(.care-price) { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 900px) {
  .steps { grid-template-columns: repeat(2, 1fr); border-top: 0; gap: 40px 24px; }
  .steps li { border-top: 2px solid var(--ink); }
  .plan-grid { grid-template-columns: 1fr; }
  .plan-for { min-height: 0; }
  .blocks { flex-direction: column; }
  .block.old { min-height: 0; }
}

@media (max-width: 640px) {
  body { font-size: 17px; }
  /* На узком экране видна только середина цеха – подтягиваем станки к центру */
  .f-pos-gears    { transform: translateX(-330px); }
  .f-pos-gearleft { transform: translate(480px, -140px); }
  .f-pos-press    { transform: translateX(200px); }
  .f-pos-robot    { transform: translateX(-250px); }
  .top-nav { display: none; }
  .gantries { font-size: 11px; }
  .gantries span { padding-left: 4px; }
  .item { width: 132px; height: 100px; padding: 12px; }
  .belt { padding: 20px 0; }
  .belt-set { gap: 18px; padding-right: 18px; }
  .steps { grid-template-columns: 1fr; }
  .contact-links { grid-template-columns: 1fr; }
  .care-row { grid-template-columns: 1fr; padding: 22px 20px; }
  .care-row .care-price { text-align: left; grid-row: auto; }
  .contact-link { padding: 22px 20px; }
  .hero-actions .btn { width: 100%; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .belt-track { animation: none; }
  .factory-bg * { animation: none !important; }
  .btn, .contact-link { transition: none; }
}
