/* ============================================================
   Красный конь — лендинг дизайн-группы, Якутск
   Палитра по ТЗ: глубокий красный (акцент), теплый молочный фон,
   графитовый текст, терракотовый вторичный акцент.
   ============================================================ */

:root {
  --color-primary: #B3232A;        /* глубокий красный: CTA, активные состояния */
  --color-primary-dark: #8E1B21;   /* hover для красного */
  --color-background: #FAF6F0;     /* теплый молочный фон */
  --color-surface: #F3EDE4;        /* светлый серо-бежевый: разделители, секции */
  --color-card: #FFFDF9;           /* карточки */
  --color-text: #2A2723;           /* графитовый текст */
  --color-text-muted: #6E675E;     /* вторичный текст */
  --color-accent: #B5644B;         /* приглушенный терракотовый */
  --color-border: #E6DDD1;
  --color-ok: #3E7A4E;
  --color-error: #A32027;

  --font-heading: "Playfair Display", Georgia, serif;
  --font-body: "Manrope", "Segoe UI", system-ui, sans-serif;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 6px 24px rgba(42, 39, 35, 0.08);
  --shadow-lg: 0 16px 48px rgba(42, 39, 35, 0.16);
  --container: 1200px;
  --header-h: 76px;
}

/* ---------- Сброс и база ---------- */
*, *::before, *::after { box-sizing: border-box; }

/* Атрибут hidden всегда сильнее авторских display-правил */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0 0 0.5em; line-height: 1.2; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--color-primary-dark); }

/* Видимый фокус для клавиатурной навигации (WCAG) */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  background: var(--color-primary);
  color: #fff;
  padding: 10px 18px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 600;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 0; color: #fff; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}
.container--narrow { max-width: 860px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;               /* интерактивные элементы >= 44x44 */
  padding: 12px 28px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}
.btn--primary {
  background: var(--color-primary);
  color: #fff;
}
.btn--primary:hover {
  background: var(--color-primary-dark);
  color: #fff;
  box-shadow: var(--shadow);
}
.btn--ghost {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn--ghost:hover {
  background: rgba(179, 35, 42, 0.08);
  color: var(--color-primary-dark);
}
.btn--outline {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-text-muted);
}
.btn--outline:hover { border-color: var(--color-text); }
.btn--lg { min-height: 56px; padding: 15px 34px; font-size: 17px; }
.btn--sm { min-height: 44px; padding: 9px 18px; font-size: 15px; }
.btn--full { width: 100%; }

.link-btn {
  background: none;
  border: none;
  padding: 4px 2px;
  font: inherit;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover { color: var(--color-primary-dark); }

/* ---------- Хедер ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 246, 240, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: var(--header-h);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--color-text);
}
.logo__mark { width: 44px; height: 44px; flex: none; }
.logo__name {
  display: block;
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
}
.logo__tagline {
  display: block;
  font-size: 12.5px;
  color: var(--color-text-muted);
}

.main-nav__list {
  display: flex;
  gap: 22px;
  list-style: none;
}
.main-nav a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  padding: 8px 2px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.main-nav a:hover { color: var(--color-primary); border-bottom-color: var(--color-primary); }

.site-header__contacts {
  display: flex;
  align-items: center;
  gap: 18px;
}
.site-header__phone {
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
}
.site-header__phone:hover { color: var(--color-primary); }
.site-header__messenger {
  font-size: 15px;
  color: var(--color-text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 48px;
  height: 48px;
  padding: 10px;
  background: none;
  border: none;
  cursor: pointer;
}
.burger span {
  display: block;
  height: 2.5px;
  width: 100%;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* ---------- Первый экран ---------- */
.hero {
  padding: 56px 0 64px;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(181, 100, 75, 0.14), transparent 65%),
    var(--color-background);
}
.hero__inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
}
.hero__kicker {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
}
.hero__title {
  font-family: var(--font-heading);
  font-size: clamp(34px, 4.6vw, 56px);
  font-weight: 700;
  margin-bottom: 18px;
}
.hero__subtitle {
  font-size: clamp(17px, 1.6vw, 19px);
  max-width: 54ch;
  color: var(--color-text-muted);
}
.hero__accent {
  display: inline-block;
  margin: 6px 0 26px;
  padding: 8px 16px;
  border-left: 3px solid var(--color-primary);
  background: var(--color-surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-weight: 600;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}
.hero__chat-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 26px;
  padding: 6px 2px;
  background: none;
  border: none;
  font: inherit;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: underline dashed;
  text-underline-offset: 4px;
  cursor: pointer;
}
.hero__chat-link:hover { color: var(--color-primary); }
.hero__trust {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  list-style: none;
}
.hero__trust li {
  padding: 7px 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-card);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
}

