/* ============================================================
   QR CONSULT — V9 HEADER & FOOTER
   Общие стили реестровой типографики для шапки и подвала.
   ============================================================ */
:root {
  --bg: #f7f7f4;
  --paper: #fdfdfb;
  --ink: #0f1113;
  --muted: #5d625e;
  --line: #d9dad5;
  --soft: #eeeee9;
  --accent: #1f4fd8;
  --danger: #8c2f24;

  --wrap-max: 1240px;
  --side-pad: clamp(20px, 4vw, 56px);
}

/* ============================================================
   ШАПКА (templates/includes/header_v9.html)
   ============================================================ */
.v9-header {
  position: sticky; top: 0; z-index: 200;
  height: 72px; display: flex; align-items: center;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.v9-header.is-scrolled { border-bottom-color: var(--ink); }

.v9-header-inner {
  width: 100%; max-width: 1240px; margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 56px);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  height: 100%;
}

.v9-brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none; flex-shrink: 0;
}
.v9-mark {
  width: 32px; height: 32px; display: block; flex-shrink: 0;
}
.v9-wordmark { display: flex; flex-direction: column; line-height: 1.05; }
.v9-wordmark-main { font-size: 13px; font-weight: 800; letter-spacing: .12em; color: var(--ink); }
.v9-wordmark-sub { font-size: 10px; letter-spacing: .02em; color: var(--muted); }

.v9-nav { display: none; align-items: center; gap: 2px; }
@media (min-width: 1024px) { .v9-nav { display: flex; } }

.v9-navlink {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 12px; border: 0; border-radius: 6px; background: none;
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--ink); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color 140ms ease;
}
.v9-navlink:hover { background: var(--soft); }

.v9-chevron { width: 10px; height: 10px; transition: transform 160ms ease; }
.v9-chevron.is-open { transform: rotate(180deg); }

.v9-drop { position: relative; }
.v9-drop-panel {
  position: absolute; left: 0; top: 100%; margin-top: 4px;
  min-width: 200px; padding: 6px 0; z-index: 120;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 8px;
}
.v9-drop-panel::before {
  content: ''; position: absolute; top: -8px; left: 0; right: 0; height: 8px;
}
.v9-drop-panel--wide { min-width: 250px; }
.v9-drop-panel--right { left: auto; right: 0; min-width: 150px; }
.v9-drop-link {
  display: block; padding: 7px 14px; margin: 0 6px; border-radius: 4px;
  font-size: 13px; color: var(--ink); text-decoration: none;
  transition: background-color 120ms ease;
}
.v9-drop-link:hover { background: var(--soft); }
.v9-drop-link--lead { font-weight: 600; }
.v9-drop-link.is-current { font-weight: 700; }
.v9-drop-label {
  display: block; padding: 10px 20px 4px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}

.v9-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.v9-lang { display: none; }
@media (min-width: 640px) { .v9-lang { display: block; } }
.v9-lang-btn {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 6px 8px; border: 0; border-radius: 6px; background: none; cursor: pointer;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--ink);
  transition: background-color 140ms ease;
}
.v9-lang-btn:hover { background: var(--soft); }

.v9-btn-ink {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 18px;
  background: var(--ink); border: 1px solid var(--ink); border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--bg);
  text-decoration: none; white-space: nowrap;
  transition: background-color 140ms ease;
}
.v9-btn-ink:hover { background: #000; }
.v9-btn-ink svg { width: 14px; height: 14px; }
.v9-btn-ink--desktop { display: none; }
@media (min-width: 640px) { .v9-btn-ink--desktop { display: inline-flex; } }

.v9-btn-line {
  display: inline-flex; align-items: center; height: 34px; padding: 0 12px;
  background: transparent; border: 0; border-radius: 6px;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink);
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color 140ms ease;
}
.v9-btn-line:hover { background: var(--soft); }

.v9-logout-form { display: none; margin: 0; }
@media (min-width: 768px) { .v9-logout-form { display: block; } }

.v9-burger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent;
  color: var(--ink); cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}
.v9-burger:hover { background: var(--soft); border-color: var(--ink); }
.v9-burger svg { width: 16px; height: 16px; }
@media (min-width: 1024px) { .v9-burger { display: none; } }

