/* GKL • общая основа страниц v2 (главная с тремя входами и оболочки направлений).
   Здесь только то, что по заданию остаётся общим: сетка, глобальная шапка и подвал,
   кнопки, поля форм, служебные плашки, доступность, переходы между страницами.
   Всё, что задаёт характер направления, — в assets/css/dir-*.css под
   [data-direction="…"]. Прежняя страница с интро A/B этот файл не подключает. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }

/* Нейтральная тема по умолчанию (служебные страницы). Темы направлений
   переопределяют эти переменные на <body data-direction="…">. */
body {
  --bg: #f4f3f0;
  --surface: #ffffff;
  --surface-2: #ebe9e4;
  --ink: #17181b;
  --ink-2: #5d6068;
  --line: #d9d6cf;
  --accent: #2b2d33;
  --accent-ink: #ffffff;
  --accent-soft: #e4e2dc;
  --header-bg: #ffffff;
  --header-ink: #17181b;
  --header-ink-2: #5d6068;
  --header-line: #e2dfd8;
  --focus: #2f6df0;
  --radius: 10px;
  --wrap: 1240px;
  --gutter: clamp(16px, 3vw, 40px);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  margin: 0;
  font-family: var(--font);
  font-size: clamp(0.95rem, 1.05vw, 1.05rem);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}

img, svg { max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.12; margin: 0; }
p { margin: 0; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 200;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 6px;
}
.skip-link:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
main[id], main [id] { scroll-margin-top: 88px; }

/* ---------- Глобальная шапка: одинаковое положение на всех страницах ---------- */
.gh {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg); color: var(--header-ink);
  border-bottom: 1px solid var(--header-line);
  view-transition-name: global-header;
}
.gh__row { display: flex; align-items: center; gap: clamp(10px, 2vw, 28px); min-height: 68px; }
.gh__brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.gh__mark { font-weight: 800; font-size: 1.45rem; letter-spacing: .06em; }
.gh__sub { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--header-ink-2); white-space: nowrap; }
@media (max-width: 1480px) { .gh__sub { display: none; } }
.gh__nav { display: flex; gap: clamp(8px, 1.5vw, 22px); margin-left: auto; }
.gh__nav a {
  text-decoration: none; font-size: .9rem; color: var(--header-ink-2);
  padding: 8px 0; border-bottom: 2px solid transparent; white-space: nowrap;
}
.gh__nav a:hover, .gh__nav a[aria-current="page"] { color: var(--header-ink); border-bottom-color: var(--accent); }
.gh__cta { margin-left: 4px; }
/* Allow a long header CTA to wrap with wider system-font fallbacks. */
.gh .gh__cta { white-space: normal; text-align: center; }
.gh__toggle { display: none; }

