* {
  box-sizing: border-box;
}

html,
body,
header {
  margin: 0;
  padding: 0;
}

main {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Prevent broad page header styles from affecting the nav wrapper */
main > header:first-of-type {
  height: auto !important;
  min-height: 0 !important;
  display: block !important;
  justify-content: initial !important;
  align-content: initial !important;
  margin: 0 !important;
  padding: 0 !important;
}

a {
  text-decoration: none;
}

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 1.25rem;
  width: 100%;
  padding: 0.6rem 1.2rem;
  background: rgba(10, 10, 10, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 0 !important;
  box-shadow: none !important;
  outline: 0 !important;
}

.logo {
  display: flex;
  align-items: center;
}

.brand-link {
  display: inline-flex;
  align-items: center;
}

.brand-image {
  max-height: 52px;
  width: auto;
}

.nav-fostrap {
  display: block;
}

.nav-fostrap > ul {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.28rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-fostrap li {
  position: relative;
}

.nav-fostrap a,
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 42px;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  color: #f3f3f3 !important;
  font-size: 0.95rem;
  line-height: 1.25;
  font-weight: 500;
  border: 0;
  background: transparent !important;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-link:hover,
.nav-fostrap a:hover,
.nav-link:focus-visible,
.nav-fostrap a:focus-visible {
  background: rgba(255, 193, 7, 0.16);
  color: #ffc107 !important;
  outline: none;
}

.has-dropdown > .submenu-toggle[aria-expanded="true"] {
  background: rgba(255, 193, 7, 0.16) !important;
  color: #ffc107 !important;
}

.dropdown {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  min-width: 220px;
  padding: 0.4rem;
  margin: 0;
  list-style: none;
  border-radius: 12px;
  background: rgba(20, 20, 20, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
  display: none;
}

.dropdown a {
  width: 100%;
  border-radius: 8px;
  padding: 0.58rem 0.72rem;
}

.has-dropdown:hover > .dropdown,
.has-dropdown:focus-within > .dropdown,
.has-dropdown.submenu-open > .dropdown {
  display: block;
}

.arrow-down {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.8;
  transition: transform 0.2s ease;
}

.has-dropdown > .submenu-toggle[aria-expanded="true"] .arrow-down {
  transform: rotate(180deg);
}

.nav-bg-fostrap {
  display: none;
}

.site-nav .submenu-toggle::after {
  display: none !important;
}

/* Hide legacy spacer (if still present in some templates) */
header + div[style*="height:50px"] {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

@media (max-width: 1199px) {
  .site-nav {
    grid-template-columns: 1fr;
    padding: 0;
    min-height: 64px;
  }

  .logo {
    display: none;
  }

  .nav-bg-fostrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    min-height: 64px;
    background: rgba(10, 10, 10, 0.95);
    border-bottom: 0 !important;
  }

  .title-mobile {
    display: inline-flex;
    align-items: center;
  }

  .brand-image-mobile {
    max-height: 42px;
    width: auto;
  }

  .navbar-fostrap {
    width: 44px;
    height: 44px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
  }

  .navbar-fostrap span {
    width: 18px;
    height: 2px;
    background: #fff;
  }

  .nav-fostrap {
    position: fixed;
    top: 64px;
    left: -100%;
    width: min(88vw, 360px);
    height: calc(100vh - 64px);
    background: #101010;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: left 0.28s ease;
    z-index: 320;
    padding: 0.7rem;
  }

  .nav-fostrap.visible {
    left: 0;
  }

  .nav-fostrap > ul {
    display: block;
  }

  .nav-fostrap li {
    display: block;
  }

  .nav-fostrap a,
  .nav-link {
    width: 100%;
    justify-content: space-between;
    color: #fafafa !important;
    padding: 0.85rem 0.95rem;
    border-radius: 10px;
  }

  .dropdown {
    position: static;
    min-width: 0;
    margin-top: 0.2rem;
    margin-bottom: 0.4rem;
    background: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
  }

  .dropdown a {
    color: #dfdfdf !important;
    padding-left: 1rem;
  }

  body.cover-bg::before {
    content: "";
    position: fixed;
    inset: 64px 0 0 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 150;
    pointer-events: auto;
  }

  body.menu-open {
    overflow: hidden;
    touch-action: none;
  }
}

/* Hard stop for any visible gap around mobile header */
.site-nav,
.nav-bg-fostrap {
  margin: 0 !important;
  border-bottom: 0 !important;
  box-shadow: none !important;
  outline: 0 !important;
}

.site-nav::before,
.site-nav::after,
.nav-bg-fostrap::before,
.nav-bg-fostrap::after {
  display: none !important;
  content: none !important;
}

.site-nav a,
.site-nav .nav-link,
.site-nav .submenu-toggle {
  color: #f3f3f3 !important;
  text-decoration: none !important;
}

.site-nav .dropdown a {
  color: #dfdfdf !important;
}

.site-nav .logo,
.site-nav .brand-link,
.site-nav .nav-fostrap,
.site-nav .nav-fostrap > ul,
.site-nav .nav-fostrap li {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

main > header + section,
main > header + section.section1,
main > section.section1:first-of-type {
  margin-top: 0 !important;
  padding-top: 0 !important;
  border-top: 0 !important;
}

main > section.section1:first-of-type,
main > section.section1:first-of-type.rounded,
main > section.section1:first-of-type.shadow-sm {
  margin-top: -1px !important;
  padding-top: 0 !important;
  border-top: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* Global anti-gap reset (top of viewport + under menu) */
html,
body {
  margin: 0 !important;
  padding: 0 !important;
  background: #0b0b0b;
}

body > main,
main {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

main > *:first-child {
  margin-top: 0 !important;
}

main > section:first-of-type,
main > header:first-of-type,
main > .section1:first-of-type {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Force top edge to stick to viewport with no visual seam */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: #0b0b0b;
  z-index: 500;
  pointer-events: none;
}
