/* Общая шапка из templates/site-header.html. Отступы содержимого первого
   блока задаёт сама страница, шапка всегда выравнивается по краям карточки. */
:root {
  --site-header-top: clamp(12px, 1.6vw, 22px);
  --header-paper: radial-gradient(ellipse 18rem 14rem at 47% 0%, #faf5e9, transparent), #faf9f6;
}
.site-shell:has(.has-site-header) { margin-top: 0; }
body.lists-page, body:has(> .page > .site-header) { padding-top: 0; }

.has-site-header {
  --site-hero-inset: var(--masthead-pad-x, var(--topbar-pad-x, 28px));
}

.payments-primary-hero.has-site-header { --site-hero-inset: 64px; }

:is(.site-shell, .page) .has-site-header {
  margin-top: var(--site-header-top);
  padding-top: 0;
  padding-inline: var(--site-hero-inset);
  border-start-start-radius: 38px;
  border-start-end-radius: 38px;
  border-top-color: rgba(255, 255, 255, 0.9);
  background: var(--header-paper);
}

/* У шапки и первого блока один непрерывный фон, включая углы карточки. */
.has-site-header::before,
.has-site-header::after { content: none; }

.site-header {
  --blue-600: #2f6bff;
  --blue-100: #edf2ff;
  --muted: #717783;
  position: relative;
  isolation: isolate;
  z-index: 20;
  box-sizing: border-box;
  display: grid;
  grid-column: 1 / -1;
  justify-self: stretch;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px 20px;
  padding: 24px 28px 10px;
  color: #3f4551;
  font: 400 16px/1.4 "Inter", system-ui, sans-serif;
  text-align: left;
  -webkit-font-smoothing: antialiased;
}

.has-site-header > .site-header {
  margin-inline: calc(0px - var(--site-hero-inset));
  border-start-start-radius: inherit;
  border-start-end-radius: inherit;
}

.pricing-hero > .site-header, .billing-hero > .site-header { margin-bottom: clamp(12px, 2.4vw, 34px); }
.payments-primary-hero > .site-header { margin-bottom: clamp(42px, 5vw - 10px, 66px); }
:is(.lists-integrated-hero, .hero-concept) > .site-header { margin-bottom: 8px; }
:is(.lp-hero, .sl-hero) > .site-header { margin-bottom: clamp(8px, 1.4vw, 18px); }

:where(body, .page) > .site-header {
  width: min(1480px, calc(100% - 40px));
  margin: var(--site-header-top) auto 0;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 38px;
  background: var(--header-paper);
  box-shadow: 0 16px 42px rgba(28, 39, 70, 0.11);
}

.page > .site-header { width: 100%; }
.site-header > .brand { justify-self: start; }
.site-header__menu { min-width: 0; }
.site-header__menu > summary { display: none; }

.site-header__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px clamp(12px, 1.8vw, 28px);
  font: 550 12px/1.4 "Inter", system-ui, sans-serif;
}

.site-header__nav a {
  color: #3f4551;
  text-decoration: none;
}

.site-header__nav a:is(:hover, :focus-visible, [aria-current="page"]) { color: var(--blue-600); }
.site-header__nav a[hidden] { display: none; }

.site-header > .open-app--brand {
  grid-column: 3;
  justify-self: end;
  width: 231px;
  min-height: 44px;
  padding: 8px;
  border-radius: 12px;
  font-size: 16px;
  line-height: 20px;
}

.site-header + .lang-switch {
  position: relative;
  display: flex;
  width: max-content;
  margin: 12px auto 0;
  gap: 2px;
  padding: 3px;
  border-radius: 14px;
  background: #2855c6;
}

.lang-switch .lang-btn {
  min-width: 40px;
  height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #fff;
  font: 700 14px/1 "Inter", system-ui, sans-serif;
  cursor: pointer;
}

