/* ==========================================================================
   Layout — page gutters, top bar, header, main navigation (with the mobile
   menu toggle), and footer.
   ========================================================================== */

/* Page gutters ------------------------------------------------------------ */

.section-shell {
  padding-right: max(5.5vw, 24px);
  padding-left: max(5.5vw, 24px);
}

.section-space {
  padding-top: 80px;
  padding-bottom: 80px;
}

/* Top bar ----------------------------------------------------------------- */

.topbar {
  position: relative;
  padding: 11px 5.5%;
  background: var(--ink);
  color: var(--cream);
  font-size: 0.6875rem;
  line-height: 1.5;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
}

.topbar span {
  position: absolute;
  right: 5.5%;
}

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

.site-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 108px;
  padding: 0 max(5.5vw, 24px);
  border-bottom: 1px solid var(--line);
  background: var(--cream);
}

.brand img {
  width: 100px;
  height: 100px;
  object-fit: contain;
}

/* Navigation -------------------------------------------------------------- */

nav {
  display: flex;
  gap: 40px;
  margin-left: auto;
}

nav a {
  font-size: 0.8125rem;
}

nav a:hover {
  color: var(--red);
}

/* Shown only below 760px, where the nav collapses into a drop-down.
   nav-menu.js keeps aria-expanded in sync with the open state. */
.menu-toggle {
  display: none;
}

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

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 30px;
  padding-top: 40px;
  padding-bottom: 26px;
  background: var(--ink);
  color: var(--cream);
}

/* The logo is black and red on a transparent background, so it sits on a
   cream tile to stay visible against the ink footer. */
.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 142px;
  height: 124px;
  padding: 5px 12px;
  border-radius: 4px;
  background: var(--cream);
}

.footer-brand img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.footer-brand:focus-visible,
.footer-bottom a:focus-visible {
  outline-color: var(--focus-on-dark);
}

.footer-tagline {
  color: var(--on-dark-muted);
  font-size: 0.8125rem;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 16px;
  padding-top: 22px;
  border-top: 1px solid #4b4c40;
  color: var(--on-dark-muted);
  font-size: 0.75rem;
}

.footer-bottom a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.footer-bottom a:hover {
  color: var(--cream);
}

.footer-bottom .arrow {
  font-size: 0.875rem;
}

/* Responsive -------------------------------------------------------------- */

/* Keep 80px gutters on wide screens and cap the content at 1340px. */
@media (min-width: 1500px) {
  .section-shell,
  .site-header {
    padding-right: max(calc((100vw - 1340px) / 2), 80px);
    padding-left: max(calc((100vw - 1340px) / 2), 80px);
  }
}

/* Below this width the nav becomes a drop-down behind the menu toggle. */
@media (max-width: 760px) {
  .section-space {
    padding-top: 50px;
    padding-bottom: 50px;
  }

  .topbar {
    padding: 10px 16px;
    font-size: 0.625rem;
    letter-spacing: 0.12em;
  }

  .topbar span {
    display: none;
  }

  .site-header {
    gap: 14px;
    height: 86px;
    padding: 0 20px;
  }

  .brand img {
    width: 76px;
    height: 76px;
  }

  .header-order {
    margin-left: auto;
  }

  .menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    width: 44px;
    height: 44px;
    padding: 11px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
  }

  .menu-toggle span {
    width: 100%;
    height: 1px;
    background: currentColor;
  }

  /* The two bars cross into an "×" while the menu is open. */
  .menu-toggle[aria-expanded="true"] span:first-child {
    transform: translateY(4px) rotate(45deg);
  }

  .menu-toggle[aria-expanded="true"] span:last-child {
    transform: translateY(-4px) rotate(-45deg);
  }

  nav {
    position: absolute;
    top: 86px;
    right: 0;
    left: 0;
    display: none;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 8px 20px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--cream);
    box-shadow: 0 8px 10px rgba(41, 42, 34, 0.04);
  }

  nav.is-open {
    display: flex;
  }

  nav a {
    padding: 12px 0;
    font-size: 0.9375rem;
  }

  .site-footer {
    gap: 16px;
    padding-top: 32px;
    padding-bottom: 24px;
  }

  .footer-brand {
    width: 122px;
    height: 108px;
  }
}

@media (max-width: 380px) {
  .site-header {
    padding-right: 16px;
    padding-left: 16px;
  }

  .brand img {
    width: 60px;
    height: 60px;
  }
}