/* Фото и заглушки (стоковые изображения не используются) */
.hero__photo {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  object-fit: cover;
}
.hero__photo-caption {
  margin: 10px 2px 0;
  font-size: 13.5px;
  color: var(--color-text-muted);
}

.service-card__photo,
.project-card__photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}
.service-card__photo { border-radius: var(--radius) var(--radius) 0 0; }
.project-card__photo { border-radius: var(--radius) var(--radius) 0 0; }

.media-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--color-accent);
  text-align: center;
  border: 2px dashed var(--color-accent);
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(-45deg, rgba(181, 100, 75, 0.06) 0 12px, transparent 12px 24px),
    var(--color-surface);
  padding: 24px;
}
.media-placeholder p { margin: 0; font-weight: 600; }
.media-placeholder__note { font-size: 13px; font-weight: 400; color: var(--color-text-muted); }
.media-placeholder--card {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius) var(--radius) 0 0;
  border-top-width: 0;
  border-left-width: 0;
  border-right-width: 0;
  font-size: 14.5px;
  min-height: 180px;
}
.media-placeholder--project { aspect-ratio: 4 / 3; font-size: 14.5px; min-height: 180px; }
.media-placeholder--avatar {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  font-family: var(--font-heading);
  font-size: 40px;
  font-weight: 700;
  padding: 0;
}

/* ---------- Секции ---------- */
.section { padding: 84px 0; }
.section--tight { padding: 40px 0 8px; }
.section--surface { background: var(--color-surface); }
.section--cta {
  background:
    radial-gradient(700px 400px at 10% 0%, rgba(179, 35, 42, 0.08), transparent 60%),
    var(--color-background);
}
.section__header { max-width: 760px; margin-bottom: 42px; }
.section__title {
  font-family: var(--font-heading);
  font-size: clamp(26px, 3.2vw, 38px);
  font-weight: 700;
}
.section__subtitle {
  font-size: 18px;
  color: var(--color-text-muted);
}
.section__cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: 44px;
}

.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Быстрая форма ---------- */
.quick-form {
  display: grid;
  grid-template-columns: 0.9fr 1.6fr;
  gap: 8px 36px;
  padding: 28px 32px;
}
.quick-form__title {
  font-family: var(--font-heading);
  font-size: 24px;
  margin-bottom: 6px;
}
.quick-form__text { color: var(--color-text-muted); font-size: 15px; margin: 0; }
.quick-form__fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 16px;
  align-items: end;
}
.quick-form__submit { display: flex; }
.quick-form__submit .btn { width: 100%; }

