/* The Socium header — one object for socium.tools (home, blog, documents, product pages) and market.socium.tools
   (owner 2026-11-30: «хедер нам нужно сделать общим объектом для всех страниц, именно тот что в лендинге»).
   Markup: tools/site_header.py. Behaviour: site-header.js. Every class starts with sh- and every colour is its own
   --sh-* token, so the page's own stylesheet (socium.css, home.css, cabinet.css) cannot change it. */
.sh {
  --sh-bg: #f3f4f7; --sh-paper: #fff; --sh-ink: #1d202b; --sh-soft: #4d5364; --sh-line: #e2e4ea;
  --sh-nav: rgb(255 255 255 / .97); --sh-inv-bg: #1d202b; --sh-inv-fg: #fff; --sh-inv-hover: #000; --sh-accent: #ea580c;
  --sh-shadow: 0 1px 2px rgb(29 32 43 / .06), 0 14px 34px -18px rgb(29 32 43 / .28);
  --sh-ease: cubic-bezier(0.23, 1, 0.32, 1);
  position: fixed; top: 12px; left: 50%; z-index: 300; display: flex; align-items: center; gap: 8px;
  width: min(1180px, 100% - 40px); min-height: 62px; margin: 0; padding: 7px 8px 7px 18px; border: 0; border-radius: 20px;
  background: var(--sh-nav); box-shadow: var(--sh-shadow); color: var(--sh-ink); font-family: Onest, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.2; transform: translateX(-50%); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-sizing: border-box;
}
:root[data-theme="dark"] .sh {
  --sh-bg: #0e1016; --sh-paper: #181b24; --sh-ink: #f1f3f8; --sh-soft: #a6acbd; --sh-line: #2b2f3d;
  --sh-nav: rgb(24 27 36 / .96); --sh-inv-bg: #f1f3f8; --sh-inv-fg: #12141b; --sh-inv-hover: #fff;
  --sh-shadow: 0 0 0 1px rgb(255 255 255 / .06), 0 18px 40px -20px rgb(0 0 0 / .8);
}
.sh *, .sh *::before, .sh *::after { box-sizing: border-box; }
.sh-theme, .sh-burger, .sh-lang button { font: inherit; color: inherit; }
.sh-brand { display: flex; flex: 1 1 0; min-width: 0; align-items: center; gap: 10px; color: var(--sh-ink); font-size: 21px; font-weight: 800; letter-spacing: -.03em; text-decoration: none; white-space: nowrap; }
.sh-brand img { width: 30px; height: 30px; }
:root[data-theme="dark"] .sh-brand img { filter: invert(1) brightness(1.6); }
.sh-nav { display: flex; gap: 2px; margin: 0 10px; }
.sh-nav a { padding: 9px 13px; border-radius: 11px; color: var(--sh-ink); font-size: 15.5px; font-weight: 500; text-decoration: none; white-space: nowrap; transition: background-color .15s ease; }
.sh-nav a:hover, .sh-nav a[aria-current] { background: var(--sh-bg); }
.sh-nav a[aria-current] { font-weight: 600; }
.sh-end { display: flex; flex: 1 1 0; align-items: center; justify-content: flex-end; gap: 6px; }
.sh-lang { display: flex; flex: none; padding: 4px; border-radius: 13px; background: var(--sh-bg); }
.sh-lang a, .sh-lang button { padding: 6px 9px; border: 0; border-radius: 10px; background: none; color: var(--sh-soft); font-size: 13.5px; font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer; }
.sh-lang [aria-current], .sh-lang [aria-pressed="true"] { background: var(--sh-paper); color: var(--sh-ink); box-shadow: 0 1px 2px rgb(29 32 43 / .14); }
.sh-theme { display: grid; flex: none; width: 42px; height: 42px; place-items: center; padding: 0; border: 0; border-radius: 13px; background: none; color: var(--sh-ink); cursor: pointer; transition: background-color .2s ease; }
.sh-theme:hover { background: var(--sh-bg); }
.sh-theme svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .5s var(--sh-ease); }
.sh-theme:active svg { transform: rotate(40deg) scale(.9); }
.sh-theme .sh-sun { display: none; }
:root[data-theme="dark"] .sh-theme .sh-sun { display: block; }
:root[data-theme="dark"] .sh-theme .sh-moon { display: none; }
.sh-cta { display: inline-flex; flex: none; align-items: center; gap: 12px; height: 46px; padding: 0 7px 0 18px; border-radius: 16px; background: var(--sh-inv-bg); color: var(--sh-inv-fg) !important; font-size: 16px; font-weight: 600; text-decoration: none; white-space: nowrap; transition: transform .16s var(--sh-ease), background-color .2s ease; }
.sh-cta i { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 11px; background: var(--sh-accent); color: #fff; transition: transform .25s var(--sh-ease); }
.sh-cta svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sh-cta:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .sh-cta:hover { background: var(--sh-inv-hover); } .sh-cta:hover i { transform: translateX(3px); } }
.sh-progress { position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(var(--sh-accent), var(--sh-accent)) 0 100% / calc(var(--sh-progress, 0) * 100%) 2px no-repeat; pointer-events: none; }
.sh-burger, .sh-menu { display: none; }

