/* Монтаж Кровли 58 — «Графит и дерево» */
:root {
  --paper: #F6F3EE;      /* светлое дерево, фон */
  --paper-2: #EDE6DB;    /* фон полос */
  --ink: #24272A;        /* графит, текст */
  --ink-2: #5E5A54;      /* второстепенный текст */
  --panel: #2B2F33;      /* тёмные блоки */
  --panel-2: #363B40;
  --wood: #C9A26B;       /* стропила */
  --wood-dark: #9C7A49;
  --accent: #E85D04;     /* сигнальный */
  --accent-dark: #C24D00;
  --line: #DED5C7;
  --white: #FFFDF9;
  --radius: 6px;
  --wrap: 1160px;
  --rafters: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='14'%3E%3Cpath d='M0 13 14 1l14 12' fill='none' stroke='%23C9A26B' stroke-width='2.5'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.6 "Onest", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
img, svg { max-width: 100%; }
a { color: var(--ink); text-decoration-color: var(--wood); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); text-decoration-color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.015em; }
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.45rem, 2.6vw, 2rem); font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.wrap--text { max-width: 820px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--white); padding: 8px 14px; z-index: 50; }
.skip:focus { left: 8px; }

/* Шапка */
.header { background: var(--panel); color: var(--white); position: sticky; top: 0; z-index: 20; }
.header__row { display: flex; align-items: center; gap: 28px; min-height: 68px; }
.logo { display: flex; align-items: center; gap: 12px; color: var(--white); text-decoration: none; }
.logo:hover { color: var(--white); }
.logo__mark { width: 40px; height: 28px; flex: none; }
.logo__text { font-weight: 800; font-size: 1.08rem; line-height: 1.1; letter-spacing: -0.01em; }
.logo__text small { display: block; font-weight: 400; font-size: .78rem; color: #B9B3A8; letter-spacing: 0; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { color: #E7E1D6; text-decoration: none; padding: 8px 12px; border-radius: var(--radius); font-size: .95rem; }
.nav a:hover { background: var(--panel-2); color: var(--white); }
.nav a[aria-current="page"] { color: var(--white); box-shadow: inset 0 -3px 0 var(--wood); border-radius: 0; }
.header__phone { color: var(--white); font-weight: 700; text-decoration: none; white-space: nowrap; }
.header__phone:hover { color: var(--wood); }

/* Узор стропил — разделитель */
.rafters { height: 14px; background: var(--rafters) repeat-x left bottom; background-color: var(--panel); }

/* Кнопки */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px; border: 2px solid var(--accent); border-radius: var(--radius);
  background: var(--accent); color: var(--white); font: inherit; font-weight: 700; line-height: 1.2;
  text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s;
}
.button:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: var(--white); }
.button--small { padding: 9px 16px; font-size: .92rem; }
.button--line { background: transparent; border-color: var(--wood); color: var(--white); }
.button--line:hover { background: rgba(201, 162, 107, .16); border-color: var(--wood); }
.button--dark { background: var(--panel); border-color: var(--panel); }
.button--dark:hover { background: var(--ink); border-color: var(--ink); }

