/* The site header (relaunch v2): sticky, 72 px, one baseline; mega-menu panels; compact language
   switch (globe + code); icon-only theme toggle; login (secondary) and the call to action (primary), both
   40 px from the button system in ui.css. Nothing wraps.
   Below 1180 px the compact header (logo, CTA, burger + drawer) takes over. Colours from tokens.css. */
:root { --header-height: 72px; --site-width: 1400px; }
html { scroll-padding-top: calc(var(--header-height) + 12px); }
.site-header { position: sticky; top: 0; z-index: 60; background: var(--surface); border-bottom: 1px solid var(--line); transition: box-shadow .2s ease, background-color .2s ease; }
.site-header.is-scrolled { box-shadow: var(--elev-sm); }
.site-header-inner { width: min(var(--site-width), calc(100% - 48px)); margin: 0 auto; height: var(--header-height); display: flex; align-items: center; gap: 20px; white-space: nowrap; }
.site-header * { white-space: nowrap; }
.site-brand { flex: none; display: block; line-height: 0; }
.site-brand img { width: 140px; height: auto; display: block; }
:root[data-theme="dark"] .site-brand img, :root[data-theme="dark"] .site-drawer-head img, :root[data-theme="dark"] .market-footer-brand img { filter: brightness(0) invert(.92) sepia(.08) saturate(.6); }

/* ---- desktop nav ---- */
/* the header keeps its own geometry: legacy page styles never reach into it */
.site-header .site-nav { margin-left: 8px; height: auto; display: flex; align-items: center; align-self: center; }
.site-nav-list { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 2px; }
.site-nav-list > li { position: relative; }
.site-nav-button, .site-nav-link { display: inline-flex; align-items: center; gap: .3rem; height: 40px; padding: 0 .8rem; border: 0; border-radius: 10px; background: transparent; color: var(--ink) !important; font: inherit; font-size: 15px; font-weight: 500; line-height: 1; cursor: pointer; text-decoration: none; transition: background-color .15s ease; }
.site-nav-button:hover, .site-nav-link:hover, .site-nav-button[aria-expanded="true"] { background: var(--surface-2); color: var(--ink) !important; }
.site-nav-link[aria-current="page"] { background: var(--neutral-soft); }
.site-chevron { transition: transform .2s ease; color: var(--muted); }
.site-nav-button[aria-expanded="true"] .site-chevron, .site-lang-button[aria-expanded="true"] .site-chevron, .site-accordion[aria-expanded="true"] .site-chevron { transform: rotate(180deg); }

