/* ========== SD 专区文档：沿用 sdhome 变量，追加文档外观 ========== */
:root{
  --doc-max: 1000px;
  --frost-bg: rgba(255,255,255,.66);
  --frost-line: rgba(255,255,255,.35);
  --frost-shadow: 0 18px 50px rgba(0,0,0,.35);
  --card-radius: 16px;
}


/* 去掉普通文档的左侧边栏布局影响 */
.container { margin-left: 0 !important; }


/* HERO（与 sdhome 同风格，但标题卡毛玻璃） */
.hero-doc { position: relative; min-height: clamp(560px, 70vh, 720px); display: flex; align-items: center; }
.hero-doc .hero-overlay{
  position:absolute; inset:0;
  background:
    radial-gradient(1100px 420px at 42% 62%, rgba(255,255,255,.18), rgba(255,255,255,.06)),
    linear-gradient(180deg, rgba(249,168,212,.08), rgba(147,197,253,.06));
}
.title-card{
  max-width: 840px; margin: 0 auto;
  background: var(--frost-bg);
  border: 1px solid var(--frost-line);
  border-radius: 18px;
  backdrop-filter: blur(10px) saturate(140%);
  padding: 28px 24px;
  box-shadow: var(--frost-shadow);
}
.title-card h1{ margin: 0 0 6px; font-weight: 800; font-size: clamp(28px, 4.8vw, 44px); color:#0b0b0c; }
.title-card p { margin: 0 0 10px; color:#0b0b0c; }
.title-card .chips{ margin: 6px 0 14px; }
.title-card .btn.primary{ background: linear-gradient(180deg,#fce7f3,#dbeafe); color:#111; border:1px solid rgba(0,0,0,.06); }


/* 主文档容器 */
.doc { max-width: var(--doc-max); margin: 28px auto; }
.doc-wrap{ display:grid; grid-template-columns: 1fr 260px; gap:20px; }
@media (max-width:1024px){ .doc-wrap{ grid-template-columns: 1fr; } }


/* 正文毛玻璃卡片 */
.frost{
  background: var(--frost-bg);
  border: 1px solid var(--frost-line);
  border-radius: var(--card-radius);
  backdrop-filter: blur(10px) saturate(140%);
  box-shadow: var(--frost-shadow);
}
.frost-lite{
  background: rgba(255,255,255,.5);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: var(--card-radius);
  backdrop-filter: blur(8px) saturate(140%);
  box-shadow: 0 12px 40px rgba(0,0,0,.28);
}


/* 正文基础排版 */
.body{ padding: 28px; color:#0b0b0c; }
.body h2{ font-size: 24px; margin: 20px 0 10px; font-weight: 800; }
.body h3{ font-size: 18px; margin: 16px 0 8px; font-weight: 700; }
.body p, .body li{ line-height: 1.75; color:#111; }
.body a{ color:#0b57d0; text-decoration:none; }
.body a:hover{ text-decoration:underline; }


.step{ padding-left: 0; }
.step>li{
  margin:10px 0; padding: 10px 12px;
  border-left: 3px solid #22c55e; background: rgba(34,197,94,.06);
  border-radius: 6px;
}


/* 图文 */
.figure{ margin: 14px 0; }
.figure img{ display:block; width:100%; height:auto; border-radius: 12px; border:1px solid rgba(0,0,0,.08); cursor: zoom-in; }
.figcap{ font-size: 12px; color:#374151; margin-top: 6px; text-align: center; }


/* 右侧 TOC（悬浮） */
.toc{
  position: sticky; top: 90px; height: fit-content;
  padding: 16px;
}
.toc h4{ font-size: 13px; color:#0b0b0c; margin: 0 0 6px; }
.toc ul{ list-style:none; padding-left: 0; margin: 0; }
.toc li{ margin: 6px 0; }
.toc a{ color:#0b0b0c; font-size: 14px; text-decoration: none; }
.toc a.active{ font-weight: 700; }
@media (max-width:1024px){ .toc{ position: static; } }


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


/* 代码块（与你通用的交互一致，但视觉跟 SD 同步） */
.body pre{
  position:relative;
  background:#0b1020; color:#e6edf3; border-radius:10px;
  padding:14px 72px 14px 14px;
  max-width:100%;
  overflow:visible; cursor:copy;
  border:1px solid rgba(255,255,255,.08);
}
.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;
}
.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;
}
.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;
}
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;
}


/* 小组件与尾部 */
.code-title{ font-size:12px; color:#374151; margin: 0 0 6px; }
.back{ margin-top: 20px; text-align: center; }
.back a{ color:#0b0b0c; font-weight: 700; text-decoration: none; }
.back a:hover{ text-decoration: underline; }


.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, rgba(0,0,0,.18) 35%, rgba(0,0,0,.18) 65%, transparent);
}
.easter-egg span{
  padding:4px 8px; border:1px solid rgba(0,0,0,.12); border-radius:999px; background:rgba(255,255,255,.6); line-height:1;
}


/* 顶栏品牌区（覆盖通用黑字问题，强制使用主题色） */
.topbar .brand{ color: var(--ink); }
.topbar .brand-icon{ height:auto !important; width:70px !important; }
.topbar .brand-sub{
  display:inline-flex; align-items:center; margin-left:6px; padding:3px 10px; height:28px;
  border-radius:999px; background:linear-gradient(90deg,#fde2f3,#dbeafe);
  font-size:12px; font-weight:800; letter-spacing:.2px; color:#111; text-decoration:none;
}
.topbar .brand-sub:hover{ filter:brightness(1.05); }
.topbar .brand a:focus-visible{ outline:2px solid var(--pink); outline-offset:2px; }


/* Reveal 动画（与 sdhome 一致） */
@keyframes fadeUp{from{opacity:0;transform:translateY(18px)}to{opacity:1;transform:translateY(0)}}
.reveal{opacity:0;transform:translateY(18px)}
.reveal.in{animation:fadeUp .8s cubic-bezier(.2,.7,.2,1) forwards}


/* --- 主文档区 +30% 宽 --- */
:root{
  --doc-max: 1300px;  /* 原 1000px → 1300px */
}


/* --- HERO 调整：左下对齐、更宽，底部渐变衔接到蓝色背景 --- */
.hero-doc{
  position: relative;
  min-height: clamp(560px, 72vh, 780px);
  display: block; /* 让我们自己控制内层对齐 */
}


/* 底部渐变：从透明 → 深蓝，衔接 body 的夜蓝底 */
.hero-doc::after{
  content:"";
  position:absolute; left:0; right:0; bottom:-1px; height:140px;
  pointer-events:none;
  background: linear-gradient(
    to bottom,
    rgba(11,18,38,0) 0%,
    rgba(11,18,38,.35) 35%,
    var(--bg2) 70%,
    var(--bg) 100%
  );
}


/* 内层容器：把内容推到左下角，稍微离底边一点 */
.hero-doc .hero-inner{
  position: relative;
  display: flex;
  align-items: flex-end;        /* 靠下 */
  justify-content: flex-start;  /* 靠左 */
  min-height: inherit;
  padding: 0 0 8vh;             /* “稍微靠下边一点” */
  text-align: left;             /* 文案左对齐 */
}


/* 毛玻璃标题卡：更宽一些 */
.title-card{
  /* 原 max-width: 840px; 改为更宽的自适应范围 */
  max-width: clamp(760px, 56vw, 1100px);
  margin: 0;               /* 贴左下 */
}


/* 去掉胶囊（防守式，防止旧标记残留） */
.title-card .chips{ display:none !important; }

/* 主文档区 +30% 宽（保持） */
:root{ --doc-max: 1300px; }


/* —— HERO 居中：水平居中；垂直接近中线、略微下移 —— */
.hero-doc{
  position: relative;
  min-height: clamp(560px, 72vh, 780px);
  display: block;
}


/* 底部蓝色衔接渐变（保留） */
.hero-doc::after{
  content:"";
  position:absolute; left:0; right:0; bottom:-1px; height:140px; pointer-events:none;
  background: linear-gradient(
    to bottom,
    rgba(11,18,38,0) 0%,
    rgba(11,18,38,.35) 35%,
    var(--bg2) 70%,
    var(--bg) 100%
  );
}


/* 关键：Hero 内层真正“居中” */
.hero-doc .hero-inner{
  position: relative;
  min-height: inherit;
  display: flex;
  align-items: center;          /* 垂直居中 */
  justify-content: center;      /* 水平居中 */
  padding: 6vh 0 8vh;           /* 略微靠下：中心线下移一点点 */
  text-align: left;             /* 文案仍左对齐（要居中文案可改成 center） */
}


/* 标题毛玻璃：更宽一点、轻微上调避免“太下了”的观感 */
.title-card{
  max-width: clamp(860px, 62vw, 1180px);  /* 宽一点 */
  margin: 0;                               /* 居中由 flex 控制 */
  transform: translateY(-2vh);             /* 从之前的“太下”往上提一丢丢 */
}


/* 保险：如果 HTML 还留着按钮/胶囊，强制隐藏 */
.title-card .chips,
.title-card .btn { display: none !important; }


/* —— 中央文档毛玻璃：整体“亮 20%” —— */
/* 主文档（正文） */
.doc-sd .body.frost{
  background: rgba(255,255,255,.80);    /* 原 .66 → .80，更亮 */
  border-color: rgba(255,255,255,.50);  /* 线也亮一点 */
  box-shadow: 0 18px 50px rgba(0,0,0,.32); /* 阴影稍收一点，避免变灰 */
}


/* 右侧 TOC 也同步增亮 ~20% */
.toc.frost-lite{
  background: rgba(255,255,255,.60);    /* 原 .50 → .60 */
  border-color: rgba(255,255,255,.42);
}


/* 图像/文字对比微调（亮背景上更舒服） */
.body h2, .body h3 { color:#0b0b0c; }
.body p, .body li { color:#111; }

/* Hero 小标题居中 */
.hero.hero-doc .title-card > p{
  text-align: center;
  margin: 8px auto 0;
  max-width: 72ch;            /* 防止超宽一行；可按需调 */
}

/* ====================
   Grid-2 side-by-side images → force 16:9
   中文注释：统一并排两图的可视区域，避免一高一低
==================== */

/* ========== 1) 撤销对全站 .container 的全局改造 ========== */
/* 删除/注释你早先这句（会拉偏布局）：
   .container { margin-left: 0 !important; }
   以及「让容器别被子元素撑爆」那整块 .container {...} */
   
/* 仅在 hero 内部加内边距，不影响全站其它地方 */
.hero-doc .container { 
  padding-inline: clamp(12px, 4vw, 32px);
}


/* 文档本体保持自身居中靠 .doc 控制即可（你已有）
   .doc { max-width: var(--doc-max); margin: 28px auto; } */




/* ========== 2) .doc-wrap 的列宽与收缩（恢复大屏两列） ========== */
.doc .doc-wrap { 
  display: grid;
  gap: 20px;                 /* 还原你最初 gap */
}
.doc .doc-wrap > .body,
.doc .doc-wrap > .toc { 
  min-width: 0;             /* 防止子项撑爆 */
}


/* ≥1025px：右侧 TOC 固定 260px，主列自适应 */
@media (min-width: 1025px){
  .doc .doc-wrap { 
    grid-template-columns: 1fr 260px;   /* 去掉之前的 !important 与 280px */
  }
}


/* ≤1024px：单列堆叠 */
@media (max-width: 1024px){
  .doc .doc-wrap { display: block; }    /* 去掉 !important */
  .doc .toc { 
    position: static; 
    width: auto; 
    margin-top: 16px; 
  }
}




/* ========== 3) 统一 HERO：只保留“居中那套”，删掉“左下对齐那套” ========== */
/* —— 请把你文件中“—— HERO 调整：左下对齐、更宽 …”那整组样式删除 —— */
/* 保留下面这套居中的定义 */
.hero-doc{
  position: relative;
  min-height: clamp(560px, 72vh, 780px);
  display: block;
}
.hero-doc::after{
  content:"";
  position:absolute; left:0; right:0; bottom:-1px; height:140px; pointer-events:none;
  background: linear-gradient(
    to bottom,
    rgba(11,18,38,0) 0%,
    rgba(11,18,38,.35) 35%,
    var(--bg2) 70%,
    var(--bg) 100%
  );
}
.hero-doc .hero-inner{
  position: relative;
  min-height: inherit;
  display: flex;
  align-items: center;          /* 垂直居中 */
  justify-content: center;      /* 水平居中 */
  padding: 6vh 0 8vh;
  text-align: left;
}
.title-card{
  /* 保留你想要的更宽范围 */
  max-width: clamp(860px, 62vw, 1180px);
  margin: 0;
  transform: translateY(-2vh);
}




/* ========== 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);
  }
}

.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; }
}
