/*
 * Site header: the only place that styles it (2026-10-10). The older
 * stylesheets used to hold six overlapping header rules with !important and two
 * different breakpoints; those rules are gone. Loaded last.
 *
 *   >= 900px   logo | five links (centred) | RU/EN segmented control
 *   <  900px   logo | menu button; the menu is a sheet below the bar with a
 *              grouped list, the language control and the social links
 */

.site-header {
  position: fixed; inset: 0 0 auto; z-index: 110; height: var(--pk-bar);
  border-bottom: 1px solid transparent; font-family: var(--pk-font);
  transition: border-color var(--pk-base) var(--pk-ease), box-shadow var(--pk-base) var(--pk-ease);
}
/* The material lives on a pseudo-element: a backdrop-filter on the header itself would
   become the containing block of the fixed mobile sheet and squash it to the bar's height. */
.site-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--pk-material); -webkit-backdrop-filter: var(--pk-blur); backdrop-filter: var(--pk-blur);
  transition: background-color var(--pk-base) var(--pk-ease);
}
.site-header.is-scrolled, body.menu-open .site-header { border-bottom-color: var(--pk-separator); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
body.menu-open .site-header::before { background: var(--pk-material-thick); }

.site-header__bar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px;
  height: 100%; width: min(1440px, 100% - 2 * var(--pk-gutter)); margin-inline: auto;
}

/* Logo */
.site-header .logo { display: inline-flex; align-items: center; gap: 10px; justify-self: start; min-height: 44px; color: var(--pk-label); border-radius: var(--pk-r-sm); }
.site-header .logo img { display: block; width: 32px; height: 32px; border-radius: 8px; object-fit: contain; }
.site-header .logo::after { content: none; }
.site-header .logo__name { font: 600 17px/1 var(--pk-font-display); letter-spacing: -0.012em; white-space: nowrap; }

/* Links */
.site-header .site-nav { display: flex; align-items: center; gap: 2px; margin: 0; }
.site-header .site-nav a {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: var(--pk-r-pill);
  background: none; box-shadow: none; color: var(--pk-label-2); font: 500 15px/1 var(--pk-font); letter-spacing: -0.006em; text-transform: none; white-space: nowrap;
  transition: background-color var(--pk-fast) var(--pk-ease), color var(--pk-fast) var(--pk-ease);
}
.site-header .site-nav a::after { content: none; display: none; }
.site-header .site-nav a:hover { background: var(--pk-fill); color: var(--pk-label); }
.site-header .site-nav a:active { background: var(--pk-fill-2); }
.site-header .site-nav a.is-active, .site-header .site-nav a[aria-current="page"] { box-shadow: none; background: var(--pk-accent-tint); color: var(--pk-accent-text); }

/* Right side */
.site-header .header-right { display: flex; align-items: center; gap: 8px; justify-self: end; margin: 0; }

