/* ==========================================================================
   Опорные Технологии — визуальный слой.
   Bootstrap остаётся подключённым: здесь только переопределения и свои блоки.
   Эстетика — «технический лист»: бумага, графит, красный акцент штампа foottech.
   ========================================================================== */

:root {
  --paper: #f6f5f1;
  --paper-2: #ecebe5;
  --card: #ffffff;
  --ink: #1d1f22;
  --ink-2: #4a4e55;
  --ink-3: #80858d;
  --line: #d9d7cf;
  --line-strong: #b9b6ab;
  --accent: #d8342b;        /* красный из логотипа foottech */
  --accent-ink: #b0261f;
  --steel: #5e6873;
  --duct: #2f6f9f;
  --pipe: #2e8a6a;
  --equip: #b8742a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 22, 26, .06), 0 8px 24px rgba(20, 22, 26, .06);
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
}

html { font-size: 15px; position: relative; min-height: 100%; }
@media (min-width: 768px) { html { font-size: 16px; } }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  margin-bottom: 0;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 { font-weight: 800; letter-spacing: -.015em; color: var(--ink); }
.lead { color: var(--ink-2); }
a { color: var(--accent-ink); }
a:hover { color: var(--accent); }
hr { border-color: var(--line-strong); opacity: 1; }

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