/* Первый экран */
.hero { background: var(--panel); color: var(--white); padding: 64px 0 56px; overflow: hidden; }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 40px; align-items: center; }
.hero h1 { max-width: 12ch; }
.hero__lead { font-size: 1.15rem; color: #DCD5C9; max-width: 34em; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.truss { display: block; width: 100%; height: auto; }
.truss__dim text { font-family: inherit; }
@media (prefers-reduced-motion: no-preference) {
  .truss__draw { stroke-dasharray: 320; stroke-dashoffset: 320; animation: draw .9s ease-out forwards; }
  .truss__draw--late { animation-delay: .6s; }
  .truss__ridge { opacity: 0; animation: ridge .4s ease-out 1.3s forwards; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes ridge { to { opacity: 1; } }

/* Шапка внутренних страниц */
.pagehead { background: var(--panel); color: var(--white); padding: 40px 0 36px; }
.pagehead h1 { font-size: clamp(1.8rem, 3.8vw, 2.8rem); max-width: 22ch; }
.pagehead__lead { color: #DCD5C9; font-size: 1.08rem; max-width: 46em; }
.pagehead a:not(.button) { color: var(--white); }
.pagehead__actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0 0; }
.crumbs { font-size: .88rem; color: #B9B3A8; margin-bottom: 14px; }
.crumbs a { color: #E7E1D6 !important; }

/* Секции */
.section { padding: 64px 0; }
.section--wood { background: var(--paper-2); }
.section--dark { background: var(--panel); color: var(--white); }
.section__title { margin-bottom: .35em; }
.section__lead { color: var(--ink-2); max-width: 40em; margin-bottom: 28px; }
.intro { font-size: 1.08rem; color: var(--ink-2); }

/* Типы крыш */
.roofs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; background: var(--line); border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.roofs__item { background: var(--white); padding: 22px 22px 18px; }
.roofs__pic { width: 96px; height: 60px; color: var(--ink-2); display: block; margin-bottom: 12px; }
.roofs__roof { stroke: var(--wood-dark); }
.roofs__item:hover .roofs__roof { stroke: var(--accent); }
.roofs__item h3 { margin-bottom: .3em; }
.roofs__item h3 a { text-decoration: none; }
.roofs__item h3 a::after { content: ""; position: absolute; inset: 0; }
.roofs__item { position: relative; }
.roofs__item p { color: var(--ink-2); font-size: .95rem; margin: 0; }

/* Карточки услуг */
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: var(--white); border-radius: var(--radius); padding: 22px; border-top: 4px solid var(--wood); position: relative; }
.card h2, .card h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: .4em; }
.card p { color: var(--ink-2); margin: 0; font-size: .97rem; }
.card--link a { text-decoration: none; }
.card--link a::after { content: ""; position: absolute; inset: 0; }
.card--link:hover { border-top-color: var(--accent); }
.card--link:hover h2 a, .card--link:hover h3 a { color: var(--accent-dark); }
.card__price { margin-top: 12px !important; color: var(--ink) !important; font-weight: 700; }
.materials { margin: 28px 0 0; color: var(--ink-2); max-width: 46em; }

/* Шаги работы */
.steps { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; counter-reset: step; }
.steps li { counter-increment: step; padding: 52px 20px 0 0; position: relative; color: #DCD5C9; font-size: .97rem; }
.steps li::before { content: counter(step); position: absolute; top: 0; left: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--wood); color: var(--panel); font-weight: 800; display: grid; place-items: center; }
.steps li::after { content: ""; position: absolute; top: 17px; left: 42px; right: 8px; height: 2px; background: #4A5056; }
.steps li:last-child::after { display: none; }
.steps strong { display: block; color: var(--white); font-size: 1.1rem; margin-bottom: 4px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.links { list-style: none; padding: 0; margin: 0 0 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.links a { display: inline-block; padding: 7px 14px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; font-size: .95rem; }
.links a:hover { border-color: var(--accent); }
.links--light a { background: var(--panel-2); border-color: #4A5056; color: var(--white) !important; }

/* Текст страниц */
.text h2 { margin-top: 1.6em; }
.text ul { padding-left: 1.2em; }
.text li { margin-bottom: .35em; }
.text li::marker { color: var(--wood-dark); }
.note { color: var(--ink-2); font-size: .92rem; }
.price-head { margin: 28px 0 10px; }

/* Таблица цен */
.table-scroll { overflow-x: auto; margin: 0 0 14px; }
.prices { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; }
.prices th, .prices td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.prices thead th { background: var(--panel); color: #E7E1D6; font-weight: 500; font-size: .9rem; }
.prices tr:last-child td { border-bottom: 0; }
.prices__sum { white-space: nowrap; font-weight: 700; text-align: right !important; }
.prices__note { display: block; color: var(--ink-2); font-size: .86rem; }

/* Заглушка разделов, которые появятся позже */
.soon { background: var(--white); border-left: 6px solid var(--wood); padding: 24px 28px; border-radius: var(--radius); margin-bottom: 28px; max-width: 760px; }
.soon p { color: var(--ink-2); margin: 0; }

/* Форма заявки */
.lead { scroll-margin-top: 90px; }
section.lead { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 36px; background: var(--panel); color: var(--white); border-radius: var(--radius); padding: 36px; font-size: 1rem; }
section.lead .lead__text h2 { color: var(--white); }
section.lead .lead__text p { color: #DCD5C9; }
.lead__alt a { color: var(--white); }
.lead__form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; align-content: start; }
.lead__wide { grid-column: 1 / -1; }
.lead__trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.lead__submit { grid-column: 1 / -1; justify-self: start; }
.lead__notice { grid-column: 2; align-self: start; }
.field { display: grid; gap: 6px; font-size: .92rem; color: #E7E1D6; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--white); border: 2px solid transparent; border-radius: var(--radius);
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field textarea { resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; color: #DCD5C9; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.check a { color: var(--white); }

.alert { padding: 12px 16px; border-radius: var(--radius); border-left: 5px solid; background: var(--white); color: var(--ink); }
.alert--ok { border-color: #3D8B58; }
.alert--error { border-color: #C0392B; }
.alert--warn { border-color: var(--wood); }

/* Подвал */
.footer { background: var(--panel); color: #CFC8BC; padding: 0 0 40px; font-size: .95rem; }
.footer::before { content: ""; display: block; height: 14px; background: var(--rafters) repeat-x left bottom; background-color: var(--paper); margin-bottom: 40px; }
.footer__row { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 32px; }
.footer__name { color: var(--white); font-size: 1.1rem; }
.footer a { color: #E7E1D6; }
.footer nav { display: grid; gap: 6px; align-content: start; }
.footer__note { color: #A39C91; font-size: .88rem; }

/* Всплывающая форма */
.modal { border: 0; padding: 0; background: transparent; max-width: 860px; width: calc(100% - 24px); }
.modal::backdrop { background: rgba(20, 22, 24, .72); }
.modal section.lead { margin: 0; }
.modal__close { position: absolute; right: 12px; top: 8px; z-index: 2; background: none; border: 0; color: var(--white); font-size: 2rem; line-height: 1; cursor: pointer; padding: 4px 10px; }

/* Панель на телефоне */
.mobilebar { display: none; }

@media (max-width: 1080px) {
  .header__phone { display: none; }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 28px; }
  .steps li:nth-child(3)::after { display: none; }
}
@media (max-width: 900px) {
  .hero__grid, .split, section.lead { grid-template-columns: 1fr; }
  .hero { padding: 40px 0 32px; }
  .hero__art { max-width: 520px; }
  .roofs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer__row { grid-template-columns: 1fr; }
  .lead__notice { grid-column: 1; }
}
@media (max-width: 760px) {
  body { font-size: 16px; padding-bottom: 62px; }
  .wrap { padding: 0 16px; }
  .header__row { flex-wrap: wrap; gap: 0 12px; min-height: 0; padding-top: 10px; }
  .header__cta { display: none; }
  .nav { order: 3; flex-basis: 100%; margin: 6px -16px 0; padding: 0 8px; overflow-x: auto; }
  .nav a { white-space: nowrap; padding: 10px; }
  .section { padding: 44px 0; }
  .steps { grid-template-columns: 1fr; }
  .steps li { padding: 0 0 0 50px; }
  .steps li::after { display: none; }
  section.lead { padding: 24px 18px; }
  .lead__form { grid-template-columns: 1fr; }
  .roofs__item { padding: 16px; }
  .mobilebar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--panel); border-top: 3px solid var(--wood);
  }
  .mobilebar a { flex: 1; text-align: center; padding: 15px 6px; color: var(--white); text-decoration: none; font-weight: 700; }
  .mobilebar a + a { border-left: 1px solid #4A5056; }
  .mobilebar .mobilebar__lead { background: var(--accent); }
}
@media (max-width: 480px) {
  .roofs { grid-template-columns: 1fr; }
  .hero__actions .button { width: 100%; }
}

/* Страница конструктора */
.pagehead--tight { padding: 28px 0 24px; }
.section--constructor { padding: 32px 0 56px; }

/* Калькулятор и смета */
.calc { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding: 26px; border-radius: var(--radius); background: var(--panel); }
.calc .field small { color: #A39C91; font-size: .8rem; }
.calc__checks { grid-column: 1 / -1; border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 26px; }
.calc__checks legend { color: #E7E1D6; font-size: .92rem; margin-bottom: 8px; padding: 0; }
.calc__submit { grid-column: 1 / -1; justify-self: start; }
.estimate { scroll-margin-top: 90px; margin-top: 36px; }
.estimate:empty { margin: 0; }
.total { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; padding: 24px 26px; border-radius: var(--radius); color: var(--white); background: var(--panel); border-left: 6px solid var(--accent); }
.total span { display: block; font-size: .92rem; color: #DCD5C9; }
.total strong { display: block; font-size: clamp(1.6rem, 4vw, 2.5rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.total small { display: block; margin-top: 6px; font-size: .86rem; color: #CFC8BC; }
.total dl { display: flex; flex-wrap: wrap; gap: 10px 32px; margin: 0; }
.total dt { font-size: .85rem; color: #CFC8BC; }
.total dd { margin: 0; font-size: 1.2rem; font-weight: 700; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 2px; margin: 16px 0; padding: 0; list-style: none; background: var(--line); border-radius: var(--radius); overflow: hidden; }
.facts li { padding: 12px 16px; background: var(--white); font-size: .88rem; color: var(--ink-2); }
.facts b { display: block; font-size: 1.25rem; color: var(--ink); }
.prices__group th { background: var(--paper-2); font-size: .95rem; }
.prices--estimate { font-size: .95rem; font-variant-numeric: tabular-nums; }
.prices--estimate td:nth-child(n+2), .prices--estimate th:nth-child(n+2) { text-align: right; white-space: nowrap; }
.text--columns { max-width: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px 40px; }
.text--columns h2 { margin-top: 0; }
.wrap--text section.lead { grid-template-columns: 1fr; }
.wrap--text .lead__notice { grid-column: 1; }
@media (max-width: 900px) { .calc { grid-template-columns: 1fr 1fr; padding: 18px; gap: 12px; } }
@media (max-width: 560px) {
  .calc { grid-template-columns: 1fr; }
  .calc__submit { justify-self: stretch; }
  .col-price { display: none; }
  .total { padding: 18px; }
}
.pagehead__price { font-size: 1.25rem; font-weight: 800; color: var(--wood); margin: 6px 0 0; }

/* Своя смета: страница оплаты и скачивания */
.cest__ok, .cest__wait, .cest__warn, .cest__test { padding: 14px 18px; border-radius: 6px; background: var(--white); border-left: 6px solid #3D8B58; }
.cest__wait { border-left-color: var(--wood); }
.cest__warn { border-left-color: #C0392B; }
.cest__test { border-left-color: var(--accent); margin-top: 14px; }
.cest__files { list-style: none; padding: 0; display: grid; gap: 10px; }
.cest__files .button { width: 100%; justify-content: flex-start; }

/* Конструктор: промо на главной и текст на странице конструктора */
.promo-kon { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 32px; align-items: center; }
.promo-kon__list { margin: 0 0 20px; padding-left: 20px; display: grid; gap: 6px; }
.promo-kon__img { width: 100%; height: auto; border-radius: 8px; box-shadow: 0 14px 30px -18px rgba(0, 0, 0, .5); }
@media (max-width: 860px) { .promo-kon { grid-template-columns: 1fr; } }
.faq { border-bottom: 1px solid var(--line, #DED5C7); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq p { margin: 8px 0 0; }

/* 3D-пример на страницах (заглушка до загрузки модели) */
.k3d { margin: 28px 0; }
.k3d__placeholder { display: grid; gap: 10px; justify-items: start; padding: 28px 24px; border-radius: 6px; min-height: 220px; align-content: center;
  background: linear-gradient(180deg, #7FA3C9 0%, #A9C2D9 40%, #D5DFE4 70%, #DDE1DD 100%); }
.k3d__placeholder p { margin: 0; max-width: 520px; }
.k3d__title { font-weight: 800; font-size: 1.15rem; }
.k3d--loading .k3d__placeholder [data-k3d-start] { opacity: .6; pointer-events: none; }
.k3d--loading .k3d__placeholder [data-k3d-start]::after { content: "…"; }
.k3d__placeholder .button { margin-right: 8px; }
.k3d__placeholder .button--line { color: var(--ink); border-color: var(--ink); }

/* Статьи */
.pagehead__meta { color: #B9B2A6; font-size: .9rem; margin: 10px 0 0; }
.callout { margin: 32px 0 8px; padding: 22px 24px; border-radius: var(--radius); background: var(--paper-2); border-left: 4px solid var(--accent); }
.callout h2 { margin-top: 0; }
.callout .button { margin: 4px 8px 4px 0; }
.button--dark { background: var(--panel); border-color: var(--panel); color: var(--white); }
.button--dark:hover { background: var(--panel-2); border-color: var(--panel-2); }
.text table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: .95rem; }
.text th, .text td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.text th { font-weight: 700; background: var(--paper-2); }

/* Калькуляторы кровли */
.tool__form { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.tool__form .calc__submit { align-self: end; }
.tool__check { align-self: end; padding-bottom: 12px; }
.tool__result { margin-top: 26px; }
.tool__facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 0 0 22px; }
.tool__facts div { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tool__facts dt { color: var(--ink-2); font-size: .88rem; }
.tool__facts dd { margin: 4px 0 0; font-size: 1.35rem; font-weight: 800; }
.tool__total { font-size: 1.1rem; margin: 14px 0 4px; }
.tool__total b { font-size: 1.35rem; }
.tool__next { margin-top: 22px; }
.prices__best td { background: #FFF1E6; font-weight: 700; }
.tools-grid .card h2 { font-size: 1.2rem; }
.tool__form .field { align-content: start; }
.nav a { white-space: nowrap; }
@media (max-width: 1320px) and (min-width: 761px) { .nav a { padding: 8px 8px; font-size: .92rem; } }
@media (max-width: 980px) and (min-width: 761px) { .header__cta { display: none; } }
.logo { flex: none; white-space: nowrap; }
@media (max-width: 1240px) and (min-width: 1081px) { .header__phone { font-size: .95rem; } }
@media (max-width: 1180px) and (min-width: 761px) { .header__phone { display: none; } }
