/* 文档页：「最新」时间线（手机优先）+ 全屏阅读器。只用 style.css 里的主题变量，深浅色都跟着走。 */

.docs-page { display: grid; gap: 12px; align-content: start; }
.docs-tabs { justify-self: start; }

/* ───────── 时间线 ───────── */

.dfeed { display: grid; gap: 10px; min-width: 0; }
.dfeed-top { display: flex; align-items: center; gap: 4px; min-width: 0; }
/* 目录筛选：一排能横向滑动的 chip */
.dfeed-chips { flex: 1; min-width: 0; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; -webkit-overflow-scrolling: touch; }
.dfeed-chips::-webkit-scrollbar { display: none; }
.dfeed-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: 14px; white-space: nowrap; }
.dfeed-chip:hover { color: var(--fg); }
.dfeed-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
/* 自动识别出来的目录（auto）名字后面的灰色小字；选中的 chip 里也保持灰色、不加粗 */
.dfeed-auto { margin-left: -4px; font-size: 11.5px; font-weight: 400; color: var(--muted); }.dfeed-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 2px color-mix(in srgb, var(--panel) 70%, transparent); }

/* 搜索框 */
.dfeed-search { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); }
.dfeed-search:focus-within { border-color: var(--accent); }
.dfeed-search input { flex: 1; min-width: 0; height: 36px; border: 0; outline: none; background: transparent; color: var(--fg); font: inherit; font-size: 15px; }
.dfeed-search input::-webkit-search-cancel-button { display: none; }

/* 分组标题：小号、吸顶（滚动容器是外壳的 .content） */
.dfeed-list, .dfeed-hits { display: grid; gap: 0; min-width: 0; }
.dfeed-list section { display: grid; gap: 10px; margin-bottom: 8px; min-width: 0; }
.dfeed-group { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 6px; padding: 8px 2px 6px; background: var(--bg); color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .06em; }
.dfeed-group span { font-weight: 400; opacity: .8; }
.dfeed-group span::before { content: '· '; }

