/* Full-width chapters with one shared header navigation. Load after the theme. */
:root {
  --site-header-height: 86px;
}

html {
  scroll-padding-top: 0;
}

.theme-military section[id],
.theme-military #main {
  scroll-margin-top: calc(var(--site-header-height) + 18px);
}

.theme-military .field-layout {
  display: block;
  grid-template-columns: none;
  gap: 0;
  width: 100%;
  max-width: 1490px;
  margin: 0 auto;
  padding: 25px 24px 35px;
}

.theme-military .field-pages {
  width: 100%;
  min-width: 0;
}

.theme-military .site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto;
  align-items: center;
  gap: 8px 24px;
  height: auto;
  min-height: 86px;
  padding: 14px max(24px, calc((100vw - 1442px) / 2));
  background: var(--barracks);
  color: var(--paper);
}

.theme-military .site-header .brand {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  gap: 12px;
  min-width: 0;
}

.theme-military .site-header .brand img {
  flex: none;
  width: 42px;
  height: 42px;
}

.theme-military .site-header .brand-name {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0;
  white-space: nowrap;
}

.theme-military .site-header .brand-ticker {
  color: var(--teal);
  font: inherit;
}

.theme-military .site-header .menu-toggle {
  display: none;
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  margin: 0;
}

.theme-military .site-header #main-nav {
  position: static;
  inset: auto;
  display: flex;
  grid-column: 2;
  grid-row: 1;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 2px 4px;
  min-width: 0;
  width: 100%;
  max-height: none;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
  color: inherit;
  overflow: visible;
}

.theme-military .site-header #main-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 7px;
  border-radius: 2px;
  font-family: var(--body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  text-decoration: none;
}

.theme-military .site-header #main-nav a:hover {
  background: color-mix(in srgb, var(--paper) 12%, transparent);
}

.theme-military .site-header #main-nav a[aria-current="location"] {
  background: var(--paper);
  color: var(--barracks);
  font-weight: 600;
}

.theme-military .site-header #main-nav a:focus-visible,
.theme-military .site-header .menu-toggle:focus-visible {
  outline-color: var(--teal);
}

/* A second header row lets intermediate widths keep every section visible. */
@media (min-width: 801px) and (max-width: 1199px) {
  .theme-military .site-header {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .theme-military .site-header .brand {
    justify-self: center;
  }

  .theme-military .site-header #main-nav {
    grid-column: 1;
    grid-row: 2;
    justify-content: center;
  }
}

@media (max-width: 800px) {
  .theme-military .field-layout {
    padding: 18px 16px 28px;
  }

  .theme-military .site-header {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto;
    min-height: 76px;
    padding: 12px 18px;
    gap: 10px 12px;
  }

  .theme-military .site-header .brand {
    gap: 9px;
  }

  .theme-military .site-header .brand img {
    width: 34px;
    height: 34px;
  }

  .theme-military .site-header .brand-name {
    gap: 8px;
    font-size: 25px;
  }

  .theme-military .site-header .menu-toggle {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--paper) 50%, transparent);
    border-radius: 2px;
    background: transparent;
    color: var(--paper);
    font-size: 14px;
    line-height: 1.4;
  }

  .theme-military[data-nav-ready="true"] .site-header .menu-toggle {
    display: inline-flex;
  }

  .theme-military .site-header [data-menu-mark] {
    width: 1em;
    font-size: 20px;
    line-height: 1;
    text-align: center;
  }

  .theme-military .site-header .menu-toggle[aria-expanded="true"] {
    border-color: var(--teal);
    color: var(--teal);
  }

  .theme-military .site-header #main-nav {
    display: grid;
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 12px;
    padding-top: 10px;
    border-top: 1px solid color-mix(in srgb, var(--paper) 25%, transparent);
    max-height: min(65dvh, calc(100dvh - 92px));
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: var(--teal) var(--barracks);
  }

  .theme-military[data-nav-ready="true"] .site-header #main-nav {
    display: none;
  }

  .theme-military[data-nav-ready="true"] .site-header #main-nav.open {
    display: grid;
  }

  .theme-military .site-header #main-nav a {
    justify-content: flex-start;
    min-width: 0;
    padding: 10px 12px;
    font-size: 16px;
    white-space: normal;
  }
}

/* Text links provide the footer's utility navigation without a recruitment panel. */
.theme-military section.footer-links {
  display: block;
  margin: 0;
  padding: 24px clamp(20px, 3.5vw, 52px);
  border-top: 1px solid var(--rule);
  background: var(--sand);
  color: var(--barracks);
}

.theme-military section.footer-links > nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 26px;
}

.theme-military section.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: underline;
  text-underline-offset: 5px;
}

.theme-military section.footer-links a:hover {
  color: var(--olive);
}

@media (max-width: 420px) {
  .theme-military .field-layout {
    padding: 12px 10px 20px;
  }

  .theme-military .site-header {
    gap: 8px;
    padding-inline: 12px;
  }

  .theme-military .site-header .brand {
    gap: 7px;
  }

  .theme-military .site-header .brand img {
    width: 28px;
    height: 28px;
  }

  .theme-military .site-header .brand-name {
    gap: 6px;
    font-size: 20px;
  }

  .theme-military .site-header .menu-toggle {
    gap: 8px;
    padding-inline: 10px;
    font-size: 13px;
  }

  .theme-military section.footer-links > nav {
    gap: 2px 20px;
  }

  .theme-military section.footer-links a {
    font-size: 16px;
  }
}

@media (max-width: 360px) {
  .theme-military .site-header .brand-name {
    font-size: 18px;
  }

  .theme-military .site-header #main-nav {
    grid-template-columns: minmax(0, 1fr);
  }
}
