/* ==================== Code Blocks（命令行专治版） ==================== */
/* 代码块：只在块内横向滚动，绝不把页面撑宽 */
.doc { max-width: 980px; margin: 0 auto; }
.doc .meta { display:flex; gap:10px; align-items:center; color:#666; font-size:13px; margin:6px 0 18px; }

.doc .hero{
  background:#fff; border-radius:12px; box-shadow:0 4px 18px rgba(0,0,0,.08);
  padding:28px; margin-bottom:18px; position:relative; overflow:hidden;
}
.doc .hero h1{ font-size:30px; font-weight:700; letter-spacing:.2px; margin-bottom:6px; }
.doc .hero p{ color:#555; }

.doc .body{
  background:#fff; border-radius:12px; box-shadow:0 4px 18px rgba(0,0,0,.08);
  padding:28px; margin-bottom:40px;
}

.doc-wrap{ display:grid; grid-template-columns:1fr 260px; gap:20px; }
@media (max-width:1024px){ .doc-wrap{ grid-template-columns:1fr; } }

.toc{
  position:sticky; top:calc(var(--header-height) + 12px);
  height:fit-content; background:#fff; border:1px solid #e5e7eb; border-radius:12px;
  box-shadow:0 4px 18px rgba(0,0,0,.06); padding:16px;
}
.toc h4{ font-size:13px; color:#333; margin-bottom:8px; }
.toc ul{ list-style:none; padding-left:0; }
.toc li{ margin:6px 0; }
.toc a{ color:#333; text-decoration:none; font-size:14px; }
.toc a.active{ font-weight:600; }
@media (max-width:1024px){ .toc{ position:static; margin-top:-10px; } }

.doc .body h2{ font-size:24px; margin:26px 0 10px; font-weight:700; }
.doc .body h3{ font-size:18px; margin:18px 0 8px; font-weight:600; color:#333; }
.doc .body p, .doc .body li{ color:#444; line-height:1.75; }
.doc .body ul{ padding-left:18px; }
.doc .body a{ color:#0b57d0; text-decoration:none; }
.doc .body a:hover{ text-decoration:underline; }

.step{
  border-left:3px solid #22c55e; background:#f9fff9; padding:12px 14px; border-radius:8px; margin:12px 0;
}
.step .num{
  display:inline-flex; width:22px; height:22px; border-radius:6px; border:1px solid #c8f3d3;
  align-items:center; justify-content:center; font-size:13px; margin-right:8px; background:#fff;
}

.call{ padding:12px 14px; border-radius:8px; margin:12px 0; border:1px solid transparent; }
.call.tip{  background:#f0f9ff; border-color:#dbeafe; }
.call.warn{ background:#fff7ed; border-color:#ffedd5; }
.call.note{ background:#f8fafc; border-color:#e2e8f0; }
.call strong{ color:#111; }

.figure{ margin:14px 0; }
.figure img{ display:block; width:100%; height:auto; border:1px solid #eee; border-radius:10px; cursor:zoom-in; }
.figcap{ font-size:12px; color:#666; margin-top:6px; text-align:center; }

.table-wrap{ overflow:auto; border:1px solid #e5e7eb; border-radius:10px; }
table{ width:100%; border-collapse:collapse; font-size:14px; }
th,td{ padding:10px 12px; border-bottom:1px solid #eef2f7; text-align:left; }
th{ background:#fafafa; }

.grid-2{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
@media (max-width:720px){ .grid-2{ grid-template-columns:1fr; } }

.doc .back{ margin-top:28px; text-align:center; }
.doc .back a{ color:#333; font-weight:600; text-decoration:none; }
.doc .back a:hover{ color:#555; }

.sd-sidebar{
  position:fixed !important;
  top:var(--header-height);
  left:0;
  bottom:var(--footer-height);
  width:var(--sidebar-width);
  z-index:1000;
}
body:not(.sidebar-hidden) .container{ margin-left:var(--sidebar-width) !important; }

.doc-wrap > .body, .doc-wrap > .toc{ min-width:0; }

html, body{ overflow-x:hidden; }

.doc .body pre{
  position:relative;
  background:#0b1020; color:#e6edf3; border-radius:10px;
  padding:14px 72px 14px 14px;
  max-width:100%;
  overflow:visible;
  cursor:copy;
}

.doc .body pre .code-scroll{
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  max-height:60vh;
  white-space:pre;
  word-break:normal; overflow-wrap:normal;

  scrollbar-gutter:stable both-edges;

  padding-right:16px;
  padding-bottom:10px;
}
@supports not (scrollbar-gutter: stable){
  .doc .body pre .code-scroll{ padding-right:18px; padding-bottom:12px; }
}

.doc .body pre::after{
  content:"";
  position:absolute; inset:0 0 0 auto;
  width:56px; pointer-events:none;
  background:linear-gradient(to left, rgba(11,16,32,1), rgba(11,16,32,0));
  border-radius:0 10px 10px 0;
}

.doc .body pre > .copy-btn{
  position:absolute; top:8px; right:8px; z-index:2;
  border:1px solid #313a52; background:#151b2e; color:#cbd5e1;
  padding:4px 8px; border-radius:6px; font-size:12px; cursor:pointer;
}
.doc .body pre > .copy-btn:hover{ filter:brightness(1.08); }

pre.copied::after{
  content:"Copied";
  position:absolute; top:8px; right:8px;
  background:rgba(20,24,38,.95); color:#e6edf3; font-size:12px;
  padding:4px 8px; border-radius:6px; border:1px solid #2b3550;
}

.doc .body pre .code-scroll::-webkit-scrollbar{ width:10px; height:8px; }
.doc .body pre .code-scroll::-webkit-scrollbar-thumb{
  background:rgba(120,130,160,.45);
  border-radius:8px; border:2px solid transparent; background-clip:content-box;
}
.doc .body pre .code-scroll::-webkit-scrollbar-track{ background:transparent; }

pre:focus{ outline:2px solid #3b82f6; outline-offset:2px; }

@media (max-width:520px){
  .doc .body pre{ padding-right:64px; }
  .doc .body pre::after{ width:48px; }
}

.easter-egg{
  margin:18px 0 8px; display:flex; justify-content:center; align-items:center; gap:8px;
  color:#6b7280; font-size:13px; user-select:text; opacity:.92;
}
.easter-egg::before, .easter-egg::after{
  content:""; height:1px; flex:1 1 40px;
  background:linear-gradient(to right, transparent, #e5e7eb 35%, #e5e7eb 65%, transparent);
}
.easter-egg span{
  padding:4px 8px; border:1px solid #e5e7eb; border-radius:999px; background:#fafafa; line-height:1;
}
@media (max-width:520px){ .easter-egg{ font-size:12px; } }

ol.step{ list-style: none; padding-left: 0; margin-left: 0; }
ol.step>li::marker{ content: ""; }
ol.step>li{ margin: 10px 0; }



/* 紫色 Tips */
.call.tips{
  background:#faf5ff;          /* 很浅的紫色底 */
  border-color:#e9d5ff;         /* 紫色边框 */
    color:#111;             /* 整块文字统一黑色 */
}


.call.tips strong{
  color:#6b21a8;                /* 标题更紫一点 */
}


/* 可选：像 .step 一样加左侧强调条，想更显眼就解开注释 */
// .call.tips{ border-left-width:3px; border-left-color:#c084fc; }


.call.tips strong{ color:#111; }      /* 标题也保持黑色 */
.call.tips a{ color:#0b57d0; }        /* 链接仍然用站内蓝 */

/* ========== 4) grid-2 统一 & 图片不裁切（还原大屏观感） ========== */
/* === grid-2：双图并排，等高 16:9 裁切，顶部对齐 === */
.grid-2{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;         /* 顶对齐，行间不挤压 */
}
@media (max-width: 900px){
  .grid-2{ grid-template-columns: 1fr; }  /* 小屏单列 */
}


/* 每张图做成“卡片”：上面是裁切后的 16:9 图，下面是字幕 */
.grid-2 .figure{
  margin: 0;
  display: flex;
  flex-direction: column;
}


/* 关键：统一 16:9 + cover 裁切，保证两列同高 */
.grid-2 .figure > img{
  width: 100%;
  height: auto;              /* 由 aspect-ratio 计算高度 */
  aspect-ratio: 16 / 9;
  object-fit: cover;         /* 裁切填满 */
  display: block;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.08);
}


/* 字幕可选：最多两行，避免一长一短把卡片拖高 */
.grid-2 .figure .figcap{
  margin-top: 6px;
  text-align: center;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;     /* 需要更多行就改数字 */
  overflow: hidden;
  min-height: calc(1em * 2 + 6px);
}


/* 个别需要完整显示的图：在 figure 上加 .contain-16x9 即用 contain */
.grid-2 .figure.contain-16x9 > img{
  object-fit: contain;
  background: #fff;
}


/* 个别想调裁切焦点：在 <img> 上加这些类 */
img.crop-top    { object-position: 50% 20%; }
img.crop-bottom { object-position: 50% 80%; }
img.crop-left   { object-position: 0   50%; }
img.crop-right  { object-position: 100% 50%; }



/* 大图保持等比缩放，不强行 16:9，避免大屏被“裁平”看上去塌 */
.grid-2 .figure > img{
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.08);
}


/* 若某两张确实想 16:9，再单独给那组 figure 加类名 override：
.grid-2 .figure.ratio-16x9 > img { aspect-ratio:16/9; object-fit:cover; } */




/* ========== 5) 通用图片/代码兜底（无 !important） ========== */
.body img,
.figure img{
  max-width: 100%;
  width: 100%;
  height: auto;
  display: block;
}


pre, code, pre code{
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
pre{ overflow: auto; }

/* 优先使用 svh（小视口单位，避免移动端动态地址栏 vh 偏差） */
.hero-doc{
  min-height: clamp(560px, 72svh, 780px);
}


/* 兼容不支持 svh 的浏览器 */
@supports not (height: 100svh) {
  .hero-doc{
    min-height: clamp(560px, 72vh, 780px);
  }
}
