/* Site header «Landing / Site Header».
   Figma «LidFly — Проекты · новая структура» → «20 · Шапка и меню сайта» (473:3003): V1–V3 desktop panels,
   V5 mobile sheet, V6 keyboard focus; components on page 00 → «Навигация сайта · шапка и меню» (448:241).
   Markup: scripts/lib/site-header.mjs from content/site-header/nav.config.json. Buttons take palette and
   size from landing-buttons.css. Every link stays in the server HTML; /js/mobile-nav.js only toggles state. */

.lf-header {
  /* Colours: «Landing / …» variables of the design system (tokens.css → Landing style v2). */
  --lfh-ink: var(--v2-ink);
  --lfh-ink-secondary: var(--v2-ink-secondary);
  --lfh-cream: var(--v2-cream);
  --lfh-sand: var(--v2-sand);
  --lfh-grid: var(--v2-grid);
  --lfh-line: var(--v2-line);
  --lfh-lime: var(--v2-lime);
  --lfh-lime-soft: var(--v2-lime-soft);
  --lfh-card: var(--v2-card);
  --lfh-forest: var(--color-forest);
  --lfh-height: 72px;
  --lfh-panel-shadow:
    0 24px 48px -12px color-mix(in srgb, var(--v2-ink) 14%, transparent),
    0 6px 12px -4px color-mix(in srgb, var(--v2-ink) 8%, transparent);
  --lfh-scrim: color-mix(in srgb, var(--v2-night) 14%, transparent);
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--lfh-height);
  border-bottom: 1px solid var(--lfh-grid);
  background: var(--lfh-cream);
  color: var(--lfh-ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  transition: transform 0.22s ease;
}
.lf-header,
.lf-header * { box-sizing: border-box; }
/* Reset with the specificity of one class: page CSS cannot add margins, component rules below still win. */
.lf-header :where(ul, li, p, figure, figcaption) { margin: 0; padding: 0; }
.lf-header :where(ul) { list-style: none; }
.lf-header :where(a) { text-decoration: none; }
.lf-header svg { flex: 0 0 auto; }
.lf-header__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Bar: logo · menu · actions, 120 px gutters at 1440 */
.lf-header__bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 40px;
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 clamp(24px, calc(50vw - 600px), 120px);
}
.lf-header .lf-header__logo {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  border-radius: 10px;
  color: var(--lfh-ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}
.lf-header__logo img { display: block; width: 30px; height: 30px; border-radius: 8px; }
.lf-header__nav { flex: 1 1 auto; min-width: 0; }
.lf-header__menu { display: flex; align-items: center; gap: 2px; }
.lf-header__item { position: relative; }

/* «Landing / Nav Trigger»: Default · Hover · Open · Focus */
.lf-header .lf-header__trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  margin: 0;
  padding: 8px 10px 8px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--lfh-ink-secondary);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.lf-header__chevron { width: 16px; height: 16px; color: inherit; }
.lf-header .lf-header__trigger:hover { background: color-mix(in srgb, var(--lfh-sand) 60%, transparent); color: var(--lfh-ink); }
.lf-header .lf-header__trigger[aria-expanded="true"] { background: var(--lfh-sand); color: var(--lfh-ink); }
.lf-header .lf-header__trigger.is-current { color: var(--lfh-ink); text-decoration: underline 2px var(--lfh-forest); text-underline-offset: 6px; }

/* Keyboard focus (V6): Forest 2 px outside the element; no container clips it. */
.lf-header :is(a, button):focus { outline: none; }
.lf-header :is(a, button):focus-visible { outline: 2px solid var(--lfh-forest); outline-offset: 0; }
.lf-header.lf-header :is(.lf-header__login, .lf-header__cta):focus-visible { outline: 2px solid var(--lfh-forest); outline-offset: 2px; }

/* Actions: Войти (Gray M) · Начать бесплатно (Tinted M) */
.lf-header__actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; margin-left: auto; }
.lf-header__cta,
.lf-header__login { white-space: nowrap; }
.lf-header .lf-header__burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--lfh-ink-secondary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.lf-header__burger svg { width: 20px; height: 20px; }
.lf-header__burger-close { display: none; }
.lf-header[data-menu-open] .lf-header__burger-open { display: none; }
.lf-header[data-menu-open] .lf-header__burger-close { display: block; }

/* Panels: rendered in HTML, hidden by CSS until opened */
.lf-header__panel {
  position: absolute;
  top: calc(100% + 28px);
  left: -24px;
  display: none;
  border: 1px solid var(--lfh-line);
  border-radius: 20px;
  background: var(--lfh-card);
  box-shadow: var(--lfh-panel-shadow);
  color: var(--lfh-ink);
  cursor: auto;
}
.lf-header__panel::before { content: ""; position: absolute; top: -29px; right: 0; left: 0; height: 29px; }
.lf-header__item[data-open] > .lf-header__panel { display: block; }
.lf-header__panel--features { width: 878px; }
.lf-header__panel--connect { width: max-content; min-width: 679px; }
.lf-header__panel--learn { width: 578px; }
.lf-header__panel-body { display: flex; }
.lf-header__panel--connect .lf-header__panel-body { gap: 16px; padding: 20px 14px 16px; }
.lf-header__panel--learn .lf-header__panel-body { gap: 8px; padding: 20px 16px 16px; }

