/* Метраж — общие стили всех страниц. Цвета — только через переменные. */
:root {
  --bg: #F5F1EA;
  --ink: #1E2226;           /* основной текст, тёмные блоки, рамки */
  --muted: #5A5F66;         /* второстепенный текст */
  --text-2: #4A4F56;        /* подписи полей, абзацы */
  --text-3: #3E434A;        /* текст статей */
  --card: #FFFDF9;
  --line: #E2DBCF;
  --field-line: #CFC7B8;
  --seg-bg: #EFE9DF;
  --accent: #D9622B;        /* только декор: тени, полоски, иконки */
  --tint: #F7E2D5;
  --btn: #A9481A;           /* кнопки и ссылки */
  --btn-hover: #7E3511;
  --on-dark: #F0A27A;       /* оранжевый на тёмном */
  --on-dark-text: #E6E1D8;
  --on-dark-muted: #C9C4BB;
  --dark-line: #4A4F56;
  --white: #FFFFFF;
  --grid-major: rgba(30, 34, 38, .07);
  --grid-minor: rgba(30, 34, 38, .035);
  --font: Manrope, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 16px/1.55 var(--font);
  color: var(--ink);
  background-color: var(--bg);
  /* миллиметровка */
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
  background-size: 50px 50px, 50px 50px, 10px 10px, 10px 10px;
}
a { color: var(--btn); }
a:hover { color: var(--btn-hover); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
main { flex: 1 0 auto; }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }
.svg-num { font: 700 12px var(--mono); fill: var(--ink); }

/* ---------- шапка ---------- */
.site-header { background: var(--ink); color: var(--bg); }
.header-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding-top: 12px; padding-bottom: 12px; }
.logo { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--bg); }
.logo:hover { color: var(--bg); }
.logo-name { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; line-height: 1; }
.logo-ruler { display: block; width: 96px; height: 9px; }
.nav { display: flex; gap: 4px; overflow-x: auto; max-width: 100%; white-space: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 8px; color: var(--bg); text-decoration: none; font-weight: 600; font-size: 15px; flex: 0 0 auto; }
.nav a:hover { background: rgba(245, 241, 234, .1); color: var(--bg); }
.nav a[aria-current="page"] { background: var(--btn); color: var(--white); font-weight: 700; }
.nav a.nav-all { background: var(--bg); color: var(--ink); font-weight: 700; padding: 0 16px; }
.nav a.nav-all:hover { background: var(--white); }
@media (max-width: 760px) {
  .nav { width: 100%; }
}

/* ---------- кнопки ---------- */
.btn-primary, .buy-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px;
  padding: 12px 24px; border-radius: 10px; background: var(--btn); color: var(--white);
  font-weight: 700; font-size: 16px; text-decoration: none; text-align: center;
}
.btn-primary:hover, .buy-btn:hover { background: var(--btn-hover); color: var(--white); }

