/* ============================================================
   EEEEEN 博客 - 全局样式（极简 · 单栏 · 无依赖）
   ============================================================ */

/* ---------- 设计变量（想改配色改这里） ---------- */
:root {
  --bg: #ffffff;            /* 背景色 */
  --bg-soft: #f7f8fa;       /* 浅灰背景 */
  --text: #1f2328;          /* 正文颜色 */
  --muted: #6b7280;         /* 次要文字 */
  --line: #e8eaee;          /* 分割线 / 边框 */
  --accent: #4f46e5;        /* 主色（强调色） */
  --accent-soft: rgba(79, 70, 229, .08);
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06);
  --maxw: 760px;            /* 内容最大宽度（单栏） */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--text); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .6em; font-weight: 700; }
p { margin: 0 0 1em; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

mark { background: #fef08a; color: inherit; padding: 0 .15em; border-radius: 3px; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.site-main { max-width: var(--maxw); margin: 0 auto; padding: 0 20px 80px; min-height: 60vh; }

/* ============================================================
   加载动画（首屏 loading）
   ============================================================ */
.loader {
  position: fixed; inset: 0; z-index: 999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .5s ease, visibility .5s;
}
.loader-mark {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 800;
  animation: loaderPulse 1.2s ease-in-out infinite;
}
@keyframes loaderPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(.86); opacity: .75; }
}
body.loaded .loader { opacity: 0; visibility: hidden; pointer-events: none; }

/* ============================================================
   顶部导航
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, .85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; gap: 16px;
}
.logo { font-size: 19px; font-weight: 800; letter-spacing: .02em; }
.logo:hover { color: var(--text); }

.site-nav { display: flex; gap: 4px; margin: 0 auto; }
.site-nav a {
  position: relative;
  padding: 6px 12px; font-size: 14.5px; color: var(--muted);
  border-radius: 8px;
}
.site-nav a:hover { color: var(--text); background: var(--bg-soft); }
.site-nav a.active { color: var(--accent); font-weight: 600; }
.site-nav a.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 0;
  height: 2px; border-radius: 2px; background: var(--accent);
}

.header-tools { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }

.nav-toggle { display: none; flex-direction: column; gap: 4px; }
.nav-toggle span { width: 18px; height: 2px; background: currentColor; border-radius: 2px; transition: transform .2s, opacity .2s; }
.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* 搜索栏 */
.search-bar { border-top: 1px solid var(--line); padding: 12px 0; background: var(--bg); }
.search-form { display: flex; gap: 10px; max-width: var(--maxw); }
.search-form input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14.5px; font-family: inherit; background: var(--bg-soft);
}
.search-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--bg); }
.search-form button {
  padding: 0 20px; border: 0; border-radius: 10px; background: var(--accent);
  color: #fff; font-size: 14px; cursor: pointer; font-family: inherit;
}
.search-form button:hover { background: #4338ca; }

/* ============================================================
   首页 Hero
   ============================================================ */
.hero { padding: 72px 0 40px; text-align: center; }
.hero-title { font-size: 40px; letter-spacing: .01em; margin-bottom: 14px; }
.hero-desc { color: var(--muted); font-size: 17px; max-width: 520px; margin: 0 auto 10px; }
.hero-meta { color: #9ca3af; font-size: 13px; }

/* 列表页头部 */
.list-head { padding: 48px 0 8px; }
.list-title { font-size: 30px; margin-bottom: 6px; }
.list-sub { color: var(--muted); font-size: 14px; }

/* ============================================================
   文章卡片（列表）
   ============================================================ */
.post-list { margin-top: 28px; display: flex; flex-direction: column; gap: 28px; }

.post-card {
  display: flex; flex-direction: column; gap: 18px;
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--bg);
  transition: box-shadow .2s, transform .2s;
}
.post-card:hover { box-shadow: 0 8px 30px rgba(0, 0, 0, .08); transform: translateY(-2px); }

.post-cover { display: block; overflow: hidden; }
.post-cover img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: transform .4s; }
.post-card:hover .post-cover img { transform: scale(1.03); }

.post-body { padding: 0 24px 24px; }
.post-title { font-size: 21px; margin-bottom: 8px; }
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--accent); }

.post-excerpt { color: var(--muted); font-size: 14.5px; margin-bottom: 12px; }

.post-meta {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  color: #9ca3af; font-size: 13px;
}
.post-meta a { color: #9ca3af; }
.post-meta a:hover { color: var(--accent); }
.meta-cat {
  padding: 2px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent) !important;
  font-size: 12.5px;
}

/* 空状态 */
.empty {
  text-align: center; color: var(--muted); padding: 60px 0; font-size: 15px;
}

