/*
 * BrainX brand footer — canonical CSS.
 * Statement-led layout (C-4). Spec: docs/superpowers/specs/2026-05-23-footer-redesign-design.md
 *
 * All selectors namespaced under .bx-footer so this file drops into both the
 * Astro landing and any Sphinx docs theme without colliding.
 *
 * Light-only by design (site-wide `color-scheme: light` in global.css).
 * No JS — Footer.astro / brainx_sphinx_header SSR the {{YEAR}} substitution.
 */

.bx-footer {
  /* Locally derived defaults so the footer renders even outside the Neural
     Atlas token cascade (e.g., embedded in a Sphinx page that imports the
     footer CSS before any site tokens). All values mirror tokens.css. */
  --bxf-paper:        var(--bx-paper, #fbf6e9);
  --bxf-paper-deep:   var(--bx-paper-deep, #f6efde);
  --bxf-ink:          var(--bx-ink, #1c1610);
  --bxf-ink-soft:     var(--bx-ink-soft, #3a2e1f);
  --bxf-bronze:       var(--bx-bronze, #5a4a2a);
  --bxf-coral-strong: var(--bx-coral-strong, #a04420);
  --bxf-rule:         var(--bx-rule, #d8cfb8);
  --bxf-rule-strong:  var(--bx-rule-strong, #b9ad8e);
  --bxf-font-display: var(--bx-font-display, 'Source Serif 4', Georgia, serif);
  --bxf-font-body:    var(--bx-font-body, 'Inter', system-ui, sans-serif);
  --bxf-font-mono:    var(--bx-font-mono, 'JetBrains Mono', ui-monospace, monospace);

  position: relative;
  overflow: hidden;
  margin-top: 6rem;
  background: var(--bxf-paper-deep);
  color: var(--bxf-ink-soft);
  font-family: var(--bxf-font-body);
  font-size: 0.875rem;

  /* container queries — let the footer adapt to its host's inline size, not
     the viewport. matters inside Sphinx docs where the content column is
     narrower than the viewport. */
  container-type: inline-size;
}

.bx-footer-inner {
  position: relative;
  max-width: 80rem;
  margin: 0 auto;
  padding: 4.25rem 1.5rem 2.5rem;
}

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

.bx-footer-grid {
  display: grid;
  grid-template-columns: minmax(14rem, 0.9fr) minmax(0, 2.7fr);
  gap: clamp(2rem, 3.5vw, 3.75rem);
  align-items: start;
}

.bx-footer-col {
  min-width: 0;
}

/* ---------- Brand column ---------- */

.bx-footer-brand-wordmark {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.bx-footer-brand-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  overflow: hidden;
}

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

.bx-footer-brand-name {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  line-height: 1;
  white-space: nowrap;
}

.bx-footer-brand-strong {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--bxf-ink);
}

.bx-footer-brand-sub {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bxf-ink-soft);
}

.bx-footer-brand-affil {
  max-width: 22rem;
  margin: 0 0 1rem;
}

.bx-footer-brand-affil p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--bxf-bronze);
}

.bx-footer-brand-affil p em {
  font-style: italic;
  color: var(--bxf-ink-soft);
}

.bx-footer-brand-affil p strong {
  font-weight: 600;
  color: var(--bxf-ink);
}

/* ---------- Link columns ---------- */

.bx-footer-col-heading {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bxf-ink);
}

.bx-footer-col-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
}

.bx-footer-col-list a {
  display: inline-flex;
  align-items: baseline;
  min-height: 1.35rem;
  color: var(--bxf-ink-soft);
  text-decoration: none;
  transition: color 150ms ease, transform 150ms ease;
}

.bx-footer-col-list a:hover,
.bx-footer-col-list a:focus-visible {
  color: var(--bxf-coral-strong);
  transform: translateX(2px);
}

/* ---------- Documentation columns ---------- */

.bx-footer-links {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(0.9rem, 1.35vw, 1.45rem);
  align-items: start;
}

.bx-footer-docs {
  min-width: 0;
  grid-column: span 4;
}

.bx-footer-doc-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.9rem, 1.35vw, 1.45rem);
  align-items: start;
}

.bx-footer-doc-group {
  min-width: 0;
}

.bx-footer-doc-layer {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--bxf-ink);
}

/* ---------- Bottom strip ---------- */

.bx-footer-bottom {
  position: relative;
}

.bx-footer-bottom-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 2.5rem;
  border-top: 1px solid var(--bxf-rule-strong);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.78rem;
  color: var(--bxf-bronze);
}

.bx-footer-bottom-left {
  display: flex;
  align-items: center;
  gap: 0.4rem 1.5rem;
  flex-wrap: wrap;
}

.bx-footer-cite-link,
.bx-footer-lab-link {
  color: var(--bxf-ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--bxf-rule-strong);
  padding-bottom: 1px;
  transition: color 150ms ease, border-color 150ms ease;
}

.bx-footer-cite-link:hover,
.bx-footer-cite-link:focus-visible,
.bx-footer-lab-link:hover,
.bx-footer-lab-link:focus-visible {
  color: var(--bxf-coral-strong);
  border-color: var(--bxf-coral-strong);
}

/* ---------- Responsive (container queries) ---------- */

/* Five link columns need ~760px (INFRASTRUCTURE is the widest nowrap
   heading), so the brand column stacks on top well before the side-by-side
   grid would squeeze them. */
@container (max-width: 1120px) {
  .bx-footer-inner {
    padding: 3rem 1.5rem 2rem;
  }
  .bx-footer-grid {
    grid-template-columns: 1fr;
    gap: 2.25rem;
  }
  .bx-footer-brand {
    max-width: 32rem;
  }
}

/* Too narrow for five columns: doc groups go 2-up, Research drops below. */
@container (max-width: 800px) {
  .bx-footer-links {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }
  .bx-footer-docs {
    grid-column: auto;
  }
  .bx-footer-doc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 1.75rem;
  }
}

@container (max-width: 640px) {
  .bx-footer-inner {
    padding: 2.5rem 1.25rem 1.5rem;
  }
  .bx-footer-grid {
    gap: 1.75rem;
  }
  .bx-footer-brand {
    max-width: 100%;
  }
  .bx-footer-col-heading {
    margin-bottom: 0.75rem;
  }
  .bx-footer-col-list {
    gap: 0.45rem;
  }
  .bx-footer-doc-layer {
    margin-bottom: 0.75rem;
    white-space: normal;
  }
  .bx-footer-bottom-inner {
    padding: 1.25rem 1.25rem 2rem;
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .bx-footer-col-list a,
  .bx-footer-cite-link,
  .bx-footer-lab-link {
    transition: none;
  }
}


/* --- brainx-sphinx-header docs-site footer overrides ---
   The shared footer.css ships with `margin-top: 6rem` so the brand footer
   separates cleanly from the editorial content on the Astro landing page.
   Inside a Sphinx page the theme renders its own footer (bd-footer-content
   with copyright / last-updated) directly above ours, and that top margin
   then shows up as a ~6-8rem blank band between the two footers. Zero it
   so the BrainX footer sits flush against the theme footer; its own
   internal padding and distinct background still mark a clear band. */
.bx-footer {
  margin-top: 0 !important;
}
