/* ============================================================
   DevNotes · 编程手记 — 深色开发者风格样式
   ============================================================ */

:root {
  --bg: #0b0e14;
  --bg-soft: #10141d;
  --card: #141925;
  --card-hover: #182030;
  --border: #232b3b;
  --text: #e8ebf0;
  --muted: #8b95a7;
  --accent: #4ade80;
  --accent-dim: #22c55e;
  --accent-glow: rgba(74, 222, 128, 0.14);
  --code-bg: #0d1117;
  --tag-bg: rgba(74, 222, 128, 0.1);
  --tag-text: #6ee7a0;
  --radius: 12px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-code: "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(1200px 500px at 80% -10%, rgba(74, 222, 128, 0.06), transparent 60%),
    radial-gradient(900px 400px at 0% 0%, rgba(56, 189, 248, 0.05), transparent 55%);
  background-attachment: fixed;
}

::selection { background: var(--accent); color: #04120a; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #263043; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #32405c; }

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

/* ---------------- 顶部导航 ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: rgba(11, 14, 20, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.logo { display: flex; align-items: center; gap: 10px; color: var(--text); }
.logo:hover { text-decoration: none; }

.logo-mark {
  font-family: var(--font-code);
  color: var(--accent);
  font-weight: 700;
  font-size: 18px;
  background: var(--accent-glow);
  border: 1px solid rgba(74, 222, 128, 0.35);
  border-radius: 6px;
  padding: 2px 8px;
  line-height: 1.4;
}

.logo-text { font-weight: 700; font-size: 17px; letter-spacing: 0.3px; }
.logo-text small {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 8px;
  letter-spacing: 2px;
}

.site-nav { display: flex; gap: 6px; }
.site-nav a {
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  transition: color 0.2s, background 0.2s;
}
.site-nav a:hover { color: var(--text); background: var(--card); text-decoration: none; }
.site-nav a.active { color: var(--accent); background: var(--accent-glow); }

.container { max-width: 860px; margin: 0 auto; padding: 0 24px; }

/* ---------------- 首页 Hero ---------------- */
.hero { padding: 72px 0 40px; text-align: center; }

.hero-title {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1.3;
  background: linear-gradient(120deg, #e8ebf0 20%, var(--accent) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.cursor {
  display: inline-block;
  width: 12px;
  height: 1.1em;
  background: var(--accent);
  margin-left: 6px;
  vertical-align: text-bottom;
  animation: blink 1s steps(2, start) infinite;
  border-radius: 2px;
}

@keyframes blink { 50% { opacity: 0; } }

.hero-sub { color: var(--muted); margin-top: 16px; font-size: 16px; }

/* 搜索框 */
.search-box {
  position: relative;
  max-width: 520px;
  margin: 32px auto 0;
}
.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  padding: 13px 18px 13px 46px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box input::placeholder { color: #5b6475; }
.search-box input:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ---------------- 标签栏 ---------------- */
.tag-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 12px 0 8px;
  scroll-margin-top: 80px;
}

.chip {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.chip:hover { color: var(--text); border-color: var(--accent-dim); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #04120a;
  font-weight: 600;
}

/* ---------------- 文章列表 ---------------- */
.post-section { padding: 24px 0 60px; }

.post-section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 18px;
}
.post-section-head h2 { font-size: 19px; font-weight: 700; }
.post-count { color: var(--muted); font-size: 13px; }

.post-list { display: flex; flex-direction: column; gap: 16px; }

.post-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  transition: transform 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.post-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s;
}
.post-card:hover {
  transform: translateY(-3px);
  border-color: rgba(74, 222, 128, 0.4);
  background: var(--card-hover);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  text-decoration: none;
}
.post-card:hover::before { opacity: 1; }

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}
.post-card-meta .date { font-family: var(--font-code); }
.post-card-meta .dot { opacity: 0.5; }

.post-card-title { font-size: 18px; font-weight: 700; color: var(--text); }

.post-card-summary {
  color: var(--muted);
  font-size: 14px;
  margin-top: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}

.post-card .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.post-card .tags .tag {
  font-size: 12px;
  color: var(--tag-text);
  background: var(--tag-bg);
  border: 1px solid rgba(74, 222, 128, 0.2);
  padding: 2px 10px;
  border-radius: 999px;
}

.read-more { color: var(--accent); font-size: 13px; font-weight: 600; }
.post-card:hover .read-more { text-decoration: underline; }

