/* chrome.css - the shared header and footer, on every page.
 *
 * One file instead of a copy of the nav and footer rules in each page's
 * <style>. Root pages link it AFTER their own <style>, so it wins any tie;
 * campaign pages link it from SITE-HEAD, which sits BEFORE campaign.css, so
 * there the selectors' specificity (below) is what keeps campaign.css off the
 * chrome - never add a bare nav/footer/ul/li rule to campaign.css. The
 * markup it styles is stamped from internal/seo-templates/chrome.html by
 * tools/gen_chrome.py, which CI drift-checks. Tokens (--ink, --rule, --red,
 * ...) come from each page's :root; the fallbacks cover /preview, whose
 * tokens come from brand-tokens.css.
 *
 * Selectors are deliberately specific (nav.top ..., footer.site-foot ...):
 * /preview carries vendored tool CSS with bare button, p, h2 and .wordmark
 * rules, and those must not reach the chrome.
 */

@keyframes chrome-fade-down {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================ HEADER ================ */
nav.top {
  position: relative;
  z-index: 10;   /* above the z-index:2 content sections */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 28px;
  padding: 26px 56px 0 120px;
  animation: chrome-fade-down 1.1s cubic-bezier(.2,.7,.2,1) both;
}
nav.top .wordmark {
  font-family: 'Crimson Pro', Georgia, serif;
  font-style: italic;
  font-weight: 600;
  font-size: 22px;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  margin: 0 auto 0 0;
  flex-shrink: 0;
}
nav.top ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 28px;
  margin: 0;
  padding: 0;
}
nav.top li { margin: 0; padding: 0; }
nav.top a.link {
  position: relative;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pencil);
  text-decoration: none;
  white-space: nowrap;
  /* 16px of type in a 44px target. The link is inline, so its vertical
     padding widens what a finger can hit and moves nothing (WCAG 2.5.8). */
  padding: 14px 0;
  transition: color .2s ease;
}
nav.top a.link:hover { color: var(--ink); }
nav.top a.link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 11px;
  height: 1px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}
nav.top a.link:hover::after,
nav.top a.link.active::after { transform: scaleX(1); }
nav.top a.link.active { color: var(--ink); }

/* The one action in the header: the same dark fill as the hero's
   "Add Margin to Chrome", at nav size. */
nav.top .nav-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  background: var(--ink-soft, #2C2820);
  color: var(--cream);
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 500;
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  padding: 9px 18px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .25s ease;
}
nav.top .nav-cta::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s cubic-bezier(.2,.7,.2,1);
}
nav.top .nav-cta:hover { background: var(--ink); color: var(--cream); }
nav.top .nav-cta:hover::after,
nav.top .nav-cta:focus-visible::after { transform: scaleX(1); }

/* Menu button: hidden on desktop and whenever JS is absent. */
nav.top .nav-toggle {
  display: none;
  order: 2;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 21px 11px;
  margin: -13px -11px -13px -3px;   /* 44x44 tap target, flush right */
  cursor: pointer;
  color: var(--ink);
  font: inherit;
  line-height: 0;
  flex-shrink: 0;
}
nav.top .nav-toggle:hover { background: none; color: var(--ink); }
nav.top .nav-toggle-bars,
nav.top .nav-toggle-bars::before,
nav.top .nav-toggle-bars::after {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  transition: transform .25s ease, background .2s ease;
}
nav.top .nav-toggle-bars { position: relative; }
nav.top .nav-toggle-bars::before,
nav.top .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
nav.top .nav-toggle-bars::before { top: -7px; }
nav.top .nav-toggle-bars::after  { top: 7px; }
/* Open -> X, driven off aria-expanded so the look and the state agree. */
nav.top .nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
nav.top .nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { top: 0; transform: rotate(45deg); }
nav.top .nav-toggle[aria-expanded="true"] .nav-toggle-bars::after  { top: 0; transform: rotate(-45deg); }

