:root {
  --bg: #ffffff;
  --bg-alt: #f3f4f6;
  --dark: #1f2328;
  --text: #24292f;
  --muted: #6b7280;
  --border: #d8dce2;
  --accent: #e8590c;
  --accent-dark: #c2410c;
  --error: #c62828;
  --ok: #2e7d32;
  --radius: 10px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 70px; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--accent-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 16px; }
h2 { font-size: 30px; }

.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); margin-top: -6px; }
.hint { color: var(--muted); font-size: 14px; margin: 4px 0 0; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-block;
  padding: 12px 22px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn--ghost { background: transparent; color: inherit; border-color: currentColor; }
.btn--ghost:hover { background: rgba(255,255,255,.1); border-color: var(--accent); }
.btn--small { padding: 7px 14px; font-size: 14px; }
.btn--block { display: block; width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }

/* ---------- Шапка ---------- */
.header {
  position: sticky; top: 0; z-index: 10;
  background: var(--dark); color: #fff;
}
.header__inner { display: flex; align-items: center; gap: 18px; height: 64px; }
.logo { color: #fff; font-weight: 800; font-size: 20px; text-decoration: none; }
.logo__mark { color: var(--accent); }
.nav { display: flex; gap: 20px; margin-left: auto; }
.nav a { color: #d1d5db; text-decoration: none; white-space: nowrap; }
.logo, .header__phone { white-space: nowrap; flex-shrink: 0; }
.nav a:hover { color: #fff; }
.burger { display: none; margin-left: auto; background: none; border: 0; color: #fff; font-size: 26px; cursor: pointer; }

/* ---------- Первый экран ---------- */
.hero {
  background:
    linear-gradient(120deg, rgba(31,35,40,.95) 40%, rgba(31,35,40,.75)),
    repeating-linear-gradient(45deg, #2b3036 0 12px, #262a30 12px 24px);
  color: #fff;
  padding: 90px 0;
}
.hero h1 { font-size: 46px; max-width: 700px; }
.hero__lead { font-size: 19px; color: #d1d5db; max-width: 620px; margin: 0 0 30px; }
.hero__actions { display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------- Преимущества ---------- */
.features { background: var(--accent); color: #fff; }
.features__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; padding: 26px 20px; }
.feature b { display: block; font-size: 18px; }
.feature span { opacity: .9; font-size: 14px; }

/* ---------- Секции ---------- */
.section { padding: 70px 0; }
.section--alt { background: var(--bg-alt); }

/* ---------- Таблица каталога ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; }
.table th { background: var(--bg-alt); font-weight: 600; }
.table .num { text-align: right; white-space: nowrap; }

/* ---------- Карточки услуг ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.card { background: #fff; border-radius: var(--radius); padding: 22px; border-top: 4px solid var(--accent); }
.card h3 { font-size: 19px; margin-bottom: 8px; }
.card p { margin: 0 0 12px; color: var(--muted); }
.card .price { font-weight: 700; }

/* ---------- Калькулятор ---------- */
.calc { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.calc__form { background: var(--bg-alt); border-radius: var(--radius); padding: 24px; }
.calc__result {
  position: sticky; top: 84px;
  background: var(--dark); color: #fff;
  border-radius: var(--radius); padding: 24px;
}
.result-line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #3a3f46; }
.result-line--total { border-bottom: 0; font-size: 22px; padding-top: 14px; }
.result-line--total b { color: #ffa94d; }
.result-line b { text-align: right; overflow-wrap: anywhere; }
.result-hint { color: #ffd8a8; font-size: 14px; line-height: 1.4; margin: 10px 0 0; }
.result-hint:empty { display: none; }
.calc__result .btn { margin-top: 14px; }

.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--muted); min-width: 0; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; }
.field input, .field select, .field textarea {
  font: inherit; color: var(--text);
  padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.field textarea { resize: vertical; }
/* Ошибки в полях */
.field.invalid > span:first-child { color: var(--error); }
.field.invalid input, .field.invalid textarea, .field.invalid select {
  border-color: var(--error);
  background: #fff5f5;
  animation: shake .3s;
}
.field.invalid input:focus, .field.invalid textarea:focus { outline-color: var(--error); }
.field__error { color: var(--error); font-size: 13px; line-height: 1.3; }
.field__counter { align-self: flex-end; font-size: 12px; color: var(--muted); margin-top: -2px; }
.field__counter:empty { display: none; }
.field__counter.near { color: #c2410c; }
.field__counter.full { color: var(--error); font-weight: 600; }
.field__error::before { content: '⚠ '; }
.checkbox.invalid { color: var(--error); }
.checkbox.invalid input { outline: 2px solid var(--error); outline-offset: 1px; animation: shake .3s; }
.checkbox-error { color: var(--error); font-size: 13px; margin: -8px 0 0 26px; }
.checkbox-error::before { content: '⚠ '; }
.form-status.err {
  background: #fff5f5; border: 1px solid #f5c2c2; border-radius: 8px; padding: 10px 12px;
}
.form-status.ok {
  background: #f0faf0; border: 1px solid #b7dfb9; border-radius: 8px; padding: 10px 12px;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.error { color: #ff8a80; min-height: 1em; margin: 8px 0 0; font-size: 14px; }

/* ---------- Заявка ---------- */
.order { display: grid; grid-template-columns: 1fr 380px; gap: 32px; align-items: start; }
.order-items { list-style: none; padding: 0; margin: 0 0 16px; }
.order-item {
  display: flex; gap: 12px; align-items: flex-start;
  background: #fff; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
}
.order-item__info { flex: 1; }
.order-item__title { font-weight: 600; }
.order-item__details { font-size: 14px; color: var(--muted); }
.order-item__price { font-weight: 700; white-space: nowrap; }
.order-item__remove { background: none; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; }
.order-item__remove:hover { color: var(--error); }
.order-total { font-size: 20px; }

.order__form { background: #fff; border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.order__form h3 { margin: 0; }
.checkbox { display: flex; gap: 8px; font-size: 14px; align-items: flex-start; }
.checkbox input { margin-top: 3px; }
.hp { position: absolute; left: -9999px; }
.form-status { margin: 0; font-size: 14px; min-height: 1em; }
.form-status.ok { color: var(--ok); }
.form-status.err { color: var(--error); }
.form-status:empty { display: none; }

/* ---------- Контакты ---------- */
.contacts { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.contacts p { margin: 0 0 10px; }
.contact-card {
  background: var(--dark); color: #fff; border-radius: var(--radius); padding: 32px;
  display: flex; flex-direction: column; justify-content: center; gap: 14px;
}
.contact-card h3 { margin: 0; font-size: 24px; }
.contact-card p { margin: 0; color: #d1d5db; }
.contact-card__phone { font-size: 30px; font-weight: 800; color: #ffa94d; text-decoration: none; }
.contact-card__phone:hover { color: #fff; }
.contact-card__actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }

/* ---------- Подвал ---------- */
.footer { background: var(--dark); color: #9ca3af; padding: 24px 0; font-size: 14px; }
.footer__inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer a { color: #9ca3af; }

/* ---------- Блоки приёма и резки ---------- */
.hero__place {
  display: inline-block; margin: 0 0 18px; padding: 6px 14px;
  border: 1px solid rgba(255,255,255,.25); border-radius: 999px;
  color: #ffd8a8; font-size: 15px; font-weight: 600;
}
.header__place { color: #9ca3af; font-size: 13px; white-space: nowrap; }
.header__max { color: #fff; white-space: nowrap; flex-shrink: 0; }
.nav__max { display: none; }
.table__group td { background: #fff4ec; font-weight: 700; color: var(--accent-dark); }
.lead-note { font-size: 18px; max-width: 760px; margin: 0 0 24px; }
.cta-line { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 26px 0 0; }
.cta-line .muted { margin: 0; }

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.steps li { counter-increment: step; position: relative; padding: 58px 18px 18px;
  background: var(--bg-alt); border-radius: var(--radius); }
.steps li::before { content: counter(step); position: absolute; top: 16px; left: 18px;
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; }
.steps b { display: block; margin-bottom: 4px; }
.steps span { color: var(--muted); font-size: 15px; }
.order__list h3 { margin-top: 6px; }

/* ---------- Наши работы ---------- */
.gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.photo {
  position: relative; margin: 0; cursor: zoom-in;
  border-radius: var(--radius); overflow: hidden; background: var(--dark);
}
.photo img { display: block; width: 100%; height: auto; aspect-ratio: 7 / 5; object-fit: cover; transition: transform .25s; }
.photo:hover img, .photo:focus img { transform: scale(1.04); }
.photo:focus { outline: 3px solid var(--accent); outline-offset: 2px; }
.photo figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 12px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff; font-size: 14px; font-weight: 600;
}
.photo__label {
  position: absolute; top: 12px; left: 12px; padding: 4px 12px; border-radius: 999px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px;
}
.before-after { margin-bottom: 24px; max-width: 860px; }
.before-after__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.before-after__pair .photo figcaption { display: none; }
.before-after__caption { margin: 10px 0 0; color: var(--muted); }

.lightbox {
  border: 0; padding: 0; background: transparent; max-width: min(1100px, 94vw); max-height: 92vh;
}
.lightbox::backdrop { background: rgba(0,0,0,.85); }
.lightbox img { display: block; max-width: 100%; max-height: 82vh; border-radius: var(--radius); }
.lightbox__caption { color: #fff; text-align: center; margin: 10px 0 0; }
.lightbox__close {
  position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 26px; line-height: 1; cursor: pointer;
}

/* ---------- Страница политики ---------- */
.page { padding: 50px 0 70px; max-width: 800px; }

/* ---------- Адаптив ---------- */
@media (max-width: 1240px) {
  .header__place { display: none; } /* на узких экранах место в шапке — меню; город есть на первом экране */
}
@media (max-width: 960px) and (min-width: 721px) {
  .header__inner { gap: 14px; }
  .nav { gap: 14px; font-size: 15px; }
  .header__max { display: none; } /* на планшете не помещается; MAX есть в контактах */
}

@media (max-width: 900px) {
  .calc, .order, .contacts { grid-template-columns: minmax(0, 1fr); }
  .calc__result { position: static; }
  .features__grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .steps { grid-template-columns: 1fr; }
  .order__form .field-row { grid-template-columns: 1fr; }
}

/* ---------- Смартфоны ---------- */
.mobile-bar { display: none; }

@media (max-width: 720px) {
  /* 16px в полях — иначе iPhone увеличивает страницу при касании поля */
  .field input, .field select, .field textarea { font-size: 16px; }
  /* галочки побольше — под палец */
  .checkbox input { width: 22px; height: 22px; flex-shrink: 0; margin-top: 0; }
  .checkbox { align-items: center; font-size: 15px; }
  .checkbox-error { margin-left: 30px; }

  /* кнопки во всю ширину, одинаковые */
  .hero__actions .btn, .contact-card__actions .btn, .cta-line .btn { flex: 1 1 100%; text-align: center; }
  .contact-card { padding: 24px 20px; }
  .contact-card__phone { font-size: 26px; white-space: nowrap; }

  /* карточки работ — по две в ряд, компактно */
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card { padding: 14px; border-top-width: 3px; }
  .card h3 { font-size: 16px; margin-bottom: 4px; hyphens: auto; overflow-wrap: anywhere; }
  .card p { font-size: 13px; margin: 0; }

  .gallery, .before-after__pair { gap: 10px; }
  .photo figcaption { font-size: 12px; padding: 18px 8px 6px; }
  .photo__label { top: 8px; left: 8px; font-size: 12px; padding: 3px 10px; }

  /* закреплённая панель «Позвонить / MAX» внизу экрана */
  .mobile-bar {
    display: flex; gap: 10px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: rgba(31, 35, 40, .97);
    box-shadow: 0 -4px 16px rgba(0,0,0,.25);
  }
  .mobile-bar .btn { flex: 1; text-align: center; padding: 12px 10px; }
  .mobile-bar .btn--ghost { color: #fff; }
  body { padding-bottom: 72px; } /* чтобы панель не закрывала подвал */
}

@media (max-width: 720px) {
  .burger { display: block; }
  .header__phone { display: none; }
  .header__max { display: none; }
  .nav .nav__max { display: block; color: #ffa94d; }
  .nav {
    display: none;
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--dark);
  }
  .nav.open { display: flex; }
  .nav a { padding: 14px 20px; border-top: 1px solid #3a3f46; }
  .hero { padding: 60px 0; }
  .hero h1 { font-size: 32px; }
  h2 { font-size: 25px; }
  .section { padding: 50px 0; }
}
