/* АПТ-телеком — редакционная тема. Цвета и шрифты задаются переменными ниже. */
:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --text: #1c2228;
  --text-soft: #3c454e;
  --muted: #69737d;
  --border: #e3ded4;
  --blue: #0062b1;
  --blue-ink: #004f8f;
  --orange: #e2621f;
  --orange-soft: #fbe9df;
  --link: #0062b1;
  --shadow: 0 1px 2px rgba(28, 34, 40, .05), 0 4px 16px rgba(28, 34, 40, .05);
  --radius: 10px;
  --serif: Georgia, "PT Serif", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wrap: 1180px;
  --measure: 70ch;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417;
    --surface: #191c20;
    --surface-2: #20242a;
    --text: #e6e8eb;
    --text-soft: #c5cad0;
    --muted: #949ea8;
    --border: #2b3037;
    --blue: #5fa8ec;
    --blue-ink: #8cc0f2;
    --orange: #f28a4e;
    --orange-soft: #3a2619;
    --link: #79b6f0;
    --shadow: none;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--sans);
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--orange); }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; line-height: 1.22; color: var(--text); margin: 0 0 .5em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.6rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); }
h3 { font-size: 1.2rem; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* ---------- шапка */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-row { display: flex; align-items: center; gap: 24px; min-height: 72px; }
.logo { display: flex; flex-direction: column; text-decoration: none; line-height: 1; flex-shrink: 0; }
.logo svg { display: block; width: 190px; height: auto; overflow: visible; }
.logo .tagline { font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-top: 6px; padding-left: 2px; }
.logo .w1 { fill: var(--orange); }
.logo .w2 { fill: var(--blue); }

.main-nav { margin-left: auto; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 0; }
.main-nav a {
  display: block; padding: 8px 9px; border-radius: 8px; color: var(--text-soft); white-space: nowrap;
  text-decoration: none; font-size: .92rem; font-weight: 500;
}
.main-nav a:hover { background: var(--surface-2); color: var(--text); }
.main-nav a[aria-current] { color: var(--orange); }

.search-form { display: flex; align-items: center; position: relative; }
.search-form input {
  width: 170px; padding: 9px 14px 9px 36px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg); color: var(--text); font: inherit; font-size: .92rem;
}
.search-form input:focus { outline: none; border-color: var(--blue); background: var(--surface); }
.search-form svg { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search-form button { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; padding: 0; }

.rubrics-nav { border-top: 1px solid var(--border); }
.rubrics-nav ul {
  list-style: none; margin: 0 auto; padding: 0 20px; max-width: var(--wrap);
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent);
}
.rubrics-nav li:last-child { padding-right: 40px; }
.rubrics-nav ul::-webkit-scrollbar { display: none; }
.rubrics-nav a {
  display: block; white-space: nowrap; padding: 11px 10px; font-size: .88rem; color: var(--muted);
  text-decoration: none; border-bottom: 2px solid transparent;
}
.rubrics-nav a:hover { color: var(--text); }
.rubrics-nav a[aria-current] { color: var(--text); border-bottom-color: var(--orange); }

.nav-toggle { display: none; }

.menu-wrap { margin-left: auto; }
.menu-wrap > .panel { display: flex; align-items: center; gap: 16px; }
@media (max-width: 1080px) {
  .header-row { min-height: 64px; padding: 10px 0; }
  .logo svg { width: 160px; }
  .nav-toggle {
    display: block; margin-left: auto; cursor: pointer; padding: 8px 14px; background: none; font: inherit;
    border: 1px solid var(--border); border-radius: 8px; font-size: .9rem; color: var(--text-soft);
  }
  .menu-wrap { margin: 0; }
  .menu-wrap > .panel { display: none; }
  .nav-open .menu-wrap > .panel {
    display: block; position: absolute; left: 0; right: 0; top: 64px; z-index: 20;
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); padding: 12px 20px 18px;
  }
  .site-header { position: relative; }
  .main-nav ul { flex-direction: column; }
  .main-nav a { padding: 10px 4px; font-size: 1rem; border-bottom: 1px solid var(--border); border-radius: 0; }
  .search-form { margin-top: 12px; }
  .search-form input { width: 100%; padding-top: 11px; padding-bottom: 11px; }
}