.lang-switch .lang-btn[aria-pressed="true"] { background: #fff; color: #173e9f; }
.lang-switch .lang-btn:focus-visible,
.site-header :is(summary, nav a):focus-visible { outline: 2px solid #245ef2; outline-offset: 3px; }

html:lang(en) .site-header [lang="ru"],
html:not(:lang(en)) .site-header [lang="en"] { display: none; }

@media (max-width: 1100px) { .payments-primary-hero.has-site-header { --site-hero-inset: 46px; } }
@media (max-width: 960px) { .payments-primary-hero.has-site-header { --site-hero-inset: 54px; } }

@media (max-width: 820px) {
  :root { --site-header-top: 10px; }
  :is(.site-shell, .page) .has-site-header { border-start-start-radius: 30px; border-start-end-radius: 30px; }
  .site-header {
    --header-mark-size: 34px;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: baseline;
    align-content: center;
    gap: 0 6px;
    min-height: 62px;
    padding: 2px 14px;
  }
  :where(body, .page) > .site-header { border-radius: 30px; }
  body > .site-header { width: min(720px, calc(100% - 20px)); }

  .site-header__menu { display: none; }
  .site-header > .brand {
    box-sizing: border-box;
    max-width: 100%;
    min-height: 44px;
    gap: 7px;
    padding-block: 5px;
  }
  .site-header .brand-mark, .site-header .brand::before {
    width: var(--header-mark-size);
    height: var(--header-mark-size);
  }
  .site-header .brand-mark { padding: 3px; }
  .site-header .brand::before { box-shadow: 0 3px 8px rgba(47, 89, 238, 0.16); }
  .site-header .brand::after {
    top: calc(50% - var(--header-mark-size) * 0.53);
    left: calc(var(--header-mark-size) * 0.7);
    width: calc(var(--header-mark-size) * 0.35);
    height: calc(var(--header-mark-size) * 0.35);
  }

  /* Базовую линию ссылки задаёт первая строка названия, даже когда слоган переносится. */
  .site-header .brand-copy { align-self: baseline; gap: 2px; }
  .site-header .brand-copy strong { font-size: 15.5px; white-space: nowrap; }
  .site-header .brand-copy small { color: #646c79; font-size: 10px; line-height: 1.25; }
  .site-header > .open-app--brand {
    grid-column: 2;
    align-self: baseline;
    align-items: flex-start;
    width: auto;
    padding: 6px 0 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #000;
    font-size: 13px;
    line-height: 18px;
    white-space: nowrap;
  }
  .site-header > .open-app--brand:active { transform: none; }
  .site-header > .open-app--brand > span, .site-header .open-app__accent {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
  }
  .site-header .open-app__accent { display: inline-block; color: inherit; }

  .pricing-hero > .site-header, .billing-hero > .site-header { margin-bottom: clamp(4.8px, 0.96vw, 13.6px); }
  .payments-primary-hero > .site-header { margin-bottom: clamp(12px, 2vw - 10px, 20.4px); }
  :is(.lists-integrated-hero, .hero-concept) > .site-header { margin-bottom: 0; }
  :is(.lp-hero, .sl-hero) > .site-header { margin-bottom: clamp(3.2px, 0.56vw, 7.2px); }
}

@media (max-width: 720px) {
  :is(.hero-concept, .lists-integrated-hero).has-site-header { --site-hero-inset: 13px; }
  .lists-page .has-site-header { margin-inline: max(-8px, calc((100% - 100vw) / 2)); }
  .payments-primary-hero.has-site-header { --site-hero-inset: 21px; }
}

@media (max-width: 680px) { .payments-primary-hero.has-site-header { --site-hero-inset: 18px; } }

@media (max-width: 580px) {
  :root { --site-header-top: 6px; }
  :is(.site-shell, .page) .has-site-header { border-start-start-radius: 25px; border-start-end-radius: 25px; }
  :where(body, .page) > .site-header { border-radius: 25px; }
  body > .site-header { width: calc(100% - 12px); }
}

@media (max-width: 360px) {
  .site-header { --header-mark-size: 28px; padding-inline: 10px; }
  .site-header > .brand { gap: 6px; }
  .site-header .brand-copy strong { font-size: 14px; }
  .site-header > .open-app--brand { font-size: 12px; }
  .lang-switch .lang-btn { min-width: 32px; padding-inline: 4px; }
}
