/* =========================================================
   呆木记 · 个人博客样式
   结构:
   1. 设计变量      2. 基础重置      3. 滚动进度条
   4. 顶部导航      5. Hero          6. 主体布局
   7. 工具栏        8. 文章卡片      9. 侧栏
   10. 文章详情     11. 页脚         12. 响应式
   ========================================================= */

/* ========== 1. 设计变量 ========== */
:root {
  --bg-rgb: 250, 249, 247;
  --bg: #faf9f7;
  --bg-card: #ffffff;
  --bg-subtle: #f4f3f1;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --border: #e8e6e2;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --code-bg: #f5f4f2;
  --glow: rgba(37, 99, 235, 0.16);
  --shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.18);
  --radius: 16px;
  --radius-sm: 10px;
}

[data-theme="dark"] {
  --bg-rgb: 15, 17, 21;
  --bg: #0f1115;
  --bg-card: #171a21;
  --bg-subtle: #1c2029;
  --text: #e8eaed;
  --text-muted: #9aa0a6;
  --text-faint: #6b7280;
  --border: #262a33;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-soft: rgba(96, 165, 250, 0.12);
  --code-bg: #0b0d11;
  --glow: rgba(96, 165, 250, 0.14);
  --shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.7);
}

/* ========== 2. 基础 ========== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  position: relative;
  isolation: isolate;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
  "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s ease, color .35s ease;
  background-image:
    radial-gradient(circle at 8% 8%, var(--accent-soft), transparent 30rem),
    radial-gradient(circle at 92% 24%, rgba(168, 85, 247, .06), transparent 28rem);
  animation: pageEnter .7s ease both;
}

.particle-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: .72;
}

.site-header,
main,
.site-footer,
.placeholder-card {
  position: relative;
  z-index: 1;
}

body::before,
body::after {
  content: '';
  position: fixed;
  z-index: -1;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(70px);
  opacity: .18;
  animation: ambientFloat 18s ease-in-out infinite alternate;
}

body::before {
  top: 12%;
  left: -18rem;
  background: #60a5fa;
}

body::after {
  right: -18rem;
  bottom: 4%;
  background: #c084fc;
  animation-delay: -7s;
  animation-direction: alternate-reverse;
}

@keyframes pageEnter {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ambientFloat {
  0% { transform: translate3d(0, 0, 0) scale(.9); }
  50% { transform: translate3d(7rem, 3rem, 0) scale(1.08); }
  100% { transform: translate3d(2rem, -4rem, 0) scale(.96); }
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
h1, h2, h3, h4 { line-height: 1.35; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
::selection { background: var(--accent); color: #fff; }

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

/* ========== 3. 滚动进度条 ========== */
.progress-bar {
  position: fixed; top: 0; left: 0; z-index: 300;
  height: 3px; width: 0;
  background: linear-gradient(90deg, var(--accent), #a855f7);
  opacity: 0;
  transition: opacity .3s ease;
}
.progress-bar.active { opacity: 1; }

/* ========== 4. 顶部导航 ========== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(var(--bg-rgb), 0.78);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 64px;
}

.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; }

.logo-mark {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 6px 16px -6px var(--accent);
}

.logo-text { font-size: 16px; letter-spacing: 0.02em; }

.nav-links { display: flex; gap: 4px; }

.nav-links a {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--text-muted);
  transition: color .2s, background-color .2s;
}
.nav-links a:hover,
.nav-links a.active { color: var(--text); background: var(--bg-subtle); }

.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--text-muted);
  transition: background-color .2s, color .2s, transform .2s;
}
.icon-btn:hover { background: var(--bg-subtle); color: var(--text); transform: translateY(-1px); }
.icon-btn svg { width: 19px; height: 19px; }

.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* ========== 5. Hero ========== */
.hero {
  position: relative;
  overflow: hidden;
  padding: 104px 0 82px;
  animation: heroEnter .8s .08s ease both;
}

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

.hero::after {
  content: '';
  position: absolute;
  width: 180px;
  height: 180px;
  right: 12%;
  top: 12%;
  border: 1px solid var(--accent-soft);
  border-radius: 42% 58% 65% 35%;
  transform: rotate(25deg);
  animation: morphShape 12s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes morphShape {
  to { border-radius: 63% 37% 30% 70%; transform: rotate(70deg) scale(1.18); }
}

.hero::before {
  content: '';
  position: absolute;
  top: -240px; right: -140px;
  width: 560px; height: 560px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 68%);
  filter: blur(30px);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 56px;
  min-height: 300px;
}

.hero-text { max-width: 600px; }

.hero-eyebrow {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(38px, 6vw, 56px);
  letter-spacing: -0.03em;
  margin-bottom: 22px;
  background: linear-gradient(110deg, var(--text) 18%, var(--accent) 72%, #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero h1 .wave {
  display: inline-block;
  animation: wave 2.6s ease-in-out infinite;
  transform-origin: 70% 70%;
}
@keyframes wave {
  0%, 60%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
}

.hero-desc {
  font-size: 17px;
  color: var(--text-muted);
  line-height: 1.85;
  margin-bottom: 34px;
  max-width: 530px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  transition: transform .2s, box-shadow .2s, background-color .2s, border-color .2s;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -80%;
  width: 45%;
  height: 100%;
  background: rgba(255, 255, 255, .22);
  transform: skewX(-20deg);
  transition: left .45s ease;
}

.btn:hover::after { left: 135%; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px -12px var(--accent);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -12px var(--accent); }

.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-faint); transform: translateY(-2px); }