/* Segmented language control */
.lang-switcher { display: inline-flex; align-items: center; gap: 0; padding: 2px; border: 0; border-radius: var(--pk-r-pill); background: var(--pk-fill); font-family: var(--pk-font); }
.lang-switcher a {
  display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 28px; padding: 0 12px; border: 0; border-radius: var(--pk-r-pill);
  background: none; color: var(--pk-label-2); font: 600 13px/1 var(--pk-font); letter-spacing: 0.01em; text-transform: none;
  transition: background-color var(--pk-fast) var(--pk-ease), color var(--pk-fast) var(--pk-ease);
}
.lang-switcher a:hover { color: var(--pk-label); }
.lang-switcher a.is-active, .lang-switcher a[aria-current="true"] { background: var(--pk-surface-3); color: var(--pk-label); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
.site-header .lang-switcher a { background-color: transparent; border: 0; box-shadow: none; }
.site-header .lang-switcher a.is-active, .site-header .lang-switcher a[aria-current="true"] { background: var(--pk-surface-3); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }

/* Menu button: two bars that become a cross */
.site-header .nav-toggle {
  display: none; position: relative; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--pk-r-pill);
  background: var(--pk-fill); color: var(--pk-label); cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--pk-fast) var(--pk-ease);
}
.site-header .nav-toggle:hover { background: var(--pk-fill-2); }
.nav-toggle__bars { position: absolute; inset: 0; }
.nav-toggle__bars i { position: absolute; left: 14px; right: 14px; height: 2px; border-radius: 2px; background: currentColor; transition: transform var(--pk-base) var(--pk-spring), top var(--pk-base) var(--pk-spring); }
.nav-toggle__bars i:first-child { top: 17px; }
.nav-toggle__bars i:last-child { top: 25px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars i:first-child { top: 21px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars i:last-child { top: 21px; transform: rotate(-45deg); }

/* Focus: one visible ring everywhere in the bar */
.site-header a:focus-visible, .site-header button:focus-visible { outline: 3px solid var(--pk-focus); outline-offset: 2px; }
.site-header .site-nav a:focus-visible { outline-offset: 0; }

/* Skip link */
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 1000; padding: 11px 18px; border-radius: var(--pk-r-pill); background: var(--pk-accent); color: var(--pk-on-accent); font: 600 15px/1 var(--pk-font); transform: translateY(-160%); transition: transform var(--pk-base) var(--pk-spring); }
.skip-link:focus { transform: none; }

/* Mobile sheet */
.mobile-menu { display: none; }

@media (max-width: 899px) {
  .site-header__bar { grid-template-columns: minmax(0, 1fr) auto; }
  .site-header .site-nav, .site-header .header-right .lang-switcher { display: none; }
  .site-header .nav-toggle { display: block; }

  .mobile-menu {
    display: flex; flex-direction: column; gap: 20px; position: fixed; inset: var(--pk-bar) 0 0; z-index: 109;
    max-height: calc(100dvh - var(--pk-bar)); overflow-y: auto; overscroll-behavior: contain;
    padding: 16px var(--pk-gutter) max(28px, env(safe-area-inset-bottom));
    background: var(--pk-material-thick); -webkit-backdrop-filter: var(--pk-blur); backdrop-filter: var(--pk-blur);
    border-top: 1px solid var(--pk-separator);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity var(--pk-base) var(--pk-ease), transform var(--pk-base) var(--pk-spring), visibility 0s linear var(--pk-base);
  }
  .mobile-menu.is-open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  .mobile-menu__list { display: flex; flex-direction: column; border-radius: var(--pk-r-lg); background: var(--pk-surface-2); overflow: hidden; }
  .mobile-menu__list a {
    display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 0 20px; border: 0; border-bottom: 1px solid var(--pk-separator);
    color: var(--pk-label); font: 500 19px/1.2 var(--pk-font); letter-spacing: -0.014em; text-transform: none;
    transition: background-color var(--pk-fast) var(--pk-ease);
  }
  .mobile-menu__list a:last-child { border-bottom: 0; }
  .mobile-menu__list a::after { content: ""; width: 8px; height: 8px; margin-right: 4px; border-top: 2px solid var(--pk-label-3); border-right: 2px solid var(--pk-label-3); transform: rotate(45deg); }
  .mobile-menu__list a:active { background: var(--pk-fill); }
  .mobile-menu__list a[aria-current="page"] { color: var(--pk-accent-text); }
  .mobile-menu__list a[aria-current="page"]::after { border-color: var(--pk-accent-text); }
  .mobile-menu__list a:focus-visible { outline: 3px solid var(--pk-focus); outline-offset: -3px; }
  .mobile-menu__foot { display: flex; flex-direction: column; gap: 16px; }
  .lang-switcher--wide { display: flex; width: 100%; padding: 3px; }
  .lang-switcher--wide a { flex: 1; height: 40px; font-size: 15px; }
  .mobile-menu__social { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0; }
  .mobile-menu__social a {
    display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: var(--pk-r-pill); background: var(--pk-fill); color: var(--pk-label-2);
    transition: background-color var(--pk-fast) var(--pk-ease), color var(--pk-fast) var(--pk-ease);
  }
  .mobile-menu__social a:hover { background: var(--pk-fill-2); color: var(--pk-label); }
  .mobile-menu__social a:focus-visible { outline: 3px solid var(--pk-focus); outline-offset: 2px; }
}
@media (min-width: 900px) { .mobile-menu { display: none !important; } }
@media (max-width: 400px) { .site-header .logo__name { font-size: 16px; } }
body.menu-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .mobile-menu, .nav-toggle__bars i, .skip-link { transition: none; } }
@media (forced-colors: active) {
  .site-header .site-nav a.is-active, .lang-switcher a.is-active { outline: 2px solid CanvasText; }
}
