/**
 * Remove white space above msu-header-top
 * This file ensures no spacing appears at the top of the page
 * Applies to ALL page templates
 */

/* CRITICAL: Absolutely no spacing at the top of the page */
html {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  outline: 0 !important;
}

html::before,
html::after {
  content: none !important;
  display: none !important;
}

body {
  margin: 0 !important;
  padding: 0 !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
  border-top: 0 !important;
  display: block !important;
  position: relative !important;
}

/* Override Bootstrap's default body spacing and pseudo-elements */
body::before,
body::after {
  content: none !important;
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* First child of body must have no top margin */
body > *:first-child {
  margin-top: 0 !important;
  margin-block-start: 0 !important;
}

/* Ensure first section has no top spacing */
body > section:first-of-type,
body > a + section,
body > .skip-link + section,
#msu-header-top {
  margin-top: 0 !important;
  padding-top: 0 !important;
  display: block !important;
}

/* Remove any spacing from elements before msu-header-top */
#msu-header-top:first-child {
  margin-top: 0 !important;
}

/* Target msu-header-top regardless of position */
section#msu-header-top,
#msu-header-top {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* CRITICAL: Ensure skip link uses FIXED positioning and doesn't create ANY spacing */
div.skip-link,
div.visually-hidden-focusable.skip-link,
a.skip-link.visually-hidden-focusable,
a.skip-link,
.skip-link.visually-hidden-focusable,
.skip-link,
a[href="#main-content"] {
  position: fixed !important;
  top: -40px !important;
  left: 0 !important;
  margin: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding: 8px !important;
  z-index: 9999 !important;
  display: block !important;
  width: auto !important;
  height: auto !important;
  line-height: normal !important;
}

/* When skip link is focused, ensure it doesn't push content down */
div.skip-link:focus-within,
div.visually-hidden-focusable.skip-link:focus-within,
a.skip-link.visually-hidden-focusable:focus,
a.skip-link:focus,
.skip-link.visually-hidden-focusable:focus,
.skip-link:focus,
a[href="#main-content"]:focus {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 9999 !important;
  margin: 0 !important;
  background: #0f2b23 !important;
  color: #fff !important;
  padding: 8px !important;
  text-decoration: none !important;
}

/* Reset any container spacing at the top */
#msu-header-top .container,
#msu-header-top .container-fluid,
.container:first-child,
.container-fluid:first-child {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Remove spacing from rows inside msu-header-top */
#msu-header-top .row {
  margin-top: 0 !important;
}

/* Ensure no spacing on the first visible element (after skip link) */
body > section:first-of-type,
body > .skip-link + section {
  margin-top: 0 !important;
  margin-block-start: 0 !important;
}

/* Force msu-header-top to absolute top of page */
#msu-header-top {
  display: block !important;
  position: relative !important;
  top: 0 !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Force body to start at top with no gap */
body > section:first-of-type#msu-header-top,
section#msu-header-top:first-of-type {
  margin-top: 0 !important;
  padding-top: 0 !important;
}
