/* =========================================================================
   AUK Header — responsive, RTL/LTR aware, sticky shrink, off-canvas drawer
   Namespaced under .site-header / .site-drawer / .site-search to avoid
   collisions with legacy rules in style.css.
   ========================================================================= */

.site-header,
.site-drawer,
.site-search {
  --auk-header-bg: #2d4d89;
  --auk-header-bg-alt: #24406f;
  --auk-header-fg: #ffffff;
  --auk-header-muted: rgba(255, 255, 255, 0.78);
  --auk-header-accent: #f7a600;
  --auk-header-accent-hover: #ffbf3d;
  --auk-header-divider: rgba(255, 255, 255, 0.16);
  --auk-topbar-h: 44px;
  --auk-header-h: 110px;
  --auk-header-h-sm: 72px;
  --auk-drawer-w: min(320px, 85vw);
  --auk-z-header: 900;
  --auk-z-drawer: 1000;
  --auk-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --auk-radius: 8px;
  font-family: inherit;
}

/* --- Sticky shell ---------------------------------------------------------*/
.site-header {
  position: sticky;
  top: 0;
  inset-inline: 0;
  z-index: var(--auk-z-header);
  background: var(--auk-header-bg);
  color: var(--auk-header-fg);
  box-shadow: 0 2px 10px rgba(12, 20, 40, 0.1);
}
.site-header__box { /* full-width pass-through */ }
.site-header a { color: inherit; text-decoration: none; }
.site-header *,
.site-drawer *,
.site-search * { box-sizing: border-box; }

/* --- Topbar ---------------------------------------------------------------*/
.site-header__topbar {
  background: #ffffff;
  color: #3b4a6a;
  border-bottom: 1px solid #eef1f6;
  font-size: 13px;
  line-height: 1.2;
  overflow: hidden;
  max-height: var(--auk-topbar-h);
  transition: max-height 0.25s var(--auk-ease), padding 0.25s var(--auk-ease);
}
/* Shared container — matches Bootstrap's .container breakpoints */
.site-header__topbar-inner,
.site-header__inner,
.site-header__nav-inner {
  width: 100%;
  margin-inline: auto;
  padding-inline: 12px;
}
@media (min-width: 576px) {
  .site-header__topbar-inner,
  .site-header__inner,
  .site-header__nav-inner { max-width: 540px; }
}
@media (min-width: 768px) {
  .site-header__topbar-inner,
  .site-header__inner,
  .site-header__nav-inner { max-width: 720px; }
}
@media (min-width: 992px) {
  .site-header__topbar-inner,
  .site-header__inner,
  .site-header__nav-inner { max-width: 960px; }
}
@media (min-width: 1200px) {
  .site-header__topbar-inner,
  .site-header__inner,
  .site-header__nav-inner { max-width: 1140px; }
}
@media (min-width: 1400px) {
  .site-header__topbar-inner,
  .site-header__inner,
  .site-header__nav-inner { max-width: 1320px; }
}

