/* Каркас лендинга ИП Петрова А.А. — общая стиль-система (прототип, MVP) */
:root {
  --bg: #ffffff;
  --fg: #1c2530;
  --muted: #5b6675;
  --accent: #2f4a6b;
  --accent-2: #3d6291;
  --line: #e3e8ee;
  --soft: #f4f7fb;
  --warn-bg: #fff8e8;
  --warn-border: #e0b400;
  --ok-bg: #eef6ef;
  --ok-border: #5a9e6a;
  --radius: 12px;
  --maxw: 980px;
  --cta-bar-h: 0px; /* высота мобильной панели «Позвонить/Написать»; на десктопе 0 */
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.55;
  font-size: 17px;
}

a { color: var(--accent); }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 18px;
}

/* Skip-link (доступность): скрытая ссылка «Перейти к содержимому», видна при фокусе с клавиатуры */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1100; /* выше cookie-баннера и мобильной панели */
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 0 0 10px 0;
  text-decoration: none;
}
.skip-link:focus { left: 0; }

/* Шапка */
.site-header {
  position: static; /* мобильный: не-липкий; липкость — только на десктопе (см. @media min-width:720px) */
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .2px;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
}
.brand span { color: var(--muted); font-weight: 500; }
.nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.nav a {
  text-decoration: none;
  color: var(--fg);
  font-size: 15px;
  padding: 8px 10px;
  border-radius: 8px;
}
.nav a:hover, .nav a:focus { background: var(--soft); }
.header-phone { order: 1; text-decoration: none; white-space: nowrap; }
.header-phone .hp-num { display: none; }
.header-phone .hp-call {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
}
.header-phone:hover .hp-call, .header-phone:focus .hp-call { background: var(--accent-2); }
.nav { order: 2; }
/* Ссылки на мессенджеры в шапке: только на десктопе (на мобильных их заменяет панель cta-bar) */
.header-msg { order: 3; display: none; align-items: center; gap: 12px; }
.header-msg a { color: var(--accent); text-decoration: none; font-size: 15px; font-weight: 600; white-space: nowrap; }
.header-msg a:hover, .header-msg a:focus { text-decoration: underline; }

