/*
  dsh-channel-wechat 站点共用样式。

  站点由 GitHub Pages 从 /docs 发布在 /dsh-channel-wechat/ 子路径下，
  所以引用本文件一律用相对路径：<link rel="stylesheet" href="assets/site.css">。
  写成 /assets/site.css 会指到 wangx-wx.github.io 根上并 404。
*/

:root {
  --green: #07C160;
  --green-dark: #06A350;
  --ink: #0F172A;
  --muted: #5A6B7B;
  --line: #E3E9EE;
  --bg: #FFFFFF;
  --soft: #F5F8FA;
  --code-bg: #0F172A;
  --radius: 14px;
  --max: 960px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.75;
}

a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* ---------- hero ---------- */

.hero {
  text-align: center;
  padding: 72px 24px 56px;
  background: linear-gradient(180deg, #F3FBF7 0%, #FFFFFF 100%);
  border-bottom: 1px solid var(--line);
}

.logo {
  width: 96px; height: 96px;
  display: block;
  margin: 0 auto 24px;
  border-radius: 22px;
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(28px, 5vw, 42px);
  letter-spacing: -0.02em;
  font-weight: 700;
}

.tagline {
  margin: 0 auto 20px;
  max-width: 620px;
  font-size: clamp(16px, 2.2vw, 19px);
  color: var(--ink);
}

.meta {
  margin: 0 0 32px;
  font-size: 14px;
  color: var(--muted);
}

.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 11px 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  transition: border-color .15s, background .15s;
}
.btn:hover { text-decoration: none; border-color: #C8D4DE; }
.btn.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.btn.primary:hover { background: var(--green-dark); border-color: var(--green-dark); }

/* ---------- sections ---------- */

section { padding: 64px 0; border-bottom: 1px solid var(--line); }
section:last-of-type { border-bottom: 0; }

h2 {
  margin: 0 0 12px;
  font-size: clamp(22px, 3.4vw, 28px);
  letter-spacing: -0.01em;
  font-weight: 700;
}

.lede { margin: 0 0 36px; color: var(--muted); max-width: 680px; }

/* ---------- screenshots ---------- */

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

/*
  截图位。图片文件放到位就自动显示，不需要改 HTML：
  图片加载失败时 onerror 把它从 DOM 里删掉，:has(img) 随之失效，
  ::before 的占位说明就透出来了。data-label 只是占位提示，不是最终文案。
*/
.shot {
  margin: 0;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 18px;
  text-align: center;
  border: 1px dashed #B9D8C6;
  border-radius: var(--radius);
  background: var(--soft);
}

.shot::before {
  content: attr(data-label);
  font-size: 13px;
  line-height: 1.9;
  color: #6B8A79;
  white-space: pre-line;
}

.shot:has(img)::before { display: none; }

/*
  手机截图多是 9:19.5 的长图。按高度收能让三张并排时高度一致，但长图缩到 300px 宽
  字就看不清了——所以这里只是缩略图，外面套 <a target="_blank"> 点开看原图。
*/
.shot a { display: block; line-height: 0; }
.shot a:hover img { opacity: .9; }

.shot img {
  max-width: 100%;
  max-height: 440px;
  border-radius: 8px;
  background: #fff;
}

.shot figcaption {
  width: 100%;
  padding-top: 12px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

/* ---------- feature list ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
}

/* 卡片标题可以是链接（如「先看的东西」那组），保持与正文同级颜色，
   否则同一排卡片里会有一半是绿色标题。悬停时再给下划线。 */
.card h3 a { color: inherit; }
.card h3 a:hover { color: var(--green-dark); }

.card p { margin: 0; font-size: 15px; color: var(--muted); }

/* ---------- code ---------- */

pre {
  margin: 0 0 20px;
  padding: 18px 20px;
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--code-bg);
  color: #E6EDF3;
  font-size: 14px;
  line-height: 1.7;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
}

p code, li code, td code {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--soft);
  color: var(--green-dark);
}

/* ---------- steps ---------- */

ol.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }

ol.steps > li {
  position: relative;
  counter-increment: step;
  padding: 0 0 32px 48px;
  border-left: 2px solid var(--line);
  margin-left: 16px;
}

ol.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }

ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: -17px;
  top: 0;
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

ol.steps h3 { margin: 0 0 10px; font-size: 17px; font-weight: 600; }
ol.steps p { margin: 0 0 12px; font-size: 15px; color: var(--muted); }
ol.steps pre { margin-bottom: 12px; }

.note {
  margin: 0;
  padding: 14px 18px;
  border-left: 3px solid var(--green);
  border-radius: 0 8px 8px 0;
  background: var(--soft);
  font-size: 14px;
  color: var(--ink);
}

.note strong { font-weight: 600; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; margin: 0 0 20px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th { font-weight: 600; color: var(--muted); font-size: 14px; white-space: nowrap; }

/* ---------- diagram ---------- */

.diagram {
  margin: 0 0 24px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  overflow-x: auto;
}

.diagram svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }

/* ---------- limits ---------- */

.limits li { margin-bottom: 10px; color: var(--muted); }
.limits strong { color: var(--ink); font-weight: 600; }

/* ---------- footer ---------- */

footer {
  padding: 48px 0 64px;
  background: var(--soft);
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}

footer .wrap { display: flex; flex-wrap: wrap; gap: 24px 40px; justify-content: space-between; }
footer ul { margin: 0; padding: 0; list-style: none; }
footer li { margin-bottom: 6px; }

