:root {
  --bg: #0a1018;
  --surface: #121b27;
  --surface-2: #182535;
  --text: #e6edf5;
  --muted: #b5c1d1;
  --line: #2a3a4f;
  --accent: #6ca5ff;
  --accent-soft: rgba(108, 165, 255, 0.18);
  --max-width: 1120px;
  --radius: 14px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.55;
  color: var(--text);
  background: radial-gradient(circle at 15% 5%, #13233a 0%, var(--bg) 48%);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  background: #fff;
  color: #111;
  padding: 0.5rem 0.75rem;
  border-radius: 0.4rem;
}

.container {
  width: min(100% - 2rem, var(--max-width));
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(10, 16, 24, 0.88);
  backdrop-filter: blur(8px);
}

.header-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 2rem;
  align-items: center;
  padding: 2.4rem 0;
}

.kicker {
  margin: 0 0 0.4rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 2.7vw, 2.7rem);
  line-height: 1.2;
}

.lead {
  margin: 1rem 0 0;
  color: var(--muted);
  max-width: 67ch;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
}

.nav-list a {
  display: inline-block;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0.52rem 0.8rem;
  border-radius: 999px;
  font-size: 0.95rem;
}

.nav-list a:hover,
.nav-list a:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.section {
  padding: 3.1rem 0;
}

.section h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
}

.cards {
  margin-top: 1.2rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1rem 0.9rem;
}

.card h3 {
  margin-top: 0;
  font-size: 1.05rem;
}

.card p,
.section p {
  color: var(--muted);
}

.term-link {
  color: #cfe0ff;
  text-decoration: underline;
  text-decoration-color: rgba(108, 165, 255, 0.55);
  text-underline-offset: 0.16rem;
}

.term-link:hover,
.term-link:focus-visible {
  color: var(--accent);
}

.toc {
  margin-top: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem;
}

.toc h3 {
  margin-top: 0;
}

.toc ol {
  margin: 0;
  padding-left: 1.1rem;
  columns: 2;
  gap: 1.8rem;
}

.toc a {
  color: var(--text);
  text-decoration: none;
}

.toc a:hover,
.toc a:focus-visible {
  color: var(--accent);
}

.matrix-wrap {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: auto;
}

.matrix {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.matrix th,
.matrix td {
  padding: 0.75rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  color: var(--muted);
}

.matrix th {
  color: #dbe8ff;
  font-weight: 600;
  background: rgba(108, 165, 255, 0.08);
}

.matrix tbody tr:last-child td {
  border-bottom: 0;
}

.glossary {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.glossary-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem;
  background: rgba(18, 27, 39, 0.85);
}

.glossary-item h3 {
  margin: 0 0 0.4rem;
  color: #d8e6ff;
  font-size: 1rem;
}

.glossary-item p {
  margin: 0;
  color: var(--muted);
}

.glossary-item .example {
  margin-top: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--line);
  color: #c9d6e7;
}

.glossary-item .example strong {
  color: #dbe8ff;
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding: 1rem 0 1.3rem;
}

.footer-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

@media (max-width: 960px) {
  .header-grid {
    grid-template-columns: 1fr;
  }

  .nav-list {
    justify-content: flex-start;
  }

  .cards,
  .glossary {
    grid-template-columns: 1fr;
  }

  .toc ol {
    columns: 1;
  }
}

@media (max-width: 520px) {
  body {
    line-height: 1.5;
  }

  .section {
    padding: 2.2rem 0;
  }

  .nav-list a {
    width: 100%;
    text-align: center;
  }
}
