/* ASA header styles — builds on theme.css tokens (var(--asa-*)). */

/* ASA logo light/dark switching (Blade components application-logo / application-mark) */
.asa-logo-on-dark { display: none; }
.dark .asa-logo-on-light { display: none; }
.dark .asa-logo-on-dark { display: inline-block; }

/* Preloader: ASA emblem instead of the theme icon (animation classes unchanged) */
.preloader__image {
  background-image: url(../../images/resources/asa-mark.svg) !important;
  background-size: 64px auto !important;
}

/* ==========================================================================
   Site header (owned by header engineer). Fixed glass bar + mega menu.
   Heights: --asa-header-h is the space reserved above the page content.
   ========================================================================== */

:root {
  --asa-header-h: 64px;
  --asa-header-bar-h: 52px;
}
@media (min-width: 1200px) {
  :root { --asa-header-h: 76px; --asa-header-bar-h: 60px; }
}

html { scroll-padding-top: calc(var(--asa-header-h) + 16px); }

/* Reserve room for the fixed header (page-wrapper keeps overflow hidden, so sticky is not an option) */
.page-wrapper { padding-top: var(--asa-header-h); }

.asa-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 999;
  height: var(--asa-header-h);
  padding: 0;
  background: transparent;
  box-shadow: none;
  display: flex;
  align-items: center;
}
header.asa-header .main-menu { width: 100%; background: transparent; padding: 0; }
.asa-header .container { max-width: 1320px; padding-left: 12px; padding-right: 12px; }

.asa-header__bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--asa-header-bar-h);
  padding: 0 10px 0 18px;
  border-radius: var(--asa-radius-pill);
  transition: height .25s var(--asa-ease), box-shadow .25s var(--asa-ease);
}
/* glass lives on a pseudo-element so child panels can blur the page behind them too */
.asa-header__bar::before {
  content: "";
  position: absolute; inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--asa-glass-bg);
  border: 1px solid var(--asa-glass-border);
  -webkit-backdrop-filter: blur(var(--asa-glass-blur)) saturate(140%);
  backdrop-filter: blur(var(--asa-glass-blur)) saturate(140%);
  box-shadow: var(--asa-glass-shadow);
  transition: background-color .25s var(--asa-ease), box-shadow .25s var(--asa-ease);
}
.asa-header.is-scrolled .asa-header__bar::before {
  background: color-mix(in srgb, var(--asa-surface) 88%, transparent);
  box-shadow: var(--asa-shadow);
}
@media (min-width: 1200px) {
  .asa-header.is-scrolled .asa-header__bar { height: 56px; }
}
@media (min-width: 1200px) { .asa-header__bar { padding: 0 12px 0 24px; gap: 24px; } }

.asa-header a { text-decoration: none; }

/* Logo */
.asa-header__logo { display: inline-flex; align-items: center; flex-shrink: 0; }
.asa-header__logo img { height: 34px; width: auto; }
.asa-header__logo .asa-logo-on-light,
.dark .asa-header__logo .asa-logo-on-dark { display: block; }
.asa-header__logo .asa-logo-on-dark,
.dark .asa-header__logo .asa-logo-on-light { display: none; }
@media (min-width: 1200px) { .asa-header__logo img { height: 40px; } }

/* Nav (desktop only) */
.asa-header__nav { display: none; flex: 1 1 auto; justify-content: center; min-width: 0; }
@media (min-width: 1200px) { .asa-header__nav { display: flex; } }