.btn { border-radius: 8px; font-weight: 700; padding: .6rem 1.15rem; }
.btn-primary, .btn-primary:focus { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover, .btn-primary:active { background: var(--accent-ink) !important; border-color: var(--accent-ink) !important; }
.btn-success, .btn-outline-dark { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn-success:hover, .btn-outline-dark:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 .1rem #fff, 0 0 0 .25rem rgba(216, 52, 43, .45);
}

/* ---------- Шапка ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(246, 245, 241, .92);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .navbar { padding-block: .7rem; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; color: var(--ink) !important; text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 6px; background: var(--accent);
  display: grid; place-items: center; flex: none;
}
.brand-mark::after { content: ""; width: 14px; height: 14px; border: 3px solid #fff; border-radius: 2px; }
.brand small { display: block; font-weight: 600; font-size: .7rem; color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase; line-height: 1; }
.site-header .nav-link { color: var(--ink-2) !important; font-weight: 600; padding-inline: .8rem !important; border-radius: 6px; }
.site-header .nav-link:hover { color: var(--ink) !important; background: var(--paper-2); }
.site-header .nav-link.active { color: var(--ink) !important; background: var(--card); box-shadow: inset 0 -2px 0 var(--accent); }

/* ---------- Подвал ---------- */
.footer {
  position: static; white-space: normal; line-height: 1.6;
  background: var(--ink); color: #b9bcc2 !important;
  padding-block: 2.5rem; margin-top: 4rem; border: 0 !important;
}
.footer a { color: #fff; }
.footer .footer-grid { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; justify-content: space-between; }

/* ---------- Сетка «чертёжной бумаги» ---------- */
.blueprint {
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
}

/* ---------- Главная: hero ---------- */
.hero {
  position: relative; overflow: hidden;
  border: 1px solid var(--line-strong); border-radius: 16px;
  padding: clamp(1.5rem, 4vw, 3.5rem);
  margin-top: 1.5rem;
}
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 2rem; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.hero h1.display-4 { font-size: clamp(2rem, 4.6vw, 3.4rem); font-weight: 800; line-height: 1.05; }
.hero .eyebrow { margin-bottom: 1rem; }
.hero-figure {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 1rem; box-shadow: var(--shadow); position: relative;
}
.hero-figure img { width: 100%; height: auto; display: block; }
.hero-figure figcaption { font-family: var(--mono); font-size: .75rem; color: var(--ink-3); margin-top: .5rem; display: flex; justify-content: space-between; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--mono); font-size: .75rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2);
}
.eyebrow::before { content: ""; width: 18px; height: 2px; background: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line-strong); border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; margin-top: 2rem; }
@media (max-width: 700px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--card); padding: 1rem 1.2rem; }
.stat b { display: block; font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.stat span { color: var(--ink-3); font-size: .85rem; }

.section { margin-top: 4.5rem; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.section-head h2 { margin: .3rem 0 0; font-size: clamp(1.5rem, 3vw, 2.1rem); }

/* Направления (три колонки исходника) */
.direction {
  height: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem; display: flex; flex-direction: column; gap: .5rem;
  transition: transform .15s ease, box-shadow .15s ease; text-decoration: none; color: inherit;
}
.direction:hover { transform: translateY(-3px); box-shadow: var(--shadow); color: inherit; }
.direction .dir-img { aspect-ratio: 4 / 3; background: var(--paper); border-radius: 8px; position: relative; overflow: hidden; margin-bottom: .6rem; }
.direction h3 { font-size: 1.25rem; margin: 0; }
.direction p { color: var(--ink-2); margin: 0; }
.direction .count { margin-top: auto; padding-top: .6rem; font-family: var(--mono); font-size: .8rem; color: var(--ink-3); }

/* Шаги подбора */
.steps { counter-reset: step; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 900px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; position: relative; }
.step::before {
  counter-increment: step; content: "0" counter(step);
  font-family: var(--mono); font-weight: 700; color: var(--accent); font-size: .85rem;
  display: block; margin-bottom: .5rem;
}
.step h4 { font-size: 1.05rem; margin-bottom: .35rem; }
.step p { font-size: .92rem; color: var(--ink-2); margin: 0; }

/* Правила/предупреждения */
.rules { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (max-width: 700px) { .rules { grid-template-columns: 1fr; } }
.rule { display: flex; gap: .8rem; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: .9rem 1rem; }
.rule svg { flex: none; color: var(--accent); margin-top: .15rem; }
.rule p { margin: 0; font-size: .94rem; color: var(--ink-2); }

.cta {
  background: var(--ink) !important; color: #fff; border-radius: 16px !important;
  padding: clamp(1.5rem, 4vw, 2.75rem) !important;
  display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: center;
}
@media (max-width: 700px) { .cta { grid-template-columns: 1fr; } }
.cta h3, .cta h4 { color: #fff; }
.cta p { color: #c4c7cc; margin: 0; }
.cta .btn-primary { white-space: nowrap; }

/* ---------- Каталог ---------- */
.catalog-toolbar {
  position: sticky; top: 64px; z-index: 20;
  background: rgba(246, 245, 241, .95); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  padding-block: .8rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
}
.chip {
  border: 1.5px solid var(--line-strong); background: var(--card); color: var(--ink-2);
  border-radius: 999px; padding: .35rem .9rem; font-weight: 700; font-size: .88rem; cursor: pointer;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .n { font-family: var(--mono); font-weight: 500; opacity: .7; margin-left: .3rem; }
.catalog-search { margin-left: auto; min-width: 220px; max-width: 100%; border-radius: 999px; border: 1.5px solid var(--line-strong); padding: .4rem 1rem; }
@media (max-width: 700px) {
  .catalog-toolbar { position: static; }
  .catalog-search { margin-left: 0; width: 100%; min-width: 0; }
}

.cat-section { scroll-margin-top: 140px; }
.cat-section h2 { display: flex; align-items: center; gap: .7rem; }
.cat-dot { width: 12px; height: 12px; border-radius: 3px; background: var(--steel); flex: none; }
.cat-duct_rect .cat-dot, .cat-duct_round .cat-dot { background: var(--duct); }
.cat-pipe .cat-dot { background: var(--pipe); }
.cat-equipment .cat-dot { background: var(--equip); }

.node-card, .catalog .card {
  height: 100%; background: var(--card); border: 1px solid var(--line) !important; border-radius: var(--radius) !important;
  overflow: hidden; transition: transform .15s ease, box-shadow .15s ease;
}
.node-card:hover, .catalog .card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.node-thumb { display: block; aspect-ratio: 4 / 3; background: var(--paper); border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.node-thumb img, .dir-img img, .node-visual img {
  position: absolute; inset: 7%; width: 86%; height: 86%; max-width: none;
  object-fit: contain; mix-blend-mode: multiply; transition: transform .25s ease;
}
.node-card:hover .node-thumb img { transform: scale(1.04); }
.node-thumb .code-tag { position: absolute; left: .7rem; top: .7rem; z-index: 1; }
.code-tag {
  display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .03em;
  background: var(--ink); color: #fff; padding: .15rem .5rem; border-radius: 4px;
}
.node-card .card-body { display: flex; flex-direction: column; }
.node-card .card-title { font-size: 1rem; font-weight: 800; line-height: 1.3; }
.node-card .card-text { font-size: .9rem; color: var(--ink-2); }
.node-card .card-text strong { color: var(--ink); font-weight: 700; }
.node-card .btn { margin-top: auto; align-self: flex-start; }

.specs { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0 .9rem; padding: 0; list-style: none; }
.specs li { font-family: var(--mono); font-size: .75rem; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: .1rem .45rem; color: var(--ink-2); }

.empty-state { display: none; text-align: center; color: var(--ink-3); padding: 3rem 0; }

/* ---------- Страница узла ---------- */
.crumbs { font-size: .88rem; color: var(--ink-3); margin: 1.2rem 0; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.node-head { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; }
@media (max-width: 900px) { .node-head { grid-template-columns: 1fr; } }
.node-visual { background: var(--card); border: 1px solid var(--line); border-radius: 14px; aspect-ratio: 1 / 1; position: relative; overflow: hidden; }
.node-title { font-size: clamp(1.5rem, 3vw, 2.2rem); line-height: 1.15; margin: .6rem 0 1rem; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 1rem 0 1.5rem; }
.kv div { background: var(--card); padding: .75rem 1rem; }
.kv div:last-child:nth-child(odd) { grid-column: span 2; }
.kv dt { font-size: .78rem; color: var(--ink-3); font-weight: 600; }
.kv dd { margin: 0; font-weight: 800; font-size: 1.1rem; font-family: var(--mono); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: clamp(1rem, 3vw, 1.75rem); margin-top: 1.5rem; }
.panel h2 { font-size: 1.3rem; margin-bottom: 1rem; }
.table-wrap { overflow-x: auto; }
.bom { width: 100%; border-collapse: collapse; font-size: .93rem; }
.bom th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); text-align: left; border-bottom: 2px solid var(--ink); padding: .5rem .6rem; }
.bom td { border-bottom: 1px solid var(--line); padding: .55rem .6rem; }
.bom td:first-child, .bom td:nth-child(3), .bom td:nth-child(4) { font-family: var(--mono); white-space: nowrap; }
.bom td:nth-child(4) { text-align: right; font-weight: 700; }
.bom tr:hover td { background: var(--paper); }

.notes { counter-reset: note; list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.notes li { counter-increment: note; display: grid; grid-template-columns: 2rem 1fr; gap: .5rem; color: var(--ink-2); }
.notes li::before { content: counter(note); font-family: var(--mono); font-weight: 700; color: var(--ink); background: var(--paper); border-radius: 4px; height: 1.6rem; display: grid; place-items: center; font-size: .8rem; }
.notes li.warn { color: var(--ink); }
.notes li.warn::before { background: var(--accent); color: #fff; }

.sheet-link { display: block; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.sheet-link img { width: 100%; height: auto; display: block; }
.sheet-link:hover { border-color: var(--ink); }

.siblings { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }
.siblings a { text-decoration: none; font-weight: 700; color: var(--ink); }

/* ---------- Контакты ---------- */
.contact-page .card { border: 1px solid var(--line); border-radius: 14px; box-shadow: none; height: 100%; }
.form-control { border-radius: 8px; border: 1.5px solid var(--line-strong); padding: .6rem .8rem; }
.form-control:focus { border-color: var(--ink); }
.map-placeholder { height: 300px; border: 1px dashed var(--line-strong); border-radius: 8px; display: grid; place-content: center; text-align: center; }

/* ---------- Вводные тексты ---------- */
.prose p { color: var(--ink-2); line-height: 1.7; max-width: 72ch; }
.prose p:first-child { color: var(--ink); font-size: 1.1rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