.site-header__topbar-inner {
  min-height: var(--auk-topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
}
.site-header__date { margin: 0; font-size: 12.5px; color: #6b7893; }
.site-header__topmenu {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-header__topmenu ul {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-header__topmenu a {
  display: inline-block;
  padding: 6px 8px;
  font-size: 12.5px;
  color: #3b4a6a;
  transition: color 0.15s;
}
.site-header__topmenu a:hover { color: var(--auk-header-bg); }

/* --- Main bar -------------------------------------------------------------*/
.site-header__main {
  position: relative;
  background: var(--auk-header-bg);
}
.site-header__inner {
  height: var(--auk-header-h);
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
  transition: height 0.25s var(--auk-ease);
}

/* --- Primary nav row (desktop) -------------------------------------------*/
.site-header__nav-row {
  background: #ffffff;
  border-top: 1px solid #eef1f6;
  /* no overflow:hidden — it clips dropdown submenus */
  position: relative;
  z-index: 2;
}
.site-header__nav-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
}

/* Logo */
.site-header__logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  transition: transform 0.25s var(--auk-ease);
}
.site-header__logo img {
  display: block;
  height: 80px;
  width: auto;
  max-width: none;
  object-fit: contain;
  transition: height 0.25s var(--auk-ease);
}

/* Primary nav (desktop horizontal menu) */
.site-header__primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.site-header__primary > ul {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-header__primary li {
  position: relative;
  flex-shrink: 0;
}
.site-header__primary li > a {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 52px;
  padding-inline: 10px;
  color: #1e2a44;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.15s var(--auk-ease), color 0.15s;
}

/* First item becomes a home icon */
.site-header__primary > ul > li:first-child > a {
  font-size: 0;
  padding-inline: 14px;
}
.site-header__primary > ul > li:first-child > a::before {
  content: "\f015"; /* fa-home */
  font-family: "FontAwesome";
  font-size: 18px;
  line-height: 1;
}
.site-header__primary > ul > li:first-child.has-sub > a::after { display: none; }
.site-header__primary li > a:hover,
.site-header__primary li:hover > a,
.site-header__primary li:focus-within > a {
  background: #f4f6fa;
  color: var(--auk-header-bg);
}
.site-header__primary li.has-sub > a::after {
  content: "\f107"; /* fa-angle-down */
  font-family: "FontAwesome";
  font-size: 12px;
  margin-inline-start: 4px;
  opacity: 0.6;
}
/* Hide the inline chevron <i> that display_menu_items() emits — we use ::after */
.site-header__primary li.has-sub > i {
  display: none;
}

/* Submenus: hidden, revealed on hover / focus-within */
.site-header__primary li > ul {
  position: absolute;
  top: 100%;
  inset-inline-start: 0;
  min-width: 220px;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: #fff;
  color: #1e2a44;
  border-radius: var(--auk-radius);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.14);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.18s var(--auk-ease), transform 0.18s var(--auk-ease), visibility 0.18s;
  z-index: 5;
}
.site-header__primary li:hover > ul,
.site-header__primary li:focus-within > ul {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.site-header__primary li ul a {
  display: block;
  height: auto;
  padding: 10px 14px;
  color: #1e2a44;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  border-radius: 0;
  white-space: nowrap;
}
.site-header__primary li ul a:hover {
  background: #f4f6fa;
  color: var(--auk-header-bg);
}
/* Nested submenu (3+ levels) flies out to the inline-end side */
.site-header__primary li ul li > ul {
  top: 0;
  inset-inline-start: 100%;
  margin-inline-start: 2px;
}

/* Actions cluster */
.site-header__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Icon button (shared) */
.site-header__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  color: var(--auk-header-fg);
  font-size: 18px;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s var(--auk-ease), color 0.15s;
}
.site-header__icon-btn:hover,
.site-header__icon-btn:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  color: var(--auk-header-accent);
  outline: none;
}
.site-header__icon-btn:focus-visible {
  outline: 2px solid var(--auk-header-accent);
  outline-offset: 2px;
}
.site-header__icon-btn .fa { font-size: 18px; line-height: 1; }

/* Hamburger icon (hidden on desktop) */
.site-header__menu-toggle { display: none; }

/* Language switcher */
.site-header__lang {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding-inline: 12px;
  border-radius: 999px;
  border: 1px solid var(--auk-header-divider);
  color: var(--auk-header-fg);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.site-header__lang:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--auk-header-accent);
}

/* Social list (desktop) */
.site-header__social {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 4px;
  padding: 0;
  list-style: none;
}
.site-header__social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--auk-header-fg);
  font-size: 15px;
  transition: background 0.15s, color 0.15s;
}
.site-header__social a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--auk-header-accent);
}
.site-header__social img {
  width: 16px;
  height: 16px;
  display: block;
  object-fit: contain;
}

