/* 寻梦日记 · 站点主题（Robes 风格：左侧边栏 + 右侧内容区）
 *
 * 设计要点：
 * - **移动优先**：基础样式按窄屏编写（侧边栏为抽屉，隐藏于视口外），
 *   ≥ 920px 时才切换为「固定侧边栏 + 内容区」的两栏桌面布局。
 * - **深浅双主题**：CSS 变量统一管理配色，`<html data-theme="dark">`
 *   切换深色；主题记忆由 app.js 写入 localStorage。
 * - **零外部依赖**：图标全部来自 index.html 内联的 SVG 精灵。
 */

:root {
  --bg: #f4f6fa;
  --bg-soft: #eef1f7;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --ink: #2b3648;
  --ink-2: #4a5668;
  --ink-mute: #8d97a8;
  --line: #e6eaf1;
  --line-soft: #eef1f6;
  --brand: #4a7fb5;
  --brand-soft: #e8f1f9;
  --brand-ink: #2f6ea8;
  --accent: #b5654a;
  --chip-bg: #eef2f8;
  --chip-ink: #5a6779;
  --shadow-sm: 0 1px 2px rgba(43, 54, 72, 0.04);
  --shadow: 0 2px 10px rgba(43, 54, 72, 0.06);
  --shadow-lg: 0 10px 30px rgba(43, 54, 72, 0.10);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 248px;
  --gutter: 20px;
  --maxw: 860px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

html[data-theme='dark'] {
  --bg: #161a21;
  --bg-soft: #1b2029;
  --panel: #1e232c;
  --panel-2: #232935;
  --ink: #e6eaf2;
  --ink-2: #c3cad6;
  --ink-mute: #8b95a6;
  --line: #2b323d;
  --line-soft: #262c36;
  --brand: #6ba3d8;
  --brand-soft: #22303f;
  --brand-ink: #8fbde7;
  --accent: #d9917a;
  --chip-bg: #262d38;
  --chip-ink: #aab3c2;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 12px 34px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 2;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; 
  text-decoration: none;
}
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: inline-block;
  fill: none;
  stroke: currentColor;
  color: inherit;
  vertical-align: middle;
}

/* ---------------- 布局骨架 ---------------- */
.layout {
  min-height: calc(100vh + 32px);
  display: flex;
  flex-direction: column;
  max-width: 970px;
  margin: 0 auto;
  background: var(--panel);
}

.main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1 1 auto;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 8px var(--gutter) 40px;
}

.empty {
  text-align: center;
  color: var(--ink-mute);
  padding: 48px 12px;
}

/* ---------------- 侧边栏 ---------------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  width: min(80vw, var(--sidebar-w));
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior: contain;
  transform: translateX(-102%);
  transition: transform 0.24s ease;
  background: var(--panel);
}
.sidebar::-webkit-scrollbar {
  display: none;
}
.sidebar.open { transform: none; box-shadow: var(--shadow-lg); }

.scrim {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(20, 26, 36, 0.42);
  backdrop-filter: blur(2px);
}

.scrim[hidden] { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 14px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.brand-text { min-width: 0; flex: 1 1 auto; }

.brand-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 12px;
  color: var(--ink-mute);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sidebar-close { display: inline-flex; }

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14.5px;
  transition: background 0.16s, color 0.16s;
}

.nav-item .icon { color: var(--ink-mute); }
.nav-item:hover { background: var(--bg-soft); color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.nav-item.active .icon { color: var(--brand-ink); }

.side-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.side-block[hidden] { display: none; }

.side-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--ink-mute);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
  margin: 10px 0;
}

.side-block-head .icon {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.side-block-head.collapsed .icon { transform: rotate(-90deg); }
.side-block-body.collapsed { display: none; }


.side-block-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 46vh;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.16s, color 0.16s;
}

.side-link .icon { width: 16px; height: 16px; color: var(--ink-mute); }
.side-link:hover { background: var(--bg-soft); color: var(--ink); }
.side-link.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.side-link.active .icon { color: var(--brand-ink); }

.side-link-text {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-count {
  flex: 0 0 auto;
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--ink-mute);
  font-size: 11.5px;
  text-align: center;
}

.side-link.active .side-count { background: rgba(74, 127, 181, 0.16); color: var(--brand-ink); }

.status{
  margin-bottom: 16px;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px var(--gutter);
  background: var(--panel);
}

.search-wrap {
  position: relative;
  flex: 1 1 auto;
  max-width: 420px;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--ink-mute);
  pointer-events: none;
}

.search {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.search:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}

.icon-btn:hover { background: var(--bg-soft); color: var(--ink); border-color: var(--brand); }

.count-badge {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand-ink);
  font-variant-numeric: tabular-nums;
}

.menu-btn { flex: 0 0 auto; }

/* ---------------- 列表卡片 ---------------- */
.entries {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.entry {
  display: block;
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
}

.entry:hover {
  box-shadow: var(--shadow);
  border-color: var(--brand);
  transform: translateY(-1px);
}

.entry-head { margin-bottom: 8px; }

.entry-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
  margin: 0 0 6px;
  color: var(--ink);
  word-wrap: break-word;
  word-break: break-all;
  position: relative;
}

