/* Layout, header, nav, footer, scroll shell (UI/UX owns this file). Mobile first, text only. */
.skip-link {
  position: absolute; left: var(--space-4); top: -4rem; z-index: 20;
  padding: var(--space-2) var(--space-4); background: var(--color-primary); color: var(--color-on-primary);
  text-decoration: none; font-weight: 600; border-radius: 4px;
}
.skip-link:focus { top: 0.5rem; outline: 3px solid var(--color-focus); outline-offset: 2px; }

/* Entrance animations translate text sideways; clip (not hidden) keeps the sticky header working. */
html, body { overflow-x: clip; }

:where(a, button):focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; }

.site-header {
  padding: 0.75rem var(--space-4);
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
}
.brand {
  display: inline-block; text-transform: var(--heading-transform); letter-spacing: 0.06em; text-shadow: var(--glow-primary); padding: 0.25rem 0; font-family: var(--font-heading);
  font-size: var(--text-lg); font-weight: var(--weight-heading); color: var(--color-text); text-decoration: none;
}
.nav-list {
  display: flex; flex-wrap: wrap; gap: 0 0.25rem; margin: 0.25rem 0 0; padding: 0; list-style: none;
}
.nav-list a {
  display: block; min-height: 2.75rem; padding: 0.5rem 0.625rem; line-height: 1.75rem;
  font-family: var(--font-mono); font-size: var(--text-sm); color: var(--color-text); text-decoration: none;
  text-transform: lowercase; border-bottom: 3px solid transparent;
  transition: color var(--motion-fast), text-shadow var(--motion-fast), border-color var(--motion-fast);
}
.nav-list a:hover { color: var(--color-primary); text-shadow: var(--glow-primary); border-bottom-color: currentColor; }
.nav-list a[aria-current="true"] { color: var(--color-primary); font-weight: 700; border-bottom-color: var(--color-primary); text-shadow: var(--glow-primary); }

main { max-width: 64rem; margin: 0 auto; padding: 0 var(--space-4); }
main :where(p, ul, ol, h3, .table-scroll) { max-width: var(--measure); }
.chapter { scroll-margin-top: var(--space-4); }
main p, main li { font-size: var(--text-base); overflow-wrap: break-word; }
.lead { font-size: var(--text-lg); }
#hero { min-height: 60vh; display: flex; flex-direction: column; justify-content: center; }
#hero h1 { font-size: var(--text-4xl); color: var(--color-primary); text-shadow: var(--glow-primary); text-transform: var(--heading-transform); line-height: var(--leading-heading); letter-spacing: var(--tracking-heading); margin: 0 0 var(--space-4); }

/* Section headers: huge, uppercase, glowing */
.chapter h2 {
  margin: 0 0 var(--space-5); font-size: var(--text-3xl); font-weight: var(--weight-heading);
  line-height: var(--leading-heading); letter-spacing: var(--tracking-heading);
  text-transform: var(--heading-transform); color: var(--color-text); text-shadow: var(--glow-primary);
  overflow-wrap: anywhere;
}
main .chapter { border-top: 1px solid var(--color-border); padding: var(--space-7) 0; }
main #hero { border-top: 0; }
.chapter h3 {
  margin: var(--space-6) 0 var(--space-2); font-family: var(--font-mono); font-size: var(--text-lg);
  font-weight: 700; color: var(--color-accent);
}
.chapter h3::before { content: "// "; color: var(--color-text-muted); }
.chapter strong { color: var(--color-primary); }
.lead { color: var(--color-text-muted); }
.table-scroll { overflow-x: auto; background: var(--color-surface); box-shadow: var(--glow-box); }
.compare-table th { font-family: var(--font-mono); color: var(--color-primary); }
.compare-table caption { color: var(--color-text-muted); }
.compare-table th, .compare-table td { border-bottom-color: var(--color-border); }


.site-footer {
  margin-top: var(--space-6); padding: var(--space-6) var(--space-4); text-align: center;
  border-top: 1px solid var(--color-border); background: var(--color-surface); font-size: var(--text-sm);
}
.site-footer p { margin: 0; }

@media (min-width: 64rem) {
  .site-header {
    position: sticky; top: 0; z-index: 10; display: flex; align-items: center;
    justify-content: space-between; gap: var(--space-6); padding: 0.5rem var(--space-6);
  }
  .nav-list { margin: 0; justify-content: flex-end; }
  .chapter { scroll-margin-top: 5rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .chapter h2 { animation: neon-pulse calc(var(--motion-slow) * 3) ease-in-out infinite; }
  html { scroll-behavior: smooth; }
}