/* 卡片：整块可点 */
.dfeed-card { display: grid; gap: 6px; width: 100%; min-width: 0; text-align: left; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); transition: border-color .15s, transform .1s; -webkit-tap-highlight-color: transparent; }
.dfeed-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.dfeed-card:active { transform: scale(.99); }
.dfeed-hits .dfeed-card { margin-bottom: 10px; }
.dfeed-title { font-size: 16.5px; font-weight: 600; line-height: 1.4; color: var(--fg); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.dfeed-title.mono { font-size: 14.5px; }
.dfeed-new { display: inline-flex; align-items: center; gap: 4px; margin-right: 6px; padding: 0 7px; height: 19px; vertical-align: 2px; border-radius: 999px; background: var(--bad-soft); color: var(--err); font-size: 11.5px; font-weight: 700; }
.dfeed-new::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dfeed-sum { font-size: 14px; line-height: 1.55; color: var(--muted); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.dfeed-meta { display: flex; align-items: center; gap: 6px; min-width: 0; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.dfeed-meta > * + *::before { content: '·'; margin-right: 6px; opacity: .7; }
.dfeed-root { flex: none; display: inline-flex; align-items: center; gap: 5px; font-weight: 500; }
.dfeed-root .dfeed-dot { box-shadow: none; }
.dfeed-dir { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.dfeed-time { flex: none; margin-left: auto; font-variant-numeric: tabular-nums; }
.dfeed-foot { text-align: center; margin: 8px 0 16px; }
/* 顶上「正在刷新…」一行：先画上次的列表，后台拉新的时显示（docs.js 的 Feed） */
.dfeed-refresh { display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin: 2px 0 8px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; }
/* 列表底部往下翻的那一行（滚到它就自动翻下一页） */
.dfeed-more { margin: 4px 0 16px; }

/* 骨架 */
.dfeed-card.skel { pointer-events: none; }
.dfeed-card.skel i, .docread-skel i { display: block; height: 14px; border-radius: 7px; background: var(--panel-2); animation: dfeed-pulse 1.2s ease-in-out infinite; }
.dfeed-card.skel i:first-child { height: 18px; width: 70%; }
.dfeed-card.skel i.short, .docread-skel i.short { width: 40%; }
.dfeed-list[aria-busy] { gap: 10px; padding-top: 8px; }
@keyframes dfeed-pulse { 50% { opacity: .5; } }

/* 空状态 */
.dfeed-empty { display: grid; justify-items: center; gap: 4px; padding: 40px 16px; text-align: center; color: var(--muted); }
.dfeed-empty p { margin: 0; }
.dfeed-empty .icon { opacity: .5; margin-bottom: 6px; }

/* ───────── 全屏阅读器 ───────── */

/* 盖住外壳顶栏（z 5）和手机底部导航（z 4），但留在弹窗（z 50）和提示（z 60）下面 */
/* 双指放大照常可用（10-05 禁过，后来查明“左右滑后退再滑不动”是小米浏览器的左右滑手势，和缩放无关） */
.docread { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; background: var(--bg); color: var(--fg); overscroll-behavior: none; }
.docread-bar { flex: none; display: flex; align-items: center; gap: 4px; min-height: 48px; padding: env(safe-area-inset-top) 6px 0; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.docread-title { flex: 1; min-width: 0; font-size: 15.5px; font-weight: 600; text-align: center; }
.docread-bar .icon-btn.on { background: var(--accent-soft); color: var(--accent); }
.docread-info { flex: none; display: grid; gap: 2px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.docread-info .mono { overflow-wrap: anywhere; }
/* 横向不再裁掉：正常内容都限制在 100% 宽内，真有漏网的宽东西（md 里的 HTML、svg）整页也能左右滑过去看 */
.docread-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: auto; overscroll-behavior: none; -webkit-overflow-scrolling: touch; }
.docread-col { max-width: 820px; margin: 0 auto; padding: 18px 16px calc(40px + env(safe-area-inset-bottom)); min-width: 0; }
.docread-skel { display: grid; gap: 12px; padding-top: 8px; }
.docread-skel i:first-child { height: 26px; width: 60%; margin-bottom: 8px; }
.docread-pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.6; }
.docread .docimg { display: block; margin: 0 auto; }

/* 正文排版：只在阅读器里生效，不动全局 .md（对话气泡也用它） */
.docread .md { font-size: 16.5px; line-height: 1.75; overflow-wrap: anywhere; word-break: normal; }
.docread .md p { margin: 0 0 1em; }
.docread .md h1, .docread .md h2, .docread .md h3, .docread .md h4 { line-height: 1.35; font-weight: 700; scroll-margin-top: 12px; }
.docread .md h1 { font-size: 1.6em; margin: .2em 0 .7em; letter-spacing: -.01em; }
.docread .md h2 { font-size: 1.3em; margin: 1.6em 0 .7em; padding-bottom: .35em; border-bottom: 1px solid var(--line); }
.docread .md h3 { font-size: 1.12em; margin: 1.4em 0 .5em; }
.docread .md h4 { font-size: 1em; margin: 1.2em 0 .4em; color: var(--muted); }
.docread .md ul, .docread .md ol { padding-left: 1.5em; margin: 0 0 1em; }
.docread .md li { margin: .25em 0; }
.docread .md li > ul, .docread .md li > ol { margin: .2em 0; }
.docread .md li::marker { color: var(--muted); }
.docread .md blockquote { margin: 0 0 1em; padding: .4em 1em; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--fg); }
.docread .md blockquote > :last-child { margin-bottom: 0; }
.docread .md hr { border: 0; border-top: 1px solid var(--line); margin: 1.8em 0; }
.docread .md a { overflow-wrap: anywhere; }
.docread .md img { max-width: 100%; height: auto; border-radius: 8px; }
.docread .md code { font-size: .86em; }
.docread .md > * { max-width: 100%; }
.docread .md svg, .docread .md video, .docread .md iframe { max-width: 100%; }
/* 宽内容只有一层横向滚动：decorate 已包好的 .table-wrap（表格）和 .codeblock 里的 pre（代码块） */
.docread .md .table-wrap, .docread .md .codeblock pre {
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-x: none;
  scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 55%, transparent) transparent;
}
.docread .md .table-wrap::-webkit-scrollbar, .docread .md .codeblock pre::-webkit-scrollbar { height: 8px; }
.docread .md .table-wrap::-webkit-scrollbar-thumb, .docread .md .codeblock pre::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 55%, transparent); border-radius: 4px; }
.docread .md .table-wrap::-webkit-scrollbar-track, .docread .md .codeblock pre::-webkit-scrollbar-track { background: transparent; }
.docread .md .codeblock { margin: 0 0 1em; border-radius: 10px; }
.docread .md .codeblock pre { padding: 8px 14px 12px; font-size: 13.5px; line-height: 1.55; }
.docread .md pre code { white-space: pre; }
.docread .md .table-wrap { margin: 0 0 1em; border-radius: 10px; }
/* 表格不无限撑宽：单元格可换行、有上下限；列多时整表在 .table-wrap 里左右滑 */
.docread .md .table-wrap > table { width: max-content; min-width: 100%; font-size: 14.5px; line-height: 1.5; }
.docread .md .table-wrap th, .docread .md .table-wrap td { padding: 7px 11px; min-width: 6em; max-width: 28em; overflow-wrap: anywhere; word-break: normal; }
.docread .md tr:nth-child(even) td { background: var(--panel2); }