/* ---------- главная ---------- */
.home-hero { display: flex; flex-direction: column; gap: 24px; padding-top: 40px; padding-bottom: 56px; }
.home-hero h1 { margin: 0; font-size: 44px; line-height: 1.08; font-weight: 800; letter-spacing: -1.2px; }
.home-hero .lead { margin: -8px 0 0; color: var(--text-2); font-size: 17px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: -10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.card {
  display: flex; flex-direction: column; gap: 10px; padding: 18px; min-height: 44px;
  background: var(--card); border: 1.5px solid var(--ink); border-radius: 14px;
  color: var(--ink); text-decoration: none; transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { color: var(--ink); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(30, 34, 38, .10); }
.card-name { font-weight: 800; font-size: 18px; line-height: 1.2; }
.card-desc { font-size: 13px; color: var(--muted); line-height: 1.4; }

.demo { display: flex; flex-wrap: wrap; gap: 32px; align-items: center; padding-bottom: 64px; }
.demo-text { flex: 1 1 400px; min-width: 0; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.eyebrow { font: 700 13px var(--mono); color: var(--btn); letter-spacing: 1px; text-transform: uppercase; }
.demo h2, .steps h2, .home-faq h2 { margin: 0; font-size: 32px; line-height: 1.15; font-weight: 800; letter-spacing: -0.6px; }
.demo-text p { margin: 0; font-size: 17px; line-height: 1.6; color: var(--text-2); }
.demo-card { flex: 1 1 340px; min-width: 0; max-width: 460px; background: var(--card); border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 22px; box-shadow: 6px 6px 0 var(--ink); display: flex; flex-direction: column; gap: 14px; }
.demo-card svg { width: 100%; height: auto; display: block; }
.demo-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.demo-title { font-weight: 700; font-size: 15px; }
.demo-meta { font: 500 13px var(--mono); color: var(--muted); }
.demo-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; border-top: 1.5px dashed var(--line); padding-top: 14px; }
.demo-big { font: 700 34px/1 var(--mono); color: var(--btn); }
.demo-sub { font-size: 15px; color: var(--text-2); }

.steps { background: var(--ink); color: var(--bg); }
.steps .wrap { padding-top: 56px; padding-bottom: 56px; display: flex; flex-direction: column; gap: 28px; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px; }
.step { display: flex; flex-direction: column; gap: 10px; border-top: 3px solid var(--accent); padding-top: 18px; }
.step-num { font: 700 15px var(--mono); color: var(--on-dark); }
.step h3 { margin: 0; font-weight: 700; font-size: 20px; }
.step p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--on-dark-muted); }

.home-faq { max-width: 820px; padding-top: 64px; padding-bottom: 64px; display: flex; flex-direction: column; gap: 16px; }
.faq { display: flex; flex-direction: column; gap: 12px; }
.faq-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; }
.faq-card h3 { margin: 0 0 8px; font-weight: 700; font-size: 18px; }
.faq-card p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--text-2); }

