/* ===========================================================
   全站样式 —— 想换长相基本只改这个文件
   =========================================================== */

:root {
  --bg: #0f1115;
  --bg-soft: #161a22;
  --card: #1a1f2a;
  --line: #2a3040;
  --text: #e8ebf2;
  --text-dim: #98a1b3;
  --accent: #ffb84d;
  --accent-2: #ff7a59;
  --link: #7fc4ff;
  --code-bg: #12151c;
  --radius: 14px;
  --max: 760px;
}

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

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(900px 400px at 80% -10%, rgba(255,122,89,.07), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  line-height: 1.8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 22px; }

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

::selection { background: rgba(255,184,77,.3); }

/* ---------- 顶栏 ---------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15,17,21,.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 13px;
  padding-bottom: 13px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 800;
  font-size: 15px;
  color: var(--text);
}

.brand-logo {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: block;
  flex-shrink: 0;
}

.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.brand:hover { text-decoration: none; color: var(--accent); }

.site-head nav { display: flex; gap: 18px; flex-shrink: 0; font-size: 14px; }
.site-head nav a { color: var(--text-dim); }
.site-head nav a:hover { color: var(--accent); text-decoration: none; }

main { flex: 1; padding-top: 38px; padding-bottom: 70px; }

/* ---------- 首页 ---------- */

.hero { margin-bottom: 30px; }

.hero h1 {
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 900;
  letter-spacing: .01em;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.hero p { color: var(--text-dim); font-size: 15px; }

.post-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }

.post-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: transform .15s ease, border-color .15s ease;
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,184,77,.45);
}

.post-item h2 { font-size: 17px; font-weight: 800; margin-bottom: 4px; }

.post-item h2 a { color: var(--text); }
.post-item h2 a:hover { color: var(--accent); text-decoration: none; }

/* 让标题链接铺满整张卡片，整卡可点；标签再压回上层保持独立可点 */
.stretched::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.chip { position: relative; z-index: 1; }

.meta { font-size: 12.5px; color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.summary { font-size: 14px; color: var(--text-dim); margin-top: 7px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--accent);
  border: 1px solid rgba(255,184,77,.35);
  border-radius: 999px;
  padding: 1px 9px;
  white-space: nowrap;
}

.chip:hover { background: rgba(255,184,77,.12); text-decoration: none; }

.chip b { font-size: 10.5px; color: var(--text-dim); font-weight: 700; }

/* ---------- 首页分类栏 ---------- */

.cat-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 26px;
  padding: 13px 15px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.cat-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-dim);
  letter-spacing: .1em;
  margin-right: 2px;
}

.cat-more { font-size: 12px; color: var(--text-dim); margin-left: auto; white-space: nowrap; }
.cat-more:hover { color: var(--accent); text-decoration: none; }

/* ---------- 分类总览页 ---------- */

.cat-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.cat-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  height: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 17px;
  transition: transform .15s ease, border-color .15s ease;
}

.cat-item:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: rgba(255,184,77,.45);
}

/* ---------- 友链 ---------- */

.link-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin-bottom: 34px;
}

.link-card {
  display: flex;
  align-items: center;
  gap: 13px;
  height: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: inherit;
  transition: transform .15s ease, border-color .15s ease;
}

.link-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: rgba(255,184,77,.45);
}

.link-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.link-avatar-text {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 800;
  color: var(--accent);
}

.link-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.link-name { font-size: 15px; font-weight: 800; color: var(--text); }
.link-desc { font-size: 12.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-host { font-size: 11.5px; color: #5d6679; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.link-apply {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.link-apply h2 { font-size: 15px; font-weight: 800; margin-bottom: 5px; }
.link-apply p { font-size: 13px; color: var(--text-dim); }

.cat-name { font-size: 16px; font-weight: 800; color: var(--accent); }
.cat-count { font-size: 12px; color: var(--text-dim); }

.cat-latest {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty { color: var(--text-dim); font-size: 14px; padding: 20px 0; }

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

.post-head {
  padding-bottom: 20px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.post-head h1 { font-size: clamp(23px, 4.6vw, 31px); font-weight: 900; line-height: 1.4; margin-bottom: 10px; }

.prose { font-size: 16px; }
.prose > * + * { margin-top: 18px; }

.prose h2 {
  font-size: 21px;
  font-weight: 800;
  margin-top: 40px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  line-height: 1.5;
}

.prose h3 { font-size: 17.5px; font-weight: 800; margin-top: 30px; color: #d7dcea; }
.prose h4 { font-size: 16px; font-weight: 700; margin-top: 24px; color: var(--text-dim); }

.prose p { color: #d6dbe6; }

.prose ul, .prose ol { padding-left: 24px; color: #d6dbe6; }
.prose li + li { margin-top: 6px; }
.prose li > ul, .prose li > ol { margin-top: 6px; }

/* 任务清单：- [ ] / - [x] */
.prose ul:has(.task) { list-style: none; padding-left: 4px; }
.task { color: var(--text-dim); margin-right: 3px; }
.task.done { color: #57d9a3; }

.prose a { color: var(--link); border-bottom: 1px solid rgba(127,196,255,.3); }
.prose a:hover { text-decoration: none; border-bottom-color: var(--link); }

.prose strong { color: #fff; font-weight: 800; }
.prose del { color: var(--text-dim); }

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
}

.prose hr { border: none; border-top: 1px solid var(--line); margin: 34px 0; }

.prose blockquote {
  border-left: 3px solid var(--accent-2);
  background: rgba(255,122,89,.07);
  border-radius: 0 10px 10px 0;
  padding: 12px 16px;
  color: #f0cbbc;
  font-size: 15px;
}

.prose blockquote > * + * { margin-top: 10px; }

/* 行内代码 */
.prose code {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1.5px 5px;
  font-size: .88em;
  font-family: "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  color: #ffd7a8;
}

/* 代码块 */
.prose pre.code {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.7;
}

.prose pre.code code {
  background: none;
  border: none;
  padding: 0;
  color: #cfd6e6;
  font-size: inherit;
  white-space: pre;
}

.prose pre.code[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  right: 0;
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-soft);
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0 10px 0 8px;
  padding: 2px 10px;
  letter-spacing: .04em;
}

/* 表格 */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }

.prose table { border-collapse: collapse; width: 100%; font-size: 14px; }

.prose th, .prose td { padding: 9px 13px; border-bottom: 1px solid var(--line); white-space: nowrap; }

.prose thead th { background: var(--bg-soft); font-weight: 800; font-size: 13px; color: var(--text-dim); }

.prose tbody tr:last-child td { border-bottom: none; }
.prose tbody tr:hover { background: rgba(255,255,255,.02); }

/* 上一篇 / 下一篇 */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 46px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.post-nav a { color: var(--text-dim); }
.post-nav a:hover { color: var(--accent); text-decoration: none; }

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

.site-foot {
  border-top: 1px solid var(--line);
  padding: 22px 0;
  font-size: 12.5px;
  color: var(--text-dim);
}

.site-foot a { color: var(--text-dim); }
.site-foot a:hover { color: var(--accent); }

@media (max-width: 560px) {
  main { padding-top: 26px; padding-bottom: 50px; }
  .prose { font-size: 15.5px; }
  .post-nav { flex-direction: column; gap: 8px; }
  /* 四个菜单项在窄屏会挤，收紧一点 */
  .site-head nav { gap: 12px; font-size: 13px; }
  .brand { font-size: 14px; }
  .brand-logo { width: 20px; height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