/* ---------- общая раскладка */
main { padding: 28px 0 56px; min-height: 60vh; }
.crumbs { font-size: .85rem; color: var(--muted); margin: 0 0 18px; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.crumbs li + li::before { content: "/"; margin: 0 6px 0 2px; color: var(--border); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--orange); }

.layout-aside { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 40px; align-items: start; }
@media (max-width: 1080px) { .layout-aside { grid-template-columns: 1fr; gap: 20px; } .layout-aside > aside { order: 2; } }

.page-head { margin-bottom: 26px; }
.page-head .lead { color: var(--text-soft); font-size: 1.05rem; max-width: var(--measure); }
.kicker {
  display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--orange); text-decoration: none; margin-bottom: 10px;
}
.meta { color: var(--muted); font-size: .9rem; }

/* ---------- главная */
.home-lead { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 28px; margin-bottom: 44px; }
.lead-main {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: flex-end; min-height: 300px;
  position: relative; overflow: hidden;
}
.lead-main::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 5px;
  background: linear-gradient(90deg, var(--orange) 0 35%, var(--blue) 35% 100%);
}
.lead-main h2 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.2rem); margin-bottom: 12px; }
.lead-main h2 a { color: var(--text); text-decoration: none; }
.lead-main h2 a:hover { color: var(--blue); }
.lead-main p { color: var(--text-soft); margin: 0 0 14px; }
.lead-list { display: flex; flex-direction: column; gap: 0; }
.lead-list .section-title { margin-bottom: 6px; }
.lead-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.lead-item:last-child { border-bottom: 0; }
.lead-item a { color: var(--text); text-decoration: none; font-family: var(--serif); font-size: 1.08rem; font-weight: 700; line-height: 1.3; }
.lead-item a:hover { color: var(--blue); }
.lead-item time { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 4px; }
@media (max-width: 860px) { .home-lead { grid-template-columns: 1fr; } .lead-main { min-height: 0; padding: 24px; } }

.section-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  font-family: var(--sans); font-size: .8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 16px; padding-bottom: 10px; border-bottom: 2px solid var(--text);
}
.section-title a { color: inherit; text-decoration: none; }
.section-title a:hover { color: var(--orange); }
.section-title .more { font-size: .78rem; letter-spacing: .04em; text-transform: none; font-weight: 500; }

.rubric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 36px 32px; margin-bottom: 52px; }
.rubric-block ul { list-style: none; margin: 0; padding: 0; }
.rubric-block li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.rubric-block li:last-child { border-bottom: 0; }
.rubric-block li a { color: var(--text); text-decoration: none; font-weight: 500; line-height: 1.4; }
.rubric-block li a:hover { color: var(--blue); }
.rubric-block li time { display: block; font-size: .8rem; color: var(--muted); }
@media (max-width: 400px) { .rubric-grid { grid-template-columns: 1fr; } }

.about-box {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 32px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow);
}
.about-box h2 { font-size: 1.4rem; }
.about-box p { color: var(--text-soft); margin: 0 0 12px; }
.about-box .contacts { border-left: 3px solid var(--orange); padding-left: 20px; font-size: .95rem; }
.about-box .contacts dt { color: var(--muted); font-size: .82rem; margin-top: 10px; }
.about-box .contacts dd { margin: 2px 0 0; }
@media (max-width: 760px) { .about-box { grid-template-columns: 1fr; padding: 24px; } }