/* ---------- страница калькулятора ---------- */
.calc-page { display: flex; flex-direction: column; gap: 16px; padding-top: 14px; padding-bottom: 64px; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--muted); }
.calc-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; }
.calc-head h1 { margin: 0; font-size: 34px; line-height: 1.1; font-weight: 800; letter-spacing: -0.8px; }
.calc-tagline { font-size: 14px; font-weight: 600; color: var(--muted); }
.calc { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.form-card { flex: 999 1 460px; min-width: 0; background: var(--card); border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 22px; }
.calc-side { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 600px) {
  .calc-head h1 { font-size: 30px; }
  .form-card { padding: 18px 16px; }
}

/* форма */
.form-card h3 { margin: 24px 0 12px; font-size: 18px; font-weight: 800; }
.form-card h3:first-child { margin-top: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field[hidden], [data-show][hidden] { display: none; }
.field label { font-size: 14px; font-weight: 600; color: var(--text-2); }
.field input, .field select {
  width: 100%; height: 48px; padding: 0 14px; border: 1.5px solid var(--field-line); border-radius: 10px;
  background: var(--white); color: var(--ink); font: 700 18px var(--mono); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field select { font-size: 16px; padding-right: 8px; }
.field input:focus, .field select:focus { border-color: var(--btn); box-shadow: 0 0 0 3px rgba(217, 98, 43, .18); }
.hint { margin: 10px 0 0; font-size: 14px; color: var(--muted); }

/* переключатели-сегменты */
.seg { display: flex; flex-wrap: wrap; gap: 6px; background: var(--seg-bg); padding: 5px; border-radius: 12px; }
.seg input, .seg-cards input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 6px 10px; border-radius: 9px; font-weight: 600; font-size: 15px; text-align: center; cursor: pointer; }
.seg input:checked + label { background: var(--ink); color: var(--white); font-weight: 700; }
.seg input:focus-visible + label, .seg-cards input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }
.seg-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.seg-cards label { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; padding: 6px 8px; border: 1.5px solid var(--field-line); border-radius: 10px; background: var(--white); text-align: center; cursor: pointer; }
.seg-cards b { font: 700 17px var(--mono); }
.seg-cards span { font-size: 12px; color: var(--muted); line-height: 1.3; }
.seg-cards input:checked + label { background: var(--ink); border-color: var(--ink); color: var(--white); }
.seg-cards input:checked + label span { color: var(--on-dark-text); }

/* двери и окна */
.openings { display: flex; flex-direction: column; gap: 10px; }
.opening { display: grid; grid-template-columns: 1.3fr 1fr 1fr 0.9fr 44px; gap: 8px; align-items: end; }
.opening .field label { font-size: 12px; }
@media (max-width: 520px) {
  .opening { grid-template-columns: 1fr 1fr 44px; }
  .opening .field:first-child { grid-column: 1 / -1; }
  .opening .field:nth-child(4) { display: none; }
}
.icon-btn { width: 44px; height: 48px; border-radius: 10px; border: 1.5px solid var(--field-line); background: var(--white); color: var(--muted); cursor: pointer; font-size: 20px; }
.icon-btn:hover { color: var(--btn); border-color: var(--btn); }
.btn { font: 700 15px var(--font); min-height: 44px; padding: 0 16px; margin-top: 12px; border-radius: 10px; border: 1.5px dashed var(--field-line); background: transparent; color: var(--btn); cursor: pointer; }
.btn:hover { border-color: var(--btn); }

/* карточка результата */
.result-card { background: var(--ink); color: var(--bg); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; gap: 18px; box-shadow: 8px 8px 0 var(--accent); }
@media (max-width: 600px) { .result-card { padding: 22px 18px; box-shadow: 6px 6px 0 var(--accent); } }
.res-cap { font: 700 13px var(--mono); letter-spacing: 1px; text-transform: uppercase; color: var(--on-dark); }
.res-main { display: flex; flex-direction: column; gap: 6px; }
.res-big { font: 700 52px/1.05 var(--mono); color: var(--white); overflow-wrap: anywhere; }
.res-big.mid { font-size: 40px; }
.res-big.long { font-size: 32px; }
.res-big.xlong { font-size: 28px; }
.res-sub { font-size: 17px; color: var(--on-dark-text); }
.res-rows { list-style: none; margin: 0; padding: 0; border-top: 1px dashed var(--dark-line); }
.res-rows li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--dark-line); }
.res-rows li span { color: var(--on-dark-muted); flex: 1 1 40%; min-width: 0; }
.res-rows li b { font-family: var(--mono); font-weight: 700; font-size: 15px; text-align: right; flex: 0 1 auto; }
.res-rows li.cost b { color: var(--on-dark); }
.res-warn { margin: 0; padding: 10px 12px; border-left: 3px solid var(--accent); background: rgba(240, 162, 122, .12); color: var(--on-dark-text); font-size: 14px; border-radius: 0 8px 8px 0; }
.res-error { margin: 0; font-size: 16px; line-height: 1.5; color: var(--on-dark); }
.res-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.res-actions button { flex: 1 1 120px; min-height: 48px; border-radius: 10px; font: 700 15px var(--font); cursor: pointer; }
.res-actions .share { border: 0; background: var(--bg); color: var(--ink); }
.res-actions .share:hover { background: var(--white); }
.res-actions .print { border: 1.5px solid var(--bg); background: transparent; color: var(--bg); }
.res-actions .print:hover { background: rgba(245, 241, 234, .1); }