.site-panel { position: absolute; top: calc(100% + 10px); left: 0; min-width: 320px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--elev-lg); opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s; z-index: 70; white-space: normal; }
.site-panel * { white-space: normal; }
[data-menu].is-open > .site-panel { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.site-panel--wide { min-width: 660px; }
.site-panel-lead { margin: 2px 8px 10px; font-size: .85rem; color: var(--muted); }
.site-panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.site-panel-list { display: grid; gap: 4px; }
.site-panel-item { display: flex; align-items: center; gap: .8rem; padding: .6rem .7rem; border-radius: 12px; color: var(--ink) !important; text-decoration: none; line-height: 1.3; }
.site-panel-item:hover, .site-panel-item:focus-visible { background: var(--surface-2); }
.site-panel-item[aria-current="page"] { background: var(--accent-tint); }
.site-panel-item strong { display: block; font-weight: 600; font-size: .95rem; color: var(--ink); }
.site-panel-item small { display: block; color: var(--muted); font-size: .8rem; margin-top: .1rem; }
.site-panel-all { display: inline-flex; align-items: center; gap: .4rem; margin: 10px 8px 2px; font-size: .9rem; font-weight: 600; color: var(--accent-text) !important; text-decoration: none; }
.site-panel-all:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---- actions (right group) ---- */
.site-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.site-icon-button { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; height: 40px; min-width: 40px; padding: 0 .5rem; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--ink) !important; font: inherit; font-size: 14px; font-weight: 500; line-height: 1; cursor: pointer; }
.site-icon-button:hover { background: var(--surface-2); }
.site-lang { position: relative; }
.site-lang-button span { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.site-panel--lang { left: auto; right: 0; min-width: 200px; padding: 8px; }
.site-lang-list { list-style: none; margin: 0; padding: 0; display: grid; }
.site-lang-list a { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .55rem .7rem; border-radius: 10px; color: var(--ink) !important; text-decoration: none; font-size: .95rem; }
.site-lang-list a:hover, .site-lang-list a:focus-visible { background: var(--surface-2); }
.site-lang-list a[aria-current="true"] { color: var(--accent-text) !important; font-weight: 650; }
.site-theme .icon-moon { display: none; }
.site-theme[aria-pressed="true"] .icon-moon { display: inline-block; }
.site-theme[aria-pressed="true"] .icon-sun { display: none; }
.site-login { margin-left: 6px; }
.site-cta { margin-left: 4px; }
.site-burger { display: none; }

/* ---- drawer ---- */
.site-drawer { position: fixed; inset: 0; z-index: 80; background: var(--overlay-dark); opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility 0s linear .2s; }
.site-drawer.is-open { opacity: 1; visibility: visible; transition-delay: 0s; }
.site-drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--surface); color: var(--ink); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .25s ease; overflow: hidden; }
.site-drawer.is-open .site-drawer-panel { transform: none; }
.site-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px 20px; border-bottom: 1px solid var(--line); }
.site-drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px; display: grid; gap: 6px; align-content: start; }
.site-drawer .site-cta--block, .site-drawer .site-login--block { --_h: 48px; --_fs: 16px; --_r: 12px; justify-content: center; width: 100%; margin-left: 0; }
.site-login--block { margin-bottom: 10px; }
.site-accordion { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 56px; padding: 0 4px 0 6px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink) !important; font: inherit; font-size: 17px; font-weight: 600; text-align: left; cursor: pointer; text-decoration: none; transition: background-color .15s ease; }
.site-accordion:hover { background: var(--row-hover); }
.site-accordion .site-chevron, .site-accordion > .icon:last-child { display: flex; align-items: center; justify-content: center; box-sizing: content-box; width: 16px; height: 16px; padding: 6px; border-radius: 50%; background: var(--neutral-soft); color: var(--ink); }
.site-accordion[aria-expanded="true"] .site-chevron { background: var(--ink); color: var(--surface); }
.site-accordion-panel { display: grid; padding: 4px 0 10px; }
.site-accordion-panel a { display: flex; align-items: center; gap: .7rem; min-height: 44px; padding: 0 .5rem; border-radius: 10px; color: var(--ink-2) !important; text-decoration: none; font-size: .98rem; }
.site-accordion-panel a:hover { background: var(--surface-2); }
.site-accordion-panel .icon { color: var(--accent-text); }
.site-drawer-foot { padding: 12px 20px 20px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.site-drawer-foot .site-theme { justify-self: start; border: 1px solid var(--secondary-border); background: var(--secondary-bg); box-shadow: var(--elev-xs); padding: 0 .8rem; }
.site-drawer-langs { display: flex; flex-wrap: wrap; gap: 6px; }
.site-drawer-langs a { min-height: 36px; padding: 0 12px; font-size: 14px; }
body.drawer-open { overflow: hidden; }

/* ---- the compact header below the width where the longest language fits on one line ---- */
@media (max-width: 1180px) {
    .site-header .site-nav, .site-header .site-actions > .site-login, .site-header .site-lang, .site-header .site-actions > .site-theme { display: none; }
    .site-burger { display: inline-flex; }
    :root { --header-height: 64px; }
    .site-header-inner { width: calc(100% - 32px); gap: 10px; }
    .site-brand img { width: 126px; }
}
/* Phones: logo + a compact single-line CTA + burger must fit 375 px (the longest CTA is German/Russian). */
@media (max-width: 520px) {
    .site-header-inner { width: calc(100% - 24px); gap: 6px; }
    .site-brand img { width: 100px; }
    .site-header .site-actions > .site-cta { --_h: 38px; --_px: 12px; --_fs: 13.5px; --_icon: 15px; gap: 5px; margin-left: 0; }
    .site-burger { min-width: 38px; padding: 0 .3rem; }
}
@media (max-width: 400px) {
    .site-header .site-header-inner { gap: 4px; }
    .site-header .site-brand img { width: 90px; }
    .site-header .site-actions > .site-cta { --_px: 10px; gap: 4px; }
    .site-header .site-burger { min-width: 36px; padding: 0 .2rem; }
}
@media (max-width: 360px) { .site-header .site-actions > .site-cta { --_fs: 12.5px; --_px: 9px; } .site-brand img { width: 92px; } }
@media (prefers-reduced-motion: reduce) { .site-panel, .site-drawer, .site-drawer-panel, .site-chevron, .site-accordion { transition: none; } }