/* 宽内容的按钮（docs.js 渲染后补进 DOM）：放不下（.over）才出 ◀ ▶，宽表（.wide）才出“卡片看” */
.docread .md .dr-btn { min-height: 36px; min-width: 36px; padding: 0 9px; border-radius: 8px; font-size: 12.5px; color: var(--muted); background: none; }
.docread .md .dr-btn:active { color: var(--accent); background: var(--accent-soft); }
.docread .md .dr-btn:disabled { opacity: .35; }
.docread .md .dr-prev, .docread .md .dr-next { display: none; font-size: 11px; }
.docread .md .over > .code-head .dr-prev, .docread .md .over > .code-head .dr-next,
.docread .md .over > .dr-tbar .dr-prev, .docread .md .over > .dr-tbar .dr-next { display: inline-flex; align-items: center; justify-content: center; }
.docread .md .code-head .code-lang { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docread .md .code-head { gap: 2px; }
/* 代码块换行：窄屏默认开，长行折下来就不用左右滑 */
.docread .md .codeblock.wrap pre code { white-space: pre-wrap; overflow-wrap: anywhere; }
.docread .md .dr-table { margin: 0 0 1em; }
.docread .md .dr-table > .table-wrap { margin: 0; }
.docread .md .dr-tbar { display: none; justify-content: flex-end; align-items: center; gap: 2px; margin-bottom: 2px; }
.docread .md .dr-table.wide > .dr-tbar { display: flex; }
.docread .md .dr-cards { margin-right: auto; border: 1px solid var(--line); }
/* 卡片看：宽表的每一行变成一张卡片，“列名 内容”竖着排，完全不用左右滑 */
.docread.cards .md .dr-table.wide > .table-wrap { overflow: visible; border-radius: 0; }
.docread.cards .md .dr-table.wide table,
.docread.cards .md .dr-table.wide tbody,
.docread.cards .md .dr-table.wide tr { display: block; width: auto; min-width: 0; }
.docread.cards .md .dr-table.wide thead { display: none; }
.docread.cards .md .dr-table.wide tr { margin: 0 0 10px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.docread.cards .md .dr-table.wide td { display: block; min-width: 0; max-width: none; padding: 7px 0; border: 0; border-top: 1px solid var(--line); background: none; }
.docread.cards .md .dr-table.wide td:first-child { border-top: 0; font-weight: 600; }
/* 列名放在内容上面一小行（不用左右两栏：单元格里有加粗、链接时两栏会被拆乱） */
.docread.cards .md .dr-table.wide td::before { content: attr(data-label); display: block; margin-bottom: 1px; color: var(--muted); font-size: 12.5px; font-weight: 400; line-height: 1.4; }
.docread.cards .md .dr-table.wide td[data-label=""]::before { display: none; }

@media (min-width: 900px) {
  .docread-bar { padding-left: 12px; padding-right: 12px; }
  .docread-col { padding: 32px 32px 64px; }
  .docread .md { font-size: 16px; }
}

/* ───────── 正文图片：按宽高占好框 → 糊图 / 底色 → 预览淡入 → 失败点重试（img-progressive-1114） ───────── */

.docread-bar { position: relative; }
.docread-stale {
  position: absolute; left: 50%; top: 100%; transform: translate(-50%, 6px); z-index: 3; pointer-events: none;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap;
  background: color-mix(in srgb, var(--panel) 92%, transparent); color: var(--muted); border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
.docread-stale.offline { color: var(--warn); }
/* 框本身就是图位：宽度占满（最多原图宽），高度由 aspect-ratio 定，图没来之前布局已经定死 */
.docread .md .dimg {
  position: relative; display: block; width: 100%; margin: .4em auto; overflow: hidden; border-radius: 8px;
  background-color: var(--panel-2); background-size: cover; background-position: center; cursor: zoom-in;
}
.docread .md .dimg.nodim { min-height: 160px; }
.docread .md .dimg.nodim.ok { min-height: 0; }
.docread .md .dimg.nodim.ok .dimg-i { position: static; height: auto; }
/* 没糊图的框：底色上走一道浅光，表示在路上 */
.docread .md .dimg:not(.lq):not(.ok):not(.err) {
  background-image: linear-gradient(100deg, var(--panel-2) 30%, color-mix(in srgb, var(--panel-2) 55%, var(--panel)) 50%, var(--panel-2) 70%);
  background-size: 300% 100%; animation: dimg-shine 1.4s ease-in-out infinite;
}
/* 糊图放大后会出马赛克：模糊一下更像"正在对焦" */
.docread .md .dimg.lq::before { content: ''; position: absolute; inset: -8px; background: inherit; filter: blur(10px); }
@keyframes dimg-shine { from { background-position: 100% 0; } to { background-position: 0 0; } }
.docread .md .dimg .dimg-i {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; margin: 0; border-radius: 0;
  object-fit: contain; opacity: 0; transition: opacity .35s ease;
}
.docread .md .dimg.ok .dimg-i { opacity: 1; }
.docread .md .dimg.ok { background-image: none; animation: none; }
.dimg-msg { position: absolute; inset: 0; display: none; place-items: center; padding: 8px; z-index: 1; }
.dimg.err .dimg-msg, .dimg-solo.err .dimg-msg { display: grid; }
.dimg.err { cursor: default; animation: none; background-image: none; }
.dimg-retry {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  font-size: 13px; cursor: pointer;
}
.dimg-retry:hover { color: var(--fg); border-color: var(--accent); }
.dimg-retry.inline { padding: 0 6px; border: 0; background: none; color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .docread .md .dimg { animation: none !important; }
  .docread .md .dimg .dimg-i { transition: none; }
}

/* 单独打开的图片文件 */
.dimg-solo-wrap { display: grid; gap: 6px; justify-items: center; }
.dimg-solo {
  position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: 8px; overflow: hidden;
  background: var(--panel-2); cursor: zoom-in;
}
.dimg-solo.nodim { min-height: 240px; }
.dimg-solo.nodim .dimg-i { position: static; height: auto; }
.dimg-solo .dimg-i { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; animation: dimg-in .35s ease; }
.dimg-solo:not(.ok):not(.err) { background-image: linear-gradient(100deg, var(--panel-2) 30%, color-mix(in srgb, var(--panel-2) 55%, var(--panel)) 50%, var(--panel-2) 70%); background-size: 300% 100%; animation: dimg-shine 1.4s ease-in-out infinite; }
.dimg-solo.err { min-height: 160px; cursor: default; }
.dimg-prog { font-variant-numeric: tabular-nums; }
@keyframes dimg-in { from { opacity: 0; } to { opacity: 1; } }
