/* Contrast patch 1.1.2-local — candidate only, not published.
   Separable: remove this file and its two hooks in common/header.html to roll back.
   Does not change copy, hrefs, menu order, or tsparticles logic.
   Goal: raise header/footer text contrast on dark surfaces, including where
   parent opacity lets the particle layer show through.
*/
:root {
  --mg-contrast-bg: #0A0B10;
  --mg-contrast-text: #E6E9EE;      /* secondary body/link, not pure white */
  --mg-contrast-text-strong: #F5F7FA; /* hover / current / emphasis */
  --mg-contrast-muted: #C5CBD4;     /* copyright / tertiary, still >= 4.5:1 on --mg-contrast-bg */
  --mg-contrast-link-hover: #7EE7D5; /* lighter than #14B8A6, still on-brand */
  --mg-contrast-dropdown: #16171D;
  --mg-contrast-focus: #7EE7D5;
}

/* ----- Header bar: keep dark brand, paint a near-opaque backing so particles do not wash out type ----- */
nav.fixed.top-0.z-50 {
  background-color: rgba(10, 11, 16, 0.97);
  isolation: isolate;
}

/* Root cause (live academy computed): parent dropdowns and the hamburger are
   native <button> with appearance:auto and UA background rgb(239,239,239);
   .text-white/70 then paints light type on a light face. Homepage stays
   readable because tw-index preflight sets background-color:transparent.
   Reset appearance/background only inside the fixed header nav — never
   unscoped, and do not zero the hamburger border or padding. */
nav.fixed.top-0.z-50 button {
  -webkit-appearance: none;
  appearance: none;
  background-color: transparent;
  background-image: none;
}
#mg-mobile-menu {
  background-color: rgba(10, 11, 16, 0.98);
}

/* Desktop parent labels and top-level links (originally text-white/70) */
nav.fixed.top-0.z-50 .text-white\/70 {
  color: var(--mg-contrast-text);
}
nav.fixed.top-0.z-50 .text-white\/70:hover,
nav.fixed.top-0.z-50 .text-white\/70:focus-visible,
nav.fixed.top-0.z-50 a.text-white\/70[aria-current="page"] {
  color: var(--mg-contrast-text-strong);
}

/* Academy pages load tw-shared without Tailwind preflight. UA <button> is a light
   rectangle; .text-white/70 then paints light text on a light face. Reset only nav
   parent labels — do not touch the hamburger border or academy form controls. */
nav.fixed.top-0.z-50 button.text-white\/70,
nav.fixed.top-0.z-50 button.mg-nav-parent {
  -webkit-appearance: none;
  appearance: none;
  background-color: transparent;
  background-image: none;
  border-style: none;
  border-width: 0;
  border-color: transparent;
  padding: 0;
  color: var(--mg-contrast-text);
  box-shadow: none;
}
nav.fixed.top-0.z-50 button.text-white\/70:hover,
nav.fixed.top-0.z-50 button.text-white\/70:focus-visible,
nav.fixed.top-0.z-50 button.mg-nav-parent:hover,
nav.fixed.top-0.z-50 button.mg-nav-parent:focus-visible {
  color: var(--mg-contrast-text-strong);
}

/* Hamburger */
nav.fixed.top-0.z-50 #mg-menu-toggle {
  color: var(--mg-contrast-text-strong);
  border-color: rgba(255, 255, 255, 0.28);
  -webkit-appearance: none;
  appearance: none;
  background-color: transparent;
  background-image: none;
}
nav.fixed.top-0.z-50 #mg-menu-toggle:hover,
nav.fixed.top-0.z-50 #mg-menu-toggle:focus-visible {
  color: #fff;
  border-color: var(--mg-contrast-link-hover);
}

/* Dropdown: original items had no explicit color (inherit) and a frosted surface.
   On academy light pages inherit would become dark gray on a dark panel. Set colors explicitly. */
nav.fixed.top-0.z-50 .bg-surface-container-highest {
  background-color: var(--mg-contrast-dropdown);
  color: var(--mg-contrast-text);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
nav.fixed.top-0.z-50 .absolute a {
  color: var(--mg-contrast-text);
}
nav.fixed.top-0.z-50 .absolute a:hover,
nav.fixed.top-0.z-50 .absolute a:focus-visible,
nav.fixed.top-0.z-50 .absolute a[aria-current="page"] {
  color: var(--mg-contrast-text-strong);
  background-color: rgba(255, 255, 255, 0.08);
}

/* Mobile drawer */
#mg-mobile-menu .text-white\/75,
#mg-mobile-menu .text-white\/85 {
  color: var(--mg-contrast-text);
}
#mg-mobile-menu .text-white\/75:hover,
#mg-mobile-menu .text-white\/75:focus-visible,
#mg-mobile-menu .text-white\/85:hover,
#mg-mobile-menu .text-white\/85:focus-visible,
#mg-mobile-menu a[aria-current="page"] {
  color: var(--mg-contrast-text-strong);
}
#mg-mobile-menu .text-primary\/80 {
  color: #7EE7D5; /* group labels stay teal, but brighter than primary/80 */
}

nav.fixed.top-0.z-50 .mg-nav-group-label,
#mg-mobile-menu .mg-nav-group-label {
  color: #7EE7D5;
}


/* Current page: typographic emphasis only, no layout change */
nav.fixed.top-0.z-50 a[aria-current="page"] {
  color: var(--mg-contrast-text-strong);
  font-weight: 650;
}

/* Focus rings for keyboard use */
nav.fixed.top-0.z-50 a:focus-visible,
nav.fixed.top-0.z-50 button:focus-visible,
footer a:focus-visible,
footer button:focus-visible {
  outline: 2px solid var(--mg-contrast-focus);
  outline-offset: 2px;
}

/* ----- Footer: opaque local backing; raise 50%/30%/40% whites that fail or look muddy ----- */
footer.relative.z-10 {
  background-color: var(--mg-contrast-bg);
  isolation: isolate;
}
footer.relative.z-10::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--mg-contrast-bg);
  z-index: 0;
  pointer-events: none;
}
/* Do not hoist every footer child into position:relative. #tsparticles and
   #mg-contact-float are position:fixed; this catch-all overrode them, left a
   ~100vh dark canvas under the footer, and parked the contact card on top of
   the footer links. */
footer.relative.z-10 > *:not(#tsparticles):not(#mg-contact-float) {
  position: relative;
  z-index: 1;
}
footer.relative.z-10 > #tsparticles {
  position: fixed !important;
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
  z-index: -50 !important;
  pointer-events: none !important;
}
footer.relative.z-10 > #mg-contact-float {
  position: fixed !important;
  z-index: 1200;
}

footer.relative.z-10 .text-white\/70 { color: var(--mg-contrast-text-strong); }
footer.relative.z-10 .text-white\/50 { color: var(--mg-contrast-text); }
footer.relative.z-10 .text-white\/40 { color: var(--mg-contrast-text); }
footer.relative.z-10 .text-white\/30 { color: var(--mg-contrast-muted); }
footer.relative.z-10 .font-light { font-weight: 400; } /* light weight made 14px copyright feel weaker */

footer.relative.z-10 a.hover\:text-primary:hover,
footer.relative.z-10 a:hover,
footer.relative.z-10 .hover\:text-primary:hover {
  color: var(--mg-contrast-link-hover);
}

/* Placeholders only for nav/footer chrome. Contact float keeps original styles. */
footer input::placeholder,
footer textarea::placeholder,
nav input::placeholder {
  color: var(--mg-contrast-muted);
  opacity: 1;
}