header.asa-header .main-menu .main-menu__list {
  display: flex; align-items: center; gap: 2px;
  margin: 0; padding: 0; list-style: none;
}
header.asa-header .main-menu .main-menu__list > li { position: static; list-style: none; margin: 0; padding: 0; }
header.asa-header .main-menu .main-menu__list > li > a {
  display: inline-flex; align-items: center;
  min-height: 44px; padding: 0 14px;
  border-radius: var(--asa-radius-pill);
  font: 500 15px/1 var(--asa-font);
  color: var(--asa-text);
  white-space: nowrap;
  transition: background-color .2s var(--asa-ease), color .2s var(--asa-ease);
}
header.asa-header .main-menu .main-menu__list > li.dropdown > a::after {
  content: ""; width: 6px; height: 6px; margin: -3px 0 0 8px;
  border: solid currentColor; border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg); opacity: .6;
}
header.asa-header .main-menu .main-menu__list > li > a:hover,
header.asa-header .main-menu .main-menu__list > li:has(:focus-visible) > a,
header.asa-header .main-menu .main-menu__list > li:hover > a {
  background: rgba(var(--asa-navy-rgb), .07);
  color: var(--asa-accent);
}
header.asa-header .main-menu .main-menu__list > li.current > a {
  color: var(--asa-accent);
  background: rgba(var(--asa-mint-rgb), .45);
}
html.dark header.asa-header .main-menu .main-menu__list > li > a:hover,
html.dark header.asa-header .main-menu .main-menu__list > li:has(:focus-visible) > a,
html.dark header.asa-header .main-menu .main-menu__list > li:hover > a { background: rgba(255, 255, 255, .08); }
html.dark header.asa-header .main-menu .main-menu__list > li.current > a { background: rgba(var(--asa-mint-rgb), .16); }

.asa-header a:focus-visible,
.asa-header button:focus-visible {
  outline: 2px solid var(--asa-teal);
  outline-offset: 2px;
}
html.dark .asa-header a:focus-visible,
html.dark .asa-header button:focus-visible { outline-color: var(--asa-mint); }

/* Simple dropdown */
header.asa-header .main-menu__list > li > .asa-dropdown {
  position: absolute; top: calc(100% + 8px); left: 50%;
  min-width: 220px; margin: 0; padding: 8px; list-style: none;
  border-radius: var(--asa-radius);
  background: var(--asa-glass-bg);
  border: 1px solid var(--asa-glass-border);
  -webkit-backdrop-filter: blur(var(--asa-glass-blur)) saturate(140%);
  backdrop-filter: blur(var(--asa-glass-blur)) saturate(140%);
  box-shadow: var(--asa-shadow);
  opacity: 0; visibility: hidden; transform: translate(-50%, 6px);
  transition: opacity .2s var(--asa-ease), transform .2s var(--asa-ease), visibility .2s;
}
header.asa-header .main-menu__list > li > .asa-dropdown::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; }
header.asa-header .main-menu__list > li > .asa-dropdown > li { list-style: none; margin: 0; }
header.asa-header .main-menu__list > li > .asa-dropdown > li > a {
  display: flex; align-items: center; min-height: 44px; padding: 0 14px;
  border-radius: var(--asa-radius-sm);
  font: 500 15px/1.3 var(--asa-font);
  color: var(--asa-text);
  transition: background-color .15s var(--asa-ease), color .15s var(--asa-ease);
}
header.asa-header .main-menu__list > li > .asa-dropdown > li:hover > a,
header.asa-header .main-menu__list > li > .asa-dropdown > li.current > a { background: rgba(var(--asa-mint-rgb), .45); color: var(--asa-accent); }
html.dark header.asa-header .main-menu__list > li > .asa-dropdown > li > a:hover,
html.dark header.asa-header .main-menu__list > li > .asa-dropdown > li.current > a { background: rgba(var(--asa-mint-rgb), .16); }

/* Open states (hover + keyboard) */
header.asa-header .main-menu .main-menu__list > li.dropdown { position: relative; }
header.asa-header .main-menu .main-menu__list > li.dropdown:has(.asa-mega) { position: static; }
header.asa-header .main-menu .main-menu__list > li.dropdown:hover > .asa-dropdown,
header.asa-header .main-menu .main-menu__list > li.dropdown:has(:focus-visible) > .asa-dropdown {
  opacity: 1; visibility: visible; transform: translate(-50%, 0);
}

