/* The navigation (scripts/build_nav.py, templates/base.html, templates/partials/nav.html): the
   header and its Menu, the footer's sitemap, the trail in a page's label, the next section on a
   hub, and the home page's way in. Colors only from tokens.css.

   Phone (under 40rem): the logo, Tonight and the Menu on one row, down to 320 px. Wider: the logo
   and the descriptor, then one row of the main sections between paired navy rules, and the Menu. */

/* ---------------------------------------------------------------- the header */

.masthead {
  position: relative;
  border-bottom: 4px double var(--navy);
}
.masthead-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.5rem;
  padding-block: 0.625rem;
}
.masthead .logo { width: clamp(110px, 32vw, 180px); }
.masthead-logo { display: block; }
.masthead .descriptor { display: none; }
.masthead .lang-switch { grid-column: 1 / -1; margin: 0; }

.nav-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.375rem;
  min-width: 0;
}
.nav-row {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-wide { display: none; }
.nav-row a,
.menu > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
}
/* On a phone, Tonight is the one action in the header. */
.nav-row a {
  padding-inline: 0.75rem;
  background: var(--field-green);
  color: var(--white);
}
.nav-row a:hover { text-decoration: underline; }
.nav-row a[aria-current] { box-shadow: inset 0 -3px var(--white); }
.nav-row a:focus-visible { outline-color: var(--navy); }

/* The Menu: a <details>, so it works without scripts. */
.menu {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 1rem;
}
.menu > summary {
  gap: 0.375rem;
  padding: 0 0.625rem;
  border: 1px solid var(--navy);
  list-style: none;
  cursor: pointer;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover { text-decoration: underline; }
.menu[open] > summary { background: var(--navy); color: var(--white); }
.menu[open] > summary:focus-visible { outline-color: var(--field-green); }
/* The icon is the paired pinstripe: two rules with air between. */
.menu-icon {
  display: block;
  width: 0.875rem;
  height: 0;
  border-top: 6px double currentColor;
}
.menu-panel {
  position: absolute;
  z-index: 10;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  padding-block: 1rem 1.5rem;
  background: var(--white);
  border-bottom: 4px double var(--navy);
}

/* ---------------------------------------------------------------- every section, by job */
/* The Menu, the 404 and the home page's list. */

.sections-list {
  display: grid;
  gap: 1.25rem 2rem;
}
.sections-job > .label {
  padding-bottom: 0.375rem;
  border-bottom: 4px double var(--navy);
}
.sections-list ul,
.menu .sections-list ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.menu .sections-list li + li { margin-top: 0; }
.sections-job > ul > li { border-bottom: 1px solid var(--road-gray); }
.sections-job > ul > li > a {
  display: block;
  min-height: 44px;
  padding-block: 0.5rem;
  text-decoration: none;
}
.sections-job b {
  display: block;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.35;
}
.sections-job a span {
  display: block;
  margin-top: 0.125rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--reading-gray);
}
.sections-job > ul > li > a:hover b { text-decoration: underline; }
.sections-job a[aria-current] b { color: var(--field-green); }
.sections-job a[aria-current] b::after { content: " · you are here"; font-weight: 400; font-size: 0.8125rem; }
.sections-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1rem;
  margin-top: -0.25rem;
}
.sections-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.8125rem;
}

/* ---------------------------------------------------------------- the trail, in a page's label */

.trail a { padding-block: 0.875rem; }   /* a taller target, without moving the line */

/* ---------------------------------------------------------------- the next section, on a hub */

.next-section {
  border-top: 4px double var(--navy);
  padding-block: 1rem 2.5rem;
}
.next-section a {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.75rem;
  min-height: 44px;
  font-family: var(--font-slab);
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.next-section a:hover { text-decoration: underline; }
.next-section .label { display: inline; letter-spacing: 0.09em; }
.next-name { white-space: nowrap; }

/* ---------------------------------------------------------------- the footer's sitemap */

.footer-grid {
  display: grid;
  gap: 2rem;
  padding-block: 2.5rem 2rem;
}
.sitemap {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}
.sitemap .label {
  padding-bottom: 0.375rem;
  border-bottom: 4px double var(--road-gray);
  color: var(--road-gray);
}
.site-footer .sitemap ul {
  display: block;
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
}
.site-footer .sitemap a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-block: 0;
  overflow-wrap: anywhere;
}
.footer-grid .footnote {
  padding-top: 1rem;
  border-top: 4px double var(--road-gray);
  max-width: none;
}
.footer-grid .footnote p { max-width: 40rem; }

/* ---------------------------------------------------------------- the home page's way in */

.jobs {
  display: grid;
  gap: 2.5rem 2rem;
}
.job {
  border-top: 4px double var(--navy);
  padding-top: 1rem;
  scroll-margin-top: 1rem;
}
.job img {
  width: 100%;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  margin-bottom: 1rem;
}
.job h3 { font-size: 1.5rem; margin: 0.5rem 0 0.5rem; }
.job-line { font-size: 0.9375rem; margin-bottom: 0.75rem; }
.job .sections-job > ul { border-top: 1px solid var(--road-gray); margin: 0; padding: 0; list-style: none; }

/* ---------------------------------------------------------------- wider screens */

@media (min-width: 40rem) {
  .masthead { border-bottom: 0; }
  .masthead-row {
    grid-template-columns: auto 1fr;
    gap: 1rem 2rem;
    padding-block: 1.5rem 0;
  }
  .masthead .logo { width: 220px; }
  .masthead .descriptor { display: block; justify-self: end; text-align: right; }
  .nav-bar {
    grid-column: 1 / -1;
    justify-content: space-between;
    gap: 1.5rem;
    border-block: 4px double var(--navy);
  }
  .nav-row { flex: 1; justify-content: space-between; gap: 0 1.25rem; max-width: 52rem; }
  .nav-wide { display: block; }
  .nav-row a { padding: 0; background: none; color: inherit; }
  .nav-row a[aria-current] { color: var(--field-green); box-shadow: inset 0 -3px var(--field-green); }
  .nav-row a:focus-visible { outline-color: var(--field-green); }
  .menu > summary { border-width: 0 0 0 1px; border-color: var(--road-gray); padding: 0 0.75rem 0 1rem; }
  .menu-panel { top: 100%; }
  .sections-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sitemap { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .jobs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Between phone and the four-column desktop menu, the groups flow as balanced columns rather
   than grid rows, so a short group (Know the team) doesn't hold open a row as tall as a long one
   (Show up right). */
@media (min-width: 40rem) and (max-width: 59.99rem) {
  .sections-list, .jobs, .sitemap { display: block; column-gap: 2rem; }
  .sections-list, .jobs { columns: 2; }
  .sitemap { columns: 3; }
  .sections-list > *, .jobs > *, .sitemap > * { break-inside: avoid; display: block; }
  .sections-list > * { margin-bottom: 1.25rem; }
  .jobs > * { margin-bottom: 2.5rem; }
  .sitemap > * { margin-bottom: 1.5rem; }
}

@media (min-width: 60rem) {
  .menu .sections-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .menu .sections-about { grid-column: 1 / -1; }
  .menu .sections-about > ul { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 2rem; }
  .footer-grid { grid-template-columns: minmax(10rem, 1fr) 4fr; }
  .sitemap { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .footer-grid .footnote { grid-column: 1 / -1; }
}

@media (forced-colors: active) {
  .nav-row a, .menu > summary { border: 1px solid ButtonText; }
  .nav-row a[aria-current], .sections-job a[aria-current] b { text-decoration: underline; text-decoration-thickness: 3px; }
}

@media print {
  .next-section { display: none; }
}
