/* Shared site header — requires page-level tokens: --bg, --text, --muted, --accent, --line, --font-ui, --header-height */

header#siteHeader {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--bg);
  height: var(--header-height);
}

.header-inner {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "brand   tools"
    "tagline nav";
  align-items: center;
  column-gap: 40px;
  text-align: left;
  align-content: center;
}

.brand {
  grid-column: 1;
  grid-row: 1 / 3;
  display: block;
  width: fit-content;
  align-self: center;
  line-height: 0;
}

.brand-image {
  display: block;
  width: 400px;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  transform: translateX(-12px);
}

.header-tools {
  grid-area: tools;
  justify-self: end;
  align-self: start;
  display: flex;
  align-items: center;
  gap: 14px;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lang-option {
  border: 0;
  background: transparent;
  padding: 2px;
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 11pt;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.45;
  transition: opacity .2s, color .2s;
}

.lang-option:hover { opacity: 1; }
.lang-option.is-active { opacity: 1; color: var(--text); }

.header-social {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 11pt;
  letter-spacing: 0.04em;
  color: var(--accent);
  transition: color .2s;
}

.header-social:hover { color: var(--text); }

.menu-toggle {
  display: none;
  width: 22px;
  height: 22px;
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
}

.menu-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
}

nav#mainNav {
  grid-area: nav;
  justify-self: end;
}

nav#mainNav ul {
  list-style: none;
  display: flex;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: clamp(18px, 2.5vw, 40px);
  min-width: 0;
}

nav#mainNav a {
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 18px;
  letter-spacing: 0.03em;
  color: var(--text);
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  transition: border-color .25s, color .25s;
}

nav#mainNav a:hover,
nav#mainNav a.is-current {
  border-bottom-color: var(--text);
}

.has-submenu { position: relative; }
.nav-social { display: none; }

.submenu-toggle,
.menu-close {
  display: none;
}

@media (min-width: 960px) {
  .nav-item-head {
    display: inline;
  }
  nav#mainNav .submenu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    min-width: 0;
    display: none;
    flex-direction: column;
    align-content: center;
    gap: 4px;
    margin: 0;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.72);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    z-index: 210;
  }

  nav#mainNav .has-submenu:hover .submenu { display: flex; }
  nav#mainNav .submenu li { display: block; width: auto; text-align-last: center; }
  nav#mainNav .submenu a {
    display: block;
    padding: 0;
    font-size: 15px;
    white-space: nowrap;
    text-align: left;
    border-bottom: 0;
    color: var(--muted);
  }

  nav#mainNav .submenu a:hover { color: #000; }
}

@media (max-width: 959px) {
  header#siteHeader {
    height: auto;
    min-height: var(--header-height-mobile, 70px);
  }

  header#siteHeader.menu-open {
    min-height: var(--header-height-mobile, 70px);
  }

  .header-inner {
    height: auto;
    min-height: var(--header-height-mobile, 70px);
    display: grid;
    grid-template-columns: auto auto;
    grid-template-rows: auto;
    grid-template-areas: none;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    margin: 0;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    justify-self: start;
  }

  .brand-image {
    width: auto;
    height: 44px;
    max-width: min(260px, 58vw);
    transform: translate(-12px, 2px);
  }

  .header-tools {
    position: static;
    grid-column: 2;
    grid-row: 1;
    justify-self: start;
    align-self: center;
    gap: 12px;
  }

  .social-desktop { display: none; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }

  nav#mainNav {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0;
    padding: 72px 24px 40px;
    background: var(--bg);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  header#siteHeader.menu-open nav#mainNav {
    display: flex;
  }

  .menu-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 310;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
  }

  .menu-close svg {
    width: 22px;
    height: 22px;
    display: block;
  }

  nav#mainNav ul {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    min-width: 0;
    width: min(100%, 320px);
    padding: 0;
    list-style: none;
  }

  nav#mainNav > ul > li {
    width: 100%;
    text-align: center;
  }

  nav#mainNav a {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .nav-item-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
  }

  .submenu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: auto;
    height: auto;
    margin-right: 1px;
    color: var(--muted);
    pointer-events: none;
    font-family: var(--font-ui);
    font-size: 17px;
    line-height: 1;
    opacity: 0.65;
    transition: opacity 0.2s, color 0.2s;
  }

  .has-submenu.is-expanded .submenu-toggle {
    color: var(--text);
    opacity: 1;
  }

  .nav-item-head > a {
    text-align: center;
    cursor: pointer;
  }

  .submenu-toggle-icon::before {
    content: "+";
  }

  .has-submenu.is-expanded .submenu-toggle-icon::before {
    content: "\2212";
  }

  nav#mainNav .submenu {
    display: none;
    flex-direction: column;
    align-items: center;
    list-style: none;
    gap: 10px;
    margin: 0;
    padding: 12px 0 0;
  }

  nav#mainNav .has-submenu.is-expanded .submenu {
    display: flex;
  }

  nav#mainNav .submenu a {
    font-size: 15px;
    color: var(--muted);
    border-bottom: 0;
  }

  .nav-social {
    display: flex;
    justify-content: center;
    gap: 22px;
    padding: 28px 0 0;
  }

  .nav-social a { color: var(--accent); width: 20px; height: 20px; }
  .nav-social svg { width: 20px; height: 20px; }
}