/* Mega menu (projects) */
.asa-mega {
  position: absolute; left: 0; right: 0; top: calc(100% + 10px);
  display: grid; grid-template-columns: 280px 1fr; gap: 32px;
  padding: 28px;
  border-radius: var(--asa-radius-lg);
  box-shadow: var(--asa-shadow);
  opacity: 0; visibility: hidden; transform: translateY(6px);
  pointer-events: none;
  transition: opacity .2s var(--asa-ease), transform .2s var(--asa-ease), visibility 0s linear .2s;
  text-align: left;
}
.asa-mega::before { content: ""; position: absolute; left: 0; right: 0; top: -14px; height: 14px; }
header.asa-header .main-menu .main-menu__list > li.dropdown.is-open > .asa-mega {
  opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto;
  transition: opacity .2s var(--asa-ease), transform .2s var(--asa-ease), visibility 0s;
}
/* The plain projects list is only for the mobile menu clone. */
header.asa-header .asa-dropdown--mobile { display: none !important; }
.asa-mega__eyebrow {
  margin: 0 0 12px 14px; font: 600 12px/1 var(--asa-font);
  letter-spacing: .14em; text-transform: uppercase; color: var(--asa-text-muted);
}
.asa-mega__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.asa-mega__item { list-style: none; margin: 0; }
.asa-mega__item a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; padding: 0 14px;
  border-radius: var(--asa-radius-sm);
  font: 600 15px/1.3 var(--asa-font); color: var(--asa-text);
  transition: background-color .15s var(--asa-ease), color .15s var(--asa-ease);
}
.asa-mega__item a svg { opacity: 0; transform: translateX(-6px); transition: opacity .2s, transform .2s var(--asa-ease); flex-shrink: 0; }
.asa-mega__item.is-active a,
.asa-mega__item a:hover,
.asa-mega__item a:focus-visible { background: rgba(var(--asa-mint-rgb), .45); color: var(--asa-accent); }
html.dark .asa-mega__item.is-active a,
html.dark .asa-mega__item a:hover { background: rgba(var(--asa-mint-rgb), .16); }
.asa-mega__item.is-active a svg,
.asa-mega__item a:hover svg,
.asa-mega__item a:focus-visible svg { opacity: 1; transform: none; }

.asa-mega__previews { display: grid; min-height: 280px; }
.asa-mega__preview {
  grid-area: 1 / 1;
  display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: center;
  opacity: 0; visibility: hidden; transition: opacity .25s var(--asa-ease), visibility .25s;
}
.asa-mega__preview.is-active { opacity: 1; visibility: visible; }
.asa-mega__media {
  height: 260px; border-radius: var(--asa-radius); overflow: hidden;
  background: linear-gradient(135deg, var(--asa-navy), var(--asa-teal));
}
.asa-mega__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asa-mega__text h4 { margin: 0 0 10px; font: 700 24px/1.25 var(--asa-font-display); color: var(--asa-text); }
.asa-mega__text p { margin: 0 0 18px; font: 400 15px/1.6 var(--asa-font); color: var(--asa-text-muted); }
.asa-mega__cta {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  font: 600 14px/1 var(--asa-font); color: var(--asa-accent);
}
html:not(.dark) .asa-mega__cta { color: var(--asa-teal); }
.asa-mega__cta:hover { gap: 12px; }
.asa-mega__cta { transition: gap .2s var(--asa-ease); }

/* Actions */
.asa-header__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
@media (min-width: 1200px) { .asa-header__actions { margin-left: 0; gap: 10px; } }

header.asa-header .asa-theme-toggle,
header.asa-header .main-menu .asa-mobile-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: var(--asa-radius-pill);
  background: transparent; color: var(--asa-text);
  cursor: pointer;
  transition: background-color .2s var(--asa-ease), color .2s var(--asa-ease);
}
.asa-theme-toggle:hover,
.asa-mobile-toggle:hover { background: rgba(var(--asa-navy-rgb), .08); }
html.dark .asa-theme-toggle:hover,
html.dark .asa-mobile-toggle:hover { background: rgba(255, 255, 255, .1); }

/* Icons switch with the html.dark class: no JS needed, no flash */
.asa-theme-toggle__sun { display: none; }
html.dark .asa-theme-toggle__moon { display: none; }
html.dark .asa-theme-toggle__sun { display: block; }

.asa-donate-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 18px;
  border-radius: var(--asa-radius-pill);
  background: var(--asa-accent); color: var(--asa-accent-contrast);
  font: 600 14px/1 var(--asa-font); white-space: nowrap;
  transition: transform .2s var(--asa-ease), box-shadow .2s var(--asa-ease), background-color .2s var(--asa-ease);
}
header.asa-header .asa-donate-btn { color: var(--asa-accent-contrast); }
.asa-donate-btn:hover { transform: translateY(-1px); box-shadow: var(--asa-shadow-sm); filter: brightness(1.12); }
@media (min-width: 1200px) { .asa-donate-btn { padding: 0 24px; font-size: 15px; } }

