/* ==========================================================
   Kayuma 的独立博客 —— 杂志式极简排版 + 深浅双主题
   ========================================================== */
* { box-sizing: border-box; }

:root {
  --paper: #f8f6f1;
  --ink: #26241f;
  --ink-soft: #6f6a60;
  --hairline: #d8d2c4;
  --accent: #9e3b2c;
  --field: #fffdf8;
  --code: #eee9df;
}
[data-theme="dark"] {
  --paper: #16181d;
  --ink: #d8d3c7;
  --ink-soft: #8d887c;
  --hairline: #34383f;
  --accent: #cf7a63;
  --field: #1d2026;
  --code: #22262d;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  line-height: 1.8;
  font-size: 16px;
  transition: background 0.25s, color 0.25s;
}

a { color: inherit; text-decoration: none; }

/* ---- 顶栏 ---- */
.blog-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  max-width: 880px;
  margin: 0 auto;
  padding: 14px 20px;
  border-bottom: 1px solid var(--hairline);
  font-size: 13px;
}
.blog-back { color: var(--ink-soft); white-space: nowrap; }
.blog-back:hover { color: var(--accent); }
.blog-nav { display: flex; gap: 16px; margin-left: auto; align-items: center; }
.blog-nav a { color: var(--accent); letter-spacing: 0.06em; }
#theme-btn {
  background: none;
  border: 1px solid var(--hairline);
  color: var(--ink-soft);
  font-size: 13px;
  width: 30px;
  height: 26px;
  cursor: pointer;
  line-height: 1;
}
#theme-btn:hover { border-color: var(--accent); color: var(--accent); }
.blog-search input {
  font-family: inherit;
  font-size: 13px;
  width: 120px;
  padding: 5px 10px;
  border: 1px solid var(--hairline);
  background: var(--field);
  color: var(--ink);
}
.blog-search input:focus { outline: none; border-color: var(--accent); width: 160px; }

/* ---- 提示条 ---- */
.blog-flash { max-width: 880px; margin: 12px auto 0; padding: 0 20px; }
.bf { padding: 9px 14px; font-size: 14px; border-left: 3px solid var(--accent);
      background: var(--code); margin-bottom: 8px; }
