/* =========================================================
   Header scroll lock — prevent crushed / clipped second bar
   Load LAST. Keeps lang row + nav row stable while scrolling.
   ========================================================= */

:root {
  --lang-bar-h: 2.1rem !important;
  --header-h: 4.5rem !important;
}

html body .site-chrome {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: calc(var(--lang-bar-h) + var(--header-h)) !important;
  min-height: calc(var(--lang-bar-h) + var(--header-h)) !important;
  overflow: visible !important;
  pointer-events: none !important;
  z-index: 210 !important;
  background: transparent !important;
  transform: none !important;
}

html body .site-chrome .lang-bar,
html body .site-chrome .site-header {
  pointer-events: auto !important;
}

html body .lang-bar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: var(--lang-bar-h) !important;
  min-height: var(--lang-bar-h) !important;
  max-height: var(--lang-bar-h) !important;
  z-index: 212 !important;
  overflow: hidden !important;
  transform: none !important;
  opacity: 1 !important;
}

/* Second bar = main nav — never collapse on scroll */
html body .site-header,
html body.page-download .site-header,
html body.page-home .site-header,
html body.page-inner .site-header,
html body.is-scrolled .site-header,
html body .site-header.is-scrolled,
html body.is-scrolled.page-download .site-header,
html body.is-scrolled.page-home .site-header,
html body.is-scrolled.page-inner .site-header {
  position: fixed !important;
  top: var(--lang-bar-h) !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 211 !important;
  display: block !important;
  box-sizing: border-box !important;
  height: var(--header-h) !important;
  min-height: var(--header-h) !important;
  max-height: none !important;
  padding: 0 !important;
  margin: 0 !important;
  gap: 0 !important;
  overflow: visible !important;
  transform: none !important;
  clip: auto !important;
  clip-path: none !important;
  /* Kill mid-scroll height flicker from padding/top transitions */
  transition:
    background-color 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease,
    color 0.35s ease,
    backdrop-filter 0.35s ease !important;
}

html body .site-chrome:hover .site-header,
html body .site-chrome:focus-within .site-header,
html body.is-scrolled .site-chrome:hover .site-header,
html body.is-scrolled .site-chrome:focus-within .site-header {
  top: var(--lang-bar-h) !important;
}

html body .site-header__bar {
  display: grid !important;
  grid-template-columns: auto 1fr auto !important;
  align-items: center !important;
  height: 100% !important;
  min-height: var(--header-h) !important;
  margin-inline: auto !important;
  width: min(100% - 2.5rem, 92rem) !important;
  padding: 0 !important;
  overflow: visible !important;
}

/* Kill pad-breathing extras that push content out of fixed height */
html body .site-header .header-cats,
html body.is-scrolled .site-header .header-cats,
html body .site-header.is-scrolled .header-cats {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  opacity: 1 !important;
}

html body .site-header .header-cats a,
html body.is-scrolled .site-header .header-cats a,
html body .site-header.is-scrolled .header-cats a {
  padding-top: 0.55rem !important;
  padding-bottom: 0.55rem !important;
}

html body .site-header a.logo,
html body .site-header .logo__img,
html body.is-scrolled .site-header .logo__img,
html body .site-header.is-scrolled .logo__img {
  max-height: calc(var(--header-h) - 0.85rem) !important;
}

html body.is-scrolled .site-header .logo__img,
html body .site-header.is-scrolled .logo__img {
  height: clamp(2.05rem, 2.6vw, 2.45rem) !important;
}

html body.is-scrolled .site-header,
html body .site-header.is-scrolled {
  background: rgba(229, 226, 217, 0.98) !important;
  background-color: rgba(229, 226, 217, 0.98) !important;
  color: #1a1510 !important;
  -webkit-text-fill-color: #1a1510 !important;
  border-bottom: 0 !important;
  border-bottom-color: transparent !important;
  box-shadow: none !important;
}

html body.is-scrolled .site-header .logo,
html body.is-scrolled .site-header .logo__mark,
html body.is-scrolled .site-header .header-cats a,
html body.is-scrolled .site-header .nav-toggle,
html body.is-scrolled .site-header .search-btn,
html body .site-header.is-scrolled .logo,
html body .site-header.is-scrolled .logo__mark,
html body .site-header.is-scrolled .header-cats a,
html body .site-header.is-scrolled .nav-toggle,
html body .site-header.is-scrolled .search-btn {
  color: #1a1510 !important;
  -webkit-text-fill-color: #1a1510 !important;
}

html body.is-scrolled .site-header .nav-toggle span,
html body .site-header.is-scrolled .nav-toggle span {
  background: #1a1510 !important;
}

html body.is-scrolled .site-header .search-btn::before,
html body .site-header.is-scrolled .search-btn::before {
  border-color: #1a1510 !important;
  background: transparent !important;
}

html body.is-scrolled .site-header .search-btn::after,
html body .site-header.is-scrolled .search-btn::after {
  background: #1a1510 !important;
}

@media (max-width: 980px) {
  :root {
    --header-h: 4rem !important;
  }

  html body .site-header .header-cats,
  html body nav.header-cats {
    display: none !important;
  }

  html body .site-header__bar {
    grid-template-columns: 1fr auto !important;
  }
}