/* ---------- Поля форм ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field-check {
  font-size: 14.5px;
  font-weight: 600;
}
.field input, .field select, .field textarea {
  font: inherit;
  font-size: 16px;
  color: var(--color-text);
  background: #fff;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  min-height: 48px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field textarea { min-height: auto; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(179, 35, 42, 0.15);
}
.field--wide { grid-column: 1 / -1; }
.req { color: var(--color-primary); }

.field input[aria-invalid="true"],
.field select[aria-invalid="true"] {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(163, 32, 39, 0.12);
}
.field__error {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--color-error);
  margin: 0;
}
.field-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 18px 0;
  font-weight: 400;
  cursor: pointer;
}
.field-check input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--color-primary);
  flex: none;
}
.field-check input[aria-invalid="true"] { outline: 2px solid var(--color-error); outline-offset: 2px; }

.form-note { font-size: 13.5px; color: var(--color-text-muted); margin: 12px 0 0; }
.form-status {
  font-weight: 600;
  margin: 14px 0 0;
}
.form-status--ok { color: var(--color-ok); }
.form-status--error { color: var(--color-error); }

/* ---------- Услуги ---------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.service-card {
  display: flex;
  flex-direction: column;
  padding: 0 24px 22px;
  overflow: hidden;
}
.service-card__photo { margin: 0 -24px; width: calc(100% + 48px); max-width: none; }
.service-card h3 {
  font-size: 19px;
  font-weight: 700;
  margin: 16px 0 8px;
}
.service-card p { color: var(--color-text-muted); font-size: 15.5px; margin-bottom: 12px; }
.link-more {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 2px 0;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-primary);
  cursor: pointer;
  border-bottom: 1.5px solid transparent;
}
.link-more:hover { border-bottom-color: var(--color-primary); }
.service-card__details {
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  font-size: 15px;
}
.service-card__details p { margin: 0; color: var(--color-text); }

/* ---------- Портфолио ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 34px;
}
.filter {
  min-height: 44px;
  padding: 9px 20px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-card);
  border: 1.5px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.filter:hover { border-color: var(--color-accent); color: var(--color-text); }
.filter.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.project-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.project-card.is-hidden { display: none; }
.project-card .media-placeholder {
  border: none;
  border-bottom: 2px dashed var(--color-accent);
  border-radius: var(--radius) var(--radius) 0 0;
}
.project-card__body { padding: 18px 20px 20px; }
.project-card__meta {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
}
.project-card__body h3 { font-size: 18.5px; margin-bottom: 6px; }
.project-card__task { font-size: 14.5px; color: var(--color-text-muted); margin-bottom: 12px; }

.status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
}
.status--done { background: rgba(62, 122, 78, 0.14); color: var(--color-ok); }
.status--wip { background: rgba(181, 100, 75, 0.16); color: var(--color-accent); }
.status--concept { background: rgba(42, 39, 35, 0.08); color: var(--color-text-muted); }
.status--placeholder { background: rgba(42, 39, 35, 0.07); color: var(--color-text-muted); font-style: italic; }

/* ---------- Преимущества ---------- */
.advantages-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.advantage-card { padding: 24px; }
.advantage-card h3 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 18px;
}
.advantage-card__num {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 600;
  color: var(--color-primary);
  opacity: 0.85;
}
.advantage-card p { margin: 8px 0 0; font-size: 15.5px; color: var(--color-text-muted); }

/* ---------- О студии ---------- */
.about__grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 28px;
  align-items: stretch;
}
.founders {
  display: flex;
  flex-direction: column;
  gap: 20px;
  /* колонка и обе карточки тянутся под высоту текстовой карточки слева */
}
.founder {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  padding: 22px 26px;
  margin: 0;
  text-align: left;
}
.founder__photo { margin: 0; flex: none; }
.founder figcaption h3 { font-size: 18px; margin-bottom: 2px; }
.founder figcaption p { margin: 0; font-size: 14.5px; color: var(--color-text-muted); }
.about__text {
  padding: 32px 36px;
  font-size: 16.5px;
}
.about__text p:last-child { margin-bottom: 0; }