/* схема */
.plan-card { background: var(--card); border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.plan-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.plan-title { font-weight: 800; font-size: 16px; }
.plan-label { font: 500 13px var(--mono); color: var(--muted); text-align: right; }
#plan { width: 100%; height: auto; display: block; }
.pl-floor { fill: var(--tint); }
.pl-empty { fill: var(--card); }
.pl-tile { fill: var(--tint); stroke: var(--accent); stroke-width: .8; }
.pl-seam { fill: none; stroke: var(--accent); stroke-width: .8; }
.pl-walls { fill: none; stroke: var(--accent); stroke-width: 8; }
.pl-room { fill: none; stroke: var(--ink); stroke-width: 2; }
.pl-dim { fill: none; stroke: var(--ink); stroke-width: 1; }
.pl-box { fill: var(--card); }
.svg-hint { font: 600 14px var(--font); fill: var(--muted); }

/* блок «Купить …» */
.buy-card { background: var(--card); border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 24px 28px; display: flex; flex-direction: column; gap: 6px; }
.buy-card:empty { display: none; }
@media (max-width: 600px) { .buy-card { padding: 20px 16px; } }
.buy-card h2 { margin: 0; font-weight: 800; font-size: 20px; }
.buy-lead { margin: 0 0 10px; font-size: 15px; color: var(--muted); }
.buy-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.buy-extra { display: flex; flex-wrap: wrap; gap: 8px; }
.buy-small {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 10px;
  border: 1.5px solid var(--btn); color: var(--btn); background: var(--white); font-weight: 700; font-size: 14px; text-decoration: none;
}
.buy-small:hover { background: var(--btn); color: var(--white); }
.ad-mark { margin: 12px 0 0; font-size: 12px; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }

/* реклама РСЯ — пустой блок не занимает места */
.ad-slot { display: none; }
.ad-slot.ad-on { display: block; min-height: 120px; }

/* статья */
.article { max-width: 820px; display: flex; flex-direction: column; gap: 18px; margin-top: 16px; }
.article h2 { margin: 16px 0 0; font-size: 32px; line-height: 1.15; font-weight: 800; letter-spacing: -0.6px; }
.article p, .article li { margin: 0; font-size: 17px; line-height: 1.65; color: var(--text-3); }
.article ol, .article ul { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 600px) { .article h2 { font-size: 26px; } .article p, .article li { font-size: 16px; } }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 16px; }
.table-wrap th { text-align: left; padding: 12px 16px; background: var(--seg-bg); font-weight: 700; }
.table-wrap td { padding: 12px 16px; border-top: 1px solid var(--line); }
.article details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 22px; }
.article summary { cursor: pointer; font-weight: 700; font-size: 18px; padding: 18px 0; min-height: 44px; }
.article details p { padding-bottom: 18px; font-size: 16px; color: var(--text-2); }

/* полоса итога на телефоне */
.mbar { display: none; }
@media (max-width: 760px) {
  .mbar { display: flex; position: sticky; bottom: 0; z-index: 5; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; background: var(--ink); color: var(--white); box-shadow: 0 -4px 16px rgba(30, 34, 38, .25); }
}
.mbar-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mbar-cap { font-size: 12px; font-weight: 700; color: var(--on-dark); }
.mbar-big { font: 700 20px var(--mono); }
.mbar-sub { font-size: 14px; color: var(--on-dark-text); text-align: right; }

/* подвал */
.site-footer { border-top: 1.5px solid var(--ink); background: var(--card); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 16px; padding-top: 28px; padding-bottom: 28px; font-size: 14px; color: var(--muted); }
.footer-text { margin: 0; flex: 1 1 400px; }
.footer-text strong { color: var(--ink); }
.footer-links { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.footer-links a { color: var(--muted); display: inline-flex; align-items: center; min-height: 32px; }
.footer-links a:hover { color: var(--btn); }

@media (max-width: 600px) {
  .home-hero { padding-top: 28px; padding-bottom: 40px; }
  .home-hero h1 { font-size: 32px; letter-spacing: -0.8px; }
  .demo h2, .steps h2, .home-faq h2 { font-size: 26px; }
  .steps .wrap, .home-faq { padding-top: 44px; padding-bottom: 44px; }
}

/* печать: только параметры и результат */
@media print {
  body { background: var(--white); display: block; }
  .site-header, .site-footer, .article, .buy-card, .ad-slot, .res-actions, .mbar, .calc-tagline, .breadcrumbs, .btn, .icon-btn { display: none !important; }
  .calc { display: block; }
  .form-card, .plan-card { break-inside: avoid; margin-bottom: 12px; }
  .result-card { background: var(--white); color: var(--ink); box-shadow: none; border: 1.5px solid var(--ink); break-inside: avoid; margin-bottom: 12px; }
  .res-big, .res-sub, .res-rows li span, .res-cap, .res-warn { color: var(--ink); }
}
