/* ohrana-perimetra.ru — дизайн-система портала.
   Принцип: инженерный справочник. Плотная сетка, спокойный тон, ноль внешних ресурсов. */

:root {
  --ink: #0d1418;
  --ink-2: #16232b;
  --ink-3: #22333d;
  --paper: #f6f7f8;
  --surface: #ffffff;
  --text: #1a242b;
  --muted: #5c6a73;
  --muted-2: #7d8a93;
  --line: #dce2e6;
  --line-2: #eaeef1;
  --accent: #e8a33d;
  --accent-dark: #8a5a12;
  --accent-soft: #fdf3e2;
  --link: #2f6f8f;
  --link-hover: #1f4f68;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(13, 20, 24, 0.06), 0 1px 3px rgba(13, 20, 24, 0.04);
  --shadow-md: 0 4px 14px rgba(13, 20, 24, 0.08), 0 1px 3px rgba(13, 20, 24, 0.05);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Consolas", "Liberation Mono", monospace;
  --wrap: 1120px;
  --measure: 68ch;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }
svg { display: block; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--link-hover); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 32px);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #1a1206;
  padding: 10px 16px;
  font-weight: 600;
  z-index: 100;
}
.skip:focus { left: 12px; top: 12px; }

/* ---------- шапка ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--ink);
  color: #e8eef2;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 64px;
  flex-wrap: wrap;
  padding-block: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -0.01em;
  font-size: 1.02rem;
  margin-right: auto;
}
.brand:hover { color: #fff; }
.brand svg { flex: none; }
.brand span small {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #93a3ad;
  margin-top: 1px;
}

.nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.nav > a,
.nav summary {
  color: #d7e0e6;
  text-decoration: none;
  font-size: 0.92rem;
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}
.nav > a:hover,
.nav summary:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.nav summary::-webkit-details-marker { display: none; }
.nav summary::after {
  content: "";
  display: inline-block;
  margin-left: 6px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  vertical-align: middle;
  opacity: 0.7;
}

.nav details { position: relative; }
.nav details[open] summary { background: rgba(255, 255, 255, 0.1); color: #fff; }

.nav-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 290px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 8px;
  display: grid;
  gap: 2px;
}

.nav-menu a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 9px 10px;
  border-radius: 7px;
  line-height: 1.35;
}
.nav-menu a:hover { background: var(--paper); color: var(--ink); }
.nav-menu a b { display: block; font-weight: 600; }
.nav-menu a span { display: block; color: var(--muted-2); font-size: 0.78rem; margin-top: 2px; }

/* ---------- hero ---------- */

.hero {
  background:
    radial-gradient(circle at 82% 12%, rgba(232, 163, 61, 0.14), transparent 42%),
    linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
  color: #eef3f6;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85), transparent 78%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
  padding-block: clamp(36px, 6vw, 72px);
}

.hero-media {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(56%, 880px);
  z-index: 0;
  pointer-events: none;
}
.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 70% 50%;
  opacity: 0.92;
  mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.7) 26%, #000 62%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.7) 26%, #000 62%);
}

.hero-inner > * { position: relative; z-index: 1; }

.eyebrow {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(1.85rem, 4.2vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 700;
  max-width: 22ch;
}

.hero p.lead {
  margin: 0 0 26px;
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.6;
  color: #c2cfd7;
  max-width: 54ch;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-meta {
  margin: 22px 0 0;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  color: #8fa1ab;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary { background: var(--accent); color: #23180a; }
.btn-primary:hover { background: #f0b158; color: #23180a; }

.btn-ghost { border-color: rgba(255, 255, 255, 0.26); color: #e8eef2; }
.btn-ghost:hover { border-color: rgba(255, 255, 255, 0.5); color: #fff; background: rgba(255, 255, 255, 0.06); }

/* схема рубежей — типографическая, без картинок */

.rubezhi {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(2px);
}
.rubezhi h2 {
  margin: 0 0 14px;
  font-size: 0.7rem;
  font-family: var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9fb0ba;
  font-weight: 500;
}
.rubezhi ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: r; }
.rubezhi li {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  align-items: start;
  padding: 11px 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--accent);
  font-size: 0.9rem;
  line-height: 1.45;
}
.rubezhi li b { display: block; font-weight: 600; color: #fff; }
.rubezhi li span { color: #a9b8c1; font-size: 0.82rem; }
.rubezhi li em {
  font-family: var(--mono);
  font-style: normal;
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

/* ---------- секции главной ---------- */

.section { padding-block: clamp(36px, 5vw, 64px); }
.section + .section { border-top: 1px solid var(--line); }

.section-head { margin-bottom: 26px; max-width: 62ch; }
.section-head h2 {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.section-head p { margin: 0; color: var(--muted); }

.group-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 34px 0 14px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.group-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.card { display: flex; }

.card a {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.card .thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: 1px solid var(--line);
  filter: saturate(0.95);
  transition: filter 0.2s ease, transform 0.3s ease;
}
.card a:hover .thumb { filter: saturate(1.05) brightness(1.06); }
.card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 16px;
  flex: 1;
}
.card a::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.18s ease;
  border-radius: 2px;
}
.card a:hover {
  border-color: #c3ccd2;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.card a:hover::before { transform: scaleX(1); }

.card .num {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted-2);
  letter-spacing: 0.08em;
}
.card h3 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-weight: 650;
}
.card p { margin: 0; font-size: 0.87rem; line-height: 1.5; color: var(--muted); }
.card .more { margin-top: auto; font-size: 0.8rem; font-weight: 600; color: var(--link); }

/* задачи: вход по ситуации, а не по оборудованию */

.tasks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.tasks > li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  border-top: 3px solid var(--ink-3);
}
.tasks h3 { margin: 0 0 6px; font-size: 1.02rem; letter-spacing: -0.01em; }
.tasks p { margin: 0 0 12px; font-size: 0.89rem; color: var(--muted); }
.tasks ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tasks li li { margin: 0; }
.tasks ul a {
  display: inline-block;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--paper);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--link);
}
.tasks ul a:hover { border-color: #c3ccd2; background: #fff; color: var(--link-hover); }

/* шаги */

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: s;
}
.steps li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  counter-increment: s;
}
.steps li::before {
  content: counter(s, decimal-leading-zero);
  display: block;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent-dark);
  margin-bottom: 8px;
  letter-spacing: 0.1em;
}
.steps h3 { margin: 0 0 6px; font-size: 1rem; }
.steps p { margin: 0 0 10px; font-size: 0.9rem; color: var(--muted); }
.steps a { font-size: 0.88rem; font-weight: 600; }

