:root {
  --ink: #111111;
  --muted: #666666;
  --faint: #8a8a8a;
  --line: #111111;
  --soft-line: #d9d9d9;
  --paper: #ffffff;
  --wash: #f6f6f4;
  --shell: 1180px;
  --sans: "Noto Sans SC", "Source Han Sans SC", "PingFang SC",
    "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", "Consolas", "Liberation Mono",
    monospace;
}

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

html {
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  flex: 1;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

a {
  color: inherit;
  text-decoration: none;
}

p,
h1,
h2,
h3,
h4,
h5,
h6,
ul,
ol,
blockquote,
pre,
table {
  margin-top: 0;
}

img {
  max-width: 100%;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

.shell {
  width: min(100% - 64px, var(--shell));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  border: 1px solid var(--ink);
  background: var(--paper);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* Top bar ---------------------------------------------------------------- */

.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.topbar-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-mark {
  width: 9px;
  height: 9px;
  display: inline-block;
  background: var(--ink);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.topnav a {
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
}

.topnav a:hover {
  border-bottom-color: var(--ink);
}

.topnav-repo span {
  font-size: 0.9em;
}

/* Home ------------------------------------------------------------------- */

.hero {
  padding-top: 64px;
  padding-bottom: 72px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(64px, 18vw, 220px);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -0.065em;
}

.index-block {
  padding-bottom: 104px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.index-list,
.page-list {
  border-bottom: 1px solid var(--line);
}

.index-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 20px;
  min-height: 104px;
  padding: 22px 20px;
  border-top: 1px solid var(--line);
  transition: background-color 120ms linear, color 120ms linear;
}

.index-list .index-row:first-child {
  border-top: 0;
}

.index-row:hover,
.index-row:focus-visible {
  background: var(--ink);
  color: var(--paper);
}

.index-number,
.page-number {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.index-row:hover .index-number,
.page-row:hover .page-number {
  color: #d4d4d4;
}

.index-title {
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.index-arrow,
.page-arrow {
  justify-self: end;
  font-size: 24px;
  line-height: 1;
  transition: transform 120ms linear;
}

.index-row:hover .index-arrow,
.page-row:hover .page-arrow {
  transform: translateX(5px);
}

/* Inner pages ------------------------------------------------------------ */

.page-shell {
  padding-top: 30px;
  padding-bottom: 96px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.breadcrumb a {
  border-bottom: 1px solid transparent;
}

.breadcrumb a:hover {
  border-bottom-color: var(--ink);
  color: var(--ink);
}

.breadcrumb span[aria-current="page"] {
  color: var(--ink);
}

.page-hero {
  max-width: 960px;
  padding: 44px 0 36px;
  border-bottom: 1px solid var(--line);
}

.page-hero h1 {
  margin: 0;
  font-size: clamp(58px, 9vw, 112px);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.065em;
}

.article {
  max-width: 760px;
  padding: 46px 0 36px;
}

.article > :first-child {
  margin-top: 0;
}

.article h1,
.article h2,
.article h3,
.article h4,
.article h5,
.article h6 {
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

.article h1 {
  margin: 46px 0 18px;
  font-size: 38px;
}

.article h2 {
  margin: 52px 0 18px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
  font-size: 30px;
}

.article h3 {
  margin: 36px 0 12px;
  font-size: 22px;
}

.article h4 {
  margin: 30px 0 10px;
  font-size: 18px;
}

.article p {
  margin-bottom: 22px;
}

.article a {
  border-bottom: 1px solid var(--ink);
}

.article a:hover {
  background: var(--ink);
  color: var(--paper);
}

.article strong {
  font-weight: 800;
}

.article ul,
.article ol {
  margin: 0 0 24px;
  padding-left: 1.45em;
}

.article li {
  margin: 5px 0;
  padding-left: 4px;
}

.article li::marker {
  color: var(--ink);
}

.article li > ul,
.article li > ol {
  margin-top: 6px;
  margin-bottom: 8px;
}

.article blockquote {
  margin: 32px 0;
  padding: 20px 24px;
  border: 1px solid var(--line);
}

.article blockquote > :last-child {
  margin-bottom: 0;
}

.article hr {
  margin: 46px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.article code {
  padding: 2px 5px;
  border: 1px solid var(--soft-line);
  background: var(--wash);
  font-family: var(--mono);
  font-size: 0.88em;
}

.article pre {
  margin: 26px 0;
  padding: 18px 20px;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--wash);
  font-size: 14px;
  line-height: 1.65;
}

.article pre code {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: inherit;
}

.article img {
  display: block;
  width: auto;
  max-width: 100%;
  margin: 30px 0;
  border: 1px solid var(--line);
}

.article figure {
  margin: 30px 0;
}

.article figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

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

.article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.6;
}

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

.article th:last-child,
.article td:last-child {
  border-right: 0;
}

.article th:first-child,
.article td:first-child {
  min-width: 6em;
}

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

.article th {
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
}

.article .align-center {
  text-align: center;
}

.article .align-right {
  text-align: right;
}

/* Section page: child pages --------------------------------------------- */

.child-index {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.child-index--flush {
  margin-top: 32px;
  padding-top: 0;
  border-top: 0;
}

.page-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 18px;
  min-height: 84px;
  padding: 18px 16px;
  border-top: 1px solid var(--line);
  transition: background-color 120ms linear, color 120ms linear;
}

.page-list .page-row:first-child {
  border-top: 0;
}

.page-row:hover,
.page-row:focus-visible {
  background: var(--ink);
  color: var(--paper);
}

.page-title {
  font-size: 24px;
  font-weight: 750;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.empty-note {
  margin: 0;
  padding: 28px 16px;
  color: var(--muted);
  font-size: 14px;
}

.back-nav {
  padding-top: 36px;
  font-size: 13px;
}

.back-nav a {
  border-bottom: 1px solid var(--ink);
}

/* Page pager ------------------------------------------------------------- */

.page-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.pager-link {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 22px 24px;
  transition: background-color 120ms linear, color 120ms linear;
}

.pager-link + .pager-link {
  border-left: 1px solid var(--line);
}

.pager-link:hover,
.pager-link:focus-visible {
  background: var(--ink);
  color: var(--paper);
}

.pager-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.pager-link:hover .pager-label {
  color: #d4d4d4;
}

.pager-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
}

.pager-next {
  text-align: right;
  align-items: flex-end;
}

/* Footer ----------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
}

.footer-inner {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.footer-inner p {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.footer-inner strong {
  font-size: 13px;
  letter-spacing: 0.08em;
}

.footer-inner a {
  color: var(--muted);
  font-size: 11px;
  border-bottom: 1px solid transparent;
}

.footer-inner a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* Responsive ------------------------------------------------------------- */

@media (max-width: 760px) {
  body {
    font-size: 16px;
  }

  .shell {
    width: min(100% - 40px, var(--shell));
  }

  .topbar-inner {
    min-height: 58px;
  }

  .topnav {
    gap: 16px;
  }

  .hero {
    padding-top: 48px;
    padding-bottom: 56px;
  }

  .index-block {
    padding-bottom: 72px;
  }

  .index-row {
    grid-template-columns: 40px minmax(0, 1fr) 24px;
    gap: 12px;
    min-height: 92px;
    padding: 20px 4px;
  }

  .index-title {
    font-size: 27px;
  }

  .index-arrow,
  .page-arrow {
    font-size: 19px;
  }

  .page-shell {
    padding-top: 24px;
    padding-bottom: 68px;
  }

  .page-hero {
    padding: 34px 0 30px;
  }

  .page-hero h1 {
    font-size: clamp(50px, 14vw, 74px);
  }

  .article {
    padding: 36px 0 28px;
  }

  .article h2 {
    margin-top: 42px;
    font-size: 26px;
  }

  .article h3 {
    font-size: 20px;
  }

  .page-row {
    grid-template-columns: 38px minmax(0, 1fr) 24px;
    gap: 10px;
    min-height: 78px;
    padding: 18px 4px;
  }

  .page-title {
    font-size: 21px;
  }

  .page-pager {
    grid-template-columns: 1fr;
  }

  .pager-link {
    min-height: 96px;
    padding: 20px 16px;
  }

  .pager-link + .pager-link {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .pager-next {
    text-align: left;
    align-items: flex-start;
  }

  .footer-inner {
    min-height: 110px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 10px;
  }
}

@media (max-width: 420px) {
  .shell {
    width: min(100% - 32px, var(--shell));
  }

  .brand {
    font-size: 14px;
  }

  .topnav {
    gap: 12px;
    font-size: 11px;
  }

  .section-heading h2 {
    letter-spacing: 0.12em;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .topbar,
  .site-footer,
  .page-pager,
  .back-nav,
  .skip-link {
    display: none;
  }

  body {
    font-size: 12pt;
  }

  .page-shell {
    padding: 0;
  }

  .article a {
    border-bottom: 0;
  }
}