.empty-state { text-align: center; color: var(--muted); padding: 60px 0; }
.empty-state .empty-icon { font-size: 40px; display: block; margin-bottom: 12px; opacity: 0.6; }

/* ---------------- 文章详情页 ---------------- */
.article {
  padding: 36px 0 20px;
  max-width: 760px;
  margin: 0 auto;
  animation: fadeUp 0.35s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.back-link { color: var(--muted); font-size: 14px; }
.back-link:hover { color: var(--accent); text-decoration: none; }

.article-head {
  margin: 20px 0 30px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.article-meta {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}
.article-meta time { font-family: var(--font-code); }

.article-title {
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 800;
  line-height: 1.35;
}

.article-tags { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.article-tags .tag {
  font-size: 12px;
  color: var(--tag-text);
  background: var(--tag-bg);
  border: 1px solid rgba(74, 222, 128, 0.2);
  padding: 3px 12px;
  border-radius: 999px;
}

/* ---------------- Markdown 正文 ---------------- */
.article-content { font-size: 16px; }

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  font-weight: 700;
  margin: 1.6em 0 0.7em;
  line-height: 1.4;
}
.article-content h2 {
  font-size: 22px;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--border);
}
.article-content h3 { font-size: 18px; color: var(--accent); }
.article-content h4 { font-size: 16px; }

.article-content p { margin: 0.9em 0; }

.article-content ul,
.article-content ol { margin: 0.9em 0; padding-left: 1.6em; }
.article-content li { margin: 0.35em 0; }
.article-content li::marker { color: var(--accent-dim); }

.article-content strong { color: #ffffff; font-weight: 700; }
.article-content em { color: var(--accent); }

.article-content a {
  border-bottom: 1px dashed rgba(74, 222, 128, 0.5);
}
.article-content a:hover { border-bottom-style: solid; }

.article-content blockquote {
  margin: 1.2em 0;
  padding: 12px 20px;
  border-left: 3px solid var(--accent);
  background: var(--accent-glow);
  border-radius: 0 8px 8px 0;
  color: #c8d3c0;
}
.article-content blockquote p { margin: 0.4em 0; }

.article-content hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }

.article-content code {
  font-family: var(--font-code);
  font-size: 0.9em;
  background: #1c2333;
  padding: 2px 7px;
  border-radius: 5px;
  color: #7ee0a3;
}

/* 代码块 */
.code-block {
  position: relative;
  margin: 1.3em 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--code-bg);
}
.code-block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 14px;
  background: #131826;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.code-lang {
  font-family: var(--font-code);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.copy-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 5px;
  transition: color 0.2s, background 0.2s;
}
.copy-btn:hover { color: var(--accent); background: var(--accent-glow); }
.copy-btn.copied { color: var(--accent); }

.code-block pre {
  padding: 16px 18px;
  overflow-x: auto;
  background: transparent;
}
.code-block pre code {
  display: block;
  font-family: var(--font-code);
  font-size: 13.5px;
  line-height: 1.7;
  color: #d6e2f0;
  background: transparent;
  padding: 0;
}
.code-block pre code::selection { background: #2a3a52; }

/* 任务清单 */
.article-content li.task { list-style: none; margin-left: -1.2em; }
.article-content li.task input { margin-right: 8px; accent-color: var(--accent); }

/* 图片 */
.article-content img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); }

/* ---------------- 上一篇 / 下一篇 ---------------- */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.post-nav a {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color 0.2s, transform 0.2s;
}
.post-nav a:hover { border-color: rgba(74, 222, 128, 0.4); transform: translateY(-2px); text-decoration: none; }
.post-nav .nav-label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.post-nav .nav-title { font-size: 14px; font-weight: 600; color: var(--text); }
.post-nav .next { text-align: right; }

/* ---------------- 404 ---------------- */
.not-found { text-align: center; padding: 80px 0; max-width: 760px; margin: 0 auto; }
.not-found-code {
  font-family: var(--font-code);
  font-size: 72px;
  font-weight: 800;
  color: transparent;
  -webkit-text-stroke: 1px var(--accent-dim);
  display: block;
  margin-bottom: 16px;
}
.not-found h2 { font-size: 22px; margin-bottom: 8px; }
.not-found p { color: var(--muted); margin-bottom: 24px; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #04120a;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 14px;
}
.btn:hover { text-decoration: none; filter: brightness(1.1); }

/* ---------------- 页脚 ---------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 640px) {
  .hero { padding: 48px 0 28px; }
  .post-card { padding: 18px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { text-align: left; }
  .logo-text small { display: none; }
}