.entry-title a { color: inherit; text-decoration: none; }
.entry-title a:hover { color: var(--brand-ink); }

.entry-summary {
  margin: 0 0 10px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.75;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  color: var(--ink-mute);
  font-size: 12.5px;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.meta-item .icon { width: 14px; height: 14px; }

.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--chip-ink);
  font-size: 12px;
  line-height: 1.7;
}

.chip-link { text-decoration: none; cursor: pointer; }
.chip-link:hover {color: var(--brand-ink); }
.chip.mute { color: var(--ink-mute); }

/* ---------------- 详情页 ---------------- */

.detail-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 10px;
  color: var(--ink);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--brand-ink);
  text-decoration: none;
  font-size: 13px;
}

.back-link:hover { text-decoration: underline; }

/* 封面图 + 叠加标题（详情页头图） */
.detail-cover {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(135deg, var(--brand-soft), var(--bg-soft));
  min-height: 190px;
  display: flex;
  align-items: flex-end;
}

.detail-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-cover-overlay {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 22px 20px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.55) 78%);
  color: #fff;
}

.detail-cover-overlay .detail-title { color: #fff; margin-bottom: 8px; }

.detail-cover-overlay .entry-meta { color: rgba(255, 255, 255, 0.88); }
.detail-cover-overlay .chip { background: rgba(255, 255, 255, 0.18); color: #fff; }

/* 详情页信息胶囊 */
.info-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12.5px;
  box-shadow: var(--shadow-sm);
}

.pill .icon { width: 14px; height: 14px; color: var(--ink-mute); }

.detail-body {
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 22px 20px;
  font-size: 15.5px;
  color: var(--ink);
  word-wrap: break-word;
  word-break: break-all;
  position: relative;
}

.updated-date {
color: var(--ink-mute);
  font-size: 13px;
  text-align: right;
}

/* GEO 地理位置信息块：详情页在坐标齐全时展示地点名 + 坐标 + 地图入口 */
.geo-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 14px 0 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  font-size: 13px;
  color: var(--ink-2);
}

.geo-info .geo-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--ink);
}

.geo-info .geo-name .icon { width: 15px; height: 15px; color: var(--accent); }

.geo-info .geo-coord {
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
}

.geo-info .geo-map {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--brand-ink);
  text-decoration: none;
  font-size: 12.5px;
  transition: background 0.16s, border-color 0.16s;
}

.geo-info .geo-map:hover { background: var(--brand-soft); border-color: var(--brand); }
.geo-info .geo-map .icon { width: 14px; height: 14px; }

