:root {
  --primary: #1e50a0;
  --primary-dark: #163a78;
  --accent: #f59e0b;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #334155;
  --border: #e2e8f0;
  --link: #1e40af;
  --focus: #b45309;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 1.0625rem;
  line-height: 1.65;
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  background: #fff;
  color: var(--primary-dark);
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  z-index: 200;
  transform: translateY(-150%);
}

.skip:focus { transform: none; }

nav[aria-label="Primary"] {
  background: var(--primary);
  color: #fff;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  align-items: center;
}

.nav-links a {
  color: #fff;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  font-size: 0.9rem;
}

.nav-links a[aria-current="page"] {
  color: #fde68a;
  font-weight: 700;
}

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

.page-header {
  background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
  color: #fff;
  padding: 2.5rem 1.25rem 2rem;
}

.page-header-inner,
.layout {
  max-width: 44rem;
  margin: 0 auto;
}

.page-header p {
  margin: 0.35rem 0 0;
  color: #f8fafc;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.layout { padding: 1.5rem 1.25rem 3rem; }

.toc,
section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.15rem 1.2rem;
  margin: 0 0 1rem;
}

.draft-note {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

section p:last-child,
.toc p:last-child { margin-bottom: 0; }

h2 {
  margin: 0 0 0.6rem;
  font-size: 1.3rem;
  line-height: 1.3;
}

h3 {
  margin: 1.15rem 0 0.35rem;
  font-size: 1.05rem;
}

p { margin: 0.7rem 0; }

ul, ol { margin: 0.5rem 0 0.7rem; padding-left: 1.25rem; }

li { margin: 0.28rem 0; }

a { color: var(--link); }

.toc {
  display: block;
  position: static;
  top: auto;
  color: var(--text);
  text-align: left;
}

.toc h2,
.toc ul,
.toc li {
  text-align: left;
}

.toc a { text-decoration: underline; text-underline-offset: 0.15em; }

.toc ul {
  display: block;
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc li {
  display: block;
  margin: 0.2rem 0;
}

footer {
  background: var(--primary-dark);
  color: #f8fafc;
  text-align: center;
  padding: 1.5rem 1.25rem 2rem;
  font-size: 0.95rem;
}

footer a {
  color: #fde68a;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

@media (max-width: 640px) {
  .page-header { padding: 2rem 1rem 1.5rem; }
  .layout { padding: 1rem 1rem 2.5rem; }
  .toc, section { padding: 1rem; }
}

@media print {
  nav[aria-label="Primary"], .skip, .toc, footer { display: none; }
  body { background: #fff; }
  .page-header { background: #fff; color: #000; padding: 0 0 1rem; }
  .page-header p, .draft-note { color: #000; }
  section { border: none; padding: 0; }
}
