:root {
  --bg: #FFFFFF;
  --text: #1C1C1C;
  --muted: #6B6B6B;
  --line: #EEEEEE;
  --accent: #0F766E;
  --border: #8F8F8F;
  --code-bg: #F6F6F6;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
/* 让 hidden 属性压过下面各处的 display 设置 */
[hidden] { display: none !important; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2, h3 { line-height: 1.3; font-weight: 600; }

/* 页面框架 */

.site-header, .site-main, .site-footer {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}
.site-header { display: flex; justify-content: flex-end; padding-top: 20px; padding-bottom: 20px; }
.site-main { flex-grow: 1; padding-top: 48px; padding-bottom: 64px; }
.site-footer { padding-top: 32px; padding-bottom: 48px; font-size: 13px; color: var(--muted); }

.site-nav { display: flex; flex-wrap: wrap; align-items: center; column-gap: 28px; font-size: 15px; }
.site-nav a, .site-nav button { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); }
.site-nav button { padding: 0; border: 0; background: none; font: inherit; cursor: pointer; }
.site-nav a:hover, .site-nav button:hover { color: var(--accent); }
.site-nav [aria-current] {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 6px;
}
.nav-logout { display: flex; margin: 0; }

/* 首页视频 */

.has-hero .site-header { position: absolute; top: 0; left: 0; right: 0; z-index: 1; }
.has-hero .site-nav a, .has-hero .site-nav button { color: #FFFFFF; }
.has-hero .site-nav [aria-current] { text-decoration-color: #FFFFFF; }
/* 强调色焦点框在视频上看不清 */
.has-hero .site-header :focus-visible, .hero-scroll:focus-visible { outline-color: #FFFFFF; }
.hero { position: relative; height: 100vh; height: 100svh; overflow: hidden; background: var(--text); }
.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* 遮罩不透明度 0.55：视频最亮时白色文字对比度仍约 4.7:1 */
.hero::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); }
.hero-scroll {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 1;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
}
.hero-scroll:hover { color: #FFFFFF; }

.recent { padding-top: 32px; }
.recent h1 { margin: 0 0 16px; font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 1px; }
.post-index { margin: 0; padding: 0; list-style: none; border-bottom: 1px solid var(--line); }
.post-index a {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 24px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.post-index-date { width: 96px; flex-shrink: 0; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.post-index-title { font-size: 17px; }

.more-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: 12px; font-size: 15px; color: var(--accent); }
.empty { margin: 0; color: var(--muted); }
.meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 文章列表 */

.page-title { margin: 0 0 32px; font-size: 32px; }
.section-title { margin: 0 0 8px; font-size: 20px; }

.drafts { margin-bottom: 48px; }
.draft-list { margin: 0; padding: 0; list-style: none; }
.draft-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 16px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}
.draft-list a { display: inline-flex; align-items: center; min-height: 44px; }

.post-list { border-bottom: 1px solid var(--line); }
.post-item { display: flex; flex-direction: column; gap: 8px; padding: 24px 0; border-top: 1px solid var(--line); }
.post-item h2 { margin: 0; font-size: 20px; line-height: 1.5; }
.post-item h2 a { display: block; padding: 7px 0; }
.post-item p { margin: 0; }
.excerpt { font-size: 15px; color: var(--muted); }

.pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; margin-top: 40px; font-size: 15px; }
.pager a { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); }
.pager-prev { justify-self: start; }
.pager-current { grid-column: 2; color: var(--muted); font-variant-numeric: tabular-nums; }
.pager-next { grid-column: 3; justify-self: end; }

/* 文章详情 */

.post-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.back-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; color: var(--muted); }
.post-actions { display: flex; gap: 12px; }
.post-actions form { margin: 0; }

.post { margin-top: 24px; }
.post-title { margin: 0; font-size: 36px; }
.post-meta { margin: 12px 0 0; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 0 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; color: var(--text); }
.post-cover { display: block; width: 100%; height: auto; margin-top: 32px; border-radius: 8px; }

.prose { margin-top: 40px; font-size: 17px; line-height: 1.85; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table, .prose .codehilite { margin: 0 0 24px; }
.prose h2 { margin: 40px 0 16px; font-size: 22px; line-height: 1.4; }
.prose h3 { margin: 32px 0 12px; font-size: 19px; line-height: 1.4; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; }
.prose blockquote { padding: 4px 0 4px 20px; border-left: 3px solid var(--line); color: var(--muted); }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; }
.prose th, .prose td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.prose code { font-family: var(--mono); font-size: 14px; }
.prose :not(pre) > code { padding: 2px 6px; border-radius: 4px; background: var(--code-bg); }
.prose .footnote { font-size: 14px; color: var(--muted); }

