/* Site header (sticky navbar + mobile menu), section tabs, and footer sitemap.
   Structure comes from _data/navigation.yml; colors use the theme variables in main.css. */

:root {
  --nav-height: 64px;
  --nav-font: "Concourse T2", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --nav-brand-font: "Concourse T6 Tab", "Concourse T4", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --nav-cta-bg: #042742;
  --nav-cta-fg: #fff;
  --nav-border: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
  --nav-cta-bg: #e8edf3;
  --nav-cta-fg: #042742;
  --nav-border: rgba(255, 255, 255, 0.12);
}

/* Keep headings visible below the sticky header when jumping to an anchor. */
html {
  scroll-padding-top: calc(var(--nav-height) + 16px);
}

.icon {
  display: block;
  flex-shrink: 0;
}

/* main.css gives every <li> a bottom margin; none of these lists want it. */
.site-nav-links li,
.site-drawer li,
.section-tabs li,
.footer-sitemap li,
.site-footer .footer-social li {
  margin: 0;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--navbar-color);
  border-bottom: 1px solid var(--nav-border);
  margin-bottom: 30px; /* same space below the bar as the previous navbar */
  transition: transform 0.25s ease;
}

/* Slides out of view while scrolling down (toggled in nav.html); keyboard focus brings it back. */
html.nav-hidden .site-header:not(:focus-within) {
  transform: translateY(-100%);
}

@media (prefers-reduced-motion: reduce) {
  .site-header {
    transition: none;
  }
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 1140px;
  height: var(--nav-height);
  margin: 0 auto;
  padding: 0 24px;
  font-family: var(--nav-font);
}

.site-brand,
.site-brand:hover,
.site-brand:focus {
  flex-shrink: 0;
  color: var(--main-text-color);
  font-family: var(--nav-brand-font);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.2px;
  text-decoration: none;
}

.site-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
}

.site-nav-links a {
  display: block;
  padding: 8px 12px;
  color: var(--main-text-color);
  font-size: 19px;
  line-height: 1.2;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.site-nav-links a:hover {
  border-bottom-color: var(--link-decoration-color);
  text-decoration: none;
}

/* Current section: underlined. */
.site-nav-links a.is-active {
  border-bottom-color: var(--main-text-color);
}

.site-nav-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--main-text-color);
  cursor: pointer;
}

.site-nav-icon:hover {
  background: var(--nav-border);
  color: var(--main-text-color);
}

/* The theme toggle shares .theme-toggle with main.css; the nav version is an icon button. */
.site-nav .theme-toggle,
.site-drawer .theme-toggle {
  min-width: 40px;
  min-height: 40px;
}

/* Outlined rather than filled, so it does not read as a selected item. */
.site-nav-cta,
.site-nav-cta:hover,
.site-nav-cta:focus {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin-left: 8px;
  padding: 0 18px;
  border: 1px solid var(--accent-soft-border);
  border-radius: 6px;
  background: transparent;
  color: var(--accent-text);
  font-family: var(--nav-font);
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
}

.site-nav-cta:hover {
  background: var(--accent-soft);
}

/* The menu button only appears on small screens. */
.site-nav-menu {
  display: none;
}

@media (max-width: 860px) {
  .site-nav {
    gap: 8px;
    padding: 0 12px 0 16px;
  }

  .site-nav-links,
  .site-nav-actions > .site-nav-icon:not(.site-nav-menu),
  .site-nav-actions > .site-nav-cta {
    display: none;
  }

  .site-nav-actions {
    margin-left: auto;
  }

  .site-nav-menu {
    display: inline-flex;
    width: 44px;
    height: 44px;
  }

  .site-brand,
  .site-brand:hover,
  .site-brand:focus {
    font-size: 20px;
  }
}

/* ---------- Mobile menu (dialog) ----------
   Base dialog styles (slide-in, backdrop) come from dialog.drawer-panel in main.css;
   main.css hides that dialog from 768px up, so re-enable it for the 768-860px range. */

