/* ==========================================================================
   Torgai Eli — основные стили
   ========================================================================== */

:root {
  --color-primary: #1f6f5c;
  --color-primary-dark: #14503f;
  --color-primary-light: #2f8f77;
  --color-accent: #e0a52e;
  --color-bg: #ffffff;
  --color-muted: #f4f7f5;
  --color-surface: #ffffff;
  --color-border: #e3e9e6;
  --color-text: #1c2b27;
  --color-text-muted: #5a6b66;

  --container: 1180px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(20, 80, 63, 0.10);
  --shadow-sm: 0 4px 14px rgba(20, 80, 63, 0.08);
  --transition: 0.25s ease;

  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Отступ под системную «домашнюю» полосу на iPhone/Android */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --mobile-bar-height: 60px;
}

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

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

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

/* Якорные секции не должны заезжать под «липкую» шапку */
section[id], [id="top"] { scroll-margin-top: 84px; }

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration: none; }

ul { margin: 0; padding: 0; list-style: none; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; font-weight: 700; }

/* --- Утилиты --- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 20px;
}

.section { padding: 84px 0; }
.section--muted { background: var(--color-muted); }

.section__head { max-width: 640px; margin-bottom: 40px; }
.section__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-primary);
  margin: 0 0 8px;
}
.section__title { font-size: clamp(1.6rem, 3vw, 2.3rem); margin: 0; }

/* --- Кнопки --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border: 2px solid transparent;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--color-primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--color-primary-dark); }

.btn--ghost { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn--ghost:hover { background: var(--color-primary); color: #fff; }

.btn--light { background: #fff; color: var(--color-primary-dark); }
.btn--light:hover { background: var(--color-accent); color: #1c2b27; }

/* ===== Шапка ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}
.header__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 68px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; }
.logo__text { letter-spacing: 0.02em; }

.nav { margin-left: auto; }
.nav__list { display: flex; gap: 22px; }
.nav__link {
  position: relative;
  font-weight: 500;
  color: var(--color-text);
  padding: 6px 0;
}
.nav__link::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 2px;
  background: var(--color-primary);
  transition: width var(--transition);
}
.nav__link:hover::after { width: 100%; }

.header__cta { margin-left: 8px; }

/* Переключатель языка */
.lang {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
  padding: 3px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #fff;
  flex: none;
}
.lang__btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 5px 9px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition);
}
.lang__btn:hover:not(.is-active) { color: var(--color-primary); }
.lang__btn.is-active { background: var(--color-primary); color: #fff; }
.lang__btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }

/* Выпадающее меню языка (используется на узких экранах) */
.lang__toggle { display: none; }
.lang__current { font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.lang__toggle svg { width: 12px; height: 12px; transition: transform var(--transition); }
.lang.is-open .lang__toggle svg { transform: rotate(180deg); }
.lang__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  min-width: 96px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.lang__menu .lang__btn { text-align: left; width: 100%; justify-content: flex-start; padding: 9px 12px; border-radius: var(--radius-sm); }
.lang.is-open .lang__menu { display: flex; }

/* На широких экранах меню языка — обычная строка кнопок (как раньше) */
@media (min-width: 761px) {
  .lang__toggle { display: none; }
  .lang__menu {
    position: static;
    display: inline-flex;
    flex-direction: row;
    gap: 2px;
    padding: 0;
    min-width: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  .lang.is-open .lang__menu { display: inline-flex; }
  .lang__menu .lang__btn { width: auto; padding: 5px 9px; border-radius: 999px; }
}

.burger {
  display: none;
  margin-left: auto;
  width: 42px; height: 42px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  padding: 10px;
}
.burger span {
  display: block;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}
.burger span + span { margin-top: 5px; }
.burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.is-open span:nth-child(2) { opacity: 0; }
.burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== Главный экран ===== */
.hero {
  padding: 90px 0 70px;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(47, 143, 119, 0.14), transparent 60%),
    linear-gradient(180deg, #ffffff, var(--color-muted));
}
.hero__inner {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: center;
}
.hero__eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-primary);
  background: rgba(47, 143, 119, 0.10);
  padding: 6px 14px;
  border-radius: 999px;
  margin: 0 0 18px;
}
.hero__title { font-size: clamp(2rem, 5vw, 3.4rem); margin: 0 0 18px; }
.hero__title span { color: var(--color-primary); }
.hero__text { font-size: 1.08rem; color: var(--color-text-muted); max-width: 540px; margin: 0 0 28px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; }
.hero__media img { border-radius: var(--radius); box-shadow: var(--shadow); }

