/* 详情页：上半部分参考小红书笔记页（作者顶栏 / 图集轮播 / 话题标签 / 评论区 / 底部操作栏），
   下半部分参考夸克「更多推荐」（灰底 + 圆角卡片流）。颜色变量沿用 style.css 的 :root */

:root { --tag: #2D6FB7; --act-h: 52px; }
@media (prefers-color-scheme: dark) { :root { --tag: #7FAEE6; } }

body.dt { background: var(--bg); padding-bottom: calc(var(--act-h) + env(safe-area-inset-bottom)); }
.dt-paper { background: var(--surface); border-radius: 0 0 18px 18px; padding-bottom: 6px; }

/* ===== 顶栏 ===== */
.dt-bar { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 4px;
  height: 48px; padding: 0 6px; background: var(--surface); }
.dt-bar.scrolled { box-shadow: 0 1px 0 var(--line); }
.dt-icon { flex: none; width: 38px; height: 38px; display: grid; place-items: center; color: var(--ink); }
.dt-icon svg { width: 22px; height: 22px; }
.bar-mid { flex: 1; min-width: 0; height: 100%; position: relative; overflow: hidden; }
.bar-author, .bar-title { position: absolute; inset: 0; display: flex; align-items: center; transition: transform .25s, opacity .25s; }
.bar-title { margin: 0; font-size: 16px; font-weight: 600; transform: translateY(100%); opacity: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 48px; }
.dt-bar.show-title .bar-author { transform: translateY(-100%); opacity: 0; }
.dt-bar.show-title .bar-title { transform: none; opacity: 1; }
.bar-author { gap: 8px; }
.b-ava { flex: none; width: 30px; height: 30px; border-radius: 50%; overflow: hidden; background: var(--surface-2);
  display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.b-ava img { width: 100%; height: 100%; object-fit: cover; }
.b-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 头像 + 名字整块可点，进自媒体主页 */
.b-author { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; color: inherit; }
/* 关注：浅红底小方角按钮（延续旧站作者行的关注样式），不用描边胶囊 */
.b-follow { flex: none; display: flex; align-items: center; gap: 2px; height: 26px; padding: 0 10px 0 7px; border-radius: 6px;
  background: rgba(229, 50, 45, .09); color: var(--brand); font-size: 13px; font-weight: 600; }
.b-follow svg { width: 13px; height: 13px; }
.b-follow.on { padding: 0 10px; background: var(--surface-2); color: var(--ink-3); font-weight: 400; }
.b-follow.on svg { display: none; }

/* ===== 图集轮播（小红书式：首图定比例，3:4 ~ 4:3 之间） ===== */
.gal { position: relative; background: var(--surface-2); }
/* touch-action: pan-y：纵向手势交给浏览器滚页面，横向手势由 detail.js 接管切图。
   内层用 transform 平移（合成层），比改 scrollLeft 跟手 */
.gal-track { overflow: hidden; touch-action: pan-y; }
.gal-inner { display: flex; width: 100%; }
.gal-item { flex: 0 0 100%; display: grid; place-items: center; background: var(--surface-2); }
/* 去掉图片自带的拖拽行为，避免滑动时整张图被拖着走；长按「存储图像」保留，图集用户常要存图 */
.gal-item img { width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; user-select: none; }
.gal-count { position: absolute; top: 12px; right: 12px; padding: 2px 9px; border-radius: 11px;
  background: rgba(0, 0, 0, .45); color: #fff; font-size: 12px; font-variant-numeric: tabular-nums; }
.gal-dots { display: flex; justify-content: center; gap: 5px; padding: 10px 0 0; }
.gal-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--line); transition: background .2s, width .2s; }
.gal-dots i.on { background: var(--brand); width: 12px; border-radius: 3px; }
.gal-cap { min-height: 3.4em; padding: 10px 16px 0; font-size: 15px; line-height: 1.7; color: var(--ink-2); }

/* ===== 标题 / 正文 ===== */
.dt-head { padding: 16px 16px 0; }
.dt-title { font-size: 21px; line-height: 1.45; font-weight: 700; word-break: break-word; }
/* 正文格式以内容为准：fawen 的段首缩进是编辑在运营后台手打的全角空格，不设 text-indent、不 trim */
.dt-body { padding: 14px 16px 0; font-size: 17px; line-height: 1.8; color: var(--ink); word-break: break-word; overflow-wrap: anywhere; }
.dt-body p { margin: 0 0 1em; }
.dt-body h1, .dt-body h2, .dt-body h3 { font-size: 18px; line-height: 1.6; margin: 1.4em 0 .6em; }
.dt-body strong, .dt-body b { font-weight: 700; }
.dt-body a { color: var(--tag); }
.dt-body img { max-width: 100%; height: auto; margin: 4px auto; border-radius: 10px; background: var(--surface-2); }
.dt-body video { display: block; width: 100%; max-height: 72vh; margin: 4px 0 1em; border-radius: 10px; background: #000; object-fit: contain; }
.dt-body .a-cap { margin-top: -.3em; font-size: 13px; line-height: 1.6; color: var(--ink-3); text-align: center; }

/* 话题标签 + 发布信息（小红书） */
/* 标签：接口下发的文章关键词，沿用旧站的灰色小标签（描边 + 12px 灰字），不做成话题样式 */
.dt-tags { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 0; }
.dt-tags span { padding: 2px 6px 3px; border: 1px solid var(--line); border-radius: 3px; font-size: 12px; line-height: 1; color: var(--ink-3); }
.dt-meta { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 14px; font-size: 13px; color: var(--ink-3); }
.dt-meta .from { max-width: 60%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ===== 评论区（小红书） ===== */
.cmt { margin: 0 16px; padding: 16px 0 8px; border-top: 1px solid var(--line); }
.cmt-total { font-size: 14px; color: var(--ink-2); }
.cmt-box { display: flex; align-items: center; gap: 10px; margin: 14px 0 6px; }
.cmt-box .b-ava { width: 32px; height: 32px; }
.cmt-box button { flex: 1; height: 36px; padding: 0 14px; border-radius: 18px; background: var(--surface-2); color: var(--ink-3); font-size: 14px; text-align: left; }
.cmt-item { display: flex; gap: 10px; padding: 14px 0 12px; }
.cmt-item + .cmt-item { border-top: 1px solid var(--line); }
.cmt-item .b-ava { width: 32px; height: 32px; }
.cmt-main { flex: 1; min-width: 0; }
.cmt-nick { font-size: 13px; color: var(--ink-3); }
.cmt-msg { margin-top: 4px; font-size: 15px; line-height: 1.6; word-break: break-word; }
.cmt-when { margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.cmt-like { flex: none; align-self: flex-start; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 32px; font-size: 11px; color: var(--ink-3); }
.cmt-like svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.cmt-like.on { color: var(--brand); }
.cmt-like.on svg { fill: currentColor; }
.cmt-empty { padding: 18px 0 14px; text-align: center; font-size: 13px; color: var(--ink-3); }

/* ===== 更多推荐（夸克：灰底 + 圆角卡片） ===== */
.rec-head { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 22px 0 12px; font-size: 13px; color: var(--ink-3); }
.rec-head::before, .rec-head::after { content: ""; width: 48px; height: 1px; background: var(--ink-3); opacity: .35; }
.rec-card { display: block; margin: 0 0 10px; padding: 14px 16px 16px; background: var(--surface); border-radius: 16px; }
.rec-by { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.rec-by .b-ava { width: 16px; height: 16px; font-size: 9px; }
.rec-by .sep { width: 1px; height: 10px; background: var(--line); }
.rec-t { margin-top: 8px; font-size: 18px; line-height: 1.5; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rec-pics { display: grid; gap: 4px; margin-top: 12px; border-radius: 10px; overflow: hidden; }
.rec-pics span { background: var(--surface-2) center / cover no-repeat; }
.rec-pics.n1 span { aspect-ratio: 16 / 9; }
.rec-pics.n2 { grid-template-columns: 1fr 1fr; }
.rec-pics.n2 span { aspect-ratio: 1; }
.rec-pics.n3 { grid-template-columns: 1fr 1fr 1fr; }
.rec-pics.n3 span { aspect-ratio: 1; }
.rec-end { padding: 14px 0 22px; text-align: center; font-size: 13px; color: var(--ink-3); }
.rec-end a { color: var(--ink-2); }

/* ===== 底部操作栏 ===== */
.dt-act { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; display: flex; align-items: center; gap: 2px;
  height: calc(var(--act-h) + env(safe-area-inset-bottom)); padding: 0 8px env(safe-area-inset-bottom) 12px;
  background: var(--surface); box-shadow: 0 -1px 0 var(--line); }
.act-input { flex: 1; min-width: 0; height: 36px; display: flex; align-items: center; gap: 6px; padding: 0 14px; margin-right: 6px;
  border-radius: 18px; background: var(--surface-2); color: var(--ink-3); font-size: 14px; }
.act-input svg { width: 16px; height: 16px; }
/* 纯净版没有写评论和评论按钮，剩下的点赞/分享平分布 */
.dt-act.act-pure .act-btn { flex: 1; }
.act-btn { flex: none; min-width: 52px; height: 44px; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 0 4px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.act-btn svg { width: 23px; height: 23px; }
.act-btn .heart { fill: none; stroke: currentColor; stroke-width: 1.7; }
.act-btn.liked { color: var(--brand); }
.act-btn.liked .heart { fill: currentColor; animation: pop .35s ease; }
@keyframes pop { 40% { transform: scale(1.3); } 100% { transform: scale(1); } }

/* 写评论 / 分享面板 / 分享图 / toast 的样式在 share.css（与视频页共用） */

/* 文章已删除：与旧站 404 页一致的版式 */
.dt-404 { padding: 72px 24px 8px; text-align: center; }
.dt-404 img { width: 52%; max-width: 220px; height: auto; }
.dt-404 p { margin-top: 24px; font-size: 16px; color: var(--ink-3); }
