/* chrome.css — the shared site chrome: station header, nav, sign-off footer.
   Single source of truth, extracted verbatim from index.html's canonical
   chrome (BRA-140, 2026-08-19). Loaded by every shipping page BEFORE its
   inline <style>, so page-level overrides (the article pages' opaque,
   hide-on-scroll header) win the cascade. 404.html deliberately carries no
   chrome and does not load this file. Var tokens resolve from each page's
   own :root block. Checked by tools/design-lint.py. */

/* ---------- Station header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 90;
  padding: max(16px, env(safe-area-inset-top)) var(--gutter) 12px;
  pointer-events: none;
}

.site-header__bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 54px;
}

/* Menu trigger — reads as a channel control, not a generic hamburger. */
.menu-toggle {
  pointer-events: auto;
  grid-column: 2;
  display: inline-grid;
  grid-template-columns: auto 14px;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(244, 239, 233, .5);
  background: rgba(16, 12, 21, .5);
  color: var(--paper);
  font-family: var(--data);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 220ms ease, color 220ms ease, border-color 220ms ease;
}

/* The word collapses away once the viewer starts scrolling. */
.menu-toggle__label {
  display: block;
  max-width: 6em;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 340ms var(--ease-out), opacity 200ms ease;
}

.site-header.is-scrolled .menu-toggle__label {
  max-width: 0;
  opacity: 0;
}

/* Scrolled: the word is gone and the trigger squares up to its bars — the
   plate (border + fill) STAYS. Do not make this state transparent: that was
   the ghost-toggle drift normalized away from seventeen pages by owner
   ruling (BRA-140, 2026-08-19). */
.site-header.is-scrolled .menu-toggle {
  gap: 0;
  padding: 0 14px;
}

.menu-toggle__bars {
  position: relative;
  width: 14px;
  height: 9px;
}

.menu-toggle__bars::before,
.menu-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 14px;
  height: 1px;
  background: currentColor;
  transition: transform 260ms var(--ease-out);
}

.menu-toggle__bars::before { top: 0; }

.menu-toggle__bars::after { bottom: 0; }

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

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

.menu-toggle:hover { background: var(--paper); border-color: var(--paper); color: var(--studio); }

/* Menu bar — slides out leftward from the trigger, on the trigger's own row. */
.site-nav {
  grid-column: 1;
  overflow: hidden;
  pointer-events: none;
}

.site-nav[data-open="true"] { pointer-events: auto; }

.site-nav__panel {
  transform: translateX(101%);
  opacity: 0;
  transition: transform 560ms var(--ease-out), opacity 220ms ease 60ms;
}

.site-nav[data-open="true"] .site-nav__panel {
  transform: translateX(0);
  opacity: 1;
}

/* Logo at the far left, then eight labels on even centres. */
.site-nav__list {
  display: grid;
  grid-template-columns: auto repeat(7, minmax(0, 1fr));
  align-items: center;
  margin: 0;
  padding: 0 4px 0 8px;
  min-height: 46px;
  border: 1px solid rgba(244, 239, 233, .5);
  background: rgba(16, 12, 21, .86);
  list-style: none;
  backdrop-filter: blur(3px);
}

.site-nav__list li { display: grid; justify-items: center; }

.site-nav__brand {
  display: inline-flex;
  align-items: center;
  padding-right: 6px;
}

.site-nav__logo {
  display: block;
  width: 34px;
  height: 34px;
}

.site-nav__list a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 44px;
  padding: 0 6px;
  font-family: var(--data);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .13em;
  text-decoration: none;
  text-transform: uppercase;
  color: rgba(244, 239, 233, .82);
  transition: color 200ms ease;
}

.site-nav__list a:hover { color: var(--paper); }

.site-nav__list a[aria-current="page"] {
  color: var(--paper);
  box-shadow: inset 0 -2px 0 var(--on-air);
}

/* Desktop only: a larger station bar — trigger, labels and logo all scale up.
   Mobile keeps the compact sizes set above. */
