:root {
  --bg: #0b0f17;
  --fg: #e6ecf3;
  --muted: #8a97a8;
  --accent: #6ea8ff;
  --card: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --code-bg: rgba(255, 255, 255, 0.03);
  --maxw: 720px;
}

* {
  box-sizing: border-box;
}

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

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

/* --- progress bar --- */

#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 10;
  transition: width 90ms linear;
}

/* --- layout --- */

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 22px 0;
  margin-bottom: 56px;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-right: auto;
}

.brand img {
  width: 20px;
  height: 20px;
  display: block;
}

.brand span {
  font-size: 16px;
}

.nav {
  display: flex;
  gap: 18px;
  font-size: 15px;
}

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

.nav a:hover,
.nav a.is-current {
  color: var(--fg);
}

main {
  padding-bottom: 72px;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 44px;
  color: var(--muted);
  font-size: 14px;
}

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

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

/* --- typography --- */

h1,
h2,
h3 {
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 650;
}

h1 {
  font-size: 30px;
  margin: 0 0 14px;
}

h2 {
  font-size: 21px;
  margin: 44px 0 12px;
}

h3 {
  font-size: 17px;
  margin: 30px 0 8px;
}

p {
  margin: 0 0 18px;
}

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

a:hover {
  text-decoration: underline;
}

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

li {
  margin-bottom: 7px;
}

.lede {
  font-size: 19px;
  color: var(--muted);
  margin-bottom: 32px;
}

.meta {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 30px;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 44px 0;
}

blockquote {
  margin: 24px 0;
  padding: 2px 0 2px 18px;
  border-left: 2px solid var(--border);
  color: var(--muted);
}

/* --- home list --- */

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-weight: 600;
  margin: 56px 0 18px;
}

.note-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.note-list li {
  margin: 0;
  border-top: 1px solid var(--border);
}

.note-list li:last-child {
  border-bottom: 1px solid var(--border);
}

.note-link {
  display: block;
  padding: 20px 0;
  color: inherit;
}

.note-link:hover {
  text-decoration: none;
}

.note-link:hover .note-title {
  color: var(--accent);
}

.note-date {
  display: block;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: 5px;
}

.note-title {
  display: block;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 5px;
}

.note-desc {
  display: block;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

/* --- cards --- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  margin: 0 0 16px;
}

.card h3 {
  margin-top: 0;
}

.card p:last-child {
  margin-bottom: 0;
}

.facts {
  list-style: none;
  padding: 0;
  margin: 0;
}

.facts li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}

.facts li:last-child {
  border-bottom: 0;
}

.facts .k {
  color: var(--muted);
}

.facts .v {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --- code --- */

pre,
code,
kbd {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

code {
  font-size: 0.87em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

.code-block {
  margin: 0 0 22px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--code-bg);
  overflow: hidden;
}

.code-block pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.55;
}

.code-block pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
}

.code-toggle {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  padding: 9px 18px;
  cursor: pointer;
}

.code-toggle:hover {
  color: var(--accent);
}

.code-block.is-collapsed pre {
  max-height: 148px;
  overflow: hidden;
}

/* --- toc --- */

.toc {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 0 0 34px;
}

.toc-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 9px;
}

.toc ol {
  margin: 0;
  padding-left: 20px;
  font-size: 15px;
}

.toc li {
  margin-bottom: 4px;
}

.toc a {
  color: var(--fg);
}

.toc a:hover {
  color: var(--accent);
}

/* --- figures --- */

figure {
  margin: 30px 0;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
}

figcaption {
  color: var(--muted);
  font-size: 14px;
  margin-top: 10px;
  line-height: 1.5;
}

/* --- tables --- */

.table-scroll {
  overflow-x: auto;
  margin: 0 0 22px;
}

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

th,
td {
  text-align: left;
  padding: 9px 14px 9px 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

td.num {
  font-variant-numeric: tabular-nums;
}

/* --- misc --- */

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 28px;
}

.tag {
  font-size: 12.5px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
}

.next-prev {
  border-top: 1px solid var(--border);
  padding-top: 22px;
  margin-top: 48px;
  font-size: 15px;
}

.big-404 {
  font-size: 64px;
  font-weight: 650;
  letter-spacing: -0.03em;
  margin: 40px 0 8px;
  color: var(--accent);
}

@media (max-width: 620px) {
  body {
    font-size: 16px;
  }
  .wrap {
    padding: 0 18px;
  }
  h1 {
    font-size: 25px;
  }
  h2 {
    font-size: 19px;
  }
  .site-header {
    margin-bottom: 38px;
  }
  .lede {
    font-size: 17px;
  }
  .facts li {
    flex-direction: column;
    gap: 2px;
  }
  .facts .v {
    text-align: left;
  }
}