/* ===== Жаңалық баннері ===== */
.news-banner { padding: 28px 0 0; }
.news-banner__card {
  display: grid;
  grid-template-columns: 1.05fr 1.35fr;
  align-items: stretch;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.news-banner__media { position: relative; min-height: 260px; background: var(--color-muted); }
.news-banner__media img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; display: block; }
.news-banner__overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 16px 20px;
  color: #fff;
  background: linear-gradient(to top, rgba(20, 80, 63, 0.88), rgba(20, 80, 63, 0));
}
.news-banner__overlay-kicker {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.9;
  margin: 0 0 4px;
}
.news-banner__overlay-title { font-size: 1.15rem; font-weight: 700; margin: 0; line-height: 1.25; }
.news-banner__body {
  padding: 30px 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.news-banner__eyebrow {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #a9761a;
  background: rgba(224, 165, 46, 0.16);
  padding: 5px 12px;
  border-radius: 999px;
  margin: 0 0 14px;
}
.news-banner__title { font-size: clamp(1.15rem, 2.4vw, 1.65rem); line-height: 1.28; margin: 0 0 12px; }
.news-banner__text { color: var(--color-text-muted); margin: 0 0 14px; }
.news-banner__meta { font-weight: 700; color: var(--color-primary); margin: 0 0 16px; }
.news-banner__link {
  align-self: flex-start;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color var(--transition);
}
.news-banner__link:hover { border-bottom-color: var(--color-primary); }
@media (max-width: 760px) {
  .news-banner { padding: 16px 0 0; }
  .news-banner__card { grid-template-columns: 1fr; }
  .news-banner__media { min-height: 0; aspect-ratio: 4 / 3; }
  .news-banner__body { padding: 22px 20px; }
}

/* ===== Жаңалық беті ===== */
.header__back { margin-left: auto; margin-bottom: 0; }
.article { max-width: 760px; margin: 0 auto; }
.article__back {
  display: inline-block;
  margin: 0 0 18px;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}
.article__back:hover { text-decoration: underline; }
.article__eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #a9761a;
  background: rgba(224, 165, 46, 0.16);
  padding: 5px 12px;
  border-radius: 999px;
  margin: 0 0 14px;
}
.article__title { font-size: clamp(1.5rem, 3.4vw, 2.15rem); line-height: 1.24; margin: 0 0 12px; }
.article__meta { font-weight: 700; color: var(--color-primary); margin: 0 0 22px; }
.article__img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 0 0 24px;
}
.article__text p { color: var(--color-text); line-height: 1.7; margin: 0 0 16px; }
.article__lead { font-size: 1.12rem; font-weight: 500; }

/* ===== О нас ===== */
.about {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}
.about__text p { color: var(--color-text-muted); margin: 0 0 16px; }
.about__media img { border-radius: var(--radius); box-shadow: var(--shadow-sm); }

.checklist { margin-top: 20px; display: grid; gap: 10px; }
.checklist li { position: relative; padding-left: 30px; font-weight: 500; }
.checklist li::before {
  content: "✓";
  position: absolute; left: 0; top: 0;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.72rem;
  border-radius: 50%;
  transform: translateY(3px);
}

/* ===== Карточки услуг ===== */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }
.card__icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(47, 143, 119, 0.12);
  color: var(--color-primary);
  font-size: 1.1rem;
  margin-bottom: 16px;
}
.card__title { font-size: 1.15rem; margin: 0 0 8px; }
.card__text { color: var(--color-text-muted); margin: 0; font-size: 0.95rem; }

/* ===== Цифры ===== */
.stats-section { background: var(--color-primary-dark); color: #fff; }
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  text-align: center;
}
.stat__num { display: block; font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; color: var(--color-accent); }
.stat__label { font-size: 0.95rem; opacity: 0.85; }

