/* Docklet 官网共享样式：顶栏、底栏、容器与基础变量 */
:root {
  --drawer-w: min(78vw, 300px);
  --bg: #f7f6f3;
  --paper: #fffefb;
  --ink: #33261c;
  --ink-soft: #6f6255;
  --muted: #6f6255;
  --ink-faint: #9b8f80;
  --faint: #9b8f80;
  --line: #ece7df;
  --sun: #eeae3c;
  --sun-soft: #fbeecf;
  --mint: #3f8f74;
  --mint-soft: #e4f0e9;
}

* { box-sizing: border-box; }

html {
  scrollbar-gutter: stable;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
}

a { color: inherit; }

.wrap {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
}

header.site {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background: rgb(247 246 243 / 78%);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 9px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.brand-text b {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.1;
}

.brand-text span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
}

.nav nav {
  display: flex;
  gap: 22px;
  font-size: 13.5px;
  font-weight: 600;
}

.nav nav a,
.nav .links a {
  position: relative;
  padding-bottom: 4px;
  color: var(--ink-soft);
  text-decoration: none;
}

.nav nav a:hover,
.nav .links a:hover {
  color: var(--ink);
}

/* 当前页：不加粗、不变色，只在下方画一条黑线；padding 常驻，避免跳动 */
.nav nav a.on,
.nav .links a.on {
  color: var(--ink-soft);
}

.nav nav a.on::after,
.nav .links a.on::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
}

footer {
  margin-top: auto;
  padding: 30px 0 40px;
  font-size: 12.5px;
  color: var(--ink-faint);
  text-align: center;
  border-top: 1px solid var(--line);
}

/* 移动端导航：小屏折叠为汉堡 + 右侧抽屉 */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

body.nav-open .nav-toggle span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

body.nav-open .nav-toggle span:nth-child(2) {
  opacity: 0;
}

body.nav-open .nav-toggle span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.nav-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgb(30 22 14 / 32%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.nav-drawer {
  position: fixed;
  top: 68px;
  left: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: var(--drawer-w);
  padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
  background: #f0ebe3;
  border-right: 1px solid var(--line);
  transform: translateX(-100%);
  transition: transform 0.22s ease;
}

.nav-open .nav-scrim {
  opacity: 1;
  pointer-events: auto;
}

.nav-open .nav-drawer {
  transform: none;
}

body.nav-open {
  overflow: hidden;
}

.nav-drawer-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-faint);
}

.nav-drawer-title button {
  width: 34px;
  height: 34px;
  font-size: 18px;
  color: var(--ink-soft);
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.nav-drawer a {
  padding: 13px 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.nav-drawer a.on {
  color: var(--ink);
}

@media (max-width: 760px) {
  .nav nav,
  .nav .links {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }
}


/* 推挤式菜单：正文右移，顶栏不动，不用遮罩 */
@media (max-width: 760px) {
  main,
  footer {
    transition: transform 0.22s ease;
  }

  body.nav-open main,
  body.nav-open footer {
    transform: translateX(var(--drawer-w));
  }

  body.nav-open {
    overflow-x: hidden;
  }

  .nav-scrim {
    display: none;
  }
}


.nav-drawer-label {
  margin: 18px 6px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
}

/* 文档目录：当前小节显示下划线 */
.toc a.on {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}