/* code.css 由 pygmentize 生成，在本文件之前加载，这里覆盖它的背景和行高 */
.codehilite { padding: 20px 24px; border-radius: 8px; background: var(--code-bg); overflow-x: auto; }
.codehilite pre { margin: 0; font-family: var(--mono); font-size: 14px; line-height: 1.7; }

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.post-nav-prev, .post-nav-next { flex: 1 1 0; max-width: 320px; }
.post-nav-prev, .post-nav-next, .post-nav a { display: flex; flex-direction: column; gap: 4px; }
.post-nav-next, .post-nav-next a { align-items: flex-end; text-align: right; }
.post-nav-label { font-size: 13px; color: var(--muted); }
.post-nav-title { font-size: 15px; }
.post-nav-prev > .post-nav-title, .post-nav-next > .post-nav-title { color: var(--muted); }

/* 评论区 */

.comments { margin-top: 64px; }
.comments-count { font-weight: 400; color: var(--muted); }
.comment-list { margin: 0; padding: 0; list-style: none; }
.comment { padding: 20px 0; border-bottom: 1px solid var(--line); }
.comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.comment-name { font-size: 15px; font-weight: 600; }
.comment-time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.comment-delete { margin: 0 0 0 auto; }
.comment-delete button {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.comment-delete button:hover { color: var(--accent); }
.comment-body { margin: 6px 0 0; font-size: 15px; white-space: pre-line; overflow-wrap: anywhere; }
.comment-form { display: flex; flex-direction: column; gap: 20px; margin-top: 40px; }
.comment-form h3 { margin: 0; font-size: 17px; }
.comment-form .form-error { margin: 0; }

/* 表单与按钮 */

.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 14px; color: var(--muted); }
input[type="text"], input[type="password"], textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
textarea { padding: 10px 12px; line-height: 1.7; resize: vertical; }

.button, .button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.button:hover { border-color: var(--accent); color: var(--accent); }
.button-primary { border-color: var(--text); background: var(--text); color: #FFFFFF; }
.button-primary:hover { border-color: var(--accent); background: var(--accent); color: #FFFFFF; }

.form-error { margin: 0 0 20px; padding: 10px 14px; border-left: 3px solid var(--text); background: var(--code-bg); font-size: 14px; }

/* 登录 */

.login { max-width: 360px; margin: 0 auto; padding-top: 48px; }
.login h1 { margin: 0 0 32px; font-size: 24px; }
.login-form { display: flex; flex-direction: column; gap: 20px; }
.login-form .button-primary { margin-top: 8px; }

/* 写作 */

.write-page .site-main { padding-top: 24px; }
.write-form { display: flex; flex-direction: column; gap: 28px; }
.write-errors { display: flex; flex-direction: column; gap: 8px; }
.write-errors .form-error { margin: 0; }
.write-field { display: flex; flex-direction: column; gap: 6px; }
.write-field > label { font-size: 14px; color: var(--muted); }
input.write-title {
  height: 56px;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  font-size: 28px;
  font-weight: 600;
}
.write-cover { display: block; max-width: 240px; height: auto; border-radius: 8px; }
.write-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.write-file { min-height: 44px; font: inherit; font-size: 14px; color: var(--muted); }
.write-hint { font-size: 13px; color: var(--muted); }

.editor-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.editor-modes { display: flex; gap: 4px; }
.editor-modes button {
  height: 44px;
  margin-bottom: -1px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.editor-modes button:hover { color: var(--accent); }
.editor-modes button[aria-pressed="true"] { border-bottom-color: var(--text); color: var(--text); }
.insert-image {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
/* 空的提示区不占位置，但保留在页面上，屏幕阅读器才能播报后来写入的内容 */
.editor-message { margin: 0; font-size: 14px; }
.editor-message:not(:empty) { margin-top: 12px; padding: 10px 14px; border-left: 3px solid var(--text); background: var(--code-bg); }
.editor-pane { gap: 8px; padding-top: 16px; }
.editor-pane textarea { min-height: 480px; padding: 16px; font-size: 16px; line-height: 1.8; }
.write-preview { min-height: 480px; margin-top: 0; padding: 24px 0 8px; }

.write-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.write-status { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.write-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-left: auto; }

@media (max-width: 600px) {
  .site-main { padding-top: 32px; }
  .page-title { font-size: 28px; }
  .post-title { font-size: 28px; }
}