@media (max-width: 900px) {
  /* The margin line stays at 88px down to 721px, so the wordmark keeps
     clear of it here and only moves in once the line moves to 28px. */
  nav.top { padding: 22px 32px 0 120px; gap: 0 18px; }
  nav.top .nav-cta { order: 1; }

  /* Without JS the links wrap onto their own row under the logo. */
  nav.top ul { order: 3; flex-basis: 100%; flex-wrap: wrap; gap: 10px 22px; margin-top: 14px; }

  /* With JS they fold behind the menu button and open as a full-width
     panel in the page flow, under the header: it pushes the page down
     instead of floating over the headline. */
  .js nav.top .nav-toggle { display: block; }
  .js nav.top ul {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-top: 18px;
    border-top: 1px solid var(--rule);
  }
  .js nav.top.nav-open ul { display: flex; }
  .js nav.top ul li { border-bottom: 1px solid var(--rule); }
  .js nav.top ul a.link {
    display: block;
    font-size: 13px;
    padding: 15px 0;
  }
  .js nav.top ul a.link::after { display: none; }
  .js nav.top ul a.link.active {
    text-decoration: underline;
    text-decoration-color: var(--red);
    text-underline-offset: 6px;
  }
}
@media (max-width: 900px) and (prefers-reduced-motion: no-preference) {
  .js nav.top.nav-open ul { animation: chrome-fade-down .2s ease both; }
}
@media (max-width: 720px) {
  nav.top { padding-left: 64px; }
}
@media (max-width: 600px) {
  nav.top { padding: 18px 20px 0 52px; gap: 0 14px; }
  nav.top .wordmark { font-size: 20px; }
  nav.top .nav-cta { font-size: 14px; padding: 7px 12px; }
}
@media (max-width: 380px) {
  nav.top { padding: 16px 16px 0 44px; gap: 0 10px; }
  nav.top .nav-cta { font-size: 13px; padding: 7px 10px; }
  nav.top ul { gap: 8px 16px; }
}

/* ================ FOOTER ================ */
footer.site-foot {
  position: relative;
  z-index: 2;
  /* width: 100% keeps it full-measure where body is a flex column
     (/404, /circle): there, margin: auto would shrink it to its content. */
  box-sizing: border-box;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 56px 40px 120px;
  display: grid;
  grid-template-columns: minmax(96px, 0.7fr) repeat(4, minmax(0, 1fr));
  gap: 28px 32px;
  align-items: start;
}
/* The footer's top rule runs the same extent as every section divider
   (inside the footer's padding), not the full 1320px frame. */
footer.site-foot::before {
  content: "";
  grid-column: 1 / -1;
  height: 1px;
  background: var(--rule);
  margin-bottom: 16px;   /* with the 28px row gap: the 44px the padding gave */
}
footer.site-foot .foot-mark {
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 600;
  font-style: italic;
  font-size: 20px;
  line-height: 1;
  color: var(--ink);
}
footer.site-foot .foot-col { min-width: 0; }
footer.site-foot .foot-head {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--pencil);
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  max-width: none;
}
footer.site-foot .foot-head::before,
footer.site-foot .foot-head::after { content: none; }
footer.site-foot ul { list-style: none; margin: 0; padding: 0; font-size: 16px; line-height: 1.35; }
/* Each link is a 30px target (28px on phones) with no gap between rows:
   the same pitch the 22px line plus an 8px gap gave, so nothing moves
   (WCAG 2.5.8). */
footer.site-foot .foot-col li { margin: 0; padding: 0; }
footer.site-foot .foot-col ul { margin: -4px 0 4px; }
footer.site-foot .foot-col a {
  display: inline-block;
  padding: 4px 0;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 16px;
  line-height: 1.35;
  color: var(--ink-soft, #2C2820);
  text-decoration: none;
  transition: color .2s ease;
}
footer.site-foot .foot-col a:hover { color: var(--red); }
/* The store is the one place a reader can get something right now, so it
   reads as an action rather than a destination. */
footer.site-foot .foot-col a.foot-store { color: var(--ink); font-weight: 600; }

footer.site-foot .foot-legal {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 18px;
  border-top: 1px solid var(--hair, rgba(107,99,88,0.10));
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.6;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pencil);
}
footer.site-foot .foot-copy { white-space: nowrap; }

@media (max-width: 1079px) {
  footer.site-foot { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  footer.site-foot .foot-mark { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  footer.site-foot { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 24px; }
}
@media (max-width: 720px) {
  footer.site-foot { padding: 0 24px 36px 56px; }
  footer.site-foot { gap: 20px 20px; }
  footer.site-foot::before { margin-bottom: 12px; }
  footer.site-foot .foot-head { margin-bottom: 8px; }
  footer.site-foot .foot-col a { font-size: 15px; }
}

/* ================ MOTION + PRINT ================ */
@media (prefers-reduced-motion: reduce) {
  nav.top { animation: none; }
  nav.top .nav-toggle-bars,
  nav.top .nav-toggle-bars::before,
  nav.top .nav-toggle-bars::after,
  nav.top .nav-cta::after { transition: none; }
}
@media print {
  nav.top, footer.site-foot { display: none !important; }
}