@media only screen and (min-width: 768px) and (max-width: 860px) {
  dialog.drawer-panel.site-drawer[open] {
    display: block;
  }
}

dialog.site-drawer {
  width: min(320px, 88vw);
  max-width: min(320px, 88vw);
  padding: 64px 24px 32px;
  font-family: var(--nav-font);
}

.site-drawer .drawer-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: inherit;
}

.site-drawer-sections,
.site-drawer-pages {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-drawer-sections > li {
  padding: 10px 0;
  border-bottom: 1px solid var(--nav-border);
}

.site-drawer-section {
  display: block;
  padding: 6px 0;
  color: var(--main-text-color);
  font-family: "Concourse T6 Tab", var(--nav-font);
  font-size: 22px;
  font-weight: 600;
  text-decoration: none;
}

.site-drawer-section.is-active {
  text-decoration: underline;
  text-decoration-color: var(--link-decoration-color);
  text-underline-offset: 5px;
}

.site-drawer-pages a {
  display: block;
  padding: 7px 0 7px 12px;
  color: var(--main-text-color);
  font-size: 17px;
  text-decoration: none;
}

.site-drawer a[aria-current="page"] {
  font-weight: 700;
}

.site-drawer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
}

.site-drawer-actions .site-nav-cta {
  flex: 1;
  justify-content: center;
  min-height: 44px;
  margin-left: 0;
}

.site-drawer-actions .site-nav-icon {
  width: 44px;
  height: 44px;
}

/* ---------- Section tabs (pages of the current section). Not ".section-nav": jekyll-toc uses that class for the post TOC. ---------- */

.section-tabs {
  clear: both; /* the page header leaves uncleared Bootstrap columns */
  max-width: 750px;
  margin: -10px auto 32px;
  padding: 0 15px;
  font-family: var(--nav-font);
}

.section-tabs ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.section-tabs a {
  display: inline-block;
  padding: 7px 14px;
  border: 1px solid var(--panel-border-color);
  border-radius: 999px;
  color: var(--main-text-color);
  font-size: 16px;
  line-height: 1.2;
  text-decoration: none;
}

.section-tabs a:hover {
  border-color: var(--main-text-color);
  text-decoration: none;
}

.section-tabs a[aria-current="page"] {
  border-color: var(--nav-cta-bg);
  background: var(--nav-cta-bg);
  color: var(--nav-cta-fg);
}

/* ---------- Footer ---------- */

footer.site-footer {
  margin-top: 64px;
  padding: 48px 0 32px;
  border-top: 1px solid var(--nav-border);
  background: var(--footer-color);
  font-family: var(--nav-font);
}

.site-footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

.footer-sitemap {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 32px 24px;
}

.footer-heading {
  margin: 0 0 12px;
  font-family: var(--nav-font);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer-heading,
.footer-heading a {
  color: var(--main-text-color);
  text-decoration: none;
}

.footer-sitemap ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-sitemap li a {
  display: inline-block;
  padding: 5px 0;
  color: var(--main-text-color);
  font-size: 16px;
  line-height: 1.3;
  text-decoration: none;
}

/* main.css adds a PDF icon to every .pdf link; not needed in the sitemap. */
.footer-sitemap a[href$=".pdf"] {
  padding-left: 0;
  background: none;
}

.footer-sitemap li a:hover,
.footer-heading a:hover {
  text-decoration: underline;
  text-decoration-color: var(--link-decoration-color);
  text-underline-offset: 4px;
}

.site-footer .footer-social {
  justify-content: flex-start;
  margin: 40px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--nav-border);
}

.site-footer .copyright {
  margin: 16px 0 0;
  padding: 0;
  text-align: left;
  font-size: 14px;
  color: var(--post-meta-index-color);
}

@media (min-width: 768px) {
  .site-footer .footer-social {
    justify-content: center;
  }

  .site-footer .copyright {
    text-align: center;
  }
}

@media (max-width: 860px) {
  .footer-sitemap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .site-footer-inner {
    padding: 0 16px;
  }

  .footer-sitemap {
    gap: 28px 16px;
  }
}