.detail-body p { margin:0 0 15px 0; }
.detail-body p:last-child { margin-bottom: 0; }
.detail-body h1, .detail-body h2, .detail-body h3 {
  line-height: 1.4;
  margin: 22px 0 10px;
  color: var(--ink);
}
.detail-body img.img-block, .detail-body img.doodle-block {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  margin: 14px 0;
}
.detail-body .video-block, .detail-body .audio-block { width: 100%; margin: 14px 0; }
.detail-body ul, .detail-body ol { padding-left: 22px; margin: 10px 0 14px; }
.detail-body .todo-list { list-style: none; padding-left: 4px; }
.detail-body .todo-item { display: flex; align-items: flex-start; gap: 8px; }
.detail-body .todo-item input { margin-top: 6px; }
.detail-body blockquote {
  margin: 14px 0;
  padding: 10px 16px;
  border-left: 3px solid var(--brand);
  background: var(--panel-2);
  border-radius: 0 10px 10px 0;
  color: var(--ink-2);
}
.detail-body .file-link {
  display: inline-block;
  margin: 10px 0;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--brand-ink);
  text-decoration: none;
}
.detail-body hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

.media-excluded {
  padding: 10px 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--ink-mute);
  font-size: 13px;
}

/* 点赞条 */
.like-bar {
  display: flex;
  justify-content: center;
}

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}

.like-btn:hover { color: var(--accent); border-color: var(--accent); }
.like-btn.liked { color: var(--accent); border-color: var(--accent); background: var(--panel-2); }
.like-btn .icon { width: 17px; height: 17px; }

.like-count {
  padding-left: 8px;
  margin-left: 2px;
  border-left: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

/* 上一篇 / 下一篇 */
.post-nav {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.post-nav-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  text-decoration: none;
  transition: border-color 0.16s, background 0.16s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-nav-item:hover { border-color: var(--brand); background: var(--bg-soft); }
.post-nav-item.next { text-align: right; }
.post-nav-label { color: var(--ink-mute); font-size: 12.5px; }
.post-nav-title {
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.related-title {
  margin: 0 0 10px;
  font-weight: bold;
  font-size: 15px;
}

.related-list { display: flex; flex-direction: column; gap: 10px; }

.related-item {
  color: var(--brand-ink);
  text-decoration: none;
  font-size: 14.5px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.related-item:hover {color: var(--ink);}

/* ---------------- 评论区 ---------------- */
.comments {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}

.comments-title {
  font-size: 17px;
  margin: 0 0 12px;
  color: var(--ink);
}

/* ---------------- 分页 / 加载更多 ---------------- */
.list-footer {
  display: flex;
  justify-content: center;
  padding: 22px 0 6px;
}

.load-more {
  padding: 9px 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--brand-ink);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.16s, border-color 0.16s;
}

.load-more:hover { background: var(--brand-soft); border-color: var(--brand); }
.load-sentinel { height: 1px; }

/* ---------------- 页脚 ---------------- */
.site-footer {
  color: var(--ink-mute);
  font-size: 13px;
  word-wrap: break-word;
  word-break: break-all;
  position: relative;
}

.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
}

.dot { opacity: 0.6; }

/*面包屑*/
.breadcrumb-item {
  margin: 0 10px;
  color: var(--ink-mute);
  font-size: 13px;
}
.breadcrumb-span{
  color: var(--ink-mute);
}

/* ---------------- 响应式：≥ 920px 切换两栏布局 ---------------- */
@media (min-width: 920px) {
  .layout { flex-direction: row; }

  .sidebar {
    position: sticky;
    top: 0;
    width: var(--sidebar-w);
    height: 100vh;
    flex: 0 0 var(--sidebar-w);
    transform: none;
  }

  .sidebar-close,
  .menu-btn { display: none; }

  .scrim { display: none !important; }

  .content { padding: 18px 32px; }
  .topbar { padding: 16px 22px; }
  .footer-inner { padding: 18px 32px; }

  .entry { padding: 20px 24px; }

  .post-nav { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1240px) {
  .content { padding-left: 40px; padding-right: 40px; }
  .footer-inner { padding-left: 40px; padding-right: 40px; }
}
