:root {
  --bg: #ffffff;
  --paper: #ffffff;
  --ink: #111111;
  --body: #2f3437;
  --muted: #7a7f83;
  --faint: #f6f6f4;
  --line: #e8e6e1;
  --line-strong: #d7d2c8;
  --accent: #a77a35;
  --accent-soft: #f5efe3;
  --code: #151515;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  background: var(--bg);
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration-color: rgba(167, 122, 53, 0.42);
  text-underline-offset: 3px;
}

.shell {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr) 268px;
  min-height: 100vh;
}

.sidebar,
.toc-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 34px 24px;
  background: #ffffff;
}

.sidebar {
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #ffffff;
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: #111111;
  border-radius: 50%;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand h1,
.topbar h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.language-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  margin-bottom: 28px;
  padding: 3px;
  background: var(--faint);
  border: 1px solid var(--line);
}

.language-button {
  padding: 8px 10px;
  color: var(--muted);
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
  font-size: 12px;
  font-weight: 800;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.language-button.active {
  color: #111111;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.doc-menu {
  display: grid;
  gap: 4px;
}

.doc-group-title {
  margin: 22px 0 6px;
  padding: 0 12px;
  color: var(--accent);
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.doc-group-title:first-child {
  margin-top: 0;
}

.doc-link {
  display: block;
  padding: 11px 12px;
  color: #3c4043;
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  text-decoration: none;
  border-left: 2px solid transparent;
}

.doc-link:hover,
.doc-link.active {
  color: #111111;
  background: var(--faint);
  border-left-color: var(--accent);
}

.content {
  min-width: 0;
  padding: 38px clamp(34px, 5vw, 84px) 86px;
}

.topbar {
  display: flex;
  gap: 18px;
  align-items: center;
  max-width: 940px;
  margin: 0 auto 34px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.icon-button {
  display: none;
  padding: 9px 14px;
  color: #ffffff;
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
  font-weight: 700;
  background: #111111;
  border: 0;
  border-radius: 999px;
}

.markdown-body {
  max-width: 940px;
  margin: 0 auto;
  padding: 0 0 40px;
  background: #ffffff;
}

html[lang="en"] body {
  font-family: Georgia, "Times New Roman", serif;
}

html[lang="en"] .doc-link,
html[lang="en"] .toc-link,
html[lang="en"] .eyebrow,
html[lang="en"] .language-button,
html[lang="en"] .markdown-body table {
  font-family: "Avenir Next", "Helvetica Neue", Arial, sans-serif;
}

html[lang="en"] .markdown-body p,
html[lang="en"] .markdown-body li {
  line-height: 1.78;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  color: var(--ink);
  scroll-margin-top: 28px;
  line-height: 1.25;
}

.markdown-body h1 {
  max-width: 860px;
  margin: 0 0 28px;
  font-size: clamp(34px, 5.5vw, 58px);
  font-weight: 800;
  letter-spacing: -0.06em;
}

.markdown-body h2 {
  margin: 58px 0 18px;
  padding-top: 28px;
  font-size: clamp(24px, 3.2vw, 34px);
  font-weight: 760;
  letter-spacing: -0.04em;
  border-top: 1px solid var(--line);
}

.markdown-body h3 {
  margin: 36px 0 14px;
  color: #1d1f20;
  font-size: 22px;
  font-weight: 760;
}

.markdown-body h4 {
  margin: 28px 0 10px;
  font-size: 18px;
  font-weight: 760;
}

.markdown-body p,
.markdown-body li {
  color: var(--body);
  font-size: 17px;
  line-height: 1.9;
}

.markdown-body p {
  margin: 14px 0;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.4em;
}

.markdown-body li::marker {
  color: var(--accent);
}

.markdown-body img {
  display: block;
  max-width: 100%;
  margin: 32px auto;
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  cursor: zoom-in;
}

body.lightbox-open {
  overflow: hidden;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 18px;
  background: rgba(17, 17, 17, 0.88);
}

.image-lightbox.open {
  display: grid;
}

.image-lightbox__toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 14px;
  color: #ffffff;
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
}

.image-lightbox__caption {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-lightbox__actions {
  display: inline-flex;
  flex: none;
  gap: 10px;
  align-items: center;
}

.image-lightbox__origin,
.image-lightbox__close {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 13px;
  color: #ffffff;
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  cursor: pointer;
}

.image-lightbox__close {
  appearance: none;
}

.image-lightbox__origin:hover,
.image-lightbox__close:hover,
.image-lightbox__close:focus {
  background: rgba(255, 255, 255, 0.22);
  outline: none;
}

.image-lightbox__stage {
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: auto;
}

.image-lightbox__image {
  display: block;
  max-width: none;
  width: auto;
  height: auto;
  max-height: none;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.markdown-body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  margin: 26px 0;
  border-collapse: collapse;
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
  font-size: 14px;
}

.markdown-body th,
.markdown-body td {
  padding: 13px 15px;
  border: 1px solid var(--line);
  vertical-align: top;
}

.markdown-body th {
  color: #111111;
  font-weight: 800;
  background: var(--faint);
}

.markdown-body tr:nth-child(even) td {
  background: #fcfcfb;
}

.markdown-body code {
  padding: 2px 6px;
  color: #6e4d19;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
  background: var(--accent-soft);
  border-radius: 4px;
}

.markdown-body pre {
  overflow-x: auto;
  padding: 18px 20px;
  color: #f5f5f5;
  background: var(--code);
}

.markdown-body pre code {
  padding: 0;
  color: inherit;
  background: transparent;
}

.markdown-body blockquote {
  margin: 28px 0;
  padding: 16px 20px;
  color: #3b3b3b;
  background: var(--faint);
  border-left: 3px solid var(--accent);
}

.toc-panel {
  border-left: 1px solid var(--line);
}

.toc-title {
  margin: 2px 0 18px;
  color: var(--accent);
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.toc-link {
  display: block;
  margin: 1px 0;
  padding: 7px 0 7px calc((var(--level) - 1) * 12px);
  color: var(--muted);
  font-family: "Avenir Next", "Noto Sans SC", sans-serif;
  font-size: 13px;
  line-height: 1.42;
  text-decoration: none;
  border-left: 2px solid transparent;
}

.toc-link:hover {
  color: #111111;
  border-left-color: var(--accent);
}

.empty-state {
  color: var(--muted);
}

body.menu-open .sidebar {
  transform: translateX(0);
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 246px minmax(0, 1fr);
  }

  .toc-panel {
    display: none;
  }
}

@media (max-width: 760px) {
  .shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 20;
    width: min(86vw, 330px);
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
  }

  .icon-button {
    display: inline-flex;
  }

  .content {
    padding: 22px 18px 48px;
  }

  .topbar {
    align-items: flex-start;
    margin-bottom: 24px;
  }

  .markdown-body h1 {
    font-size: 34px;
  }

  .markdown-body p,
  .markdown-body li {
    font-size: 16px;
  }
}