.lf-header__intro {
  display: flex;
  flex: 0 0 300px;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  border-right: 1px solid var(--lfh-grid);
  border-radius: 19px 0 0;
  background: var(--lfh-cream);
}
.lf-header .lf-header__intro-title { font-size: 18px; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; }
.lf-header .lf-header__intro-text { color: var(--lfh-ink-secondary); font-size: 14px; line-height: 1.55; }
.lf-header__dialog { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 16px; background: var(--lfh-sand); font-size: 13px; line-height: 18px; }
.lf-header__dialog figcaption { color: var(--lfh-ink-secondary); }
.lf-header__bubble { max-width: 100%; padding: 10px 12px; border-radius: 12px 12px 12px 4px; background: var(--lfh-card); color: var(--lfh-ink); }
.lf-header__bubble--user { align-self: flex-end; padding: 8px 12px; border-radius: 12px 12px 4px; background: var(--lfh-lime-soft); }

.lf-header__columns { display: flex; flex: 1 1 auto; gap: 8px; padding: 20px 16px 16px; }
.lf-header__column { display: flex; flex: 0 0 268px; flex-direction: column; gap: 2px; min-width: 0; }
.lf-header__panel--connect .lf-header__column--ai { flex-basis: 204px; }
.lf-header__panel--connect .lf-header__column--accounts { flex: 0 0 auto; }
.lf-header .lf-header__column-title {
  padding: 0 0 8px 12px;
  color: var(--lfh-ink-secondary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.lf-header :is(.lf-header__panel--connect, .lf-header__panel--learn) .lf-header__column-title { padding-left: 10px; }
.lf-header__list { display: flex; flex-direction: column; gap: 2px; }
/* «Подключите свои кабинеты»: Яндекс | VK и Авито, two 204 px lists side by side */
.lf-header__lists { display: flex; align-items: flex-start; gap: 4px; }
.lf-header__lists > .lf-header__list { flex: 0 0 auto; min-width: 204px; }
.lf-header__divider { flex: 0 0 1px; align-self: stretch; background: var(--lfh-grid); }

/* «Landing / Menu Link»: one <a> with icon, title and description */
.lf-header .lf-header__link {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--lfh-ink);
}
.lf-header__link-icon { display: flex; flex: 0 0 20px; align-items: center; justify-content: center; height: 23px; color: var(--lfh-ink-secondary); }
.lf-header__icon { width: 20px; height: 20px; }
.lf-header__link-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lf-header .lf-header__link-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; line-height: 1.55; }
.lf-header .lf-header__link-desc { color: var(--lfh-ink-secondary); font-size: 13px; font-weight: 400; line-height: 18px; }
.lf-header .lf-header__badge { padding: 2px 7px; border-radius: 6px; background: var(--lfh-lime); color: var(--lfh-forest); font-size: 12px; font-weight: 600; line-height: 1; }
.lf-header .lf-header__link:hover,
.lf-header .lf-header__link[aria-current="page"] { background: var(--lfh-sand); }
.lf-header .lf-header__link:hover .lf-header__link-icon,
.lf-header .lf-header__link[aria-current="page"] .lf-header__link-icon { color: var(--lfh-ink); }

/* «Landing / Logo Link» and logo tiles: original logos on white 24 px tiles */
.lf-header .lf-header__brand-link {
  display: flex;
  white-space: nowrap;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--lfh-ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}
.lf-header .lf-header__brand-link:hover,
.lf-header .lf-header__brand-link[aria-current="page"] { background: var(--lfh-sand); }
.lf-header__tile {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--lfh-grid);
  border-radius: 7px;
  background: var(--lfh-card);
}
.lf-header__brand { display: block; width: 16px; height: 16px; }
.lf-header__tiles { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lf-header .lf-header__tiles-label { color: var(--lfh-ink-secondary); font-size: 13px; line-height: 18px; }
.lf-header__tile-list { flex-direction: row; gap: 6px; }
.lf-header__tile-link { display: flex; border-radius: 8px; }
.lf-header__tile-link:hover .lf-header__tile { border-color: var(--lfh-line); background: var(--lfh-sand); }

.lf-header__panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 24px;
  border-top: 1px solid var(--lfh-grid);
  border-radius: 0 0 19px 19px;
}
.lf-header__panel--connect .lf-header__panel-foot { background: var(--lfh-cream); }
.lf-header .lf-header__more { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; border-radius: 6px; color: var(--lfh-ink); font-size: 14px; font-weight: 600; line-height: 1.4; }
.lf-header .lf-header__more:hover { text-decoration: underline; text-underline-offset: 3px; }
.lf-header__arrow { width: 16px; height: 16px; }
.lf-header .lf-header__note { color: var(--lfh-ink-secondary); font-size: 13px; line-height: 18px; }