/* Hamburger: visible below 1200px; icon swaps while the mobile menu is open */
.asa-mobile-toggle__close { display: none; }
body.mobile-menu-visible .asa-header .asa-mobile-toggle__open { display: none; }
body.mobile-menu-visible .asa-header .asa-mobile-toggle__close { display: block; }
@media (min-width: 1200px) { header.asa-header .main-menu .asa-mobile-toggle { display: none; } }

@media (max-width: 380px) {
  .asa-header__bar { padding-left: 14px; gap: 8px; }
  .asa-header__actions { gap: 4px; }
  .asa-donate-btn { padding: 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .asa-header *, .asa-header *::before { transition: none !important; }
}

/* Neutralise leftover theme rules (underline, FA caret, uppercase, dark dropdown separators) */
header.asa-header .main-menu .main-menu__list > li > a::before { content: none; }
header.asa-header .main-menu .main-menu__list > li > a { text-transform: none; padding-right: 14px; }
header.asa-header .main-menu .main-menu__list > li.dropdown > a::after {
  position: static; top: auto; right: auto; font-family: inherit;
  transform: rotate(45deg); color: currentColor; font-size: inherit;
}
header.asa-header .main-menu__list > li > .asa-dropdown {
  top: calc(100% + 8px); left: 50%; min-width: 220px; padding: 8px; transition: opacity .2s var(--asa-ease), transform .2s var(--asa-ease), visibility .2s;
  background-color: var(--asa-glass-bg); align-items: stretch; transform: translate(-50%, 6px);
}
header.asa-header .main-menu__list > li > .asa-dropdown > li + li { border-top: 0; }
header.asa-header .main-menu__list > li > .asa-dropdown > li > a { padding: 0 14px; }
header.asa-header .main-menu__list > li > .asa-dropdown > li:hover > a { padding-left: 14px; }

/* === mobile menu (owned by layout) === */
.mobile-nav__wrapper .mobile-nav__overlay {
  background-color: rgba(var(--asa-navy-rgb), .45) !important;
}
.mobile-nav__wrapper .mobile-nav__content.asa-glass {
  background: var(--asa-glass-bg) !important;
  -webkit-backdrop-filter: blur(var(--asa-glass-blur)) saturate(140%);
  backdrop-filter: blur(var(--asa-glass-blur)) saturate(140%);
  border: 1px solid var(--asa-glass-border);
  border-radius: var(--asa-radius) !important;
  box-shadow: var(--asa-glass-shadow);
  padding: 8px 0 0;
}
.mobile-nav__content .mobile-nav__container { padding: 8px 12px 0; }
.mobile-nav__content .main-menu__list > li > a,
.mobile-nav__content .main-menu__list > li > ul > li > a {
  min-height: 48px !important;
  color: var(--asa-text) !important;
  font-family: var(--asa-font) !important;
  font-size: 16px !important;
  font-weight: 500 !important;
}
.mobile-nav__content .main-menu__list > li > a:hover,
.mobile-nav__content .main-menu__list > li > ul > li > a:hover,
.mobile-nav__content .main-menu__list > li.current > a {
  color: var(--asa-accent) !important;
  background-color: rgba(var(--asa-mint-rgb), .35) !important;
}
html.dark .mobile-nav__content .main-menu__list > li > a:hover,
html.dark .mobile-nav__content .main-menu__list > li > ul > li > a:hover,
html.dark .mobile-nav__content .main-menu__list > li.current > a {
  color: var(--asa-mint) !important;
  background-color: rgba(var(--asa-mint-rgb), .12) !important;
}
.mobile-nav__content .main-menu__list > li > ul {
  background-color: var(--asa-surface-2) !important;
}
.mobile-nav__content .mobile-nav__donate {
  padding: 12px 16px;
  border: 0 !important;
  background: transparent !important;
}
.mobile-nav__content .mobile-nav__donate .asa-btn { width: 100%; }
.mobile-nav__content .mobile-nav__footer {
  padding: 8px 16px 16px;
  border-top: 1px solid var(--asa-border) !important;
  background: transparent !important;
}
.mobile-nav__content .mobile-nav__contact { margin: 0; padding: 0; list-style: none; }
.mobile-nav__content .mobile-nav__contact li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 !important;
  border: 0 !important;
  color: var(--asa-text-muted);
}
.mobile-nav__content .mobile-nav__contact li a { color: var(--asa-text) !important; overflow-wrap: anywhere; }
.mobile-nav__content .mobile-nav__contact .asa-icon { color: var(--asa-teal); }
html.dark .mobile-nav__content .mobile-nav__contact .asa-icon { color: var(--asa-mint); }
.mobile-nav__content .mobile-nav__social { display: flex; gap: 8px; margin-top: 4px; }
.mobile-nav__content .mobile-nav__social a {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 44px !important;
  height: 44px !important;
  border: 1px solid var(--asa-border) !important;
  border-radius: 50% !important;
  background: transparent !important;
  color: var(--asa-text) !important;
}
.mobile-nav__content .mobile-nav__social a:hover { background: var(--asa-mint) !important; color: var(--asa-navy) !important; }