/* --- Inline slide-down search (collapses the header row height) ----------*/
.site-search {
  background: #fff;
  border-bottom: 1px solid #eef1f6;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.32s var(--auk-ease), opacity 0.2s var(--auk-ease);
}
.site-search.is-open {
  max-height: 120px;
  opacity: 1;
}
.site-search__inner {
  width: 100%;
  max-width: 1140px;
  margin-inline: auto;
  padding: 14px 20px;
}
@media (min-width: 1400px) {
  .site-search__inner { max-width: 1320px; }
}

.site-search__form {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 6px 0 14px;
  background: #f7f8fb;
  border: 1px solid #e6eaf1;
  border-radius: 999px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.site-search__form:focus-within {
  background: #fff;
  border-color: var(--auk-header-bg);
  box-shadow: 0 0 0 4px rgba(45, 77, 137, 0.12);
}
.site-search__icon {
  color: #94a3b8;
  font-size: 16px;
  flex-shrink: 0;
}
.site-search__input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  font-size: 15.5px;
  font-weight: 500;
  color: #1e2a44;
  outline: none;
}
.site-search__input::placeholder { color: #94a3b8; }

.site-search__submit {
  flex-shrink: 0;
  height: 36px;
  padding-inline: 18px;
  border: 0;
  border-radius: 999px;
  background: var(--auk-header-bg);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.site-search__submit:hover { background: var(--auk-header-bg-alt); }

.site-search__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.site-search__close:hover { background: #eef1f6; color: #1e2a44; }

/* --- Scrolled state: only subtle shadow (NO height/size changes) ---------
   Any geometry transition on a sticky element causes content reflow below,
   which produces the shaking effect users noticed. We keep the header at a
   fixed height and only give a soft shadow as visual affordance.           */
.site-header.is-scrolled {
  box-shadow: 0 4px 14px rgba(12, 20, 40, 0.15);
}

/* =========================================================================
   Off-canvas drawer (mobile / tablet)
   ========================================================================= */
.site-drawer {
  position: fixed;
  inset: 0;
  z-index: var(--auk-z-drawer);
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0.3s;
}
.site-drawer.is-open { pointer-events: auto; visibility: visible; }

.site-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 20, 40, 0.55);
  opacity: 0;
  transition: opacity 0.28s var(--auk-ease);
}
.site-drawer.is-open .site-drawer__backdrop { opacity: 1; }

.site-drawer__panel {
  position: absolute;
  top: 0;
  bottom: 0;
  inset-inline-end: 0;
  width: var(--auk-drawer-w);
  background: #fff;
  color: #1e2a44;
  box-shadow: -12px 0 28px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 0.3s var(--auk-ease);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
html[dir="rtl"] .site-drawer__panel {
  box-shadow: 12px 0 28px rgba(0, 0, 0, 0.18);
  transform: translateX(-100%);
}
.site-drawer.is-open .site-drawer__panel { transform: translateX(0); }

.site-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px;
  background: var(--auk-header-bg);
  color: #fff;
  flex-shrink: 0;
}
.site-drawer__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
}
.site-drawer__brand img { height: 30px; width: auto; }

.site-drawer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s;
}
.site-drawer__close:hover,
.site-drawer__close:focus-visible {
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}
.site-drawer__close:focus-visible {
  outline: 2px solid var(--auk-header-accent);
  outline-offset: 2px;
}

.site-drawer__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 12px 24px;
}

/* Drawer search */
.site-drawer__search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  background: #f4f6fa;
  border-radius: var(--auk-radius);
  margin-bottom: 14px;
}
.site-drawer__search .search-field {
  flex: 1;
  height: 40px;
  border: 0;
  background: transparent;
  padding-inline: 12px;
  font-size: 14px;
  color: #1e2a44;
  outline: none;
}
.site-drawer__search .search-submit {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 6px;
  background: var(--auk-header-bg);
  color: #fff;
  cursor: pointer;
}

