/* theme-moments v2 — 朋友圈风格（参照 icefox 3.0），支持深色模式与移动端 */
:root {
  --name-blue: #576b95;
  --text: #181818;
  --text-2: #4d4d4d;
  --gray: #737373;
  --gray-2: #b2b2b2;
  --line: #e6e6e6;
  --page-bg: #ededed;
  --col-bg: #ffffff;
  --social-bg: #f7f7f7;
  --chip-bg: #f7f7f7;
  --green: #07c160;
  --red: #e64340;
  --orange: #e67700;
  --popover-bg: #4c4c4c;
}
html[data-theme="dark"] {
  --name-blue: #7d90b2;
  --text: #e8e8e8;
  --text-2: #c8c8c8;
  --gray: #9a9a9a;
  --gray-2: #6f6f6f;
  --line: #333333;
  --page-bg: #0e0e0e;
  --col-bg: #191919;
  --social-bg: #232323;
  --chip-bg: #232323;
  --popover-bg: #2e2e2e;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--page-bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  transition: background .25s;
}
a { color: var(--name-blue); text-decoration: none; }
img { display: block; }
button { font-family: inherit; cursor: pointer; }

.page { max-width: 660px; margin: 0 auto; background: var(--col-bg); min-height: 100vh; box-shadow: 0 0 24px rgba(0,0,0,.06); position: relative; }