/* ============================================================
   文章内容页
   ============================================================ */
.article { margin-top: 40px; }

.article-meta {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  color: #9ca3af; font-size: 13.5px; margin-bottom: 14px;
}
.article-title { font-size: 34px; margin-bottom: 14px; }
.article-excerpt {
  color: var(--muted); font-size: 17px; line-height: 1.8;
  border-left: 3px solid var(--line); padding-left: 16px;
}

.article-cover { margin: 26px 0; border-radius: var(--radius); overflow: hidden; }
.article-cover img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

/* 正文排版 */
.article-content { font-size: 16.5px; line-height: 1.9; }
.article-content h2 {
  font-size: 24px; margin: 44px 0 16px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.article-content h3 { font-size: 20px; margin: 34px 0 12px; }
.article-content p { margin-bottom: 1.2em; }
.article-content a { color: var(--accent); border-bottom: 1px solid var(--accent-soft); }
.article-content a:hover { border-color: var(--accent); }

.article-content ul, .article-content ol { padding-left: 1.5em; margin: 0 0 1.2em; }
.article-content li { margin-bottom: 8px; }

.article-content blockquote {
  margin: 28px 0; padding: 16px 20px;
  border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0;
  background: var(--bg-soft); color: var(--muted); font-size: 15.5px;
}
.article-content blockquote p { margin: 0; }

.article-content img { border-radius: var(--radius); margin: 8px 0; }

.article-content pre {
  background: #1f2328; color: #f3f4f6; padding: 18px 20px;
  border-radius: 10px; overflow-x: auto; font-size: 14px; line-height: 1.7;
  margin: 24px 0;
}
.article-content code {
  font-family: var(--mono); font-size: .9em;
  background: var(--bg-soft); padding: 2px 6px; border-radius: 5px;
}
.article-content pre code { background: transparent; padding: 0; }

.article-content table { width: 100%; border-collapse: collapse; margin: 24px 0; font-size: 15px; }
.article-content th, .article-content td { border: 1px solid var(--line); padding: 10px 14px; text-align: left; }
.article-content th { background: var(--bg-soft); }

/* 视频 / 音频 自适应 */
.video-wrap {
  position: relative; width: 100%; padding-top: 56.25%;
  border-radius: var(--radius); overflow: hidden; margin: 24px 0;
  background: #000;
}
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
audio { width: 100%; margin: 24px 0; accent-color: var(--accent); }

/* 文章底部 */
.article-foot { margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--line); }

.article-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.tag {
  padding: 5px 14px; border-radius: 999px; font-size: 13px;
  background: var(--bg-soft); color: var(--muted);
  border: 1px solid var(--line);
}
.tag:hover { color: var(--accent); border-color: var(--accent); }

.article-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.nav-card {
  padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px;
  display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, background .15s;
}
.nav-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.nav-card span { font-size: 12.5px; color: var(--muted); }
.nav-card strong { font-size: 14.5px; line-height: 1.5; }
.nav-card.next { text-align: right; }
.nav-card.empty { border-style: dashed; }