/* The account button socium.js draws in place of «Кабинет» from the cabinet's note. */
.sh .site-account { position: relative; display: flex; flex: none; align-items: center; }
.sh .site-account-button { position: relative; display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 12px 0 5px; border: 1.5px solid var(--sh-line); border-radius: 16px; background: var(--sh-paper); color: var(--sh-ink); font-weight: 700; cursor: pointer; }
.sh .site-account-button:hover, .sh .site-account-button[aria-expanded="true"] { border-color: var(--sh-ink); }
.sh .site-account-button svg { width: 16px; height: 16px; }
.sh .site-avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 11px; background: var(--sh-accent); color: #fff; font-size: 15px; }
.sh .site-account-balance { font-size: 14.5px; white-space: nowrap; }
.sh .site-account-menu { position: absolute; z-index: 60; top: calc(100% + 10px); right: 0; display: grid; gap: 2px; width: min(300px, calc(100vw - 24px)); padding: 8px; border: 1px solid var(--sh-line); border-radius: 18px; background: var(--sh-paper); box-shadow: 0 18px 50px rgb(16 18 27 / .14); }
.sh .site-account-menu[hidden] { display: none; }
.sh .site-account-head { display: grid; gap: 2px; margin-bottom: 6px; padding: 10px 12px 12px; border-bottom: 1px solid var(--sh-line); }
.sh .site-account-head b { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.sh .site-account-head small { overflow: hidden; color: var(--sh-soft); text-overflow: ellipsis; white-space: nowrap; }
.sh .site-account-balance-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 9px 12px; border-radius: 12px; background: var(--sh-bg); font-weight: 700; }
.sh .site-account-balance-row a { padding: 6px 12px; border-radius: 999px; background: var(--sh-inv-bg); color: var(--sh-inv-fg); font-size: 13px; text-decoration: none; }
.sh .site-account-menu > a { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 0 12px; border-radius: 11px; color: var(--sh-ink); font-size: 14.5px; font-weight: 600; text-decoration: none; }
.sh .site-account-menu > a:hover, .sh .site-account-menu > a:focus-visible { background: var(--sh-bg); outline: 0; }
.sh .site-account-menu > a svg { flex: 0 0 17px; color: var(--sh-soft); }
.sh .site-account-menu hr { margin: 6px 4px; border: 0; border-top: 1px solid var(--sh-line); }