@media (min-width: 781px) {
  .site-header__bar { min-height: 62px; }

  .menu-toggle {
    grid-template-columns: auto 17px;
    gap: 12px;
    min-height: 54px;
    padding: 0 18px;
    font-size: 13px;
  }

  .site-header.is-scrolled .menu-toggle { padding: 0 18px; }

  .menu-toggle__bars { width: 17px; height: 11px; }

  .menu-toggle__bars::before,
  .menu-toggle__bars::after { width: 17px; }

  .menu-toggle[aria-expanded="true"] .menu-toggle__bars::before { transform: translateY(5px) rotate(45deg); }

  .menu-toggle[aria-expanded="true"] .menu-toggle__bars::after { transform: translateY(-5px) rotate(-45deg); }

  .site-nav__list { min-height: 54px; padding: 0 6px 0 10px; }

  .site-nav__logo { width: 40px; height: 40px; }

  /* 15px only once the row is wide enough for it — "Newsletter" and
     "Contact Us" are the longest labels and crowd their cells on a narrow
     desktop window. nowrap keeps "Contact Us" from breaking at its space. */
  .site-nav__list a { min-height: 50px; font-size: clamp(13px, 1.2vw, 15px); white-space: nowrap; }
}

/* ================= Sign-off footer (BRA-128, ported from the signed mock) ================= */
.site-footer {
  position: relative;
  z-index: 10;
  border-top: 1px solid var(--line);
  background: var(--studio);
  color: var(--alloy);
}

/* Article pages: room for the fixed edition rail below the footer. */
.site-footer--column { --footer-floor: max(88px, calc(env(safe-area-inset-bottom) + 88px)); }

.site-footer__in {
  display: flex;
  align-items: center;
  gap: 24px 28px;
  padding: 40px var(--gutter) var(--footer-floor, max(40px, env(safe-area-inset-bottom)));
}

/* Article pages: the footer sits on the article's 720px column (.ed-wrap metrics). */
.site-footer--column .site-footer__in {
  max-width: 720px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

@media (min-width: 1280px) {
  .site-footer--column .site-footer__in { padding-left: 48px; padding-right: 48px; }
}

.site-footer p { margin: 0; max-width: 46rem; }

.site-footer strong { color: var(--paper); font-weight: 500; }

.site-footer__id { flex: 1 1 auto; }

.site-footer__disclaimer {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--alloy);
}

.site-footer__channel {
  margin-top: 8px;
  font-family: var(--data);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.site-footer .sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.site-footer :focus-visible { outline: 2px solid var(--paper); outline-offset: 5px; }

/* Row branch (default, non-article ≥781px): [X] [field] [button].
   16px box gap + the X box's 12px inner padding = 28px optical gap. */
.site-footer__right {
  display: flex;
  align-items: center;
  gap: 16px;
  reading-flow: flex-visual; /* keeps row tab order visual; inert when display:contents */
}

.site-footer__notify { position: relative; }

.site-footer__row { display: flex; gap: 14px; }

.site-footer__notify input[name="email"] {
  flex: 0 0 34ch;
  height: 44px;
  padding: 0 12px;
  font-family: var(--data);
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--paper);
  background: var(--field-fill);
  border: 1px solid var(--field-line);
  border-radius: 0;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

.site-footer__notify input[name="email"]::placeholder { color: var(--alloy); }

.site-footer__notify input[name="email"]:hover:not(:disabled) { border-color: var(--field-line-hover); }

.site-footer__notify input[name="email"]:focus {
  border-color: var(--field-line-hover);
  background: var(--field-fill-focus);
}

.site-footer__notify input[name="email"]:focus:not(:focus-visible) { outline: none; }

.site-footer__notify input[name="email"]:disabled { opacity: .5; }

.site-footer__notify button[type="submit"] {
  flex: 0 0 auto;
  min-width: 20ch; /* holds "Subscribing…" — no reflow on label swap */
  height: 44px;
  padding: 0 14px;
  font-family: var(--data);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--studio);
  background: var(--paper);
  border: 1px solid var(--paper);
  border-radius: 0;
  cursor: pointer;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

@media (hover: hover) {
  .site-footer__notify button[type="submit"]:hover:not(:disabled) {
    background: transparent;
    color: var(--paper);
  }
}

.site-footer__notify button[type="submit"]:disabled {
  cursor: wait;
  background: rgba(244, 239, 233, .55);
  border-color: transparent;
  color: var(--studio);
}

.site-footer__status {
  min-height: 1.5em; /* one micro line reserved — the footer never reflows */
  font-family: var(--data);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1.5;
  color: var(--alloy);
  text-align: right;
}

.site-footer__status.is-success { color: var(--paper); }

.site-footer__status.is-error { color: var(--on-air-text); }

/* Row branch: the status hangs below the row inside the bottom padding.
   p.… specificity (0,2,1) so `.site-footer p { margin: 0 }` cannot zero a
   stacked margin, and the stacked overrides below can win it back. */
.site-footer p.site-footer__status {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 100%;
  margin-top: 0;
}

.site-footer__x {
  flex: none;
  order: -1; /* row branch: X visually left of the field */
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--alloy);
  text-decoration: none;
  transition: color 160ms var(--ease-out);
}