@media (max-width: 600px) {
  .hero { padding: 52px 20px 44px; }
  section { padding: 48px 0; }
  .wrap { padding: 0 20px; }
  th, td { padding: 10px 8px; }

  /*
    窄屏一列显示。长截图按屏宽铺满会把页面拉到近万像素高，而 1080px 宽的截图缩到
    330px 后字依然读不出来——既然两种方式都读不清，就选更省滚动的：限制高度，
    点开看原图。.shot a 的 title 已写明「点开看原图」。
  */
  .shot { min-height: 0; padding: 14px; }
  .shot img { max-height: 560px; }
}

/* ---------- article（文章页 article/*.html 用） ---------- */

.article {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}

.article-header {
  margin-bottom: 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.article-header h1 {
  margin: 0 0 12px;
  font-size: clamp(26px, 4.2vw, 36px);
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.article-header .byline {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.article h2 {
  margin: 52px 0 14px;
  padding-top: 8px;
  font-size: 22px;
}

.article h3 {
  margin: 32px 0 10px;
  font-size: 17px;
  font-weight: 600;
}

.article p { margin: 0 0 18px; }

.article ul, .article ol { margin: 0 0 18px; padding-left: 22px; }
.article li { margin-bottom: 10px; }

/* 文章里的引用块用来说明「为什么这样做」，与落地页的 .note 区分开 */
.article blockquote {
  margin: 0 0 20px;
  padding: 16px 20px;
  border-left: 3px solid var(--line);
  border-radius: 0 8px 8px 0;
  background: var(--soft);
  font-size: 15px;
  color: var(--muted);
}

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

.article pre { font-size: 13px; }

/* 目录 */
.toc {
  margin: 0 0 44px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.toc p { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.toc ol { margin: 0; padding-left: 20px; font-size: 15px; }
.toc li { margin-bottom: 6px; }

.article-footer {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}

/* 文章页的返回链接 */
.back {
  display: inline-block;
  margin-bottom: 28px;
  font-size: 14px;
}

@media (max-width: 600px) {
  .article { padding: 40px 20px 60px; }
  .article h2 { margin-top: 40px; }
}

/*
  文章里的表格：第一列是「标签」，被挤成四行很难读。给一个下限，
  超宽时由外层 .table-wrap 横向滚动接住（不换行压缩列宽）。
*/
.article table td:first-child,
.article table th:first-child { min-width: 6.5em; }

/* ---------- 命令块与复制按钮 ---------- */

/*
  .cmd 包住一个 <pre><code> 和一个复制按钮。按钮绝对定位在右上角，
  所以 <pre> 需要预留右上内边距，否则长命令会钻到按钮下面。
*/
.cmd { position: relative; margin: 0 0 20px; }

.cmd pre { margin-bottom: 0; padding-right: 84px; }

/*
  命令块换行而不横向滚动。横向滚动时，超出的文字会滚到右侧 padding 区域
  被复制按钮压住（Chrome 不把容器的右 padding 算进滚动区末端）。
  这些命令都很短，换行比滚动更合适，也保证按钮永远不遮字。
*/
.cmd pre code { white-space: pre-wrap; overflow-wrap: anywhere; }

.cmd .copy {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 7px;
  background: rgba(255, 255, 255, .08);
  color: #C9D6E2;
  font-size: 12px;
  line-height: 1.5;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.cmd .copy:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.cmd .copy:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* 复制成功后短暂变绿，作为「点到了」的反馈 */
.cmd .copy.copied {
  border-color: var(--green);
  background: rgba(7, 193, 96, .18);
  color: #7BE3AD;
}

/* ---------- 更新日志 ---------- */

.releases { margin: 0; padding: 0; list-style: none; }

.releases > li {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.releases > li:last-child { border-bottom: 0; }

.releases .ver {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.releases .ver a {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}

.releases .ver a:hover { color: var(--green-dark); }

/* 最新版本给一个标记，避免读者以为列表顺序不可靠 */
.releases .tag {
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(7, 193, 96, .12);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 500;
}

.releases .date { font-size: 13px; color: var(--muted); }

.releases p { margin: 0; font-size: 15px; color: var(--muted); }

/* ---------- 安装方式二选一 ---------- */

.ways {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin: 0 0 32px;
}

.way {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.way h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.way > p { margin: 0 0 14px; font-size: 14px; color: var(--muted); }

/* 安装方式里的图，尺寸与截图位一致，但不需要虚线框 */
.way figure { margin: 0; }
.way img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
  margin-bottom: 10px;
  border-radius: 8px;
  background: var(--soft);
}
.way figcaption { font-size: 13px; color: var(--muted); }

/*
  缺图时的占位。判据是「figure 里还有没有 img」，与 .shot 一致：
  图片加载失败时 onerror 把它移出 DOM，:not(:has(img)) 随之成立，
  占位提示就出现。图片加载成功则 onload 清掉 data-placeholder，恢复普通排版。

  注意不能靠 data-placeholder 自己去 display:none 掉 img——那样图片永远不会加载，
  onload 也就永远不触发，占位和真图会同时消失。
*/
.way figure[data-placeholder]:not(:has(img)) {
  display: grid;
  place-items: center;
  min-height: 200px;
  padding: 16px;
  border: 1px dashed #B9D8C6;
  border-radius: 8px;
  background: var(--soft);
  text-align: center;
}

.way figure[data-placeholder]:not(:has(img))::before {
  content: attr(data-placeholder);
  white-space: pre-line;
  font-size: 13px;
  line-height: 1.9;
  color: #6B8A79;
}

.way figure[data-placeholder]:not(:has(img)) figcaption { display: none; }