@media (max-width: 1100px) { .sh-nav a { padding: 9px 10px; font-size: 15px; } }
/* Phones and tablets: the sections and the language behind one button; the sheet drops from the header. */
@media (max-width: 960px) {
  .sh { top: 10px; width: calc(100% - 20px); min-height: 58px; padding: 6px 6px 6px 14px; border-radius: 18px; }
  .sh-brand { font-size: 19px; } .sh-brand img { width: 27px; height: 27px; }
  .sh-nav, .sh-end > .sh-lang { display: none; }
  .sh-end { flex: none; margin-left: auto; gap: 4px; }
  .sh-cta { height: 44px; padding: 0 6px 0 14px; font-size: 15px; }
  .sh-cta i { width: 30px; height: 30px; }
  .sh-theme { width: 40px; height: 40px; }
  .sh-burger { display: grid; flex: none; width: 44px; height: 44px; align-content: center; justify-items: center; gap: 4px; padding: 0; border: 0; border-radius: 13px; background: var(--sh-bg); cursor: pointer; }
  .sh-burger span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--sh-ink); transition: transform .2s var(--sh-ease), opacity .2s ease; }
  .sh-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .sh-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .sh-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .sh-menu { position: absolute; top: calc(100% + 8px); left: 0; right: 0; display: grid; gap: 2px; padding: 10px; border-radius: 20px; background: var(--sh-paper); box-shadow: var(--sh-shadow), 0 30px 60px -30px rgb(0 0 0 / .35); }
  .sh-menu[hidden] { display: none; }
  .sh-menu > a { display: flex; align-items: center; min-height: 48px; padding: 0 14px; border-radius: 12px; color: var(--sh-ink); font-size: 17px; font-weight: 600; text-decoration: none; }
  .sh-menu > a:active, .sh-menu > a[aria-current] { background: var(--sh-bg); }
  .sh-menu-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; padding: 12px 4px 2px 14px; border-top: 1px solid var(--sh-line); color: var(--sh-soft); font-size: 14px; font-weight: 700; }
}
/* Phones, signed in: the balance moves into the menu and the menu opens as a sheet under the header, edge to edge
   (owner 2026-11-29 «выпадает в сторону», 2026-12-01: on a narrow phone the balance pushed the burger off the screen
   and the menu off the right edge). */
@media (max-width: 760px) {
  .sh .site-account-balance { display: none; }
  .sh .site-account-button { min-height: 44px; padding: 0 8px 0 4px; gap: 4px; }
  .sh .site-account { position: static; }
  .sh .site-account-menu { top: calc(100% + 8px); left: 0; right: 0; width: auto; max-height: calc(100dvh - 90px); overflow-y: auto; }
}
.sh .site-account-menu { left: auto; }
@media (max-width: 760px) { .sh .site-account-menu { left: 0; } }
@media (max-width: 380px) { .sh-cta { padding-left: 12px; font-size: 14px; } .sh-cta i { display: none; } }

/* Moving between the two languages (and between pages of the site) cross-fades instead of flashing. */
@view-transition { navigation: auto; }

/* The theme switch (socium.js): the new theme opens as a circle from the switch, as on instarium.app. Only while the
   switch runs — a move between pages keeps its cross-fade. */
:root[data-theme-switching] *, :root[data-theme-switching] { transition: none !important; }
:root[data-theme-switching]::view-transition-old(root), :root[data-theme-switching]::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
:root[data-theme-switching]::view-transition-new(root) { z-index: 1; }

/* socium.css draws its own arrow after .nav__cta (the old header): the shared header has its own. */
.sh .sh-cta::after, .sh .sh-cta::before { content: none !important; display: none !important; }
.sh .sh-cta { min-height: 0; margin: 0; border: 0; box-shadow: none; }

/* The lean header (the market): no sections, no menu; the language stays visible on a phone. */
.sh--lean .sh-end { flex: 1 1 auto; }
@media (max-width: 960px) { .sh--lean .sh-end > .sh-lang { display: flex; } }
@media (max-width: 340px) { .sh--lean .sh-brand { font-size: 0; gap: 0; } .sh--lean .sh-end { gap: 2px; } }

/* ── Language picker (owner 2026-12-03, «вариант Б»): one button — globe, current language, chevron — and the list of
   languages under it. The same copy on thredium.app, instarium.app, socium.tools and the market; it reads each site's
   own colours (--sh-* in the shared Socium header, the bold system's --paper/--ink/--soft/--line/--bg elsewhere). */
/* Before the script turns a header group into the button, only the current language shows, in a box as wide as the
   button will be: the header does not jump when the script runs. Without scripts every language stays visible. */