/* ---------- Процесс ---------- */
.process-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 22px;
  counter-reset: step;
}
.process-step {
  display: flex;
  gap: 18px;
  padding: 24px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.process-step__num {
  font-family: var(--font-heading);
  font-size: 30px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
  flex: none;
}
.process-step__body h3 { font-size: 18px; margin-bottom: 6px; }
.process-step__body p { margin: 0; font-size: 15.5px; color: var(--color-text-muted); }

/* ---------- Отзывы ---------- */
.reviews__placeholder {
  max-width: 720px;
  margin: 0 auto;
  padding: 30px 34px;
  font-size: 16.5px;
}
.reviews__case-note {
  color: var(--color-text-muted);
  font-size: 14.5px;
  border-top: 1px dashed var(--color-border);
  padding-top: 14px;
}

/* ---------- FAQ ---------- */
.accordion {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.accordion__item {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.accordion__heading { margin: 0; }
.accordion__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 56px;
  padding: 16px 20px;
  background: none;
  border: none;
  font: inherit;
  font-size: 16.5px;
  font-weight: 700;
  text-align: left;
  color: var(--color-text);
  cursor: pointer;
}
.accordion__trigger:hover { color: var(--color-primary); }
.accordion__icon { flex: none; color: var(--color-accent); transition: transform 0.25s ease; }
.accordion__trigger[aria-expanded="true"] .accordion__icon { transform: rotate(180deg); }
.accordion__panel {
  padding: 0 20px 18px;
  font-size: 15.5px;
  color: var(--color-text-muted);
}
.accordion__panel p { margin: 0; }
.faq__chat-hint {
  margin-top: 26px;
  text-align: center;
  color: var(--color-text-muted);
}

/* ---------- Финальная форма ---------- */
.lead-form { padding: 34px 36px; }
.lead-form__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 18px;
}
.lead-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

/* ---------- Футер ---------- */
.site-footer {
  background: var(--color-text);
  color: #EFE9E1;
  padding: 56px 0 0;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1fr 0.6fr;
  gap: 36px;
  align-items: start;
  padding-bottom: 40px;
}
.site-footer__logo {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.site-footer p { margin: 0 0 6px; font-size: 15px; color: #CFC7BC; }
.site-footer__contacts { display: flex; flex-direction: column; gap: 8px; }
.site-footer__contacts a { color: #fff; font-weight: 600; text-decoration: none; }
.site-footer__contacts a:hover { color: #F1B0B4; text-decoration: underline; }
.site-footer__nav ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.site-footer__nav a { color: #CFC7BC; text-decoration: none; font-size: 15px; }
.site-footer__nav a:hover { color: #fff; text-decoration: underline; }
.site-footer__cta { display: flex; justify-content: flex-end; }
.site-footer__bottom {
  border-top: 1px solid rgba(239, 233, 225, 0.16);
  padding-top: 18px;
  padding-bottom: 18px;
}
.site-footer__bottom p { margin: 0; font-size: 13.5px; color: #9C948A; }

/* ---------- Модальное окно ---------- */
.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: var(--color-background);
  box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: rgba(42, 39, 35, 0.55); }
.modal__inner { position: relative; padding: 34px 32px 28px; overflow-y: auto; max-height: calc(100vh - 48px); }
.modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 50%;
  color: var(--color-text-muted);
  cursor: pointer;
}
.modal__close:hover { background: var(--color-surface); color: var(--color-text); }
.modal__title { font-family: var(--font-heading); font-size: 28px; }
.modal__subtitle { color: var(--color-text-muted); font-size: 15px; }
.modal form .field { margin-bottom: 14px; }
.modal .btn--full { margin-top: 4px; }

/* ---------- Чат-виджет ---------- */
.chat-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 150;
}
.chat-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.chat-fab:hover { background: var(--color-primary-dark); transform: scale(1.06); }
.chat-fab__close { display: none; }
.chat-widget.is-open .chat-fab__close { display: block; }
.chat-widget.is-open .chat-fab__icon { display: none; }

.chat-panel[hidden] { display: none; }

.chat-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  width: 388px;
  max-width: calc(100vw - 40px);
  max-height: min(680px, calc(100vh - 110px));
  display: flex;
  flex-direction: column;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.chat-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 14px;
  background: var(--color-primary);
  color: #fff;
}
.chat-panel__title { font-size: 16px; margin: 0 0 2px; color: #fff; }
.chat-panel__status { margin: 0; font-size: 12.5px; color: rgba(255, 255, 255, 0.85); }
.chat-panel__controls { display: flex; gap: 4px; }
.chat-icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
}
.chat-icon-btn:hover { background: rgba(255, 255, 255, 0.18); }

.chat-panel__messages {
  flex: 1;
  min-height: 220px;
  max-height: 420px;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--color-background);
}
.chat-msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg--bot {
  align-self: flex-start;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: 4px;
}
.chat-msg--user {
  align-self: flex-end;
  background: var(--color-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg--error {
  align-self: stretch;
  max-width: 100%;
  background: rgba(163, 32, 39, 0.08);
  border: 1px solid rgba(163, 32, 39, 0.3);
  color: var(--color-error);
  font-size: 14px;
}
.chat-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 5px;
  padding: 12px 16px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
}
.chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent);
  animation: typing 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-panel__error {
  padding: 12px 14px;
  background: rgba(163, 32, 39, 0.07);
  border-top: 1px solid rgba(163, 32, 39, 0.25);
  font-size: 14px;
}
.chat-panel__error p { margin: 0 0 10px; color: var(--color-error); font-weight: 500; }
.chat-panel__error-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.chat-panel__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px 4px;
  border-top: 1px solid var(--color-border);
}
.chat-panel__quick button {
  min-height: 44px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-card);
  border: 1.5px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.chat-panel__quick button:hover { border-color: var(--color-primary); }

.chat-panel__input {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
}
.chat-panel__input input {
  flex: 1;
  min-height: 48px;
  font: inherit;
  font-size: 15.5px;
  padding: 10px 14px;
  color: var(--color-text);
  background: #fff;
  border: 1.5px solid var(--color-border);
  border-radius: 999px;
}
.chat-panel__input input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(179, 35, 42, 0.15);
}
.chat-panel__send {
  width: 48px;
  height: 48px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.chat-panel__send:hover { background: var(--color-primary-dark); }
.chat-panel__send:disabled { opacity: 0.5; cursor: default; }

.chat-panel__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px 12px;
  border-top: 1px solid var(--color-border);
  font-size: 14px;
}

/* ---------- Cookie-уведомление ---------- */
.cookie-bar {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 140;
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 460px;
  padding: 16px 18px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
}
.cookie-bar p { margin: 0; }
.cookie-bar .btn { flex: none; }

/* ---------- Появление при прокрутке ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ============================================================
   Адаптивность: планшеты 768-1199, мобильные 320-767
   ============================================================ */
@media (max-width: 1199px) {
  .services-grid, .portfolio-grid, .advantages-grid { grid-template-columns: repeat(2, 1fr); }
  .site-header__messenger { display: none; }
  .hero__inner { gap: 32px; }
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
  .site-footer__cta { justify-content: flex-start; }
}

@media (max-width: 767px) {
  body { font-size: 16px; }
  .section { padding: 60px 0; }
  .section--tight { padding: 32px 0 4px; }
  .section__header { margin-bottom: 30px; }

  /* Мобильное меню */
  .site-header { position: static; }
  .site-header__inner {
    flex-wrap: wrap;
    padding-top: 12px;
    padding-bottom: 12px;
    row-gap: 0;
    min-height: 0;
  }
  .burger { order: 5; display: flex; }
  .main-nav {
    order: 6;
    width: 100%;
    display: none;
    padding: 10px 0 16px;
    border-top: 1px solid var(--color-border);
  }
  .main-nav.is-open { display: block; }
  .main-nav__list { flex-direction: column; gap: 4px; }
  .main-nav a { display: block; padding: 12px 4px; font-size: 17px; }
  .site-header__contacts { flex: 1; justify-content: flex-end; gap: 12px; }
  .site-header__phone { font-size: 15px; }
  .site-header__contacts .btn--sm { padding: 9px 14px; font-size: 14px; }
  html { scroll-padding-top: 16px; }

  .hero { padding: 36px 0 48px; }
  .hero__inner { grid-template-columns: 1fr; }
  .hero__media { order: -1; }
  .media-placeholder--hero { min-height: 240px; }
  .hero__actions .btn { width: 100%; }

  .quick-form { grid-template-columns: 1fr; padding: 22px 20px; }
  .quick-form__fields { grid-template-columns: 1fr; }

  .services-grid, .portfolio-grid, .advantages-grid, .process-list { grid-template-columns: 1fr; }

  .about__grid { grid-template-columns: 1fr; }
  .about__text { padding: 26px 22px; }

  .lead-form { padding: 24px 18px; }
  .lead-form__grid { grid-template-columns: 1fr; }
  .lead-form__actions .btn { width: 100%; }
  .field--wide { grid-column: auto; }

  .site-footer { padding-top: 40px; }
  .site-footer__grid { grid-template-columns: 1fr; gap: 26px; }
  .site-footer__cta { justify-content: flex-start; }
  .site-footer__cta .btn { width: 100%; }

  /* Мобильный чат: на всю ширину экрана, поле ввода не перекрывается клавиатурой */
  .chat-widget { right: 0; bottom: 0; left: 0; }
  .chat-fab {
    position: absolute;
    right: 16px;
    bottom: 16px;
  }
  .chat-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    max-height: none;
    height: 100dvh;
    border-radius: 0;
    border: none;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .chat-panel__messages { max-height: none; flex: 1; }
  .chat-panel__header { padding-top: calc(env(safe-area-inset-top, 0) + 14px); }

  .cookie-bar {
    left: 12px;
    right: 76px;
    bottom: 12px;
    max-width: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

@media (max-width: 400px) {
  .container { padding: 0 14px; }
  .logo__tagline { display: none; }
  .hero__trust li { font-size: 13px; padding: 6px 10px; }
}

/* ---------- Уважение к prefers-reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* Печать */
@media print {
  .site-header, .chat-widget, .cookie-bar, .btn, .filters { display: none !important; }
  body { background: #fff; color: #000; }
}
