:root {
  color-scheme: light dark;
  --primary: #7492e3;
  --primary-strong: #4f6cc4;
  --primary-050: #ebeef5;
  --primary-100: #d5def6;
  --surface: #ffffff;
  --background: #f3f5f9;
  --border: #e3e7f0;
  --text: #181818;
  --text-body: #2f3136;
  --text-muted: #595959;
  --text-subtle: #7a7a7a;
  --placeholder-bg: #fff1c7;
  --placeholder-text: #6b4a00;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #93aaf0;
    --primary-strong: #b3c4f5;
    --primary-050: #1d2335;
    --primary-100: #2a3450;
    --surface: #161a22;
    --background: #0e1117;
    --border: #262c38;
    --text: #eef0f4;
    --text-body: #d3d7df;
    --text-muted: #a9afbc;
    --text-subtle: #858b98;
    --placeholder-bg: #3d3110;
    --placeholder-text: #f5d57e;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text-body);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
    Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

a {
  color: var(--primary-strong);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* Header */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--background) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.wordmark {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--primary);
  text-decoration: none;
}

.lang-switch {
  display: flex;
  gap: 4px;
  font-size: 14px;
  line-height: 20px;
}

.lang-switch a,
.lang-switch span {
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text-muted);
}

.lang-switch span {
  background: var(--primary-050);
  color: var(--text);
  font-weight: 600;
}

/* Document */

.doc {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.doc__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 44px 48px 52px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-strong);
}

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 40px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  text-wrap: balance;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.meta li {
  margin: 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--primary-050);
  font-size: 13px;
  line-height: 20px;
  color: var(--text-muted);
}

.intro {
  margin: 24px 0 0;
  font-size: 17px;
  color: var(--text-body);
}

.summary {
  margin: 28px 0 0;
  padding: 20px 24px;
  border-radius: 16px;
  background: var(--primary-050);
}

.summary h2 {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 24px;
}

.summary ul {
  margin: 0;
  padding-left: 20px;
}

.summary li {
  margin: 4px 0;
  font-size: 15px;
  line-height: 1.6;
}

.toc {
  margin: 32px 0 0;
  padding: 24px 0 0;
  border-top: 1px solid var(--border);
}

.toc h2 {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.toc ol {
  margin: 0;
  padding-left: 22px;
  columns: 2;
  column-gap: 40px;
}

.toc li {
  margin: 2px 0;
  font-size: 14px;
  line-height: 1.6;
  break-inside: avoid;
}

.toc a {
  color: var(--text-body);
  text-decoration: none;
}

.toc a:hover {
  color: var(--primary-strong);
  text-decoration: underline;
}

section {
  margin-top: 40px;
  scroll-margin-top: 72px;
}

h2 {
  margin: 0 0 12px;
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  color: var(--text);
}

h3 {
  margin: 24px 0 8px;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  color: var(--text);
}

p {
  margin: 12px 0 0;
}

h2 + p,
h3 + p {
  margin-top: 0;
}

ul,
ol {
  margin: 12px 0 0;
  padding-left: 22px;
}

li {
  margin: 6px 0;
}

strong {
  color: var(--text);
  font-weight: 600;
}

.callout {
  margin: 16px 0 0;
  padding: 14px 18px;
  border-left: 3px solid var(--primary);
  border-radius: 0 12px 12px 0;
  background: var(--primary-050);
}

.callout p:first-child {
  margin-top: 0;
}

.table-wrap {
  margin: 16px 0 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.55;
}

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

th {
  background: var(--primary-050);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

tbody th {
  white-space: normal;
  width: 28%;
}

tr:last-child td,
tr:last-child th {
  border-bottom: 0;
}

.placeholder {
  padding: 0 4px;
  border-radius: 4px;
  background: var(--placeholder-bg);
  color: var(--placeholder-text);
  font-weight: 500;
}

/* Footer */

.site-footer {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px 48px;
  font-size: 13px;
  line-height: 20px;
  color: var(--text-subtle);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-bottom: 12px;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--primary-strong);
  text-decoration: underline;
}

.site-footer p {
  margin: 0;
}

/* Index */

.doc-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.doc-group {
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.doc-group h3 {
  margin: 0 0 8px;
}

.doc-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.doc-group li {
  margin: 8px 0 0;
}

.doc-group a {
  font-weight: 500;
}

.doc-group small {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-subtle);
}

@media (max-width: 640px) {
  .doc {
    padding: 16px 16px 40px;
  }

  .doc__card {
    padding: 28px 20px 36px;
    border-radius: 18px;
  }

  h1 {
    font-size: 26px;
    line-height: 34px;
  }

  .toc ol {
    columns: 1;
  }

  th,
  td {
    padding: 10px;
    -webkit-hyphens: auto;
    hyphens: auto;
    overflow-wrap: break-word;
  }

  th {
    white-space: normal;
  }

  .stack thead {
    display: none;
  }

  .stack,
  .stack tbody,
  .stack tr,
  .stack td {
    display: block;
    width: 100%;
  }

  .stack tr {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
  }

  .stack tr:last-child {
    border-bottom: 0;
  }

  .stack td {
    padding: 0;
    border: 0;
    -webkit-hyphens: manual;
    hyphens: manual;
  }

  .stack td + td {
    margin-top: 8px;
  }

  .stack td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-subtle);
  }

  .doc-groups {
    grid-template-columns: 1fr;
  }

  .site-footer {
    padding: 0 16px 40px;
  }
}

@media print {
  .topbar,
  .toc,
  .site-footer nav {
    display: none;
  }

  body {
    background: #ffffff;
    color: #000000;
  }

  .doc,
  .doc__card {
    padding: 0;
    border: 0;
  }

  section {
    break-inside: avoid-page;
  }
}