@media (scripting: enabled) {
  :is([data-nav-language], [data-language-switch], .language-switch, .sh-lang, .lang):not([data-lang-pick]):not(:is(.mobile-menu, .sh-menu, .nav__menu-row, .mobile-menu-language-row, .mobile-menu__lang, [data-mobile-menu]) *) {
    min-width: 86px; justify-content: flex-end;
  }
  :is([data-nav-language], [data-language-switch], .language-switch, .sh-lang, .lang):not([data-lang-pick]):not(:is(.mobile-menu, .sh-menu, .nav__menu-row, .mobile-menu-language-row, .mobile-menu__lang, [data-mobile-menu]) *)
    > :is(a, button):not([aria-current]):not([aria-pressed="true"]):not(.active) { display: none !important; }
}
[data-lang-pick] { position: relative; }
[data-lang-pick] > .lang-pick-trigger.lang-pick-trigger {
  /* A site's own rules for a language group's links and buttons (fixed squares, muted colours, often !important and
     with several attribute selectors, as on thredium.app) must not reach the picker: hence !important and the doubled class. */
  display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 6px; width: auto !important; min-width: 0 !important;
  height: 32px !important; margin: 0 !important; padding: 0 9px 0 8px !important; border: 0 !important; border-radius: 10px !important;
  background: var(--sh-paper, var(--paper, #fff)) !important; color: var(--sh-ink, var(--ink, #1d202b)) !important;
  font: inherit; font-size: 13.5px !important; font-weight: 700 !important; line-height: 1 !important; letter-spacing: 0 !important;
  cursor: pointer; white-space: nowrap; box-shadow: 0 1px 2px rgb(29 32 43 / .14) !important;
}
.lang-pick-trigger svg { flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lang-pick-globe { width: 16px; height: 16px; }
.lang-pick-chevron { width: 14px; height: 14px; opacity: .55; transition: transform .2s ease; }
[data-lang-pick].is-open .lang-pick-chevron { transform: rotate(180deg); }
.lang-pick-trigger:focus-visible, .lang-pick-item:focus-visible { outline: 2px solid var(--sh-accent, var(--accent, #0a6cff)); outline-offset: 2px; }
.lang-pick-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 80; display: grid; gap: 2px; min-width: 180px; padding: 6px;
  border: 1px solid var(--sh-line, var(--line, #e2e4ea)); border-radius: 14px; background: var(--sh-paper, var(--paper, #fff));
  box-shadow: 0 18px 44px -18px rgb(10 14 30 / .42);
}
.lang-pick-menu[hidden] { display: none; }
[data-lang-pick] .lang-pick-menu > .lang-pick-item.lang-pick-item {
  display: flex !important; align-items: center; justify-content: space-between; gap: 14px; width: auto !important; min-width: 0 !important;
  height: auto !important; margin: 0 !important; padding: 10px 12px !important; border: 0 !important; border-radius: 10px !important; background: none !important;
  color: var(--sh-ink, var(--ink, #1d202b)) !important; font: inherit; font-size: 14px !important; font-weight: 600 !important; line-height: 1.2 !important;
  letter-spacing: 0 !important; text-align: left; text-decoration: none !important; text-transform: none !important; box-shadow: none !important; cursor: pointer;
}
[data-lang-pick] .lang-pick-menu > .lang-pick-item.lang-pick-item:hover { background: var(--sh-bg, var(--bg, #f3f4f7)) !important; }
[data-lang-pick] .lang-pick-menu > .lang-pick-item.lang-pick-item:is([aria-current], [aria-pressed="true"], .active) { background: var(--sh-bg, var(--bg, #f3f4f7)) !important; font-weight: 700 !important; }
[data-lang-pick] .lang-pick-menu > .lang-pick-item.lang-pick-item:is([aria-current], [aria-pressed="true"], .active)::after { content: "✓"; color: var(--sh-accent, var(--accent, #0a6cff)); }
@media (prefers-reduced-motion: reduce) { .lang-pick-chevron { transition: none; } }
/* The cabinet's own language group is a pill with padding and a tinted ground: the picker brings its own. */
.language[data-lang-pick] { padding: 0; border: 0; background: none; }