/* ---------- список статей */
.article-list { list-style: none; margin: 0; padding: 0; }
.article-row { padding: 20px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 20px; }
.article-row:first-child { padding-top: 4px; }
.article-row time { font-size: .85rem; color: var(--muted); padding-top: 4px; }
.article-row h2 { font-size: 1.22rem; margin: 0 0 6px; }
.article-row h2 a { color: var(--text); text-decoration: none; }
.article-row h2 a:hover { color: var(--blue); }
.article-row p { margin: 0; color: var(--text-soft); font-size: .97rem; }
.article-row .cat { font-size: .8rem; color: var(--orange); text-decoration: none; font-weight: 600; }
.article-row.has-img { grid-template-columns: 110px minmax(0, 1fr) 180px; }
.article-row .thumb { grid-column: 3; grid-row: 1; display: block; aspect-ratio: 3 / 2; overflow: hidden; border-radius: 8px; background: var(--surface-2); }
.article-row .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 600px) {
  .article-row, .article-row.has-img { grid-template-columns: 1fr; gap: 4px; }
  .article-row .thumb { grid-column: auto; grid-row: auto; margin: 6px 0; }
}

.lead-main.has-img { padding-top: 0; justify-content: flex-start; }
.lead-main .lead-img { display: block; margin: 0 -32px 24px; aspect-ratio: 16 / 9; overflow: hidden; }
.lead-main .lead-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 860px) { .lead-main .lead-img { margin: 0 -24px 20px; } }

.subcats { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 26px; padding: 0; list-style: none; }
.subcats a {
  display: block; padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  text-decoration: none; color: var(--text-soft); font-size: .9rem;
}
.subcats a:hover { border-color: var(--blue); color: var(--blue); }
.subcats .n { color: var(--muted); font-size: .8rem; margin-left: 4px; }

/* каталог */
.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; list-style: none; margin: 0; padding: 0; }
.catalog li {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 10px; text-align: center;
}
.catalog .pic { display: flex; align-items: center; justify-content: center; min-height: 130px; }
.catalog .pic img { max-height: 140px; width: auto; }
.catalog .pic p { margin: 0; }
.catalog a.title { color: var(--text); font-weight: 600; text-decoration: none; line-height: 1.35; }
.catalog a.title:hover { color: var(--blue); }
.catalog .extra { color: var(--orange); font-weight: 700; margin-top: auto; }
.catalog .note { margin: 0; font-size: .88rem; color: var(--muted); text-align: left; }

/* статья с правой колонкой */
.layout-article { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; align-items: start; }
.side-block { margin-bottom: 32px; }
.side-block ul { list-style: none; margin: 0; padding: 0; }
.side-block li { padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .93rem; line-height: 1.4; }
.side-block li:last-child { border-bottom: 0; }
.side-block a { color: var(--text-soft); text-decoration: none; }
.side-block a:hover { color: var(--blue); }
.side-block .n { color: var(--muted); font-size: .8rem; float: right; }
.layout-article > aside { position: sticky; top: 16px; }
@media (max-width: 1080px) { .layout-article { grid-template-columns: 1fr; gap: 0; } .layout-article > aside { position: static; margin-top: 48px; } }