.bf-warn { border-left-color: #b98a2f; }

/* ---- 报头 ---- */
.blog-main { max-width: 880px; margin: 0 auto; padding: 0 20px 60px; }

.masthead {
  text-align: center;
  padding: 64px 0 40px;
  border-bottom: 3px double var(--ink);
  margin-bottom: 8px;
}
.masthead-small { padding: 44px 0 28px; }
.masthead-title {
  margin: 0;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.25;
}
.masthead-sub {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  letter-spacing: 0.28em;
}
.masthead-stats { margin: 18px 0 0; font-size: 13px; color: var(--ink-soft); letter-spacing: 0.1em; }
.masthead-stats a { color: var(--accent); }

/* ---- 年份与列表 ---- */
.year-block { margin-top: 40px; }
.year-label {
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 0.3em;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 8px;
  margin-bottom: 6px;
}
.entry { padding: 26px 0; border-bottom: 1px solid var(--hairline); }
.entry:last-child { border-bottom: none; }
.entry-meta { font-size: 12.5px; color: var(--ink-soft); letter-spacing: 0.08em; }
.entry-dot { margin: 0 6px; }
.draft-mark {
  display: inline-block;
  margin-left: 8px;
  padding: 0 7px;
  font-size: 11px;
  color: var(--accent);
  border: 1px solid var(--accent);
  letter-spacing: 0.15em;
}
.entry-title { margin: 8px 0 6px; font-size: 27px; font-weight: 700; line-height: 1.45; }
.entry-title a:hover { color: var(--accent); }
.entry-excerpt { margin: 0; color: var(--ink-soft); font-size: 15px; }
.entry-tags { margin: 10px 0 0; font-size: 12.5px; color: var(--accent); letter-spacing: 0.1em; }
.empty-note { padding: 80px 0; text-align: center; color: var(--ink-soft); }

.tag-link {
  display: inline-block;
  margin: 0 8px 4px 0;
  padding: 0 8px;
  font-size: 12.5px;
  color: var(--accent);
  border: 1px solid var(--hairline);
  letter-spacing: 0.08em;
}
.tag-link:hover { border-color: var(--accent); }
.tag-big { font-size: 16px; padding: 4px 14px; margin: 0 10px 12px 0; }
.tag-big small { color: var(--ink-soft); }
.tag-cloud { padding: 30px 0; }

/* ---- 归档 ---- */
.arch-row {
  display: flex;
  gap: 18px;
  padding: 11px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 15px;
}
.arch-row time { color: var(--ink-soft); font-size: 13px; flex: 0 0 130px; padding-top: 2px; }
.arch-row a:hover { color: var(--accent); }

/* ---- 文章页 ---- */
.post { padding-top: 48px; position: relative; }
.post-head { border-bottom: 3px double var(--ink); padding-bottom: 26px; }
.post-title {
  margin: 0 0 14px;
  font-size: 38px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.04em;
}
.post-meta { font-size: 13px; color: var(--ink-soft); letter-spacing: 0.06em; }

.post-body { max-width: 42em; margin: 0 auto; padding: 34px 0 10px; font-size: 17px; }
.post-body p { margin: 0 0 1.35em; }
.post-body h1, .post-body h2, .post-body h3 {
  font-weight: 700;
  line-height: 1.5;
  margin: 2em 0 0.8em;
  letter-spacing: 0.05em;
}
.post-body h2 { font-size: 25px; padding-left: 14px; border-left: 4px solid var(--accent); }
.post-body h3 { font-size: 20px; }
.post-body blockquote {
  margin: 1.6em 0;
  padding: 2px 0 2px 20px;
  border-left: 3px solid var(--hairline);
  color: var(--ink-soft);
}
.post-body img { max-width: 100%; display: block; margin: 1.8em auto; }
.post-body pre {
  background: var(--code);
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 14px;
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
}
.post-body code { font-family: Consolas, Menlo, monospace; font-size: 0.9em; }
.post-body a { color: var(--accent); border-bottom: 1px solid var(--accent); }
.post-body ul, .post-body ol { padding-left: 1.6em; }
.post-body hr { border: none; border-top: 1px solid var(--hairline); margin: 2.4em 0; }
.post-body table { border-collapse: collapse; margin: 1.6em 0; width: 100%; font-size: 15px; }
.post-body th, .post-body td { border: 1px solid var(--hairline); padding: 8px 12px; text-align: left; }
.post-body th { background: var(--code); }

/* ---- 点赞 ---- */
.post-acts { text-align: center; margin: 34px 0 6px; }
.like-btn {
  font-family: inherit;
  font-size: 15px;
  letter-spacing: 0.08em;
  padding: 10px 30px;
  background: none;
  border: 1px solid var(--hairline);
  color: var(--ink-soft);
  cursor: pointer;
  transition: transform 0.12s, color 0.2s, border-color 0.2s;
}
.like-btn:hover { color: var(--accent); border-color: var(--accent); }
.like-btn.liked { color: var(--accent); border-color: var(--accent); cursor: default; }
.like-btn:not(.liked):active { transform: scale(0.94); }
.like-count { margin-left: 8px; }

/* ---- 目录 TOC ---- */
.toc {
  display: none;
  position: fixed;
  top: 110px;
  right: calc(50% - 640px);
  width: 190px;
  font-size: 12.5px;
  line-height: 1.7;
  max-height: 70vh;
  overflow-y: auto;
}
@media (min-width: 1360px) {
  .post.has-toc .toc { display: block; }
}
.toc-label { color: var(--ink-soft); letter-spacing: 0.3em; margin-bottom: 8px; font-size: 11px; }
.toc a { display: block; color: var(--ink-soft); padding: 3px 0; border-left: 2px solid transparent; padding-left: 10px; }
.toc a:hover { color: var(--accent); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }
.toc a.toc-3 { padding-left: 24px; }

/* ---- 上一篇 / 下一篇 ---- */
.post-adj {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 46px;
  border-top: 1px solid var(--hairline);
  padding-top: 22px;
}
.adj { display: block; max-width: 46%; font-size: 15px; line-height: 1.5; }
.adj small { display: block; color: var(--ink-soft); font-size: 12px; letter-spacing: 0.2em; margin-bottom: 4px; }
.adj:hover { color: var(--accent); }
.adj-right { text-align: right; margin-left: auto; }

.post-admin { margin-top: 34px; display: flex; gap: 16px; align-items: center; font-size: 14px; }
.post-admin a { color: var(--ink-soft); }
.post-admin a:hover { color: var(--accent); }
.post-admin button { background: none; border: none; padding: 0; font: inherit; color: var(--ink-soft); cursor: pointer; }
.post-admin button.del:hover { color: var(--accent); }

/* ---- 留言 ---- */
.comments { max-width: 42em; margin: 40px auto 0; padding-top: 12px; border-top: 3px double var(--ink); }
.comments-label { font-size: 12px; color: var(--ink-soft); letter-spacing: 0.3em; margin-bottom: 20px; }
.comment { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--hairline); }
.comment-avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.comment-main { flex: 1; min-width: 0; }
.comment-meta { font-size: 12.5px; color: var(--ink-soft); display: flex; gap: 10px; align-items: baseline; }
.comment-name { color: var(--ink); font-weight: 700; }
.comment-del { margin-left: auto; }
.comment-del button { background: none; border: none; color: var(--ink-soft); font: inherit; font-size: 12px; cursor: pointer; padding: 0; }
.comment-del button:hover { color: var(--accent); }
.comment-body { margin: 6px 0 0; font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.comment-empty { color: var(--ink-soft); font-size: 14px; }
.comment-form { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.comment-form textarea, .nick-input {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  background: var(--field);
  color: var(--ink);
  resize: vertical;
}
.comment-form textarea:focus, .nick-input:focus { outline: none; border-color: var(--accent); }
.nick-input { max-width: 280px; }
.comment-form button { padding: 8px 22px; cursor: pointer; font-family: inherit; font-size: 14px; letter-spacing: 0.1em; }

/* ---- 编辑器 ---- */
.blog-editor { padding-top: 12px; }
.editor-row { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.editor-row label { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 6px; }
.editor-row input, textarea, .login-form input {
  font-family: inherit;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  background: var(--field);
  color: var(--ink);
}
.editor-row input:focus, textarea:focus, .login-form input:focus { outline: none; border-color: var(--accent); }
.fld-md { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; }
textarea { width: 100%; resize: vertical; line-height: 1.7; font-size: 15px;
           font-family: "SFMono-Regular", Consolas, Menlo, monospace; }
.login-form { max-width: 340px; margin: 0 auto 60px; }
.login-form input { width: 100%; }

.editor-actions { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.editor-actions button {
  font-family: inherit;
  font-size: 15px;
  padding: 9px 26px;
  cursor: pointer;
  letter-spacing: 0.1em;
}
button.primary { background: var(--ink); color: var(--paper); border: 1px solid var(--ink); }
button.primary:hover { background: var(--accent); border-color: var(--accent); }
button.ghost { background: none; border: 1px solid var(--hairline); color: var(--ink-soft); }
button.ghost:hover { border-color: var(--accent); color: var(--accent); }
.pub-sw { font-size: 14px; color: var(--ink-soft); }
#save-hint { font-size: 12.5px; color: var(--accent); }

#preview-pane { margin-top: 26px; border-top: 3px double var(--ink); padding-top: 18px; }
.preview-label { font-size: 12px; color: var(--ink-soft); letter-spacing: 0.3em; margin-bottom: 8px; }

/* ---- 页脚 ---- */
.blog-footer {
  max-width: 880px;
  margin: 0 auto;
  padding: 18px 20px 34px;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.blog-foot-sep { color: var(--hairline); }
.blog-footer a:hover { color: var(--accent); }

/* ---- 图片：列表缩略图 / 封面 / 灯箱 / 图库 ---- */
.entry.has-cover { display: flex; gap: 24px; align-items: flex-start; }
.entry-main { flex: 1; min-width: 0; }
.entry-thumb { flex: 0 0 160px; order: 2; display: block; border: 1px solid var(--hairline); overflow: hidden; }
.entry-thumb img { width: 100%; height: 110px; object-fit: cover; display: block; transition: transform 0.4s; }
.entry-thumb:hover img { transform: scale(1.04); }

.post-cover { max-width: 42em; margin: 24px auto 0; padding: 0; }
.post-cover img { width: 100%; max-height: 470px; object-fit: cover; display: block; cursor: zoom-in; }
.post-body img { cursor: zoom-in; }

/* 关于站长：头像 */
.about-head {
  display: flex;
  align-items: center;
  gap: 26px;
  max-width: 42em;
  margin: 4px auto 0;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--hairline);
}
.about-avatar {
  width: 112px;
  height: 112px;
  flex: 0 0 auto;
  object-fit: cover;
  border: 1px solid var(--hairline);
  padding: 4px;
  background: var(--field);
}
.about-name { margin: 0; font-size: 34px; letter-spacing: 0.08em; line-height: 1.2; }
.about-role { margin: 8px 0 0; font-size: 12.5px; letter-spacing: 0.22em; color: var(--accent); }
.about-line { margin: 10px 0 0; font-size: 14px; color: var(--ink-soft); }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 10, 12, 0.93);
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 96vw; max-height: 92vh; object-fit: contain; box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6); }
.lightbox-hint {
  position: absolute;
  bottom: 16px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  letter-spacing: 0.2em;
}

/* 编辑器：封面与上传工具条 */
.cover-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.cover-box {
  position: relative;
  width: 150px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--hairline);
  background: var(--field);
  color: var(--ink-soft);
  font-size: 12.5px;
  letter-spacing: 0.2em;
  overflow: hidden;
}
.cover-box.has-img { border-style: solid; }
.cover-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-box img[hidden] { display: none; }
.cover-box.has-img .cover-ph { display: none; }
.cover-box.avatar-box { width: 112px; height: 112px; }
.cover-box.avatar-box img { object-fit: contain; }
.cover-ops { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cover-tip { width: 100%; font-size: 12.5px; color: var(--ink-soft); }
button.sm { padding: 5px 14px; font-size: 13px; }
.mini-link { font-size: 12.5px; color: var(--accent); border-bottom: 1px solid var(--accent); }

.md-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 10px; }
.md-tip { font-size: 12.5px; color: var(--ink-soft); }
.md-tip strong { color: var(--ink); font-weight: 600; }
.upload-state { font-size: 12.5px; color: var(--accent); }
#md-box.drag-on { border-color: var(--accent); background: rgba(158, 59, 44, 0.05); }

