:root {
  color-scheme: dark;
  --bg: #111116;
  --panel: #1c1b23;
  --panel-2: #252431;
  --text: #f4f2ff;
  --muted: #bcb8ca;
  --line: #3a3846;
  --accent: #ff79c9;
  --accent-2: #8be7f5;
  --danger: #ff9f8d;
  --max: 1100px;
  --font-heading: "Bricolage Grotesque", Arial, sans-serif;
  --font-body: "Atkinson Hyperlegible Next", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
}

a {
  color: var(--accent-2);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--text);
}

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

.wrap {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(17, 17, 22, 0.96);
  backdrop-filter: blur(8px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
}

.brand,
h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
}

.brand {
  color: var(--text);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: block;
  padding: 0.55rem 0.7rem;
  border: 1px solid transparent;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  border-color: var(--line);
  color: var(--text);
  background: var(--panel);
}

.menu-toggle {
  display: none;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel);
  font: 600 1rem/1.2 var(--font-body);
  cursor: pointer;
}

.hero {
  padding: 5rem 0 3rem;
}

.breadcrumb,
.eyebrow,
.source-id,
.doc-type,
.component-type {
  margin: 0 0 0.8rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  line-height: 1.4;
  text-transform: uppercase;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

h1,
h2,
h3,
h4 {
  margin-top: 0;
  line-height: 1.08;
}

h1 {
  max-width: 16ch;
  margin-bottom: 1rem;
  font-size: clamp(2.5rem, 6vw, 4.6rem);
  font-weight: 750;
  font-variation-settings: "wdth" 92;
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  font-weight: 700;
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

h4 {
  margin: 1rem 0 0.45rem;
  color: var(--accent);
  font-size: 1rem;
  font-weight: 700;
}

.lede {
  max-width: 78ch;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 1.15rem;
}

main section {
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--line);
}

.grid,
.rules-grid,
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 1rem;
}

.card,
.component-card,
.rule-block,
.identity,
.notice,
.citation {
  border: 1px solid var(--line);
  background: var(--panel);
}

.card,
.component-card,
.rule-block {
  padding: 1.2rem;
}

.component-card,
.rule-block {
  margin: 1rem 0;
}

.card h3,
.rule-block h3 {
  margin-bottom: 0.5rem;
}

.card p,
.card ul,
.component-card p,
.rule-block p,
.rule-block li {
  color: var(--muted);
}

.card p,
.card ul {
  margin-top: 0.25rem;
}

.rule-block {
  max-width: 86ch;
}

.rule-block h3 {
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.95rem;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.rule-block p:last-child,
.rule-block ul:last-child,
.rule-block ol:last-child {
  margin-bottom: 0;
}

.identity,
.notice,
.citation {
  max-width: 82ch;
  padding: 1rem 1.2rem;
}

.identity {
  margin-top: 1.5rem;
}

.identity strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.identity span,
.notice p,
.citation {
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 1.5rem;
}

.button {
  display: inline-block;
  padding: 0.75rem 1rem;
  border: 1px solid var(--accent);
  color: var(--text);
  background: transparent;
  font-weight: 700;
  text-decoration: none;
}

.button:hover {
  color: var(--bg);
  background: var(--accent);
}

.button.secondary {
  border-color: var(--line);
  color: var(--muted);
}

.button.secondary:hover {
  color: var(--text);
  background: var(--panel-2);
}

.links-list,
.option-list {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.plain-list,
.rule-list {
  max-width: 78ch;
  padding-left: 1.2rem;
  color: var(--muted);
}

.plain-list li + li,
.rule-list li + li {
  margin-top: 0.45rem;
}

.small,
.component-id {
  color: var(--muted);
  font-size: 0.95rem;
}

.component-id {
  margin: 0.25rem 0 1rem;
}

.formula,
.reference {
  max-width: 86ch;
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--panel-2);
}

.formula {
  color: var(--text);
  white-space: pre-line;
}

.reference {
  color: var(--muted);
}

.reference p,
.option p {
  margin: 0.25rem 0;
}

.option {
  padding: 0.9rem;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.section-index {
  max-width: 78ch;
  columns: 2;
  column-gap: 2rem;
}

.subtext {
  margin: 0 0 1rem;
  color: var(--text);
  font-style: italic;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}

.tag {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--panel-2);
  font-size: 0.9rem;
}

.penalty {
  color: var(--danger);
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--line);
  background: var(--panel);
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

.component-reference table {
  min-width: 900px;
}

.wide-tables table {
  min-width: 1100px;
}

th,
td {
  padding: 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--accent);
  background: var(--panel-2);
  font-weight: 700;
}

td {
  color: var(--muted);
}

td:first-child {
  color: var(--text);
  font-weight: 700;
}

code {
  padding: 0.1rem 0.3rem;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel-2);
  font-size: 0.9em;
}

.site-footer {
  padding: 2rem 0 4rem;
  border-top: 1px solid var(--line);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 1.5rem;
}

.footer-grid ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-grid li + li {
  margin-top: 0.45rem;
}

@media (max-width: 760px) {
  .topbar {
    flex-wrap: wrap;
    min-height: 4rem;
    padding: 0.7rem 0;
  }

  .menu-toggle {
    display: block;
  }

  .site-nav {
    flex-basis: 100%;
  }

  .site-nav ul {
    display: grid;
    gap: 0.35rem;
    padding: 0.25rem 0 0.45rem;
  }

  .nav-enhanced .site-nav {
    display: none;
  }

  .nav-enhanced .site-nav.is-open {
    display: block;
  }

  .hero {
    padding-top: 3rem;
  }

  .section-index {
    columns: 1;
  }

  table,
  .component-reference table,
  .wide-tables table {
    min-width: 520px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
