/* ============================================================
   拾光集 · 博客样式
   方向：纸感瓷白底 + 黛青（青瓷）强调，衬线中文标题，安静排版
   签名元素：首页时间线左侧的书口式刻度节点 + 站名旁的描边方印
   ============================================================ */

:root {
  --bg: #fafaf8;
  --ink: #26292e;
  --ink-soft: #4c5259;
  --muted: #7a8087;
  --line: #e5e7e2;
  --accent: #36625a;
  --accent-bright: #4a8578;
  --wash: #f0f4f1;      /* 淡青瓷：代码底、徽标底 */
  --warn-bg: #faf3e0;
  --warn-ink: #8a6d1f;
  --serif: Georgia, 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'SimSun', serif;
  --sans: -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, 'SF Mono', Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17191b;
    --ink: #d8dbd6;
    --ink-soft: #b7bcb6;
    --muted: #828984;
    --line: #2c3033;
    --accent: #5fa593;
    --accent-bright: #7dbbaa;
    --wash: #1f2422;
    --warn-bg: #322b18;
    --warn-ink: #d8b95c;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.8;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-bright); text-decoration: underline; text-underline-offset: 3px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

/* ---------- 页头：方印 + 站名 ---------- */

.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8vh 0 48px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }

.seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 2px solid var(--accent);
  border-radius: 3px;
  color: var(--accent);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1;
  flex: none;
}

.brand-name {
  font-family: var(--serif);
  font-size: 21px;
  letter-spacing: 0.12em;
}

.site-nav { display: flex; gap: 20px; font-size: 14px; }

/* ---------- 首页时间线（签名元素） ---------- */

.timeline {
  list-style: none;
  margin: 0 0 64px;
  padding: 0;
  position: relative;
}

/* 时间纵轴：一条细线贯穿所有刻度 */
.timeline::before {
  content: '';
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: calc(92px + 11px);
  width: 1px;
  background: var(--line);
}

.tl-item {
  display: grid;
  grid-template-columns: 92px 24px 1fr;
  column-gap: 0;
  padding: 26px 0;
}

.tl-date {
  color: var(--muted);
  font-size: 12.5px;
  padding-top: 9px;
  letter-spacing: 0.02em;
}

/* 书口刻度：小方块，悬停变圆，是整个设计的记忆点 */
.tl-node {
  width: 9px;
  height: 9px;
  margin-top: 12px;
  background: var(--accent);
  justify-self: center;
  border-radius: 1px;
  transition: border-radius 0.25s ease, background 0.25s ease;
}

.tl-item:hover .tl-node { border-radius: 50%; background: var(--accent-bright); }

.tl-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.5;
  margin: 0 0 6px;
}
.tl-title a { color: var(--ink); }
.tl-title a:hover { color: var(--accent); text-decoration: none; }

.tl-excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.75;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.badge {
  display: inline-block;
  margin-left: 10px;
  padding: 1px 8px;
  background: var(--wash);
  color: var(--accent);
  font-size: 12px;
  font-family: var(--sans);
  font-weight: 400;
  border-radius: 3px;
  vertical-align: 3px;
}

/* ---------- 文章页 ---------- */

.crumb { margin: 0 0 28px; font-size: 13.5px; }

.post-title {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.45;
  margin: 0 0 10px;
}

.post-meta {
  margin: 0 0 40px;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.post-meta .badge { vertical-align: baseline; margin: 0; }

/* 正文排版 */
.prose {
  font-size: 16.5px;
  line-height: 1.95;
  animation: fadein 0.4s ease;
}

@keyframes fadein {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.prose p { margin: 0 0 1.25em; }

.prose h1, .prose h2, .prose h3, .prose h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.5;
  margin: 2em 0 0.8em;
}

/* 中文小节标题：左侧一短横黛青标记 */
.prose h2::before, .prose h3::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 3px;
  background: var(--accent);
  margin-right: 12px;
  vertical-align: 6px;
}

.prose h2 { font-size: 21px; }
.prose h3 { font-size: 18px; }

.prose blockquote {
  margin: 1.5em 0;
  padding: 12px 20px;
  border-left: 3px solid var(--accent);
  background: var(--wash);
  color: var(--ink-soft);
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--wash);
  padding: 2px 6px;
  border-radius: 3px;
}

.prose pre {
  background: var(--wash);
  border: 1px solid var(--line);
  padding: 16px 18px;
  overflow-x: auto;
  line-height: 1.7;
  font-size: 14px;
}
.prose pre code { background: none; padding: 0; font-size: inherit; }