/* ---------- статья ---------- */

.crumbs {
  padding-block: 14px 0;
  font-size: 0.8rem;
  color: var(--muted-2);
}
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: #c3ccd2; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--link); }

.article-head { padding-block: 20px 0; }
.article-head .kicker {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-dark);
}
.article-head h1 {
  margin: 0 0 14px;
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  line-height: 1.14;
  letter-spacing: -0.025em;
  max-width: 28ch;
}

.article-cover {
  margin: 22px 0 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--ink);
}
.article-cover img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.article-body {
  max-width: var(--measure);
  padding-block: 10px clamp(40px, 6vw, 64px);
  font-size: 1.03rem;
}

.article-body > *:first-child { margin-top: 0; }

.article-body p.lead {
  font-size: 1.16rem;
  line-height: 1.6;
  color: #2b3942;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 28px;
}

.article-body h2 {
  margin: 38px 0 12px;
  font-size: 1.32rem;
  line-height: 1.25;
  letter-spacing: -0.015em;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
}

.article-body h3 { margin: 24px 0 10px; font-size: 1.07rem; letter-spacing: -0.01em; }

.article-body p { margin: 0 0 15px; }

.inline-figure { margin: 26px 0 28px; }
.inline-figure img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--ink);
}
.inline-figure figcaption {
  margin-top: 10px;
  padding-left: 12px;
  border-left: 2px solid var(--accent);
  font-size: 0.83rem;
  line-height: 1.5;
  color: var(--muted);
}

.article-body ul, .article-body ol { margin: 0 0 18px; padding-left: 22px; }
.article-body li { margin-bottom: 8px; }
.article-body li::marker { color: var(--accent-dark); }
.article-body strong { font-weight: 650; }

.article-body blockquote {
  margin: 22px 0;
  padding: 14px 18px;
  background: var(--surface);
  border-left: 3px solid var(--link);
  border-radius: 0 8px 8px 0;
  color: #33424c;
  font-size: 0.98rem;
}
.article-body blockquote p:last-child { margin-bottom: 0; }

.article-body dl { margin: 0 0 18px; }
.article-body dt { font-weight: 650; margin-top: 12px; }
.article-body dd { margin: 2px 0 0; color: var(--muted); }

.article-body p.todo {
  background: var(--accent-soft);
  border: 1px dashed #e3c48c;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--accent-dark);
}
.article-body p.todo::before {
  content: "дополнить";
  display: inline-block;
  margin-right: 8px;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent);
  color: #23180a;
  border-radius: 4px;
  padding: 2px 6px;
  vertical-align: 1px;
}

/* связанные разделы */

.related {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-block: clamp(28px, 4vw, 44px);
}
.related h2 {
  margin: 0 0 16px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 500;
}
.related ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.related a {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  background: var(--paper);
}
.related a:hover { border-color: #c3ccd2; background: #fff; }
.related a img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: 1px solid var(--line);
}
.related-text { display: block; padding: 12px 14px 14px; font-weight: 600; font-size: 0.95rem; line-height: 1.35; }
.related a span span { display: block; font-weight: 400; font-size: 0.82rem; color: var(--muted); margin-top: 4px; }

/* ---------- подвал ---------- */

.site-footer {
  background: var(--ink);
  color: #aebcc5;
  padding-block: 40px 28px;
  font-size: 0.88rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  gap: clamp(20px, 4vw, 48px);
  padding-bottom: 26px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.site-footer h2, .site-footer h3 {
  color: #fff;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 12px;
  font-family: var(--mono);
  font-weight: 500;
}
.site-footer p { margin: 0 0 10px; line-height: 1.55; max-width: 44ch; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer a { color: #cfdae1; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-bottom {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: space-between;
  padding-top: 18px;
  color: #8b9aa4;
  font-size: 0.8rem;
}
.footer-bottom p { margin: 0; max-width: 70ch; }

/* ---------- страница 404 ---------- */

.center-page {
  min-height: 62vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding-block: 60px;
}
.center-page h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin: 0 0 12px; letter-spacing: -0.02em; }
.center-page p { color: var(--muted); margin: 0 0 24px; }
.center-page .kicker {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 8px;
}

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

@media (max-width: 860px) {
  .hero-inner { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { max-width: none; }
  .rubezhi { max-width: 420px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hero-media { width: 100%; opacity: 0.35; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .header-inner { min-height: 56px; gap: 8px; }
  .brand span small { display: none; }
  .nav { width: 100%; overflow-x: auto; padding-bottom: 4px; }
  .nav-menu { position: static; min-width: 0; box-shadow: none; border: 1px solid var(--line); }
  .article-body { font-size: 1rem; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .btn:hover, .card a:hover { transform: none; }
}

@media print {
  .site-header, .site-footer, .related, .hero-actions, .crumbs { display: none; }
  body { background: #fff; font-size: 11pt; }
  .article-body { max-width: none; }
}