/* 图库 */
.img-toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
               padding: 4px 0 16px; border-bottom: 1px solid var(--hairline); }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
            gap: 20px; padding: 24px 0 40px; }
.img-cell { margin: 0; border: 1px solid var(--hairline); background: var(--field); }
.img-thumb { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--code); }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.35s; }
.img-thumb:hover img { transform: scale(1.03); }
.img-cell figcaption { padding: 10px 12px 12px; font-size: 12px; color: var(--ink-soft); }
.img-meta { letter-spacing: 0.06em; }
.img-name { margin: 4px 0 8px; font-size: 11.5px; color: var(--ink-soft);
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-ops { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.img-ops form { margin: 0; }
.img-ops button, .img-ops .img-used {
  font-family: inherit;
  font-size: 11.5px;
  padding: 3px 9px;
  border: 1px solid var(--hairline);
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  letter-spacing: 0.08em;
}
.img-ops button:hover { border-color: var(--accent); color: var(--accent); }
.img-ops .img-used { color: var(--accent); }
.img-ops .del { color: var(--accent); }

/* ---- 手机 ---- */
@media (max-width: 640px) {
  .masthead { padding: 44px 0 28px; }
  .masthead-title { font-size: 30px; letter-spacing: 0.08em; }
  .masthead-sub { font-size: 13px; letter-spacing: 0.18em; }
  .entry-title { font-size: 21px; }
  .post-title { font-size: 27px; }
  .post-body { font-size: 16px; }
  .blog-nav { gap: 12px; flex-wrap: wrap; }
  .adj { max-width: 48%; font-size: 13.5px; }
  .blog-top { flex-wrap: wrap; }
  .blog-search { order: 3; width: 100%; }
  .blog-search input { width: 100%; }
  .arch-row time { flex-basis: 100px; }
  .entry.has-cover { display: block; }
  .entry-thumb { flex-basis: 106px; margin-bottom: 14px; }
  .entry-thumb img { height: 132px; }
  .post-cover { margin-top: 16px; }
  .about-head { gap: 16px; padding-bottom: 20px; }
  .about-avatar { width: 84px; height: 84px; padding: 3px; }
  .about-name { font-size: 26px; }
  .about-role { font-size: 11.5px; letter-spacing: 0.16em; }
  .about-line { font-size: 13px; margin-top: 8px; }
  .img-grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; }
  .cover-box { width: 120px; height: 80px; }
  .cover-box.avatar-box { width: 84px; height: 84px; }
}