/* ===== Галерея ===== */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.gallery__item {
  overflow: hidden;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.gallery__item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.gallery__item:hover img { transform: scale(1.06); }

/* ===== CTA ===== */
.cta { background: linear-gradient(120deg, var(--color-primary), var(--color-primary-light)); color: #fff; padding: 70px 0; }
.cta__inner { text-align: center; max-width: 680px; }
.cta__title { font-size: clamp(1.5rem, 3vw, 2.2rem); }
.cta__text { opacity: 0.92; margin: 0 0 26px; }

/* ===== Контакты ===== */
.contacts {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 40px;
  align-items: start;
}

.form { display: grid; gap: 16px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form__field { display: grid; gap: 6px; font-weight: 500; font-size: 0.9rem; }
.form__field input,
.form__field textarea {
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: vertical;
}
.form__field input:focus,
.form__field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(47, 143, 119, 0.16);
}
.form__field input:invalid:not(:placeholder-shown) { border-color: #d9534f; }
.form__note { font-size: 0.9rem; margin: 0; min-height: 1.2em; }
.form__note.is-ok { color: var(--color-primary); }
.form__note.is-error { color: #d9534f; }

.contact-info { display: grid; gap: 24px; }
.contact-list { display: grid; gap: 18px; }
.contact-list__label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}
.contact-list__value { font-weight: 600; font-size: 1.02rem; }
a.contact-list__value:hover { color: var(--color-primary); }

.map img { border-radius: var(--radius); box-shadow: var(--shadow-sm); width: 100%; }

/* ===== Подвал ===== */
.footer { background: #10201b; color: #cfe0da; padding: 40px 0; }
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  justify-content: space-between;
}
.footer__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #fff; }
.footer__nav { display: flex; flex-wrap: wrap; gap: 20px; }
.footer__nav a:hover { color: #fff; }
.footer__copy { margin: 0; font-size: 0.88rem; opacity: 0.8; width: 100%; text-align: center; }

/* ==========================================================================
   Новые компоненты: факты, земляки, галерея, онлайн-приёмная
   ========================================================================== */

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

/* Honeypot: скрытое поле-ловушка для ботов (люди его не видят) */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* --- Факты на главном экране --- */
.hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin: 34px 0 0;
}
.hero__facts li { display: grid; }
.hero__facts strong {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.1;
}
.hero__facts span { font-size: 0.82rem; color: var(--color-text-muted); }
.hero__caption {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 12px 2px 0;
}

.section__lead {
  color: var(--color-text-muted);
  margin: 14px 0 0;
  max-width: 620px;
}

/* Подзаголовок внутри объединённой секции (например, блок контактов) */
.section__subtitle {
  font-size: 1.3rem;
  margin: 56px 0 24px;
}

/* --- Известные земляки --- */
.people {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.person {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 20px;
  align-items: start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.person:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.person__photo img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--color-muted);
}
.person__name { font-size: 1.15rem; margin: 0 0 4px; }
.person__meta {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-primary);
  margin: 0 0 10px;
}
.person__text { color: var(--color-text-muted); font-size: 0.94rem; margin: 0; }
.person--add {
  grid-template-columns: 1fr;
  border-style: dashed;
  background: var(--color-muted);
}
.person--add .btn { margin-top: 16px; }

/* --- Подписи в галерее --- */
.gallery__item { position: relative; display: block; }
.gallery__caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 26px 14px 12px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, transparent, rgba(16, 32, 27, 0.78));
  opacity: 0;
  transition: opacity var(--transition);
}
.gallery__item:hover .gallery__caption,
.gallery__item:focus-visible .gallery__caption { opacity: 1; }
.gallery__credits {
  margin: 20px 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--color-text-muted);
  max-width: 760px;
}

/* --- Онлайн-приёмная (чат) --- */
.chat {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: var(--shadow);
  min-height: 520px;
}

.chat__main { display: flex; flex-direction: column; min-width: 0; }
.chat__header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  background: #fff;
}
.chat__avatar {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--color-primary-dark);
  color: #fff;
  font-weight: 700;
}
.chat__name { margin: 0; font-weight: 700; }
.chat__role { margin: 0; font-size: 0.82rem; color: var(--color-text-muted); }
.chat__status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--color-primary);
  font-weight: 600;
}
.chat__status i {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(47, 143, 119, 0.2);
}

.chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, #fbfdfc, #f6faf8);
  max-height: 420px;
}
.chat__empty {
  margin: auto;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  max-width: 320px;
}
.msg {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.93rem;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-sm);
}
.msg--in { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; }
.msg--out {
  align-self: flex-end;
  background: var(--color-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg--system {
  align-self: center;
  background: rgba(224, 165, 46, 0.16);
  color: #7a5a12;
  box-shadow: none;
  font-size: 0.84rem;
  text-align: center;
  max-width: 90%;
}
.msg__time { display: block; font-size: 0.68rem; opacity: 0.7; margin-top: 4px; }

/* Неотправленное сообщение (например, спам-отказ) */
.msg--failed {
  background: #fdecea;
  color: #7a1c14;
  border: 1px solid #f3c2bc;
}
.msg--failed .msg__time { color: #a0524a; }
.msg__error {
  display: block;
  margin-top: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #c0392b;
}

.chat__form {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--color-border);
  background: #fff;
  align-items: flex-end;
}
.chat__form textarea {
  flex: 1;
  font: inherit;
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  resize: none;
  max-height: 140px;
  min-height: 46px;
}
.chat__form textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(47, 143, 119, 0.16);
}
.chat__hint {
  margin: 0;
  padding: 0 16px 14px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  background: #fff;
}

/* --- Select в форме --- */
.form__field select {
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--color-text);
}
.form__field select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(47, 143, 119, 0.16);
}

/* ===== Анимация появления ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ===== Адаптив ===== */
@media (max-width: 980px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__media { order: -1; }
  .about { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .contacts { grid-template-columns: 1fr; }
  .people { grid-template-columns: 1fr; }

  /* Освобождаем место для переключателя языка */
  .header__cta { display: none; }
}

@media (max-width: 760px) {
  .section { padding: 60px 0; }

  .nav {
    position: fixed;
    inset: 68px 0 auto 0;
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition);
  }
  .nav.is-open { max-height: 320px; }
  .nav__list { flex-direction: column; gap: 0; padding: 8px 20px 16px; }
  .nav__link { display: block; padding: 12px 0; border-bottom: 1px solid var(--color-border); }
  .nav__link::after { display: none; }

  .header__cta { display: none; }
  .burger { display: block; }

  /* На телефоне переключатель языка — компактное выпадающее меню */
  .lang { margin-left: auto; padding: 0; border: 0; background: transparent; position: relative; }
  .logo { min-width: 0; font-size: 1.02rem; }
  .logo__text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lang__toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 46px;
    height: 46px;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.78rem;
    color: var(--color-text);
  }
  .lang__btn { display: none; }
  .lang.is-open .lang__btn { display: block; }
  .burger { margin-left: 8px; }

  .cards { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .form__row { grid-template-columns: 1fr; }
  .person { grid-template-columns: 1fr; }
  .person__photo { max-width: 220px; }
  .chat__messages { max-height: 340px; }
}

@media (max-width: 420px) {
  .gallery { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Мобильная адаптация с автоопределением устройства
   --------------------------------------------------------------------------
   Классы device-mobile / device-tablet / device-desktop ставит
   js/device-detect.js. Если JS выключен — работают резервные media-запросы.
   ========================================================================== */

/* --- Нижняя навигация (только телефоны) --- */
.mobile-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: none;
  align-items: stretch;
  justify-content: space-around;
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--color-border);
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -6px 20px rgba(20, 80, 63, 0.07);
}

.mobile-bar__link {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  min-height: var(--mobile-bar-height);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-text-muted);
  -webkit-tap-highlight-color: transparent;
  transition: color var(--transition), transform var(--transition);
}
.mobile-bar__link svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mobile-bar__link.is-active { color: var(--color-primary); }
.mobile-bar__link.is-active svg { transform: translateY(-1px); }
.mobile-bar__link:active { transform: scale(0.94); }

/* Показываем панель только на смартфонах */
html.device-mobile .mobile-bar { display: flex; }
html.device-desktop .mobile-bar,
html.device-tablet .mobile-bar { display: none; }

/* Резерв, если скрипт детекта не выполнился */
@media (max-width: 760px) {
  html:not(.device-desktop):not(.device-tablet) .mobile-bar { display: flex; }
}

/* Отступ контента, чтобы нижняя панель не перекрывала страницу */
html.device-mobile body {
  padding-bottom: calc(var(--mobile-bar-height) + var(--safe-bottom));
}
@media (max-width: 760px) {
  html:not(.device-desktop):not(.device-tablet) body {
    padding-bottom: calc(var(--mobile-bar-height) + var(--safe-bottom));
  }
}

