/* Task 2: scoped header/footer; independent of the legacy off-canvas menu. */
html {
  scroll-padding-top: 6rem;
}

#header.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: auto;
  min-height: 0;
  padding: 0;
  border-bottom: 1px solid #687384;
  background: #101318;
  color: #fff;
  overflow: visible;
}

/* Older page styles otherwise trap sticky headers in a scrolling ancestor. */
body.site-navigation-page {
  overflow-x: clip;
}

.site-header .site-header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1.6fr);
  align-items: center;
  gap: .5rem;
  max-width: 1440px;
  min-height: 76px;
  margin-inline: auto;
  padding: .5rem .75rem;
}

.site-header .site-brand {
  grid-column: 1;
  grid-row: 1;
  width: min(100%, clamp(80px, 20vw, 132px));
}

.site-header .site-brand img {
  display: block;
  width: 100%;
  height: 48px;
  object-fit: contain;
}

.site-header .site-menu-toggle {
  display: none;
  grid-column: 2;
  grid-row: 1;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 44px;
  padding: .25rem;
  border: 1px solid #8995a5;
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}

.site-header .site-nav {
  display: block;
  position: static;
  width: auto;
  border: 0;
  box-shadow: none;
  height: auto;
  transition: none;
  grid-column: 1 / -1;
  grid-row: 2;
  min-width: 0;
}

.site-header .site-nav[hidden] {
  display: none;
}

.site-header .site-nav-list > li,
.site-header .site-about-links > li {
  display: block;
  margin: 0;
  border: 0;
}

.site-header .site-nav li::after {
  display: none;
}

.site-header .site-nav-list,
.site-header .site-about-links {
  position: static;
  width: auto;
  height: auto;
  transform: none;
  background: transparent;
  z-index: auto;
  box-shadow: none;
}

.site-header .site-nav-list,
.site-header .site-about-links,
#footer .site-footer-links {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-header .site-nav a,
.site-header .site-about summary {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 44px;
  padding: .5rem .75rem;
  border-radius: 4px;
  color: #fff;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
  opacity: 1;
}

.site-header .site-about summary {
  cursor: pointer;
  list-style: none;
}

.site-header .site-about summary::-webkit-details-marker {
  display: none;
}

.site-header .site-about summary::after {
  content: "⌄";
  margin-left: auto;
}

.site-header .site-about[open] summary::after {
  content: "⌃";
}

.site-header .site-about-links {
  padding-left: 1rem;
  border-left: 2px solid #8995a5;
}

.site-header .site-nav a:hover,
.site-header .site-about summary:hover {
  background: #283342;
  color: #fff;
  text-decoration: underline;
}

.site-header .site-trial-cta {
  display: inline-flex;
  grid-column: 3;
  grid-row: 1;
  align-items: center;
  justify-content: center;
  justify-self: end;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: .6rem .65rem;
  border: 2px solid #da0401;
  border-radius: 6px;
  background: #da0401;
  color: #fff;
  font-size: .875rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.site-header .site-trial-cta:hover {
  border-color: #b80301;
  background: #b80301;
  color: #fff;
  text-decoration: underline;
}

.site-header a:focus-visible,
.site-header button:focus-visible,
.site-header summary:focus-visible,
#footer .site-footer-nav a:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.site-header--enhanced .site-menu-toggle {
  display: inline-flex;
}

.site-header--enhanced .site-nav {
  max-height: calc(100dvh - 92px);
  overflow-y: auto;
  padding: .5rem .25rem;
}

#footer .site-footer-nav {
  margin-bottom: 1.5rem;
}

#footer .site-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .25rem 1rem;
}

#footer .site-footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .5rem;
  color: #fff;
  line-height: 1.5;
  text-decoration: underline;
  overflow-wrap: anywhere;
}

#footer .site-footer-links a:hover {
  color: #fff;
  text-decoration-thickness: 2px;
}

@media (max-width: 1199px) {
  /* Keep the expanded fallback from covering the page when JS is disabled. */
  #header.site-header:not(.site-header--enhanced) {
    position: relative;
  }
}

@media (min-width: 1200px) {
  .site-header .site-header-inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 1.5rem;
    padding-inline: 1.5rem;
  }

  .site-header .site-menu-toggle {
    display: none;
  }

  .site-header .site-nav {
    grid-column: 2;
    grid-row: 1;
    max-height: none;
    overflow: visible;
    padding: 0;
  }

  .site-header .site-nav-list {
    display: flex;
    justify-content: center;
    gap: .25rem;
  }

  .site-header .site-about {
    position: relative;
  }

  .site-header .site-about-links {
    position: absolute;
    top: calc(100% + .5rem);
    right: 0;
    min-width: 180px;
    padding: .5rem;
    border: 1px solid #8995a5;
    border-radius: 8px;
    background: #101318;
  }

  .site-header .site-trial-cta {
    font-size: 1rem;
    padding-inline: 1rem;
  }
}

@media (max-width: 768px) {
  .site-header .site-header-inner {
    gap: .375rem;
  }

  .site-header .site-nav a,
  .site-header .site-about summary {
    padding-inline: .5rem;
  }
}

/* Task 6: keep the licensed credit readable on the existing footer background. */
#footer .credits a,
#footer .credits a:hover {
  color: #fff;
  text-decoration: underline;
}
#footer .credits a:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* Confirmed inline links on light content use the existing dark brand colour. */
body.site-navigation-page a.a11y-text-link,
body.site-navigation-page a.a11y-text-link:hover {
  color: #743e1d;
  text-decoration: underline;
}
body.site-navigation-page a.a11y-text-link:focus-visible {
  outline: 3px solid #151a21;
  outline-offset: 3px;
}
