/* =========================================================
   OFFICE OF THE TEXTILE COMMISSIONER
   COMMON RESPONSIVE NAVIGATION
   File: css/navigation.css
   ========================================================= */

:root {
  --nav-bg: #a11e55;
  --nav-bg-dark: #7a123e;
  --nav-text: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.22);
  --nav-height-mobile: 54px;
}

/* Navbar container */
.navbar {
  position: relative;
  width: 100%;
  margin: 0;
  padding: 0;
  background: var(--nav-bg);
  border: 0;
  border-bottom: 1px solid var(--nav-bg-dark);
  box-sizing: border-box;
  z-index: 10000;
}

/* Desktop menu */
.nav-list {
  display: flex;
  position: static;
  width: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  list-style: none;
  overflow: visible;
  background: var(--nav-bg);
  box-shadow: none;
}

.nav-list > li {
  display: block;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
}

.nav-list > li > a {
  display: block;
  margin: 0;
  padding: 14px 20px;
  color: var(--nav-text);
  background: transparent;
  text-decoration: none;
  text-transform: uppercase;
  font-family: Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 18px;
  box-sizing: border-box;
}

.nav-list > li > a:hover,
.nav-list > li > a:focus,
.nav-list > li > a.active {
  color: var(--nav-text);
  background: var(--nav-bg-dark);
}

/* Hamburger is hidden on desktop */
.menu-toggle {
  display: none;
}

/* =========================================================
   MOBILE
   ========================================================= */
@media screen and (max-width: 900px) {
  .navbar {
    min-height: var(--nav-height-mobile);
    height: var(--nav-height-mobile);
    overflow: visible;
  }

  .menu-toggle {
    display: flex;
    position: absolute;
    top: 7px;
    right: 14px;
    width: 44px;
    height: 40px;
    margin: 0;
    padding: 7px 8px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 7px;
    background: transparent;
    cursor: pointer;
    box-sizing: border-box;
    z-index: 10002;
  }

  .menu-toggle .bar {
    display: block;
    width: 25px;
    height: 3px;
    min-height: 3px;
    margin: 3px 0;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: var(--nav-text);
    transition: transform 0.25s ease, opacity 0.25s ease;
  }

  .nav-list {
    display: none;
    position: absolute;
    top: var(--nav-height-mobile);
    left: 0;
    right: 0;
    width: 100%;
    max-height: calc(100vh - var(--nav-height-mobile));
    margin: 0;
    padding: 0;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: stretch;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--nav-bg);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.30);
    z-index: 10001;
  }

  .nav-list.active {
    display: flex;
  }

  .nav-list > li {
    display: block;
    width: 100%;
    border-bottom: 1px solid var(--nav-border);
  }

  .nav-list > li > a {
    width: 100%;
    padding: 14px 18px;
    text-align: left;
    background: var(--nav-bg);
  }

  .nav-list > li > a:hover,
  .nav-list > li > a:focus,
  .nav-list > li > a.active {
    background: var(--nav-bg-dark);
  }

  .menu-toggle.open .bar:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
  }

  .menu-toggle.open .bar:nth-child(2) {
    opacity: 0;
  }

  .menu-toggle.open .bar:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
  }

  body.mobile-menu-open {
    overflow: hidden;
  }
}

/* Explicit desktop reset prevents old mobile state from surviving resize */
@media screen and (min-width: 901px) {
  .navbar {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .menu-toggle,
  .menu-toggle .bar {
    display: none !important;
  }

  .nav-list,
  .nav-list.active {
    display: flex !important;
    position: static;
    flex-direction: row;
    width: 100%;
    max-height: none;
    overflow: visible;
  }

  body.mobile-menu-open {
    overflow: auto;
  }
}