/* Мобильная шторка справа: оверлей + панель.
   Узлы телепортируются в <body> (x-teleport): у <header> свой stacking context
   (position: sticky; z-index: 200), и внутри него z-index панели не поднимается
   выше cookie-баннера (z 5000). Слои ниже — из шапки, не работают. */
.v9-sheet-overlay {
  position: fixed; inset: 0; z-index: 5100;
  background: rgba(15, 17, 19, .34);
  opacity: 0; visibility: hidden;
  transition: opacity 180ms ease, visibility 180ms;
}
.v9-sheet-overlay.is-open { opacity: 1; visibility: visible; }

.v9-sheet {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 5200;
  width: min(340px, 88vw); display: flex; flex-direction: column;
  padding: 18px 20px 24px; overflow: hidden;
  background: var(--paper); border-left: 1px solid var(--line);
  transform: translateX(100%); visibility: hidden;
  transition: transform 260ms cubic-bezier(.16, 1, .3, 1), visibility 260ms;
}
.v9-sheet.is-open { transform: none; visibility: visible; }

.v9-sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-bottom: 14px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.v9-sheet-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 999px;
  border: 1px solid var(--line); background: transparent;
  color: var(--ink); cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}
.v9-sheet-close:hover { background: var(--soft); border-color: var(--ink); }
.v9-sheet-close svg { width: 16px; height: 16px; }

/* min-height: 0 обязателен: без него flex-элемент не сжимается ниже своего
   содержимого, и на коротком экране подвал с кнопками выдавливается за край. */