.prose img { max-width: 100%; height: auto; }

.prose hr {
  border: none;
  text-align: center;
  margin: 2.5em 0;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--line) 30%, var(--line) 70%, transparent);
}

.prose table { border-collapse: collapse; margin: 1.5em 0; width: 100%; font-size: 15px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 7px 12px; text-align: left; }
.prose th { background: var(--wash); }

/* ---------- 评论区 ---------- */

.comments { margin-top: 72px; border-top: 1px solid var(--line); padding-top: 40px; }

.comments-title {
  font-family: var(--serif);
  font-size: 19px;
  margin: 0 0 20px;
}
.comments-title .count { color: var(--muted); font-size: 14px; margin-left: 4px; }

.comment-list { list-style: none; margin: 0 0 32px; padding: 0; }

.comment {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 14px 18px;
  margin-bottom: 12px;
}

.comment-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 14px;
}
.comment-head time { font-size: 12px; }

.comment-body { margin: 6px 0 0; font-size: 15px; white-space: pre-wrap; word-break: break-word; }

.comment form { margin: 6px 0 0; }

/* 评论表单 */
.comment-form label, .editor label, .auth-card label {
  display: block;
  margin-bottom: 16px;
}

.label-text {
  display: block;
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

input[type='text'], input[type='password'], input[type='email'], textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  transition: border-color 0.15s ease;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

textarea { resize: vertical; }

.form-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-foot { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.form-foot .hint { font-size: 12.5px; }

/* 蜜罐：视觉上不存在，但机器人会填 */
.hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-block;
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}
.btn.primary:hover { background: var(--accent-bright); border-color: var(--accent-bright); color: #fff; }

.linkish {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 13.5px;
  color: var(--accent);
  cursor: pointer;
}
.linkish:hover { color: var(--accent-bright); text-decoration: underline; }
.linkish.danger { color: #a04545; }
.linkish.danger:hover { color: #c25a5a; }

/* ---------- 提示条 ---------- */

.flash {
  padding: 10px 16px;
  border-radius: 3px;
  font-size: 14px;
  margin: 0 0 18px;
}
.flash.ok { background: var(--wash); color: var(--accent); }
.flash.warn { background: var(--warn-bg); color: var(--warn-ink); }

/* ---------- 空状态 / 404 ---------- */

.empty {
  text-align: center;
  padding: 14vh 0;
  color: var(--muted);
}
.empty a { display: inline-block; margin-top: 8px; }

/* ---------- 登录页 ---------- */

.auth-card {
  max-width: 340px;
  margin: 0 auto;
  padding: 10vh 0 64px;
}
.auth-card h1 {
  font-family: var(--serif);
  font-size: 24px;
  margin: 0 0 24px;
}
.auth-card .hint { margin-top: 20px; }

/* ---------- 后台 ---------- */

.admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.admin-bar h1 { font-family: var(--serif); font-size: 24px; margin: 0; }

.admin-actions { display: flex; align-items: center; gap: 14px; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
.admin-table th {
  text-align: left;
  font-weight: 400;
  color: var(--muted);
  font-size: 12.5px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.admin-table td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.admin-table .actions { white-space: nowrap; text-align: right; }
.admin-table .actions > a,
.admin-table .actions > form { display: inline-block; margin-left: 12px; }
.admin-table form { margin: 0; }

.section-title { font-family: var(--serif); font-size: 19px; margin: 44px 0 16px; }

/* 编辑器 */
.editor { margin-bottom: 32px; }
.editor .editor-md {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.8;
  min-height: 420px;
}
.editor .check { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.editor .check input { width: auto; }
.editor-actions { display: flex; gap: 12px; margin-top: 8px; }

.preview {
  border: 1px dashed var(--line);
  padding: 24px;
  margin-bottom: 64px;
}

/* ---------- 页脚 ---------- */

.site-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 40px 0 32px;
  margin-top: 72px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

/* ---------- 响应式 ---------- */

@media (max-width: 560px) {
  .site-head { padding: 40px 0 32px; }
  .timeline::before, .tl-node { display: none; }
  .tl-item { grid-template-columns: 1fr; padding: 20px 0; row-gap: 4px; }
  .tl-date { padding-top: 0; }
  .form-row2 { grid-template-columns: 1fr; gap: 0; }
  .admin-actions { flex-wrap: wrap; }
  .post-title { font-size: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