@media (max-width: 1080px) {
  .gh__nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; margin: 0;
    flex-direction: column; gap: 0; padding: 6px var(--gutter) 16px;
    background: var(--header-bg); border-bottom: 1px solid var(--header-line);
    max-height: calc(100vh - 110px);
    max-height: calc(100dvh - 110px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .gh__nav.is-open { display: flex; }
  .gh__nav a { padding: 13px 0; border-bottom: 1px solid var(--header-line); white-space: normal; }
  .gh__toggle {
    display: inline-flex; align-items: center; justify-content: center; margin-left: auto;
    width: 46px; height: 46px; border-radius: 8px; cursor: pointer;
    background: transparent; color: var(--header-ink); border: 1px solid var(--header-line);
  }
  /* .gh .gh__cta, а не .gh__cta: иначе .b-btn ниже по файлу возвращает display */
  .gh .gh__cta { display: none; }
}
@media (max-width: 520px) { .gh__sub { display: none; } }

/* ---------- Бренд СЕРГАЛ (O15): в шапке — компакт «знак + СЕРГАЛ», в подвале — он же + подпись ----------
   Файлы знака и lockup — assets/brand/ (on-dark / on-light по поверхности шапки страницы). */
.gh__brand.sg-brand { align-items: center; flex: 0 0 auto; }
.sg-brand__lockup { display: block; height: 36px; width: 133.155px; aspect-ratio: 266.31 / 72; }
@media (max-width: 520px) { .sg-brand__lockup { height: 32px; width: 118.36px; } }
.sg-foot { margin: 0 0 12px; }
.sg-foot__lockup { display: block; height: 40px; width: 147.95px; aspect-ratio: 266.31 / 72; }
.sg-foot__desc { margin: 10px 0 0; font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: #a9adb6; }

/* ---------- Локальное меню раздела ---------- */
.subnav { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .86rem; }
.subnav a { text-decoration: none; color: inherit; opacity: 1; padding: 4px 0; border-bottom: 1px solid transparent; }
.subnav a:hover { opacity: 1; border-bottom-color: currentColor; }

/* ---------- Кнопки ---------- */
.b-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 22px; border-radius: 8px; cursor: pointer;
  font: inherit; font-size: .96rem; font-weight: 650; text-decoration: none; white-space: nowrap;
  border: 1px solid transparent; transition: background .18s, border-color .18s, transform .18s;
}
@media (max-width: 420px) { .b-btn { white-space: normal; text-align: center; } }
.b-btn--accent { background: var(--accent); color: var(--accent-ink); }
.b-btn--accent:hover { filter: brightness(1.08); }
.b-btn--ghost { background: transparent; color: inherit; border-color: currentColor; }
.b-btn--ghost:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.b-btn--sm { min-height: 40px; padding: 8px 16px; font-size: .88rem; }

/* ---------- Формы (общие поля; раскладка и характер — в теме направления) ---------- */
.f-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.f-grid .f-full { grid-column: 1 / -1; }
@media (max-width: 640px) { .f-grid { grid-template-columns: 1fr; } }
.f-field label, .f-legend { display: block; font-size: .84rem; color: var(--ink-2); margin-bottom: 6px; }
.f-input {
  width: 100%; min-height: 48px; padding: 11px 13px; font: inherit; font-size: .96rem;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
textarea.f-input { min-height: 104px; resize: vertical; }
.f-input:focus-visible { outline-offset: 0; }
fieldset.f-set { border: 0; padding: 0; margin: 0; min-width: 0; }
.f-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.f-choice { position: relative; }
.f-choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.f-choice span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 10px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: .92rem; cursor: pointer;
}
.f-choice input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.f-choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.f-consent { display: flex; gap: 10px; align-items: flex-start; font-size: .84rem; color: var(--ink-2); }
.f-consent input { width: 20px; height: 20px; margin-top: 2px; flex: 0 0 auto; }
.f-demo {
  border: 1px solid #c9a93c; background: #fff6d6; color: #5a4608;
  border-radius: 8px; padding: 12px 14px; font-size: .86rem;
}
.f-status { margin-top: 14px; padding: 12px 14px; border-radius: 8px; font-size: .9rem; }
.f-status:empty { display: none; }
.f-status[data-kind="demo"] { border: 1px solid #c9a93c; background: #fff6d6; color: #5a4608; }
.f-status[data-kind="error"] { border: 1px solid #d49a9a; background: #fdeeee; color: #7a1f1f; }

/* ---------- Контакт без формы: телефон + Telegram ---------- */
.contact-cta {
  border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 4vw, 34px);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-soft);
}
[data-direction="home"] .contact-cta { background: var(--surface-2); }
.contact-cta__lead { margin: 0; color: var(--ink-2); line-height: 1.6; }
.contact-cta__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.contact-cta__actions .b-btn { min-width: min(210px, 100%); }
.contact-cta__meta { margin: 16px 0 0; color: var(--ink-2); font-size: .86rem; line-height: 1.55; }
@media (max-width: 560px) {
  .contact-cta__actions { display: grid; grid-template-columns: 1fr; }
  .contact-cta__actions .b-btn { width: 100%; min-width: 0; }
}

/* ---------- Честные заглушки материалов ---------- */
.stub {
  border: 1px dashed var(--line); border-radius: var(--radius); padding: 22px;
  background: var(--surface); color: var(--ink-2);
}
.stub strong { color: var(--ink); }
.tag {
  display: inline-block; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase;
  border: 1px solid currentColor; border-radius: 4px; padding: 3px 8px; opacity: .8;
}
.art-note { font-size: .74rem; opacity: .75; }

/* ---------- Подвал ---------- */
.gf { background: #141518; color: #a9adb6; padding: 44px 0 28px; font-size: .9rem; }
.gf a { text-decoration: none; }
.gf a:hover { color: #fff; }
.gf__grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.2fr; gap: 26px; }
@media (max-width: 900px) { .gf__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .gf__grid { grid-template-columns: 1fr; } }
.gf h2 { font-size: .95rem; color: #fff; margin-bottom: 12px; }
.gf ul { list-style: none; margin: 0; padding: 0; }
.gf li { margin-bottom: 8px; }
.gf__legal { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 28px; flex-wrap: wrap; border-top: 1px solid rgba(255,255,255,.12); margin-top: 26px; padding-top: 18px; font-size: .82rem; line-height: 1.55; }
.gf__legal span:first-child { max-width: 62ch; }
.gf__bottom {
  margin-top: 26px; padding-top: 16px; border-top: 1px solid #2a2c31;
  display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; font-size: .8rem; color: #7d818a;
}

.legal-page { max-width: 900px; padding-top: clamp(40px, 7vw, 84px); padding-bottom: clamp(56px, 8vw, 96px); }
.legal-page__eyebrow { color: var(--accent, #8c683d); font-size: .78rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 12px; }
.legal-page h1 { max-width: 18ch; font-size: clamp(2rem, 5vw, 4rem); line-height: 1.02; letter-spacing: -.035em; margin-bottom: 22px; }
.legal-page__lead { max-width: 68ch; color: var(--ink-2); font-size: clamp(1.05rem, 2vw, 1.22rem); line-height: 1.65; margin-bottom: 42px; }
.legal-page section { max-width: 76ch; border-top: 1px solid var(--line); padding-top: 26px; margin-top: 30px; }
.legal-page h2 { font-size: clamp(1.25rem, 2vw, 1.55rem); margin-bottom: 12px; }
.legal-page p { line-height: 1.7; margin: 0 0 12px; }
.legal-page a { text-underline-offset: 3px; }

/* ---------- Появление при прокрутке: без JS контент виден сразу ---------- */
.js:not(.reveal-done) [data-reveal]:not(.is-in) { opacity: 0; transform: translateY(18px); }
[data-reveal] { transition: opacity .7s ease, transform .7s cubic-bezier(.22,1,.36,1); }

/* ---------- Переходы между страницами (кросс-документные View Transitions) ----------
   Работают в браузерах с поддержкой; в остальных — обычная навигация. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-group(*) { animation-duration: .5s; animation-timing-function: cubic-bezier(.22,1,.36,1); }
  ::view-transition-old(root) { animation: vt-fade-out .28s ease both; }
  ::view-transition-new(root) { animation: vt-fade-in .42s ease both; }
}
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- Формы без JavaScript и состояния ошибок ----------
   Кнопка отправки выключена в HTML и включается site.js; без скрипта видно пояснение. */
.f-nojs { display: none; margin: 0; font-size: .86rem; padding: 10px 12px; border-radius: 8px; border: 1px dashed currentColor; opacity: .85; }
html:not(.js) .f-nojs, html.reveal-done:not(.site-ready) .f-nojs { display: block; }
.b-btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.f-input[aria-invalid="true"] { border-color: #c0392b; box-shadow: 0 0 0 1px #c0392b; }
.f-choice input[aria-invalid="true"] + span { border-color: #c0392b; }

/* ---------- Кнопка заявки внутри мобильного меню (в шапке на узком экране она скрыта) ---------- */
.gh__nav-cta { display: none; }
@media (max-width: 1080px) {
  .gh__nav .gh__nav-cta { display: block; font-weight: 700; color: var(--header-ink); }
}

/* ---------- Без JavaScript меню не раскрыть кнопкой — показываем его сразу ---------- */
@media (max-width: 1080px) {
  html:not(.js) .gh__row { flex-wrap: wrap; }
  html:not(.js) .gh__toggle { display: none; }
  html:not(.js) .gh__nav { display: flex; position: static; flex-direction: row; flex-wrap: wrap; gap: 2px 16px; width: 100%; padding: 0 0 10px; border: 0; }
  html:not(.js) .gh__nav a { padding: 6px 0; border-bottom: 0; }
}