/* Drawer nav list — targets markup from display_menu_items() */
.site-drawer__nav > ul,
.site-drawer__nav ul ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-drawer__nav li {
  position: relative;
  border-bottom: 1px solid #eef1f6;
}
.site-drawer__nav ul ul li:last-child { border-bottom: 0; }
.site-drawer__nav a {
  display: block;
  padding: 13px 12px;
  color: #1e2a44;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.site-drawer__nav a:hover { color: var(--auk-header-bg); background: #f7f9fc; }

/* Submenu toggle chevron (the <i> inside .has-sub emitted by display_menu_items) */
.site-drawer__nav li.has-sub > i {
  position: absolute;
  top: 8px;
  inset-inline-end: 4px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s, transform 0.2s var(--auk-ease);
  z-index: 2;
}
.site-drawer__nav li.has-sub > i:hover { background: #eef1f6; }
.site-drawer__nav li.has-sub.is-open > i { transform: rotate(180deg); }

/* Collapsed submenus */
.site-drawer__nav li > ul {
  display: none;
  background: #f7f9fc;
  padding-inline-start: 12px;
}
.site-drawer__nav li.is-open > ul { display: block; }
.site-drawer__nav li ul a {
  padding: 11px 12px;
  font-weight: 500;
  font-size: 14px;
  color: #334155;
}

/* Language + social strip inside drawer */
.site-drawer__meta {
  margin-top: 18px;
  padding: 14px 8px 0;
  border-top: 1px solid #eef1f6;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.site-drawer__lang {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.site-drawer__lang a {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: #f4f6fa;
  color: #1e2a44;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.site-drawer__lang a:hover {
  background: var(--auk-header-bg);
  color: #fff;
}

.site-drawer__social {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.site-drawer__social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--auk-header-bg);
  color: #fff;
  font-size: 16px;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}
.site-drawer__social a:hover {
  background: var(--auk-header-accent);
  transform: translateY(-1px);
}
.site-drawer__social img {
  width: 18px;
  height: 18px;
  display: block;
  object-fit: contain;
}

/* Body scroll lock when drawer open */
body.has-drawer-open { overflow: hidden; }

/* =========================================================================
   Breakpoints — mobile-first
   ========================================================================= */

/* Tablet & below: show hamburger, hide desktop-only nav + social + search icon
   (search lives inside the drawer on mobile/tablet, so no duplicate in the bar) */
@media (max-width: 991.98px) {
  .site-header__inner { height: var(--auk-header-h-sm); }
  .site-header__logo img { height: 56px; }
  .site-header__menu-toggle { display: inline-flex; }
  .site-header__search-toggle { display: none; }
  .site-header__nav-row { display: none; }
  .site-header__social { display: none; }
  .site-header__lang {
    height: 32px;
    padding-inline: 10px;
    font-size: 12.5px;
  }
  .site-header.is-scrolled .site-header__logo img { height: 44px; }
}

/* Mobile: hide topbar, tighten spacing */
@media (max-width: 767.98px) {
  .site-header__topbar { display: none; }
  .site-header__inner {
    height: 64px;
    padding-inline: 12px;
    gap: 4px;
  }
  .site-header__logo img { height: 52px; }
  .site-header__icon-btn { width: 40px; height: 40px; }
  .site-header__lang {
    height: 30px;
    padding-inline: 9px;
    font-size: 12px;
  }
  .site-search__form { padding: 10px 12px; }
  .site-search__input { height: 40px; font-size: 14px; }
  .site-search__submit,
  .site-search__close { width: 40px; height: 40px; }
  .site-header.is-scrolled .site-header__logo img { height: 42px; }
}

/* Very small screens: keep logo prominent, shrink icons slightly */
@media (max-width: 380px) {
  .site-header__inner { gap: 2px; padding-inline: 8px; }
  .site-header__logo img { height: 46px; }
  .site-header__icon-btn { width: 36px; height: 36px; }
  .site-header__lang { padding-inline: 7px; font-size: 11.5px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .site-header,
  .site-header__topbar,
  .site-header__inner,
  .site-header__logo,
  .site-header__logo img,
  .site-search,
  .site-drawer,
  .site-drawer__panel,
  .site-drawer__backdrop,
  .site-drawer__nav li.has-sub > i {
    transition-duration: 0.001s;
  }
}