/* 相关文章 */
.related { margin-top: 56px; }
.section-title { font-size: 20px; margin-bottom: 18px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.related-card {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px;
  transition: box-shadow .2s, transform .2s;
}
.related-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.related-card img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.related-card strong { font-size: 14px; padding: 0 14px; line-height: 1.5; }
.related-card time { font-size: 12px; color: #9ca3af; padding: 0 14px; }

/* ============================================================
   静态页（关于 / 隐私 / 条款 / 感谢 / 404）
   ============================================================ */
.page { margin-top: 48px; }
.page-title { font-size: 30px; margin-bottom: 20px; }
.page-date { color: #9ca3af; font-size: 13px; margin-bottom: 28px; }
.page h2 { font-size: 20px; margin: 36px 0 12px; }
.page ul, .page ol { padding-left: 1.5em; margin-bottom: 1.2em; }
.page li { margin-bottom: 8px; }
.page a { color: var(--accent); }
.page blockquote {
  margin: 28px 0; padding: 16px 20px; border-left: 3px solid var(--accent);
  background: var(--bg-soft); color: var(--muted); border-radius: 0 10px 10px 0;
}

.btn {
  display: inline-block; padding: 10px 22px; border-radius: 10px;
  background: var(--accent); color: #fff !important; font-size: 14px;
  transition: background .15s;
}
.btn:hover { background: #4338ca; }

.thanks { text-align: center; }
.thanks-mark { font-size: 44px; color: var(--accent); margin-bottom: 8px; }
.thanks .page-title { margin-bottom: 10px; }
.thanks ul { list-style: none; padding: 0; }

.not-found { text-align: center; padding: 60px 0; }
.nf-code { font-size: 96px; font-weight: 800; color: var(--line); line-height: 1; margin-bottom: 8px; }

/* ============================================================
   归档页
   ============================================================ */
.archive-list { margin-top: 28px; }
.archive-group { margin-bottom: 34px; }
.archive-month {
  font-size: 17px; padding-bottom: 8px; margin-bottom: 14px;
  border-bottom: 1px solid var(--line); color: var(--muted);
}
.archive-items { list-style: none; padding: 0; margin: 0; }
.archive-items li {
  display: flex; align-items: baseline; gap: 16px; padding: 7px 0;
}
.archive-items time { color: #9ca3af; font-size: 13px; min-width: 42px; font-variant-numeric: tabular-nums; }
.archive-items a { font-size: 15.5px; }
.archive-items a:hover { color: var(--accent); }

/* ============================================================
   画廊 + 灯箱
   ============================================================ */
.gallery-grid {
  margin-top: 28px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px;
}
.gallery-item {
  border: 0; padding: 0; cursor: zoom-in; border-radius: 10px; overflow: hidden;
  background: var(--bg-soft); aspect-ratio: 1 / 1;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.gallery-item:hover img { transform: scale(1.05); }

.lightbox {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0, 0, 0, .92);
  display: none; align-items: center; justify-content: center; flex-direction: column;
  padding: 40px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 80vh; border-radius: 8px; box-shadow: 0 10px 60px rgba(0, 0, 0, .5); }
.lightbox .lb-caption { color: #d1d5db; font-size: 13px; margin-top: 14px; }
.lb-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lb-btn:hover { background: rgba(255, 255, 255, .25); }
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
.lb-close { top: 20px; right: 20px; transform: none; }
.lb-counter { position: absolute; top: 24px; left: 24px; color: #9ca3af; font-size: 13px; }

/* ============================================================
   分页
   ============================================================ */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 48px; flex-wrap: wrap;
}
.pg {
  padding: 8px 15px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 14px; color: var(--muted); transition: all .15s;
}
.pg:hover { border-color: var(--accent); color: var(--accent); }
.pg.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pg-dot { color: #9ca3af; padding: 0 2px; }

/* ============================================================
   页脚
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--line); background: var(--bg-soft);
  padding: 44px 0 36px; text-align: center;
}
.footer-meta {
  display: flex; justify-content: center; gap: 18px; flex-wrap: wrap;
  font-size: 13px; color: #9ca3af; margin-bottom: 8px;
}
.footer-meta a { color: #9ca3af; }
.footer-meta a:hover { color: var(--accent); }
.footer-text { font-size: 12.5px; color: #9ca3af; margin: 0; }

/* ============================================================
   回到顶部 + 阅读进度条
   ============================================================ */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg); color: var(--muted);
  font-size: 17px; cursor: pointer; box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: all .25s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { color: var(--accent); border-color: var(--accent); }

.progress {
  position: fixed; top: 0; left: 0; z-index: 200;
  height: 3px; width: 0; background: var(--accent);
  border-radius: 0 3px 3px 0;
}
body:not(.is-article) .progress { display: none; }

/* ============================================================
   滚动渐入动画
   ============================================================ */
.reveal {
  opacity: 0; transform: translateY(16px);
  transition: opacity .6s ease var(--d, 0s), transform .6s ease var(--d, 0s);
}
.reveal.in { opacity: 1; transform: none; }
/* 未启用 JS 时内容保持可见（防内容不可见） */
html:not(.js) .reveal { opacity: 1; transform: none; }

/* 页面切换过渡 */
.site-main { transition: opacity .18s ease, transform .18s ease; }
body.is-leaving .site-main { opacity: 0; transform: translateY(8px); }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 768px) {
  .hero { padding: 48px 0 28px; }
  .hero-title { font-size: 30px; }
  .article-title { font-size: 26px; }
  .article-content { font-size: 16px; }

  /* 移动端导航：收进汉堡菜单 */
  .nav-toggle { display: flex; }
  .site-nav {
    position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; gap: 2px; margin: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 10px 20px 16px; display: none;
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 11px 12px; font-size: 15.5px; }
  .site-nav a.active::after { display: none; }
  .site-nav a.active { background: var(--accent-soft); }

  .related-grid { grid-template-columns: 1fr; }
  .article-nav { grid-template-columns: 1fr; }
  .post-body { padding: 0 18px 18px; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
}

/* 尊重系统的“减少动态效果”偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto; }
}