.asa-mega__icon { width: 36px; height: 36px; flex: none; object-fit: contain; }
.asa-mega__item a > span { flex: 1; text-align: left; }

/* The mobile menu clones the desktop list; the desktop mega panel has no place there. */
.mobile-nav__content .asa-mega { display: none !important; }

/* === locale switcher === */
.asa-locale { position: relative; }
header.asa-header .asa-locale__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--asa-border); border-radius: var(--asa-radius-pill);
  background: transparent; color: var(--asa-text);
  font: 600 13px/1 var(--asa-font); letter-spacing: .04em; cursor: pointer;
  transition: background-color .2s var(--asa-ease), border-color .2s var(--asa-ease);
}
.asa-locale__btn:hover,
.asa-locale.is-open .asa-locale__btn { background: rgba(var(--asa-navy-rgb), .08); }
html.dark .asa-locale__btn:hover,
html.dark .asa-locale.is-open .asa-locale__btn { background: rgba(255, 255, 255, .1); }
.asa-locale__chev { transition: transform .2s var(--asa-ease); }
.asa-locale.is-open .asa-locale__chev { transform: rotate(180deg); }
.asa-locale__menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 30;
  min-width: 168px; margin: 0; padding: 6px; list-style: none;
  border-radius: var(--asa-radius-lg, 16px);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .15s var(--asa-ease), transform .15s var(--asa-ease), visibility .15s;
}
.asa-locale.is-open .asa-locale__menu { opacity: 1; visibility: visible; transform: none; }
.asa-locale__menu li { margin: 0; padding: 0; }
.asa-locale__menu a {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px;
  border-radius: var(--asa-radius-md, 12px);
  color: var(--asa-text); font: 500 15px/1 var(--asa-font);
}
.asa-locale__menu a:hover { background: rgba(var(--asa-navy-rgb), .08); }
html.dark .asa-locale__menu a:hover { background: rgba(255, 255, 255, .1); }
.asa-locale__menu a[aria-current] { font-weight: 700; color: var(--asa-teal); }
html.dark .asa-locale__menu a[aria-current] { color: var(--asa-mint); }
.asa-locale__item-code { width: 24px; font: 700 12px/1 var(--asa-font); letter-spacing: .06em; opacity: .7; }
/* Header is tight on phones: the pill collapses to the code only */
@media (max-width: 1199px) {
  header.asa-header .asa-locale { display: none; }
}

/* Mobile menu: three buttons */
.asa-locale-inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px 0; }
.asa-locale-inline__label { font: 600 14px/1 var(--asa-font); color: var(--asa-text-muted); }
.asa-locale-inline ul { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; }
.asa-locale-inline a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 56px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--asa-border); border-radius: var(--asa-radius-pill);
  color: var(--asa-text); font: 600 14px/1 var(--asa-font); letter-spacing: .04em;
}
.asa-locale-inline a[aria-current] { background: var(--asa-accent); border-color: var(--asa-accent); color: var(--asa-accent-contrast); }