.v9-sheet-body { flex: 1; min-height: 0; padding-top: 8px; overflow-y: auto; overscroll-behavior: contain; }
.v9-sheet-group { padding: 10px 0; border-bottom: 1px solid var(--line); }
.v9-sheet-group:last-child { border-bottom: 0; }
.v9-sheet-label {
  margin: 0 0 6px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.v9-sheet-link { display: block; padding: 10px 0; font-size: 15px; color: var(--ink); text-decoration: none; }
.v9-sheet-link:hover { color: var(--accent); }

.v9-sheet-foot {
  margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px; flex-shrink: 0;
}
.v9-sheet-langs { display: flex; gap: 6px; }
.v9-sheet-lang {
  flex: 1; padding: 9px 0; text-align: center;
  border: 1px solid var(--line); border-radius: 6px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
}
.v9-sheet-lang.is-current { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.v9-sheet-form { margin: 0; }
.v9-sheet-foot .v9-btn-line,
.v9-sheet-foot .v9-btn-ink { width: 100%; justify-content: center; height: 40px; }
.v9-sheet-foot .v9-btn-line { border: 1px solid var(--line); border-radius: 8px; }
.v9-sheet-foot .v9-btn-ink { border-radius: 999px; }

/* ============================================================
   СЕТКА (обёртка для подвала)
   ============================================================ */
.v9-wrap {
  width: 100%; max-width: var(--wrap-max); margin: 0 auto;
  padding: 0 var(--side-pad);
}

/* ============================================================
   ПОДВАЛ (templates/includes/footer_v9.html)
   ============================================================ */
.v9-footer {
  background: var(--bg); color: var(--ink);
  border-top: 1px solid var(--line);
  padding: clamp(48px, 6vw, 80px) 0 40px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.v9-footer-grid {
  display: grid; grid-template-columns: 1fr; gap: clamp(28px, 4vw, 40px);
  padding-bottom: clamp(32px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
}
@media (min-width: 700px) { .v9-footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .v9-footer-grid { grid-template-columns: 2fr 1fr 1.2fr 1.2fr; gap: 40px; } }

.v9-footer-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.v9-footer-title {
  margin: 0 0 14px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.v9-footer-nav { display: flex; flex-direction: column; gap: 8px; }
.v9-footer-nav--spaced { margin-top: 14px; }
.v9-footer-link {
  display: inline-flex; align-items: baseline; gap: 4px; width: fit-content;
  font-size: 13px; color: var(--ink); text-decoration: none;
  transition: color 140ms ease, border-color 140ms ease;
}
.v9-footer-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.v9-footer-link--ext { border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.v9-footer-link--ext:hover { border-bottom-color: var(--ink); text-decoration: none; }
@media (max-width: 699px) {
  .v9-footer-nav { gap: 2px; }
  .v9-footer-link { padding: 6px 0; }
}
.v9-footer-text { margin: 14px 0 0; font-size: 13px; line-height: 1.55; color: var(--muted); max-width: 34ch; }
.v9-footer-social { display: flex; gap: 16px; margin-top: 14px; }
.v9-footer-mail {
  display: inline-block; font-size: 15px; font-weight: 600; color: var(--ink);
  border-bottom: 1px solid var(--ink); text-decoration: none; padding-bottom: 1px;
}
.v9-footer-mail:hover { color: var(--accent); border-bottom-color: var(--accent); }

.v9-footer-bottom {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  padding-top: 24px; font-size: 11px; color: var(--muted);
}
.v9-footer-pay { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.v9-footer-pay-label { font-size: 11px; color: var(--muted); }
.v9-footer-pay img {
  height: 18px; width: auto;
  filter: grayscale(1); opacity: .55;
  transition: filter 180ms ease, opacity 180ms ease;
}
.v9-footer-pay img:hover { filter: none; opacity: 1; }

/* Клавиатурный фокус */
.v9-header a:focus-visible,
.v9-header button:focus-visible,
.v9-footer a:focus-visible,
.v9-cookie a:focus-visible,
.v9-cookie button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ============================================================
   КНОПКИ V9 (единый источник правды — без конфликта каскада)
   ============================================================ */
.v9-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 6px;
  border: 1px solid var(--ink, #0f1113);
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.v9-btn svg {
  width: 14px; height: 14px; flex-shrink: 0;
  transition: transform 150ms ease;
}
.v9-btn:hover svg { transform: translateX(2px); }

.v9-btn--primary { background: var(--ink, #0f1113); border-color: var(--ink, #0f1113); color: var(--bg, #f7f7f4); }
.v9-btn--primary:hover { background: #000; border-color: #000; }

.v9-btn--ghost { background: transparent; border-color: var(--line, #d9dad5); color: var(--ink, #0f1113); }
.v9-btn--ghost:hover { border-color: var(--ink, #0f1113); background: var(--paper, #fdfdfb); }

.v9-btn--paper { background: var(--bg, #f7f7f4); border-color: var(--bg, #f7f7f4); color: var(--ink, #0f1113); }
.v9-btn--paper:hover { background: #fff; border-color: #fff; }

.v9-btn--onink { background: transparent; border-color: rgba(247, 247, 244, .32); color: var(--bg, #f7f7f4); }
.v9-btn--onink:hover { border-color: var(--bg, #f7f7f4); background: rgba(247, 247, 244, .08); }

/* ============================================================
   ФОРМА ОБРАТНОЙ СВЯЗИ V9 (templates/web/partials/v9_contact_form.html)
   ============================================================ */
.v9-form {
  display: flex; flex-direction: column; gap: 18px;
  padding: clamp(24px, 3vw, 36px);
  background: var(--paper, #fdfdfb);
  border: 1px solid var(--line, #d9dad5);
  border-radius: 6px;
  box-shadow: 0 18px 40px -32px rgba(15, 17, 19, .45);
}
.v9-field { display: flex; flex-direction: column; gap: 6px; }
.v9-field > label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted, #5d625e);
}
.v9-input {
  width: 100%; padding: 10px 0;
  border: 0; border-bottom: 1px solid var(--line, #d9dad5);
  border-radius: 0;
  background: transparent; outline: none;
  font-family: inherit; font-size: 15px; color: var(--ink, #0f1113);
  box-shadow: none;
}
.v9-form .v9-input {
  padding: 10px 0;
  border: 0; border-bottom: 1px solid var(--line, #d9dad5);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transition: border-color 150ms ease;
}
.v9-form .v9-input:focus { border-bottom-color: var(--accent, #1f4fd8); }
.v9-form textarea.v9-input { min-height: 92px; resize: vertical; }
.v9-input::placeholder { color: #858a84; }
.v9-hint { margin: 0; font-size: 12px; line-height: 1.45; color: var(--muted, #5d625e); }

/* Кастомный бумажный файл-пикер вместо сырого браузерного input[type=file] */
.v9-file-control { position: relative; }
.v9-file-native {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.v9-file-trigger {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--line, #d9dad5); border-radius: 6px;
  background: var(--bg, #f7f7f4);
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}
.v9-file-trigger:hover { border-color: var(--ink, #0f1113); background: var(--soft, #eeeee9); }
.v9-file-native:focus-visible + .v9-file-trigger {
  outline: 2px solid var(--accent, #1f4fd8);
  outline-offset: 2px;
}
.v9-file-btn {
  flex-shrink: 0; padding: 5px 10px; border-radius: 4px;
  border: 1px solid var(--line, #d9dad5); background: var(--paper, #fdfdfb);
  font-size: 12px; font-weight: 600; color: var(--ink, #0f1113);
}
.v9-file-name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; color: var(--muted, #5d625e);
}

.v9-agree { display: flex; align-items: flex-start; gap: 10px; font-size: 12px; line-height: 1.5; color: var(--muted, #5d625e); }
.v9-agree input { width: 16px; height: 16px; flex-shrink: 0; margin: 2px 0 0; accent-color: var(--ink, #0f1113); cursor: pointer; }
.v9-agree a { color: var(--ink, #0f1113); text-decoration: underline; text-underline-offset: 2px; }

.v9-form .v9-btn { width: 100%; justify-content: center; }

/* ============================================================
   COOKIE-БАННЕР V9 (templates/includes/cookie_banner.html)
   Тёплая бумага + волосяная линия вместо чужого тёмно-фиолетового блока.
   ============================================================ */
.v9-cookie {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5000;
  background: var(--paper, #fdfdfb);
  border-top: 1px solid var(--ink, #0f1113);
  color: var(--ink, #0f1113);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.v9-cookie-enter { transition: opacity 260ms ease, transform 260ms cubic-bezier(.16, 1, .3, 1); }
.v9-cookie-leave { transition: opacity 180ms ease, transform 180ms ease; }
.v9-cookie-hidden { opacity: 0; transform: translateY(16px); }
.v9-cookie-visible { opacity: 1; transform: translateY(0); }

.v9-cookie-inner {
  width: 100%; max-width: var(--wrap-max, 1240px); margin: 0 auto;
  padding: 12px var(--side-pad, clamp(20px, 4vw, 56px));
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 12px;
}
@media (min-width: 768px) {
  .v9-cookie-inner { flex-direction: row; align-items: center; gap: 24px; }
}
.v9-cookie-text { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted, #5d625e); }
.v9-cookie-link {
  color: var(--ink, #0f1113); font-weight: 600;
  text-decoration: underline; text-underline-offset: 2px;
}
.v9-cookie-link:hover { color: var(--accent, #1f4fd8); }

.v9-cookie-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; width: 100%; }
@media (min-width: 768px) { .v9-cookie-actions { width: auto; } }

.v9-cookie-btn {
  flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center;
  height: 34px; padding: 0 14px; border-radius: 6px;
  font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1;
  cursor: pointer; white-space: nowrap;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
@media (min-width: 768px) { .v9-cookie-btn { flex: 0 0 auto; } }
.v9-cookie-btn--primary {
  background: var(--ink, #0f1113); border: 1px solid var(--ink, #0f1113); color: var(--bg, #f7f7f4);
}
.v9-cookie-btn--primary:hover { background: #000; border-color: #000; }
.v9-cookie-btn--ghost {
  background: transparent; border: 1px solid var(--line, #d9dad5); color: var(--ink, #0f1113);
}
.v9-cookie-btn--ghost:hover { border-color: var(--ink, #0f1113); background: var(--soft, #eeeee9); }

.v9-cookie-settings {
  display: none; padding: 6px 8px;
  font-size: 12px; font-weight: 500; color: var(--muted, #5d625e);
  text-decoration: none; white-space: nowrap;
}
.v9-cookie-settings:hover { color: var(--ink, #0f1113); text-decoration: underline; text-underline-offset: 2px; }
@media (min-width: 640px) { .v9-cookie-settings { display: inline-flex; } }

@media (prefers-reduced-motion: reduce) {
  .v9-sheet, .v9-sheet-overlay, .v9-cookie-enter, .v9-cookie-leave, .v9-btn svg { transition: none; }
}