.lf-header__sheet-foot { display: none; }
.lf-header__scrim { position: fixed; top: var(--lfh-height); right: 0; bottom: 0; left: 0; z-index: 1; display: none; background: var(--lfh-scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.lf-header[data-panel-open] .lf-header__scrim { display: block; }

/* Mobile and narrow windows (V5): 56 px bar, hamburger, groups open one at a time */
@media (max-width: 1119.98px) {
  .lf-header { --lfh-height: 56px; }
  .lf-header.is-hidden:not([data-menu-open]) { transform: translateY(-100%); }
  .lf-header__bar { gap: 8px; padding: 0 12px 0 16px; }
  .lf-header .lf-header__logo { font-size: 16px; line-height: 1.3; letter-spacing: -0.01em; }
  .lf-header__logo img { width: 24px; height: 24px; border-radius: 6px; }
  .lf-header__actions { gap: 4px; }
  .lf-header__actions > .lf-header__cta { display: none; }
  .lf-header .lf-header__burger { display: inline-flex; }

  .lf-header__nav {
    position: fixed;
    top: var(--lfh-height);
    right: 0;
    bottom: 0;
    left: 0;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--lfh-cream);
  }
  .lf-header[data-menu-open] .lf-header__nav { display: flex; }
  .lf-header__menu { flex-direction: column; align-items: stretch; gap: 2px; padding: 8px 16px 16px; }
  .lf-header__item { position: static; border-bottom: 1px solid var(--lfh-grid); }
  .lf-header__item[data-open] { border-bottom: 0; }
  .lf-header .lf-header__trigger {
    justify-content: space-between;
    width: 100%;
    height: auto;
    min-height: 50px;
    padding: 14px 8px;
    border-radius: 12px;
    color: var(--lfh-ink);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
  }
  .lf-header .lf-header__trigger[aria-expanded="true"],
  .lf-header .lf-header__trigger:hover { background: transparent; }
  .lf-header__chevron { width: 20px; height: 20px; transition: transform 0.2s ease; }
  .lf-header__trigger[aria-expanded="true"] .lf-header__chevron { transform: rotate(180deg); }

  .lf-header__panel { position: static; width: auto; min-width: 0; margin-top: 2px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .lf-header__panel::before,
  .lf-header__intro,
  .lf-header__divider,
  .lf-header__panel--features .lf-header__panel-foot { display: none; }
  .lf-header__panel-body,
  .lf-header__columns,
  .lf-header__panel--connect .lf-header__panel-body,
  .lf-header__panel--learn .lf-header__panel-body { flex-direction: column; gap: 12px; padding: 0 0 10px; }
  .lf-header__panel-body > .lf-header__columns { padding: 0; }
  .lf-header .lf-header__link-title { line-height: 23px; }
  .lf-header__column,
  .lf-header__panel--connect :is(.lf-header__column--ai, .lf-header__column--accounts) { flex: 1 1 auto; }
  .lf-header .lf-header__column-title { padding-left: 10px; }
  .lf-header__lists { flex-direction: column; gap: 2px; }
  .lf-header__lists > .lf-header__list { min-width: 0; }
  .lf-header__panel-foot { flex-direction: column; align-items: flex-start; gap: 6px; padding: 8px 10px 12px; border: 0; border-radius: 0; background: transparent; }
  .lf-header__panel--connect .lf-header__panel-foot { background: transparent; }

  .lf-header__sheet-foot {
    position: sticky;
    bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto;
    padding: 12px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--lfh-grid);
    background: var(--lfh-cream);
  }
  .lf-header__sheet-foot .lf-header__tile { width: 22px; height: 22px; }
  .lf-header__sheet-foot .lf-header__brand { width: 14px; height: 14px; }
  /* V5: «Начать бесплатно» alone, full width («Войти» stays in the bar). */
  .lf-header__sheet-actions { display: flex; }
  .lf-header__sheet-actions > * { flex: 1 1 auto; }
  .lf-header[data-panel-open] .lf-header__scrim { display: none; }
}
/* Selling landings keep their own desktop header (marked data-site-header-desktop): there the shared
   header is the phone and tablet menu only. :root body raises the hide above the pages' header rules. */
@media (min-width: 1120px) {
  .lf-header--mobile-only { display: none; }
}
@media (max-width: 1119.98px) {
  :root body [data-site-header-desktop] { display: none; }
}

@media (max-width: 359.98px) {
  .lf-header__bar { padding: 0 8px 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .lf-header,
  .lf-header__chevron { transition: none; }
}

/* Open mobile menu locks page scroll through <body> only: with <html> left visible, the browser applies
   body overflow to the viewport. Setting it on <html> too would turn <body> (often overflow-x: hidden on
   landings) into the scroll container of the sticky header, and after a scroll the bar with the close
   button would stay above the screen. */
html.lf-header-locked body { overflow: hidden; }
