/* Shared single-row desktop header for guests, learners and administrators. */
#site-header { position: relative; border-bottom: 1px solid var(--line); background: #fffefa; box-shadow: none; }
#site-header .header-main {
  --header-nav-gap: 12px;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: minmax(68px, auto); align-items: center;
  max-width: 1760px; min-height: 0; margin: auto; padding: 0 20px;
  column-gap: var(--header-module-gap, 112px); row-gap: 0;
}
#site-header .brand-link { grid-column: 1; grid-row: 1; justify-self: start; min-width: 0; gap: 10px; border-radius: 3px; }
#site-header .brand-link:hover { box-shadow: none; background: transparent; }
#site-header .brand-link:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; box-shadow: none; }
#site-header .aj-wordmark strong { color: var(--ink); font-size: 21px; font-weight: 750; }
#site-header .aj-wordmark small { color: #80705d; font-size: 9px; font-weight: 600; letter-spacing: .1em; }
#site-header .brand-owner-logo { width: 68px; height: 46px; }
#site-header .brand-custom-logo { width: 170px; height: 48px; }
#site-header .account-area {
  display: flex; grid-column: 3; grid-row: 1; justify-self: end; align-items: center;
  flex-wrap: nowrap; min-width: 0; max-width: none; gap: 6px;
  color: var(--ink); font-size: 14px; font-weight: 500; line-height: 1.3;
}
#site-header .language-switch { height: 36px; padding: 0; gap: 0; border: 1px solid var(--line); border-radius: 3px; background: #fffefa; overflow: hidden; }
#site-header .language-switch button { position: relative; min-height: 34px; padding: 7px 8px; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; }
#site-header .language-switch button.active { color: inherit; background: #f4efe7; box-shadow: inset 0 -2px var(--red); }
#site-header .account-area .button.small,
#site-header .account-area .role-chip {
  flex: none; min-height: 36px; padding: 7px 9px; border: 1px solid var(--line);
  border-radius: 3px; background: #fffefa; color: var(--ink); font: inherit;
}
#site-header .account-area .role-chip { background: #f4efe7; white-space: nowrap; }
#site-header .account-name { display: block; align-content: center; min-height: 36px; max-width: 120px; padding: 0 4px; border: 0; border-radius: 0; background: transparent; color: var(--ink); font: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#site-header .account-area .button:hover,
#site-header .language-switch button:hover { border-color: var(--red); color: var(--ink); background: #f4efe7; transform: none; }
#site-header .account-area button:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
#site-header .mobile-menu-toggle { display: none; }
#site-header .main-nav {
  position: static; display: flex; grid-column: 2; grid-row: 1; align-items: center;
  justify-content: space-between; flex-wrap: nowrap; width: 100%; min-width: 0; max-width: none;
  margin: 0; padding: 0; gap: var(--header-nav-gap); overflow: visible;
  border: 0; border-radius: 0; background: transparent; box-shadow: none;
}
#site-header .main-nav .nav-link {
  display: flex; flex: none; align-items: center; justify-content: center; min-width: 0;
  min-height: 44px; width: auto; padding: 10px 8px; border-radius: 0;
  color: var(--ink); font-size: 14px; font-weight: 500; line-height: 1.3;
  text-align: center; white-space: nowrap;
}
#site-header .nav-label { display: flex; align-items: center; justify-content: center; gap: 5px; width: auto; line-height: inherit; }
#site-header :is(.nav-primary, .nav-secondary) { display: inline; margin: 0; color: inherit; font: inherit; max-width: none; overflow: visible; text-overflow: clip; white-space: nowrap; }
#site-header .main-nav .nav-link:is(:hover, :focus-visible, .active) { color: var(--ink); background: #f4efe7; }
#site-header .main-nav .nav-link:is(:hover, .active) .nav-secondary { color: inherit; }
#site-header .main-nav .nav-link::after { left: 8px; right: 8px; bottom: 0; height: 2px; background: var(--red); }
#site-header .main-nav .nav-link sup { position: absolute; top: 5px; right: 4px; width: 4px; height: 4px; padding: 0; background: #b48a4d; }
/* Long translations and edited labels use the existing compact menu when needed. */
#site-header.header-compact .mobile-menu-toggle { display: inline-flex; grid-column: 2; grid-row: 1; justify-self: end; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 3px; background: #fffefa; color: var(--ink); font-family: inherit; font-size: 14px; font-weight: 500; line-height: 1.3; }
#site-header.header-compact .main-nav { display: none; gap: 0; }
#site-header.header-compact.menu-open .main-nav { position: absolute; z-index: 90; top: 100%; left: 0; right: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; padding: 8px 20px; border-bottom: 1px solid var(--line); background: #fffefa; }
#site-header.header-compact .main-nav .nav-link { width: 100%; white-space: normal; }
#site-header.header-compact .nav-label { flex-wrap: wrap; }
#site-header.header-compact :is(.nav-primary, .nav-secondary) { white-space: normal; overflow-wrap: anywhere; }
/* Keep the three groups distinct on laptops without forcing a second row. */
@media (min-width: 1181px) and (max-width: 1599px) {
  #site-header .header-main { --header-nav-gap: 4px; }
  #site-header .main-nav .nav-link { padding-inline: 6px; }
}
@media (max-width: 1180px) {
  #site-header .header-main { column-gap: 12px; }
}
@media (max-width: 900px) {
  #site-header .header-main { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: minmax(58px, auto) auto; }
  #site-header .account-area { grid-column: 1 / -1; grid-row: 2; justify-self: end; padding-bottom: 10px; }
  #site-header.header-compact.menu-open .main-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); max-height: min(60vh, 520px); overflow-y: auto; }
}
@media (max-width: 640px) {
  #site-header .header-main { padding-inline: 16px; }
  #site-header .aj-wordmark strong { font-size: 19px; }
  #site-header .brand-owner-logo { width: 60px; height: 42px; }
  #site-header .account-area { justify-self: stretch; justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
  #site-header .account-area :is(.role-chip, .account-name) { display: none; }
  #site-header .language-switch button { padding-inline: 6px; }
  #site-header .account-area .button.small { padding-inline: 7px; }
  #site-header.header-compact.menu-open .main-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-inline: 16px; }
}
