:root {
  --bg: #ffffff;
  --fg: #15181e;
  --muted: #5c6674;
  --line: #e4e8ef;
  --card: #f7f8fb;
  --accent: #2f63f0;
  --accent-soft: #ebf0ff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1015;
    --fg: #e7ecf3;
    --muted: #98a2b3;
    --line: #212836;
    --card: #141a23;
    --accent: #7ba1ff;
    --accent-soft: #17202f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -16px rgba(0, 0, 0, .8);
  }
}

* { box-sizing: border-box; }

html {
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16.5px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 22px;
}

/* header */
.top {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  z-index: 10;
}

.top__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}

.brand {
  font-weight: 650;
  letter-spacing: -.01em;
  color: var(--fg);
  text-decoration: none;
}

.lang a {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
  transition: border-color .15s, color .15s;
}

.lang a:hover { color: var(--fg); border-color: var(--accent); }

/* main */
main { padding: 44px 0 24px; }

h1 {
  font-size: clamp(1.7rem, 4.6vw, 2.35rem);
  line-height: 1.2;
  letter-spacing: -.022em;
  margin: 0 0 12px;
  font-weight: 680;
}

.meta {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.meta span::after { content: "·"; margin-left: 10px; color: var(--line); }
.meta span:last-child::after { content: ""; }

h2 {
  font-size: 1.22rem;
  letter-spacing: -.015em;
  margin: 44px 0 12px;
  scroll-margin-top: 76px;
  font-weight: 650;
}

h3 {
  font-size: 1rem;
  margin: 22px 0 8px;
  font-weight: 650;
}

p { margin: 0 0 14px; }

ul, ol { margin: 0 0 16px; padding-left: 22px; }
li { margin: 6px 0; }
li::marker { color: var(--muted); }

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

strong { font-weight: 640; }

/* toc */
.toc {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 22px;
  margin: 0 0 8px;
}

.toc__title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 600;
}

.toc ol {
  margin: 0;
  padding-left: 20px;
  columns: 2;
  column-gap: 28px;
  font-size: 14.5px;
}

.toc li { margin: 3px 0; break-inside: avoid; }
.toc a { color: var(--fg); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }

@media (max-width: 620px) {
  .toc ol { columns: 1; }
}

/* callouts */
.note {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 10px 10px 0;
  padding: 12px 16px;
  margin: 18px 0;
  font-size: 15px;
}

.note p:last-child { margin: 0; }

/* table */
.table-wrap { overflow-x: auto; margin: 0 0 18px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  min-width: 460px;
}

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

th {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}

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

/* contact card */
.contact {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 22px;
  margin: 18px 0 0;
  box-shadow: var(--shadow);
}

.contact p { margin: 0 0 6px; }
.contact p:last-child { margin: 0; }
.contact .label { color: var(--muted); font-size: 13px; }

/* footer */
footer {
  border-top: 1px solid var(--line);
  margin-top: 56px;
  padding: 24px 0 48px;
  color: var(--muted);
  font-size: 14px;
}

footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }

@media print {
  .top, .toc, footer .lang { display: none; }
  body { font-size: 11pt; }
  a { color: inherit; }
  main { padding-top: 0; }
}