/* --- Тач-устройства: убираем hover-эффекты, делаем подписи видимыми --- */
@media (hover: none) {
  .card:hover,
  .person:hover { transform: none; box-shadow: none; }
  .gallery__item:hover img { transform: none; }
  .gallery__caption { opacity: 1; }
}

/* --- Смартфоны: увеличенные тап-таргеты и компактная вёрстка --- */
html.device-mobile .btn {
  min-height: 48px;
  padding: 14px 24px;
  font-size: 1rem;
}
html.device-mobile .nav__link {
  display: flex;
  align-items: center;
  min-height: 48px;
}
html.device-mobile .burger { width: 46px; height: 46px; }
html.device-mobile .section { padding: 54px 0; }
html.device-mobile .hero { padding: 56px 0 48px; }
html.device-mobile .hero__title { font-size: clamp(1.9rem, 8vw, 2.6rem); }
html.device-mobile .hero__text { font-size: 1rem; }
html.device-mobile .hero__actions { gap: 10px; }
html.device-mobile .hero__actions .btn { flex: 1 1 auto; }
html.device-mobile .hero__facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 26px;
}
html.device-mobile .hero__facts strong { font-size: 1.35rem; }
html.device-mobile .hero__facts span { font-size: 0.74rem; line-height: 1.35; }
html.device-mobile .container { padding-inline: 16px; }

/* Поля ввода 16px — иначе iOS Safari зумит страницу при фокусе */
html.device-mobile .form__field input,
html.device-mobile .form__field textarea,
html.device-mobile .form__field select,
html.device-mobile .chat__form textarea { font-size: 16px; }

/* На телефоне прячем декоративную карту-заглушку в пользу контента */
html.device-mobile .chat__messages { max-height: 320px; }
html.device-mobile .cta { padding: 54px 0; }

/* Меню занимает почти весь экран и прокручивается */
html.device-mobile .nav {
  position: fixed;
  inset: 68px 0 auto 0;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  max-height: 0;
  overflow: hidden;
  box-shadow: 0 18px 30px rgba(20, 80, 63, 0.12);
}
html.device-mobile .nav__list { flex-direction: column; gap: 0; padding: 8px 20px 16px; }
html.device-mobile .nav__link { padding: 12px 0; border-bottom: 1px solid var(--color-border); }
html.device-mobile .nav__link::after { display: none; }

/* На телефоне всегда мобильное меню, даже в ландшафте (ширина > 760px) */
html.device-mobile .burger { display: block; }
html.device-mobile .header__cta { display: none; }
html.device-mobile .lang { margin-left: auto; padding: 0; border: 0; background: transparent; position: relative; }
html.device-mobile .logo { min-width: 0; font-size: 1.02rem; }
html.device-mobile .logo__text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.device-mobile .lang__toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 46px;
  height: 46px;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--color-text);
}
html.device-mobile .lang__btn { display: none; padding: 9px 12px; border-radius: var(--radius-sm); }
html.device-mobile .lang.is-open .lang__btn { display: block; }
html.device-mobile .burger { margin-left: 8px; }
html.device-mobile .nav.is-open {
  max-height: calc(100vh - 68px);
  max-height: calc(var(--vh, 1vh) * 100 - 68px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
body.nav-open { overflow: hidden; }

/* --- Улучшения существующих брейкпоинтов для мобильных --- */
@media (max-width: 760px) {
  .nav.is-open {
    max-height: calc(100vh - 68px);
    max-height: calc(var(--vh, 1vh) * 100 - 68px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav__list { padding-bottom: calc(20px + var(--safe-bottom)); }
  .form__field input,
  .form__field textarea,
  .form__field select,
  .chat__form textarea { font-size: 16px; }
  .hero__facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .section { padding: 54px 0; }
  .footer { padding-bottom: calc(40px + var(--safe-bottom)); }
}

@media (max-width: 420px) {
  .hero__facts { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .hero__facts strong { font-size: 1.2rem; }
  .btn { padding: 13px 20px; }
}

/* --- Горизонтальная ориентация телефона --- */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .hero { padding: 32px 0; }
  html.device-mobile .nav.is-open { max-height: calc(100vh - 68px); }
}

/* --- Планшеты: не даём карточкам и галерее быть слишком крупными --- */
html.device-tablet .cards { grid-template-columns: repeat(2, 1fr); }
html.device-tablet .gallery { grid-template-columns: repeat(3, 1fr); }
html.device-tablet .people { grid-template-columns: repeat(2, 1fr); }

