@font-face {
  font-family: "Inter";
  src: url("../inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --amber: #f0a33c;
  --rose: #e0496e;
  --background: #fdfbf8;
  --surface: #f5f1eb;
  --text: #24242a;
  --text-muted: #5f5f6a;
  --border: rgb(0 0 0 / 0.1);
  --link: #b4314f;
  --header: rgb(253 251 248 / 0.82);
  --code-comment: #6c6c78;
  --code-keyword: #a8326b;
  --code-type: #0f766e;
  --code-literal: #a8481f;
  --code-preprocessor: #5b4fb5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #121114;
    --surface: #1d1c21;
    --text: #e9e7ea;
    --text-muted: #a8a5ae;
    --border: rgb(255 255 255 / 0.12);
    --link: #ff9fb2;
    --header: rgb(18 17 20 / 0.82);
    --code-comment: #94929c;
    --code-keyword: #ff9ac6;
    --code-type: #6fd8cd;
    --code-literal: #f7bd7e;
    --code-preprocessor: #b8aeff;
  }
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

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

/* The bar at the top of each page. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--border);
  background: var(--header);
  backdrop-filter: blur(14px);
}

.site-header > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  max-width: 76rem;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
}

.site-title {
  overflow: hidden;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-header ul {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-header li a {
  display: block;
  padding: 0.25rem 0.75rem;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 550;
  text-decoration: none;
}

.site-header li a:hover,
.site-header li a[aria-current] {
  background: var(--surface);
  color: var(--text);
}

/* The sidebar and the text of a chapter. */
.layout {
  display: grid;
  grid-template-columns: 19rem minmax(0, 44rem);
  gap: 4rem;
  justify-content: center;
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.layout.single {
  display: block;
  max-width: 47rem;
}

.sidebar {
  position: sticky;
  top: 3.5rem;
  align-self: start;
  max-height: calc(100vh - 3.5rem);
  overflow-y: auto;
  padding: 2rem 0.5rem 2rem 0;
  font-size: 0.875rem;
  line-height: 1.4;
}

.sidebar details {
  margin-bottom: 0.25rem;
}

.sidebar summary {
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
}

.sidebar summary:hover {
  background: var(--surface);
}

.sidebar ul {
  margin: 0;
  padding: 0 0 0 0.75rem;
  list-style: none;
}

.sidebar li {
  margin: 0;
}

.sidebar > a {
  font-weight: 600;
}

.sidebar a {
  display: block;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
}

.sidebar a:hover {
  background: var(--surface);
  color: var(--text);
}

.sidebar a[aria-current] {
  background: var(--surface);
  color: var(--link);
  font-weight: 600;
}

.content {
  min-width: 0;
  padding: 2.5rem 0 3rem;
}

.breadcrumbs {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.breadcrumbs a {
  color: inherit;
}

.breadcrumbs span {
  margin: 0 0.375rem;
}

h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(2rem, 5vw, 2.75rem);
  letter-spacing: -0.03em;
}

h2 {
  margin: 2.5rem 0 0.75rem;
  font-size: 1.5rem;
}

h3, h4 {
  margin: 2rem 0 0.5rem;
  font-size: 1.1875rem;
}

p, ul, ol, dl {
  margin: 0 0 1.125rem;
}

li {
  margin-bottom: 0.375rem;
}

li > p:last-child {
  margin-bottom: 0;
}

blockquote {
  margin: 1.5rem 0;
  padding-left: 1.25rem;
  border-left: 3px solid var(--amber);
  color: var(--text-muted);
}

.note {
  margin-bottom: 2rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

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

code, pre {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

code {
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

figure {
  margin: 2rem 0;
}

figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
}

figcaption {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.5;
  text-align: center;
}

.listing figcaption {
  margin: 0 0 0.5rem;
  text-align: left;
}

.highlight {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.highlight pre {
  width: max-content;
  min-width: 100%;
  margin: 0;
  padding: 1rem 1.25rem;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.highlight .c, .highlight .c1 {
  color: var(--code-comment);
  font-style: italic;
}

.highlight .k, .highlight .kd, .highlight .ow {
  color: var(--code-keyword);
  font-weight: 600;
}

.highlight .kt, .highlight .nc, .highlight .nb {
  color: var(--code-type);
}

.highlight .mi, .highlight .s, .highlight .se {
  color: var(--code-literal);
}

.highlight .cp {
  color: var(--code-preprocessor);
}

.highlight .nf, .highlight .na {
  font-weight: 600;
}

.bibliography {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0 0.75rem;
}

.bibliography dt {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.bibliography dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.section-list {
  margin-top: 2rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
}

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

.section-list ul ul {
  padding-left: 1rem;
}

#footnotes {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

#footnotes h2 {
  margin-top: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

/* The links to the previous and the next page. */
.pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 3rem;
}

.pager a {
  padding: 0.875rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
  transition: border-color 0.2s ease;
}

.pager a:hover {
  border-color: var(--rose);
}

.pager span {
  display: block;
  margin-bottom: 0.125rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
}

.pager .next {
  grid-column: 2;
  text-align: right;
}

/* The introduction of the About page and the entries of the Download page. */
.hero {
  padding: 3.5rem 0 1rem;
}

.hero h1 {
  margin-bottom: 1rem;
  font-size: clamp(2.5rem, 7vw, 4rem);
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.hero em {
  padding-bottom: 0.2em;
  background: linear-gradient(95deg, var(--amber), var(--rose));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-style: normal;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1875rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.button {
  padding: 0.5rem 1.125rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  border-color: var(--rose);
}

.button.primary {
  border-color: transparent;
  background: linear-gradient(95deg, #c9601a, #c42a55);
  color: #ffffff;
}

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

.downloads li {
  margin-bottom: 1rem;
}

.downloads a {
  display: block;
  padding: 1.125rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.downloads a:hover {
  border-color: var(--rose);
}

.downloads span {
  display: block;
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 400;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

@media (max-width: 960px) {
  .layout {
    display: block;
    max-width: 47rem;
  }

  .sidebar {
    display: none;
  }
}

@media (max-width: 560px) {
  .site-header > div {
    padding: 0.625rem 1rem;
  }

  .site-title {
    display: none;
  }

  .layout {
    padding: 0 1rem;
  }
}

@media print {
  .site-header, .sidebar, .pager, .site-footer {
    display: none;
  }

  .layout {
    display: block;
  }
}