/* ===== 封面与顶部图标 ===== */
.cover { position: relative; height: 290px; background: linear-gradient(160deg, #2f3e50 0%, #50657e 55%, #7d93ad 100%); }
.cover > img { width: 100%; height: 100%; object-fit: cover; }
.cover-tools { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; padding: 12px 14px; z-index: 3; }
.cover-tools .tools-left { display: flex; gap: 10px; }
.tool-btn { width: 38px; height: 38px; border: none; border-radius: 50%; background: rgba(0,0,0,.28); color: #fff; font-size: 18px; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.tool-btn:active { background: rgba(0,0,0,.45); }
.profile-meta { position: relative; display: flex; justify-content: flex-end; align-items: flex-start; gap: 12px; padding: 0 18px; margin-top: -52px; z-index: 2; }
.profile-names { text-align: right; padding-top: 8px; max-width: 72%; }
.profile-name { color: #fff; font-size: 19px; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.55); line-height: 1.3; }
.profile-sign { color: rgba(255,255,255,.92); font-size: 12.5px; text-shadow: 0 1px 3px rgba(0,0,0,.55); margin-top: 4px; }
.profile-avatar { width: 74px; height: 74px; border-radius: 9px; border: 2px solid #fff; object-fit: cover; background: #fff; flex: none; }
.profile-avatar-fallback { display: flex; align-items: center; justify-content: center; background: var(--green); color: #fff; font-size: 30px; font-weight: 700; }
.site-tagline { text-align: right; padding: 10px 20px 2px; color: var(--gray); font-size: 13px; }
.main-nav { display: flex; gap: 24px; justify-content: flex-end; padding: 8px 20px 6px; font-size: 14px; }
.main-nav a { color: var(--text-2); }

/* ===== 动态流 ===== */
.feed { padding: 4px 20px 30px; }
.moment { display: flex; gap: 11px; padding: 17px 0 15px; border-bottom: 1px solid var(--line); }
.m-avatar { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; flex: none; background: #eee; }
.m-avatar-fallback { display: flex; align-items: center; justify-content: center; background: var(--green); color: #fff; font-size: 19px; font-weight: 700; }
.m-main { flex: 1; min-width: 0; }
.m-name { font-size: 15.5px; font-weight: 600; }
.badge { display: inline-block; font-size: 11px; line-height: 1; padding: 2.5px 5px; border-radius: 3px; margin-left: 6px; vertical-align: 2px; font-weight: 500; }
.badge-pin { color: var(--orange); border: 1px solid var(--orange); }
.badge-author { color: var(--red); border: 1px solid var(--red); }
.m-text { margin-top: 3px; font-size: 15px; line-height: 1.65; word-break: break-word; }
.m-text.clamped { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.m-expand { color: var(--name-blue); font-size: 14.5px; margin-top: 2px; display: inline-block; }
.m-full { margin-top: 3px; font-size: 15px; line-height: 1.75; word-break: break-word; }
.m-full p { margin: 0 0 .8em; }
.m-full img, .post-body img { max-width: 100%; height: auto; border-radius: 4px; margin: .4em 0; cursor: zoom-in; }
.m-full a, .post-body a { word-break: break-all; }
.m-cover { margin-top: 9px; }
.m-cover img { max-width: 76%; max-height: 320px; object-fit: cover; border-radius: 4px; cursor: zoom-in; }
.m-loc { margin-top: 8px; font-size: 13px; }
.m-loc a { margin-right: 10px; }
.m-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; position: relative; }
.m-time { font-size: 13px; color: var(--gray); }
.dots-btn { border: none; background: var(--social-bg); color: var(--gray); border-radius: 4px; width: 34px; height: 22px; font-size: 13px; letter-spacing: 1px; line-height: 1; }
.popover { position: absolute; right: 42px; top: 50%; transform: translateY(-50%); background: var(--popover-bg); border-radius: 6px; display: none; overflow: hidden; z-index: 4; }
.popover.open { display: flex; }
.popover button { background: none; border: none; color: #fff; font-size: 13.5px; padding: 8px 14px; white-space: nowrap; }
.popover button + button { border-left: 1px solid rgba(255,255,255,.18); }
.popover button.liked { color: #ff7a72; }

/* 互动区（点赞 + 评论） */
.m-social { margin-top: 9px; background: var(--social-bg); border-radius: 4px; padding: 7px 9px; font-size: 13.5px; }
.like-row { color: var(--text-2); display: flex; gap: 6px; align-items: baseline; }
.like-row .heart { color: var(--red); }
.like-btn-inline { background: none; border: none; color: var(--text-2); font-size: 13.5px; padding: 0; }
.like-btn-inline.liked { color: var(--red); }
.comment-list { margin-top: 2px; }
.like-row + .comment-list { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
.comment-line { line-height: 1.55; padding: 1.5px 0; word-break: break-word; }
.comment-line .c-name { color: var(--name-blue); font-weight: 600; }
.comment-line .c-content { display: inline; }
.comment-line .c-content p { display: inline; margin: 0; }
.comment-line img { display: inline-block; max-height: 1.4em; vertical-align: -0.25em; }
.m-comment-form { margin-top: 10px; }
.m-tags { margin-top: 7px; font-size: 13.5px; }
.m-tags a { margin-right: 10px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 22px 0 8px; font-size: 14px; color: var(--gray); }
.pager a { border: 1px solid var(--line); border-radius: 6px; padding: 5px 16px; color: var(--text-2); }
.load-more { text-align: center; color: var(--gray); font-size: 13.5px; padding: 20px 0 6px; display: none; }
.load-more.on { display: block; }
.empty { text-align: center; color: var(--gray); padding: 60px 0; }

/* ===== 详情页正文 ===== */
.post-h1 { font-size: 20px; line-height: 1.5; font-weight: 700; margin: 2px 0 4px; }
.post-body { margin-top: 10px; font-size: 16px; line-height: 1.85; word-break: break-word; }
.post-body p { margin: 0 0 1em; }
.post-body h1, .post-body h2, .post-body h3, .post-body h4 { line-height: 1.4; margin: 1.2em 0 .6em; }
.post-body h2 { font-size: 19px; } .post-body h3 { font-size: 17px; }
.post-body ul, .post-body ol { padding-left: 1.4em; margin-bottom: 1em; }
.post-body blockquote { border-left: 3px solid var(--line); padding: 2px 0 2px 12px; color: var(--text-2); margin: 0 0 1em; }
.post-body code { background: var(--social-bg); border-radius: 3px; padding: 1px 5px; font-size: .88em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.post-body pre { background: #282c34; color: #eee; border-radius: 6px; padding: 14px; overflow-x: auto; margin-bottom: 1em; }
.post-body pre code { background: none; padding: 0; color: inherit; }
.post-body table { border-collapse: collapse; max-width: 100%; display: block; overflow-x: auto; margin-bottom: 1em; }
.post-body th, .post-body td { border: 1px solid var(--line); padding: 6px 10px; }
.comment-box { margin-top: 24px; }

/* ===== 归档时间线 ===== */
.section-title { font-size: 18px; font-weight: 700; padding: 20px 0 10px; }
.section-sub { color: var(--gray); font-size: 13px; padding-bottom: 8px; }
.arch-year { font-size: 22px; font-weight: 700; margin: 20px 0 10px; }
.arch-row { display: flex; gap: 12px; margin-bottom: 10px; }
.arch-date { flex: none; width: 52px; text-align: right; line-height: 1.25; padding-top: 8px; }
.arch-date .d { font-size: 21px; font-weight: 700; }
.arch-date .mo { font-size: 12px; color: var(--gray); }
.arch-card { flex: 1; background: var(--social-bg); border-radius: 6px; padding: 10px 12px; min-width: 0; }
.arch-card a { color: var(--text); font-size: 14.5px; display: block; }
.arch-card .a-ex { color: var(--gray); font-size: 12.5px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chip-wall { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 0 26px; }
.chip { background: var(--chip-bg); border-radius: 999px; padding: 6px 14px; font-size: 14px; color: var(--text); }
.chip small { color: var(--gray); margin-left: 4px; }
.author-head { display: flex; gap: 14px; align-items: center; padding: 22px 0 6px; }
.author-head img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.author-head .an { font-size: 18px; font-weight: 700; }
.author-head .ab { color: var(--gray); font-size: 13.5px; margin-top: 2px; }

/* ===== 弹窗 ===== */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; z-index: 50; padding: 18px; }
.modal-mask.open { display: flex; }
.modal { background: var(--col-bg); border-radius: 12px; width: 100%; max-width: 420px; max-height: 82vh; overflow-y: auto; padding: 18px; position: relative; }
.modal h3 { font-size: 16px; margin-bottom: 14px; }
.modal .modal-x { position: absolute; top: 10px; right: 14px; background: none; border: none; font-size: 20px; color: var(--gray); }
.modal .group-title { font-size: 13px; color: var(--gray); margin: 16px 0 8px; }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; border: 1px solid var(--line); background: var(--col-bg); color: var(--text); border-radius: 8px; padding: 9px 12px; font-size: 14.5px; min-width: 0; }
.search-row button, .btn-green { background: var(--green); color: #fff; border: none; border-radius: 8px; padding: 9px 16px; font-size: 14.5px; }
.tag-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-pills a { background: var(--chip-bg); color: var(--text); border-radius: 999px; padding: 5px 12px; font-size: 13.5px; }
.mode-row { display: flex; align-items: center; justify-content: space-between; }
.mode-toggle { border: 1px solid var(--line); background: var(--chip-bg); color: var(--text); border-radius: 8px; padding: 8px 16px; font-size: 14px; }
.link-card { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); color: var(--text); }
.link-card:last-child { border-bottom: none; }
.link-card img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: none; }
.link-card .l-name { font-size: 15px; font-weight: 600; }
.link-card .l-desc { font-size: 12.5px; color: var(--gray); }
.link-card .l-arrow { margin-left: auto; color: var(--gray-2); }
.login-links { display: flex; flex-direction: column; gap: 10px; }
.login-links a { text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 10px; color: var(--text); font-size: 15px; }

/* ===== 灯箱 / 回顶 ===== */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); display: none; align-items: center; justify-content: center; z-index: 60; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 96vw; max-height: 92vh; object-fit: contain; }
.lightbox .lb-x { position: absolute; top: 14px; right: 18px; background: none; border: none; color: #fff; font-size: 28px; }
.to-top { position: fixed; right: 22px; bottom: 30px; width: 46px; height: 46px; border-radius: 50%; border: none; background: var(--green); color: #fff; font-size: 20px; display: none; z-index: 40; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.to-top.on { display: block; }

/* 页脚：按站长要求保持空白 */
.site-footer { height: 10px; }

@media (max-width: 700px) {
  .page { max-width: none; box-shadow: none; }
  .cover { height: 235px; }
  .feed { padding: 4px 16px 26px; }
  .m-cover img { max-width: 84%; }
  .profile-avatar { width: 66px; height: 66px; }
  .profile-meta { margin-top: -46px; padding: 0 14px; }
  .modal { max-width: none; }
  .arch-date { width: 44px; }
}