/* 头像 */
.hero-avatar { position: relative; flex: none; }

.avatar {
  position: relative;
  width: 176px; height: 176px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 62px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, #2563eb, #7c3aed 52%, #ec4899);
  box-shadow: 0 26px 60px -22px rgba(99, 102, 241, 0.8);
  animation: avatarFloat 5s ease-in-out infinite;
}

@keyframes avatarFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-9px) rotate(2deg); }
}

.avatar::after {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1.5px dashed var(--border);
  animation: spin 26s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 6. 布局 ========== */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 52px;
  padding-top: 18px;
  padding-bottom: 88px;
}

/* ========== 7. 工具栏 ========== */
.toolbar { margin-bottom: 18px; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box svg {
  position: absolute;
  left: 15px;
  width: 17px; height: 17px;
  color: var(--text-faint);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  box-shadow: 0 8px 22px -18px rgba(15, 23, 42, .5);
}
.search-box input::placeholder { color: var(--text-faint); }
.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* 标签筛选 */
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 26px;
}

.chip {
  padding: 5px 14px;
  font-size: 13.5px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: transparent;
  transition: all .2s;
}
.chip:hover { border-color: var(--text-faint); color: var(--text); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ========== 8. 文章卡片 ========== */
.post-list { display: flex; flex-direction: column; gap: 16px; }

.post-card {
  padding: 24px 26px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  outline: none;
  animation: fadeUp .5s cubic-bezier(.2,.7,.3,1) both;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
  box-shadow: 0 8px 24px -24px rgba(15, 23, 42, .6);
}

.post-card:nth-child(2) { animation-delay: 90ms; }
.post-card:nth-child(3) { animation-delay: 180ms; }
.post-card:nth-child(4) { animation-delay: 270ms; }
.post-card:nth-child(5) { animation-delay: 360ms; }

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

.post-card:hover,
.post-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.post-card-head {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 10px;
}
.post-card-head .dot {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: .7;
}

.post-card h2 {
  font-size: 20px;
  margin-bottom: 9px;
  transition: color .2s;
}
.post-card:hover h2 { color: var(--accent); }

.post-card .excerpt {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 16px;
}

.post-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.tags { display: flex; flex-wrap: wrap; gap: 7px; }

.tag {
  padding: 3px 10px;
  font-size: 12.5px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.read-more {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .25s, transform .25s;
}
.post-card:hover .read-more,
.post-card:focus-visible .read-more { opacity: 1; transform: translateX(0); }

/* 空状态 */
.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty-state .emoji { font-size: 34px; display: block; margin-bottom: 10px; }

/* ========== 9. 侧栏 ========== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 88px;
  align-self: start;
}

.card {
  padding: 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px -24px rgba(15, 23, 42, .55);
}

.card h3 {
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 16px;
}

.about-card { text-align: center; }

.about-card .mini-avatar {
  width: 66px; height: 66px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 24px; font-weight: 700; color: #fff;
  background: linear-gradient(140deg, #2563eb, #7c3aed 52%, #ec4899);
}

.about-card .name { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.about-card .bio {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.8;
}

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }

.tag-cloud button {
  padding: 4px 11px;
  font-size: 13px;
  border-radius: 8px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  transition: all .2s;
}
.tag-cloud button:hover { background: var(--accent); color: #fff; }
.tag-cloud button small { opacity: .55; margin-left: 4px; font-size: 11px; }

.recent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }

.recent-list li button {
  display: block;
  width: 100%;
  text-align: left;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  transition: color .2s;
  padding: 0;
}
.recent-list li button:hover { color: var(--accent); }
.recent-list li time {
  display: block;
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 3px;
}

/* ========== 10. 文章详情 ========== */
.post-detail {
  max-width: 760px;
  padding-top: 44px;
  padding-bottom: 90px;
  animation: fadeUp .45s ease both;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px 8px 12px;
  margin-bottom: 30px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all .2s;
}
.back-btn:hover { color: var(--accent); border-color: var(--accent); transform: translateX(-3px); }

.post-detail h1 {
  font-size: clamp(28px, 4.4vw, 38px);
  letter-spacing: -0.025em;
  margin-bottom: 18px;
}

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 14px;
  color: var(--text-faint);
  padding-bottom: 26px;
  margin-bottom: 34px;
  border-bottom: 1px solid var(--border);
}
.post-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }

.post-content { font-size: 17px; line-height: 1.9; }
.post-content p { margin-bottom: 22px; color: var(--text); }
.post-content h2 {
  font-size: 22px;
  margin: 40px 0 16px;
}
.post-content h3 {
  font-size: 18px;
  margin: 32px 0 14px;
}
.post-content ul, .post-content ol { margin: 0 0 22px; padding-left: 24px; }
.post-content li { margin-bottom: 8px; }

.post-content blockquote {
  margin: 26px 0;
  padding: 6px 0 6px 22px;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
  font-style: italic;
}

.post-content pre {
  margin: 24px 0;
  padding: 18px 20px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.7;
}

.post-content code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.post-content p code,
.post-content li code {
  padding: 2px 6px;
  font-size: 0.88em;
  border-radius: 5px;
  background: var(--code-bg);
  color: var(--accent);
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

.post-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.post-content img { margin: 24px auto; border-radius: var(--radius-sm); }

/* ========== 10.5 占位页面 ========== */
.placeholder-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 24px;
}

.placeholder-card {
  width: min(100%, 560px);
  padding: 56px 42px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 24px 70px -42px rgba(15, 23, 42, .7);
  animation: placeholderEnter .75s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes placeholderEnter {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.placeholder-card .logo-mark {
  margin: 0 auto 26px;
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { box-shadow: 0 6px 16px -6px var(--accent); }
  50% { box-shadow: 0 10px 28px -5px var(--accent); transform: translateY(-4px); }
}
.placeholder-card h1 { font-size: clamp(30px, 6vw, 44px); margin-bottom: 12px; }
.placeholder-card p { color: var(--text-muted); margin-bottom: 30px; }
.placeholder-card .btn { display: inline-flex; }

/* ========== 11. 页脚 ========== */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 48px 0 32px;
}

.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-brand p { font-size: 14px; color: var(--text-muted); }

.socials { display: flex; gap: 10px; }

.socials a {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all .2s;
}
.socials a:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}
.socials svg { width: 18px; height: 18px; }

.copyright {
  font-size: 13px;
  color: var(--text-faint);
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

/* ========== 12. 响应式 ========== */
@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; gap: 40px; }
  .sidebar { position: static; }
}

@media (max-width: 760px) {
  .nav-links { display: none; }
  .hero { padding: 68px 0 52px; }
  .hero-inner { flex-direction: column-reverse; text-align: center; gap: 36px; }
  .hero-text { max-width: 100%; }
  .hero-actions { justify-content: center; }
  .hero-desc { font-size: 16px; }
  .avatar { width: 132px; height: 132px; font-size: 46px; }
  .avatar::after { inset: -10px; }
  .post-card { padding: 20px; }
  .post-card h2 { font-size: 18px; }
  .read-more { opacity: 1; transform: none; }
  .post-content { font-size: 16px; }
  .footer-inner { flex-direction: column; }
  .placeholder-card { padding: 44px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