.site-footer__x:hover { color: var(--paper); }

.site-footer__x svg { display: block; width: 16px; height: 16px; }

/* Stacked band — subscribe row above a hairline; identity + X paired below.
   Pure CSS, deliberately written twice: `.site-footer--column …` (article
   pages at every width) and the same rules ≤780px for every page. The X box
   stays inside the content edge (focus ring never clips); its glyph
   translates +12px so the mark lands on the content margin. */
.site-footer--column .site-footer__in { flex-wrap: wrap; row-gap: 24px; }

.site-footer--column .site-footer__right { display: contents; }

.site-footer--column .site-footer__notify {
  order: 1;
  flex: 1 1 100%;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.site-footer--column .site-footer__id { order: 2; flex: 1 1 0; min-width: 0; }

.site-footer--column .site-footer__x { order: 3; align-self: center; }

.site-footer--column .site-footer__x svg { transform: translateX(12px); }

.site-footer--column .site-footer__x:focus-visible { outline: none; }

.site-footer--column .site-footer__x:focus-visible svg { outline: 2px solid var(--paper); outline-offset: 5px; }

.site-footer--column .site-footer__notify input[name="email"] {
  flex: 1 1 auto;
  max-width: 34ch;
  min-width: 0;
}

.site-footer--column p.site-footer__status {
  position: static;
  width: auto;
  margin-top: 8px;
  text-align: left;
}

@media (max-width: 780px) {
  .site-footer .site-footer__in { flex-wrap: wrap; row-gap: 24px; }

  .site-footer .site-footer__right { display: contents; }

  .site-footer .site-footer__notify {
    order: 1;
    flex: 1 1 100%;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
  }

  .site-footer .site-footer__id { order: 2; flex: 1 1 0; min-width: 0; }

  .site-footer .site-footer__x { order: 3; align-self: center; }

  .site-footer .site-footer__x svg { transform: translateX(12px); }

  .site-footer .site-footer__x:focus-visible { outline: none; }

  .site-footer .site-footer__x:focus-visible svg { outline: 2px solid var(--paper); outline-offset: 5px; }

  .site-footer .site-footer__notify input[name="email"] {
    flex: 1 1 auto;
    max-width: 34ch;
    min-width: 0;
  }

  .site-footer p.site-footer__status {
    position: static;
    width: auto;
    margin-top: 8px;
    text-align: left;
  }
}

@media (max-width: 390px) {
  .site-footer__row { flex-wrap: wrap; }

  .site-footer .site-footer__notify input[name="email"] { flex: 1 1 100%; max-width: none; }

  .site-footer__notify button[type="submit"] { flex: 1 1 100%; min-width: 0; }
}

/* ---------- Mobile ---------- */
@media (max-width: 780px) {
  /* No room to slide sideways on a phone — the panel drops instead. */
  .site-header__bar { min-height: 48px; grid-template-columns: 1fr auto; }

  .site-nav {
    position: absolute;
    left: var(--gutter);
    right: var(--gutter);
    top: calc(100% + 10px);
    overflow: hidden;
    max-height: 0;
    transition: max-height 420ms var(--ease-out);
  }

  .site-nav[data-open="true"] { max-height: 560px; }

  .site-nav__panel {
    transform: translateY(-10px);
    transition: transform 420ms var(--ease-out), opacity 220ms ease;
  }

  .site-nav[data-open="true"] .site-nav__panel { transform: translateY(0); }

  .site-nav__list {
    grid-template-columns: 1fr;
    justify-items: stretch;
    padding: 6px 0;
    background: rgba(16, 12, 21, .97);
  }

  .site-nav__list li { justify-items: center; }

  .site-nav__brand { padding: 8px 0 4px; }
}