/* Hero */
.hero {
  padding: 40px 0 28px;
  border-bottom: 1px solid var(--line);
}
.hero h1 {
  font-size: 30px;
  line-height: 1.2;
  margin: 0 0 14px;
  letter-spacing: -.3px;
}
.hero .sub {
  font-size: 18px;
  color: var(--muted);
  margin: 0 0 22px;
  max-width: 640px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
/* Телефон-ссылка в hero (P0): крупно, первым элементом блока действий */
.hero-tel {
  display: inline-flex;
  align-items: center;
  align-self: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.hero-tel:hover, .hero-tel:focus { text-decoration: underline; }
.hero-facts {
  display: flex;
  gap: 18px 28px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 15px;
}
.hero-facts b { color: var(--fg); }
.hero-photo {
  margin-top: 26px;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 4 / 5;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;            /* фото никогда не вылезает за контейнер */
}
/* Мобильный (базовый) режим: фото масштабируется по ширине контейнера,
   пропорции не искажаются (object-fit: cover), лицо держим в верхней трети */
.hero-photo img {
  display: block;
  width: 100%;                /* ключевое исправление: не шире контейнера */
  height: 100%;
  object-fit: cover;
  object-position: 50% 22%;
}

/* Кнопки */
.btn {
  display: inline-block;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  padding: 13px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
.btn-secondary { background: #fff; color: var(--accent); border-color: var(--accent); }
.btn-secondary:hover { background: var(--soft); }
.btn:focus-visible, .nav a:focus-visible, .header-phone:focus-visible,
.hero-tel:focus-visible, .cta-call:focus-visible, .cta-write:focus-visible,
.cookie-actions button:focus-visible {
  outline: 3px solid var(--accent-2);
  outline-offset: 2px;
}

/* Секции */
.section { padding: 34px 0; border-bottom: 1px solid var(--line); }
.section h2 { font-size: 23px; margin: 0 0 16px; letter-spacing: -.2px; }
.subhead { margin: 28px 0 16px; font-size: 19px; font-weight: 700; letter-spacing: -.2px; }
.section p { margin: 0 0 12px; }
.lead { color: var(--muted); font-size: 17px; margin: 0 0 20px; }

/* Карточки */
.cards { display: grid; grid-template-columns: 1fr; gap: 14px; }
.card {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card h3 { margin: 0 0 8px; font-size: 18px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.card a { text-decoration: none; font-weight: 600; }

/* Крупная цифра результата в карточке кейса (на главной) */
.card .figure {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -.4px;
  margin: 0 0 6px;
}

/* Счётчики доверия (секция «Почему можно доверять» на главной) */
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 36px;
  margin: 0 0 18px;
}
.stats b {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -.4px;
  line-height: 1.25;
}
.stats span {
  font-size: 14px;
  color: var(--muted);
}

/* Кейсы (обезличенные описания дел) */
.case {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.case h3 { margin: 0 0 4px; font-size: 19px; line-height: 1.3; letter-spacing: -.2px; }
.case .case-cat { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.case p { margin: 0 0 10px; }
.case p:last-child { margin-bottom: 0; }
.case b { color: var(--accent); }

/* Шаги */
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; }
.steps li {
  position: relative;
  padding: 0 0 16px 46px;
  border-left: 2px solid var(--line);
  margin-left: 14px;
}
.steps li:last-child { border-left-color: transparent; }
.steps li::before {
  counter-increment: s;
  content: counter(s);
  position: absolute;
  left: -16px; top: -2px;
  width: 30px; height: 30px;
  background: var(--accent); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}

/* Цены */
.price-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.price-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.price-card .name { font-weight: 700; font-size: 17px; }
.price-card .cost { color: var(--accent); font-weight: 700; font-size: 18px; margin: 4px 0 8px; }
.price-card .desc { color: var(--muted); font-size: 15px; margin: 0; }
.price-card .not { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.note { font-size: 14px; color: var(--muted); margin-top: 14px; }

/* Предупреждение */
.warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 15px;
  margin-top: 14px;
}
.ok {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 15px;
}

/* Документы список */
.doclist { margin: 0; padding-left: 20px; }
.doclist li { margin: 4px 0; }

/* Форма */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.form-row input, .form-row textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
}
.form-row textarea { min-height: 120px; resize: vertical; }
.checkrow { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); margin: 8px 0 16px; }
.checkrow input { width: auto; margin-top: 3px; flex: 0 0 auto; }

/* Сообщения об ошибках формы и honeypot */
.field-err { color: #b3261e; font-size: 13px; margin: 6px 0 0; }
.field-err:empty { display: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
#lead-form button[type="submit"][disabled] { opacity: .6; cursor: default; }

/* Единый статус отправки формы: отдельное состояние успеха (зелёное) и ошибки (красное) */
.form-status { font-size: 14px; margin: 12px 0 0; padding: 12px 14px; border-radius: 10px; border: 1px solid transparent; line-height: 1.5; }
.form-status:empty { display: none; padding: 0; border: 0; }
.form-status--ok { background: var(--ok-bg); border-color: var(--ok-border); color: #1f5132; }
.form-status--err { background: #fdecea; border-color: #b3261e; color: #8a1c16; }

/* Подвал */
.site-footer {
  background: var(--soft);
  border-top: 1px solid var(--line);
  padding: 28px 0;
  font-size: 14px;
  color: var(--muted);
}
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer .fcols { display: grid; grid-template-columns: 1fr; gap: 16px; }
.site-footer h4 { margin: 0 0 8px; font-size: 15px; color: var(--fg); }
.site-footer .disclaimer { margin-top: 18px; font-size: 13px; }

/* Placeholder-бейдж для черновиков */
.draft-badge {
  display: inline-block;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: #7a5b00;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}

/* Мобильный заголовок — компактный, не фиксированный */
@media (max-width: 719px) {
  .site-header .container { min-height: 0; padding-top: 8px; padding-bottom: 8px; }
  .brand { font-size: 15px; }
  .nav { gap: 2px; }
  .nav a { font-size: 13px; padding: 6px 7px; }
}

/* Десктоп */
@media (min-width: 720px) {
  .site-header { position: sticky; top: 0; }
  .header-phone { order: 3; font-size: 16px; font-weight: 700; }
  .header-phone:hover { text-decoration: underline; }
  .header-phone .hp-num { display: inline; }
  .header-phone .hp-call { display: none; }
  .header-msg { display: inline-flex; }
  .hero h1 { font-size: 38px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .price-grid { grid-template-columns: repeat(2, 1fr); }
  .site-footer .fcols { grid-template-columns: repeat(3, 1fr); }
  /* Hero в две колонки — только на главной, где есть фото-плейсхолдер */
  .hero .container:has(.hero-photo) {
    display: grid;
    grid-template-columns: 1fr 320px;
    grid-template-areas:
      "title   photo"
      "sub     photo"
      "actions photo"
      "facts   photo";
    gap: 16px 32px;
    align-items: start;
  }
  .hero h1 { grid-area: title; }
  .hero .sub { grid-area: sub; max-width: none; }
  .hero-actions { grid-area: actions; }
  .hero-facts { grid-area: facts; }
  .hero-photo {
    grid-area: photo;
    margin-top: 0;
    max-width: 320px;        /* ограничиваем ширину ячейкой 320px (было: none — фото вылезало) */
    width: 100%;
    align-self: stretch;
    overflow: hidden;        /* подстраховка: всё, что выходит за 320px, обрежется */
    aspect-ratio: auto;      /* отменяем 4/5 на десктопе, чтобы высота тянулась, а не ширина */
    border-radius: var(--radius);
  }
  .hero-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;       /* заполняет ячейку без искажения пропорций */
    object-position: 50% 25%;/* лицо в верхней трети — держим в фокусе */
  }
}

/* Cookie consent banner (Yandex.Metrika consent gate, cookie-consent.js) */
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  /* на десктопе — 16px; на мобильных поднимается над панелью «Позвонить/Написать» */
  bottom: calc(16px + var(--cta-bar-h));
  z-index: 1000;
  max-width: 640px;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(28, 37, 48, .18);
  padding: 16px 18px;
  font-size: 15px;
}
.cookie-banner--hidden { display: none; }
.cookie-banner p { margin: 0 0 12px; }
.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.cookie-actions button.btn { font: inherit; cursor: pointer; }

/* Фиксированная мобильная панель «Позвонить + Написать» (P0): только на мобильных.
   Cookie-баннер выше неё по z-index (1000) и приподнят на --cta-bar-h,
   пока оба элемента видны одновременно; после клика «Принять» остаётся только панель. */
.cta-bar { display: none; }
@media (max-width: 719px) {
  body {
    --cta-bar-h: calc(64px + env(safe-area-inset-bottom)); /* панель + жестовая полоска iPhone */
    padding-bottom: var(--cta-bar-h); /* подвал страницы не прячется за панелью */
  }
  .cta-bar {
    display: flex;
    gap: 8px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--cta-bar-h);
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: var(--bg);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 18px rgba(28, 37, 48, .08);
    z-index: 900; /* ниже cookie-баннера */
  }
  .cta-bar a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 4px;
    text-decoration: none;
    font-size: 14px; /* 4 кнопки в ряд на узком экране */
    font-weight: 700;
    text-align: center;
    border-radius: 10px;
  }
  .cta-call { background: var(--accent); color: #fff; }
  .cta-call:hover, .cta-call:focus { background: var(--accent-2); }
  .cta-write { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
  .cta-write:hover, .cta-write:focus { background: var(--soft); }
  .cta-tg { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
  .cta-tg:hover, .cta-tg:focus { background: var(--soft); }
  .cta-max { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
  .cta-max:hover, .cta-max:focus { background: var(--soft); }
}