/* дерево раздела */
.tree { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 0; font-size: .93rem; position: sticky; top: 16px; }
.tree .tree-title { font-weight: 700; padding: 0 18px 8px; display: block; color: var(--text); text-decoration: none; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul ul { padding-left: 14px; }
.tree a { display: block; padding: 6px 18px; color: var(--text-soft); text-decoration: none; border-left: 3px solid transparent; }
.tree a:hover { color: var(--blue); }
.tree a.active { color: var(--text); font-weight: 600; }
.tree a.current { border-left-color: var(--orange); background: var(--orange-soft); }

/* пагинация */
.pager { display: flex; flex-wrap: wrap; gap: 6px; margin: 34px 0 0; padding: 0; list-style: none; }
.pager a, .pager span {
  display: block; min-width: 40px; padding: 8px 12px; text-align: center; border: 1px solid var(--border);
  border-radius: 8px; text-decoration: none; color: var(--text-soft); background: var(--surface); font-size: .92rem;
}
.pager a:hover { border-color: var(--blue); color: var(--blue); }
.pager .cur { background: var(--text); color: var(--surface); border-color: var(--text); font-weight: 700; }
.pager .gap { border: 0; background: none; min-width: 0; padding: 8px 4px; }

/* ---------- статья */
.article { max-width: 760px; }
.article-head { margin-bottom: 28px; }
.article-head h1 { margin-bottom: 14px; }
.article-head .meta { display: flex; flex-wrap: wrap; gap: 6px 16px; }

.prose { font-size: 1.07rem; line-height: 1.72; color: var(--text); max-width: var(--measure); overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.05em; }
.prose p { margin: 0; }
.prose p + p { margin-top: 1em; }
.prose h2, .prose h3, .prose h4 { margin: 1.6em 0 .5em; }
.prose h1 { font-size: 1.6rem; margin: 1.4em 0 .5em; }
.prose ul, .prose ol { padding-left: 1.4em; margin-bottom: 0; }
.prose li + li { margin-top: .35em; }
.prose img { border-radius: 6px; }
.prose img[style*="float: left"], .prose img[style*="float:left"] { margin: .3em 1.4em 1em 0 !important; }
.prose img[style*="float: right"], .prose img[style*="float:right"] { margin: .3em 0 1em 1.4em !important; }
.prose blockquote { margin: 1.4em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--orange); color: var(--text-soft); font-style: italic; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.prose pre { background: var(--surface-2); padding: 14px; border-radius: 8px; overflow-x: auto; font-size: .9rem; }
.prose .table-wrap { overflow-x: auto; margin: 1.4em 0; -webkit-overflow-scrolling: touch; }
.prose table { border-collapse: collapse; font-size: .95rem; min-width: 60%; }
.prose td, .prose th { border: 1px solid var(--border); padding: 7px 10px; vertical-align: top; text-align: left; }
.prose th { background: var(--surface-2); }
.prose iframe { max-width: 100%; border: 0; }
.prose figure { margin: 0 0 1.6em; }
.prose figure img { display: block; width: 100%; height: auto; border-radius: 8px; }
.prose figcaption { margin-top: 8px; font-size: .82rem; color: var(--muted); }
.prose .sources, .prose p.sources { margin-top: 2em; padding-top: 14px; border-top: 1px solid var(--border); font-size: .88rem; color: var(--muted); }
.prose::after { content: ""; display: block; clear: both; }
@media (max-width: 600px) {
  .prose { font-size: 1.02rem; }
  .prose img[style*="float"] { float: none !important; display: block; margin: 1em auto !important; }
  .prose td, .prose th { padding: 6px 8px; }
}

.related { margin-top: 56px; }
.related ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.related li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.related li a { color: var(--text); text-decoration: none; font-family: var(--serif); font-weight: 700; line-height: 1.32; }
.related li a:hover { color: var(--blue); }
.related li time { display: block; font-size: .8rem; color: var(--muted); margin-top: 8px; }

/* ---------- поиск, ошибки */
.search-big { display: flex; gap: 10px; margin: 0 0 26px; max-width: 640px; }
.search-big input {
  flex: 1; min-width: 0; padding: 12px 16px; font: inherit; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
}
.btn {
  display: inline-block; padding: 12px 20px; border-radius: 10px; border: 0; background: var(--blue); color: #fff;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--orange); color: #fff; }
.error-page { text-align: center; padding: 40px 0; max-width: 640px; margin: 0 auto; }
.error-page .code { font-family: var(--serif); font-size: 5rem; font-weight: 700; color: var(--orange); line-height: 1; margin-bottom: 8px; }
.error-page .search-big { margin: 26px auto; }
.empty { color: var(--muted); padding: 20px 0; }

/* ---------- подвал */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 32px 0 40px; font-size: .9rem; color: var(--muted); }
.footer-row { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; justify-content: space-between; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; }
.site-footer a { color: var(--text-soft); text-decoration: none; }
.site-footer a:hover { color: var(--orange); }

@media print {
  .site-header, .site-footer, .related, .tree, .crumbs { display: none; }
  body { background: #fff; color: #000; }
}
