/* Палитра: известь и графит, плюс три цвета систем. Цвет систем несёт смысл:
   латунь — электрика, сталь-синий — вода, медно-красный — отопление. Больше акцентов нет. */
:root {
  --bg: #EDEEEA;
  --paper: #F8F8F6;
  --ink: #1D2125;
  --muted: #5D666E;
  --line: #CBCFCC;
  --el: #A87A22;
  --wa: #2E6B8C;
  --he: #A3412E;
  --dark: #1D2125;
  --dark-ink: #E7E9E6;
  --font: "Commissioner", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wrap: 1200px;
  --gut: clamp(20px, 4vw, 48px);
  --sec: clamp(72px, 10vw, 128px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.6 var(--font); font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; line-height: 1.08; }
h2 { font-size: clamp(32px, 4.4vw, 54px); max-width: 16ch; letter-spacing: -0.028em; }
h3 { font-size: 20px; letter-spacing: -0.01em; line-height: 1.25; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--wa); outline-offset: 3px; border-radius: 3px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gut); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; z-index: 50; }
.skip:focus { left: 8px; }


/* ——— Шапка ——— */
.top { position: sticky; top: 0; z-index: 20; background: rgba(237, 238, 234, .78); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); }
/* Край шапки при прокрутке — мягкая тень, а не линия: видно, что контент уходит под стекло */
.top::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 16px; background: linear-gradient(rgba(29, 33, 37, .07), rgba(29, 33, 37, 0)); opacity: 0; transition: opacity .25s ease; pointer-events: none; }
.top.is-scrolled::after { opacity: 1; }
@media (prefers-reduced-transparency: reduce) { .top { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; } }
.top__in { display: flex; align-items: center; gap: 32px; height: 72px; }
.mark { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.mark__sign { width: 36px; height: 36px; flex: none; }
.mark__sign path { fill: none; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.mark__sign circle { fill: var(--ink); }
.mark__text { display: flex; flex-direction: column; line-height: 1.15; }
.mark__text b { font-weight: 700; font-size: 17px; }
.mark__text span { font-size: 13px; color: var(--muted); }
.nav { display: flex; gap: 28px; margin-left: auto; font-size: 15px; }
.nav a { text-decoration: none; color: var(--muted); padding: 6px 0; }
.nav a:hover { color: var(--ink); }
.top__phone { font-weight: 600; text-decoration: none; font-size: 16px; white-space: nowrap; }
.mark__sign .sys-el { stroke: var(--el); } .mark__sign .sys-wa { stroke: var(--wa); } .mark__sign .sys-he { stroke: var(--he); }

/* ——— Кнопки ——— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 26px; border: 1.5px solid var(--ink); border-radius: 999px;
  background: transparent; color: var(--ink); font: 600 16px var(--font); text-decoration: none;
  cursor: pointer; transition: background-color .15s, color .15s, transform .1s ease-out; -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn:active { transform: scale(.97); }
.btn--solid { background: var(--ink); color: var(--bg); }
.btn--solid:hover { background: #343A40; border-color: #343A40; }

/* ——— Первый экран ——— */
.hero { padding: clamp(40px, 6vw, 72px) 0 0; }
.hero__in { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
.hero h1 { font-size: clamp(40px, 5vw, 68px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.02; max-width: 13ch; }
.lead { margin-top: 28px; font-size: clamp(17px, 1.5vw, 19px); color: var(--muted); max-width: 46ch; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.hero__area { margin-top: 24px; font-size: 15px; color: var(--muted); max-width: 46ch; letter-spacing: .005em; }

/* Модель дома в изометрии: здание серым контуром, системы — своими цветами.
   Чертёж строит _src/house/build_house.py, сюда он вставлен готовым SVG. */
.scheme { margin: 0; }
.house { width: 100%; height: auto; display: block; overflow: visible; }
.m-ground { fill: #E2E4DF; }
.m-wall { fill: #F7F7F4; stroke: #A6ACA8; stroke-width: 1; stroke-linejoin: round; }
.m-wall2 { fill: #F1F2EE; }
.m-win { fill: #DFE4E3; stroke: #A6ACA8; stroke-width: 1; }
.m-slab { fill: #F7F7F4; stroke: #A6ACA8; stroke-width: 1; stroke-linejoin: round; }
.floor1 ~ .m .m-slab { fill: rgba(247, 247, 244, .82); }
.m-cut { fill: #C8CCC8; stroke: #A6ACA8; stroke-width: 1; stroke-linejoin: round; }
.m-cut2 { fill: #BABFBB; }
.m-roof { fill: rgba(232, 234, 229, .6); stroke: #A6ACA8; stroke-width: 1; }
.m-edge { fill: none; stroke: #A6ACA8; stroke-width: 1; }
.sys-el { --c: var(--el); --t: #F3EBDA; } .sys-wa { --c: var(--wa); --t: #E0EBF0; } .sys-he { --c: var(--he); --t: #F2E1DC; }
.sys .run { fill: none; stroke: var(--c); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.sys .node { fill: var(--c); }
.sys .dev polygon, .sys circle.dev { fill: var(--t); stroke: var(--c); stroke-width: 1.4; stroke-linejoin: round; }
.sys .dev .f-side { filter: brightness(.94); }
.sys .dev .f-top { filter: brightness(1.04); }
.sys .dev-plain polygon { fill: #FAFAF8; stroke: #A6ACA8; }
.sys .sec { stroke: var(--c); stroke-width: .8; opacity: .7; }

/* Одна постановка на загрузке: трассы прокладываются по очереди — электрика, вода, тепло */
.js .sys .run { stroke-dasharray: 1; stroke-dashoffset: 1; animation: lay 1.1s cubic-bezier(.6, .1, .3, 1) forwards; }
.js .sys .dev, .js .sys .node, .js .sys .sec { opacity: 0; animation: show .4s ease-out forwards; }
.js .sys-el .run { animation-delay: .25s; } .js .sys-el .dev, .js .sys-el .node { animation-delay: 1.1s; }
.js .sys-wa .run { animation-delay: .75s; } .js .sys-wa .dev, .js .sys-wa .node { animation-delay: 1.6s; }
.js .sys-he .run { animation-delay: 1.25s; } .js .sys-he .dev, .js .sys-he .node { animation-delay: 2.1s; }
@keyframes lay { to { stroke-dashoffset: 0; } }
@keyframes show { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .js .sys .run, .js .sys .dev, .js .sys .node, .js .sys .sec { animation: none; stroke-dashoffset: 0; opacity: 1; }
}

.legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 14px; font-size: 14px; color: var(--muted); justify-content: flex-end; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend span::before { content: ""; width: 18px; height: 4px; border-radius: 2px; background: currentColor; }
.legend__el::before { background: var(--el) !important; }
.legend__wa::before { background: var(--wa) !important; }
.legend__he::before { background: var(--he) !important; }


/* ——— Работы ——— */
.works { padding: var(--sec) 0 0; }
.works__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 36px; }
.filter { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 18px;
  border: 1.5px solid var(--line); border-radius: 999px; background: transparent;
  font: 500 15px var(--font); color: var(--ink); cursor: pointer;
}
.chip:hover { border-color: var(--ink); }
.chip { transition: background-color .15s, color .15s, border-color .15s, transform .1s ease-out; -webkit-tap-highlight-color: transparent; }
.chip:active { transform: scale(.96); }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip--el::before, .chip--wa::before, .chip--he::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.chip--el::before { background: var(--el); } .chip--wa::before { background: var(--wa); } .chip--he::before { background: var(--he); }

.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; }
/* Ритм сетки: большая карточка, затем две поменьше. Порядок задаёт сам список, а не случай */
.grid > li { grid-column: span 4; }
.grid > li:nth-child(5n + 1) { grid-column: span 7; }
.grid > li:nth-child(5n + 2) { grid-column: span 5; }
.card { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.card__img { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 6px; background: #DADDD9; }
.grid > li:nth-child(5n + 1) .card__img { aspect-ratio: 16 / 10; }
.grid > li:nth-child(5n + 2) .card__img { aspect-ratio: 5 / 4.4; }
.card__img img { width: 100%; height: 100%; object-fit: cover; }
.card { -webkit-tap-highlight-color: transparent; }
.card__img { transition: transform .12s ease-out; }
.card:active .card__img { transform: scale(.985); }
.card__img.is-broken img { visibility: hidden; }
.card__img.is-broken::after { content: attr(data-msg); position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); font-size: 14px; }
.card__count { position: absolute; right: 12px; bottom: 12px; background: rgba(29, 33, 37, .78); color: #fff; font-size: 13px; padding: 4px 10px; border-radius: 999px; }
.card__meta { display: flex; align-items: baseline; gap: 10px; margin-top: 14px; }
.card__cat { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.card__cat::before { content: ""; width: 14px; height: 3px; border-radius: 2px; }
.cat-el::before { background: var(--el); } .cat-wa::before { background: var(--wa); } .cat-he::before { background: var(--he); }
.card h3 { margin-top: 6px; font-size: 19px; }
.card p { margin-top: 6px; color: var(--muted); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__sample { position: absolute; left: 12px; top: 12px; background: var(--paper); font-size: 12px; padding: 3px 9px; border-radius: 999px; color: var(--muted); }
.works__empty { color: var(--muted); padding: 32px 0; }
.works__more { margin-top: 32px; }

/* ——— Что делаю ——— */
.systems { padding: var(--sec) 0 0; }
.systems__cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 44px; border-top: 1px solid var(--ink); }
.sysc { padding: 28px 28px 8px 0; position: relative; }
.sysc + .sysc { padding-left: 28px; border-left: 1px solid var(--line); }
.sysc h3 { font-size: 24px; display: flex; align-items: center; gap: 12px; }
.sysc h3::before { content: ""; width: 26px; height: 5px; border-radius: 3px; }
.sysc--el h3::before { background: var(--el); } .sysc--wa h3::before { background: var(--wa); } .sysc--he h3::before { background: var(--he); }
.sysc ul { list-style: none; margin: 22px 0 0; padding: 0; }
.sysc li { padding: 11px 0; border-top: 1px solid var(--line); font-size: 16px; }

/* ——— Почему один ——— */
.why { padding: var(--sec) 0 0; }
.why__in { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); }
.why__list { display: grid; gap: 36px; }
.why__list h3 { font-size: 22px; }
.why__list p { margin-top: 10px; color: var(--muted); max-width: 56ch; }

/* ——— Этапы: линия трассы с узлами ——— */
.process { padding: var(--sec) 0 0; }
.steps { list-style: none; margin: 48px 0 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); counter-reset: s; position: relative; }
.steps::before { content: ""; position: absolute; left: 0; right: 0; top: 13px; height: 3px; background: linear-gradient(90deg, var(--el) 0 33%, var(--wa) 33% 66%, var(--he) 66%); border-radius: 2px; }
.steps li { counter-increment: s; padding-right: 20px; position: relative; }
.steps li::before {
  content: counter(s); display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--ink); font-weight: 700; font-size: 14px; position: relative;
}
.steps h3 { margin-top: 20px; font-size: 18px; }
.steps p { margin-top: 8px; font-size: 15px; color: var(--muted); }

/* ——— Вопросы ——— */
.faq { padding: var(--sec) 0; }
.faq__in { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(32px, 6vw, 96px); }
.faq__list { border-top: 1px solid var(--ink); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 22px 48px 22px 0; font-size: 19px; font-weight: 600; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; position: absolute; right: 6px; top: 50%; width: 14px; height: 14px; margin-top: -9px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq details p { padding: 0 48px 24px 0; color: var(--muted); max-width: 62ch; }

/* ——— Контакты ——— */
.contact { background: var(--dark); color: var(--dark-ink); padding: var(--sec) 0; }
.contact__in { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(32px, 6vw, 96px); align-items: end; }
.contact h2 { color: #fff; max-width: 13ch; }
.contact__lead { margin-top: 24px; color: #A9B0B5; max-width: 46ch; font-size: 18px; }
.contact__phone { display: block; font-size: clamp(32px, 3.8vw, 46px); font-weight: 700; letter-spacing: -0.03em; color: #fff; text-decoration: none; }
.contact__phone:hover { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }
.contact__links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.contact .btn { border-color: #5A626A; color: #fff; }
.contact .btn:hover { background: #fff; color: var(--ink); border-color: #fff; }
.contact__meta { margin: 32px 0 0; display: grid; gap: 14px; border-top: 1px solid #3A4147; padding-top: 22px; }
.contact__meta div { display: flex; justify-content: space-between; gap: 20px; }
.contact__meta dt { color: #8C949A; }
.contact__meta dd { margin: 0; text-align: right; }

.foot { background: var(--dark); color: #8C949A; font-size: 14px; border-top: 1px solid #30363C; }
.foot__in { display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: space-between; padding-top: 24px; padding-bottom: 24px; }
.lc { text-transform: lowercase; }

/* ——— Просмотр работы ——— */
.viewer { position: fixed; inset: 0; z-index: 40; background: rgba(20, 23, 26, .86); display: grid; place-items: center; padding: 24px; }
.viewer[hidden] { display: none; }
.viewer__box { position: relative; background: var(--paper); border-radius: 8px; width: min(1100px, 100%); max-height: calc(100vh - 48px); display: grid; grid-template-columns: minmax(0, 1fr) 320px; overflow: hidden; }
.viewer__photo { background: #14171A; display: grid; place-items: center; min-height: 0; }
.viewer__photo { overflow: hidden; touch-action: pan-y; cursor: grab; }
.viewer__photo:active { cursor: grabbing; }
.viewer__photo img { max-height: calc(100vh - 48px); width: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.viewer__side { padding: 32px 28px; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.viewer__side h3 { font-size: 24px; }
.viewer__side p { color: var(--muted); font-size: 15px; }
.viewer__cat { display: inline-flex; align-items: center; gap: 8px; }
.viewer__cat::before { content: ""; width: 14px; height: 3px; border-radius: 2px; }
.viewer__nav { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 20px; }
.viewer__nav .btn { min-height: 44px; padding: 0 18px; font-size: 15px; }
.viewer__nav span { font-size: 14px; color: var(--muted); }
.viewer__close { position: absolute; right: 10px; top: 10px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); font: 400 26px/1 var(--font); cursor: pointer; z-index: 1; }

/* ——— Адаптив ——— */
@media (max-width: 1020px) {
  .nav { display: none; }
  .top__phone { margin-left: auto; }
  .hero__in { grid-template-columns: 1fr; }
  .hero h1 { max-width: 13ch; }
  .scheme { max-width: 620px; }
  .legend { justify-content: flex-start; }
  .why__in, .faq__in, .contact__in { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 36px; }
  .steps::before { display: none; }
  .grid > li, .grid > li:nth-child(5n + 1), .grid > li:nth-child(5n + 2) { grid-column: span 6; }
  .grid > li:nth-child(5n + 1) { grid-column: span 12; }
  .viewer__box { grid-template-columns: 1fr; }
  .viewer__photo img { max-height: 60vh; }
}
@media (max-width: 680px) {
  body { font-size: 16px; }
  .top__in { height: 64px; gap: 16px; }
  .mark__text span { display: none; }
  .top__phone { font-size: 15px; }
  .cta .btn { flex: 1 1 100%; }
  .systems__cols { grid-template-columns: 1fr; }
  .sysc, .sysc + .sysc { padding: 26px 0 8px; border-left: 0; }
  .sysc + .sysc { border-top: 1px solid var(--ink); }
  .steps { grid-template-columns: 1fr; row-gap: 0; }
  .steps li { padding: 0 0 26px 48px; }
  .steps li::before { position: absolute; left: 0; top: 0; }
  .steps li:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 32px; bottom: 4px; width: 3px; border-radius: 2px; background: var(--line); }
  .steps h3 { margin-top: 2px; }
  .grid { gap: 28px; }
  .grid > li, .grid > li:nth-child(5n + 1), .grid > li:nth-child(5n + 2) { grid-column: span 12 !important; }
  .grid > li .card__img, .grid > li:nth-child(5n + 1) .card__img, .grid > li:nth-child(5n + 2) .card__img { aspect-ratio: 4 / 3; }
  .contact__meta div { flex-direction: column; gap: 2px; }
  .contact__meta dd { text-align: left; }
  .viewer { padding: 0; }
  .viewer__box { max-height: 100vh; height: 100%; border-radius: 0; }
}

/* Мелкий текст чуть разрежен, крупный — плотнее: трекинг зависит от размера */
.legend, .card__cat, .card__count, .card__sample, .mark__text span, .contact__meta, .foot { letter-spacing: .01em; }

/* Вопросы раскрываются плавно там, где браузер это умеет (остальные — как обычно, сразу) */
@supports (interpolate-size: allow-keywords) {
  .faq { interpolate-size: allow-keywords; }
  .faq details::details-content { block-size: 0; overflow: clip; transition: block-size .32s cubic-bezier(.2, .8, .2, 1), content-visibility .32s allow-discrete; }
  .faq details[open]::details-content { block-size: auto; }
}
@media (prefers-reduced-motion: reduce) { .faq details::details-content { transition: none; } }

@media (prefers-contrast: more) {
  :root { --muted: #3E464D; --line: #8C9490; }
  .top { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; border-bottom: 1px solid var(--ink); }
}
