/* ==========================================================================
   鱼的记忆 — 主样式表
   风格：清爽浅色博客风（自带暗色模式，默认浅色）
   ========================================================================== */

/* ---------- 1. 设计变量 ---------- */
:root {
  --bg: #f6fafc;
  --bg-soft: #eef5f9;
  --surface: #ffffff;
  --surface-2: #f9fcfd;
  --text: #1a2733;
  --text-soft: #40566b;
  --muted: #6b8296;
  --border: #e0eaf1;
  --border-strong: #cbdce6;

  --brand: #1a6f8e;
  --brand-dark: #12556e;
  --brand-soft: #e4f2f8;
  --accent: #ef8f3c;

  --code-bg: #f3f7fa;
  --code-border: #e2ecf2;

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(26, 60, 80, .05);
  --shadow: 0 4px 16px rgba(26, 60, 80, .07);
  --shadow-lg: 0 14px 40px rgba(26, 60, 80, .12);

  --container: 1080px;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI",
    system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas,
    "Liberation Mono", Menlo, monospace;
}

[data-theme="dark"] {
  --bg: #0f1922;
  --bg-soft: #142330;
  --surface: #16232e;
  --surface-2: #1a2a37;
  --text: #e8f1f6;
  --text-soft: #c2d4e0;
  --muted: #8ba4b6;
  --border: #253a49;
  --border-strong: #33505f;

  --brand: #57badb;
  --brand-dark: #7fcbe4;
  --brand-soft: #1c3442;
  --accent: #f0a35e;

  --code-bg: #10202b;
  --code-border: #24404f;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 4px 16px rgba(0, 0, 0, .35);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, .45);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

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

a { color: var(--brand); text-decoration: none; transition: color .18s ease; }
a:hover { color: var(--brand-dark); }

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

p { margin: 0 0 1.1em; }

ul, ol { padding-left: 1.4em; }
li { margin-bottom: .4em; }

hr { border: 0; border-top: 1px solid var(--border); margin: 2.4rem 0; }

::selection { background: var(--brand-soft); color: var(--brand-dark); }

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

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; color: #fff; }

/* ---------- 3. 顶部导航 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex; align-items: center; gap: 20px;
  height: 66px;
}

.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 1.06rem; color: var(--text);
  letter-spacing: .01em;
}
.brand:hover { color: var(--brand); }
.brand-mark {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #43a9c9);
  font-size: 17px; line-height: 1;
}

.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a {
  padding: 7px 14px; border-radius: 999px;
  color: var(--text-soft); font-size: .94rem; font-weight: 500;
}
.nav a:hover { background: var(--brand-soft); color: var(--brand-dark); }
.nav a.active { background: var(--brand); color: #fff; }
[data-theme="dark"] .nav a.active { color: #0f1922; }

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

.icon-btn {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-soft); cursor: pointer; font-size: 15px;
  transition: all .18s ease;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

.nav-toggle { display: none; }

/* ---------- 4. 阅读进度条 ---------- */
.progress-bar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--brand), #56c2dd);
  z-index: 200; transition: width .08s linear;
}

/* ---------- 5. 首屏 Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: 84px 0 72px;
  background:
    radial-gradient(900px 380px at 12% -10%, var(--brand-soft), transparent 62%),
    radial-gradient(700px 320px at 92% 8%, rgba(239, 143, 60, .10), transparent 60%);
}

.hero-grid {
  display: grid; grid-template-columns: 1.35fr .65fr;
  gap: 48px; align-items: center;
}

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 13px; margin-bottom: 20px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); font-size: .82rem; color: var(--muted);
}
.hero-badge .dot {
  width: 7px; height: 7px; border-radius: 50%; background: #34c759;
  box-shadow: 0 0 0 3px rgba(52, 199, 89, .16);
}

.hero h1 {
  font-size: clamp(2rem, 4.6vw, 3rem);
  margin-bottom: .35em;
  letter-spacing: -.02em;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(120deg, var(--brand), #4cb0cf 60%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.hero-sub {
  font-size: 1.06rem; color: var(--text-soft);
  max-width: 34em; margin-bottom: 28px;
}

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

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: 999px;
  font-size: .95rem; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: all .2s ease;
}
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-dark); color: #fff; transform: translateY(-2px); box-shadow: var(--shadow); }
[data-theme="dark"] .btn-primary { color: #0f1922; }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text-soft); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-2px); }

.hero-stats { display: flex; gap: 34px; flex-wrap: wrap; }
.hero-stats .num { font-size: 1.5rem; font-weight: 800; color: var(--brand); line-height: 1.2; }
.hero-stats .lbl { font-size: .82rem; color: var(--muted); }

.hero-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 26px;
  box-shadow: var(--shadow-lg);
}
.hero-card .avatar {
  width: 96px; height: 96px; border-radius: 50%;
  margin: 0 auto 16px; border: 3px solid var(--brand-soft);
}
.hero-card h3 { text-align: center; margin-bottom: .15em; font-size: 1.08rem; }
.hero-card .role { text-align: center; color: var(--muted); font-size: .86rem; margin-bottom: 18px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.tag {
  padding: 4px 11px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: .78rem; font-weight: 500;
}
[data-theme="dark"] .tag { color: var(--brand); }

/* ---------- 6. 通用区块 ---------- */
.section { padding: 64px 0; }
.section-alt { background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section-head { margin-bottom: 34px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.section-head h2 { font-size: 1.55rem; margin: 0; }
.section-head p { margin: 6px 0 0; color: var(--muted); font-size: .93rem; }
.section-head .more { font-size: .9rem; font-weight: 600; white-space: nowrap; }

/* ---------- 7. 文章卡片 ---------- */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }

.post-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }

.post-card .meta { display: flex; align-items: center; gap: 10px; font-size: .8rem; color: var(--muted); margin-bottom: 12px; }
.post-card .cat {
  padding: 3px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; font-size: .76rem;
}
[data-theme="dark"] .post-card .cat { color: var(--brand); }

.post-card h3 { font-size: 1.1rem; margin-bottom: .5em; }
.post-card h3 a { color: var(--text); }
.post-card h3 a:hover { color: var(--brand); }

.post-card .excerpt { color: var(--text-soft); font-size: .91rem; margin-bottom: 18px; flex: 1; }

.post-card .foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; border-top: 1px dashed var(--border);
  font-size: .82rem; color: var(--muted);
}
.post-card .read-more { font-weight: 600; color: var(--brand); }

/* ---------- 8. 筛选与搜索 ---------- */
.filter-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 28px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 15px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); background: transparent;
  color: var(--text-soft); font-size: .86rem; font-family: inherit;
  transition: all .18s ease;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
[data-theme="dark"] .chip.active { color: #0f1922; }

.search-box { position: relative; margin-left: auto; min-width: 210px; }
.search-box input {
  width: 100%; padding: 9px 14px 9px 36px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--bg); color: var(--text);
  font-family: inherit; font-size: .9rem; outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.search-box input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-box::before {
  content: "🔍"; position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  font-size: .82rem; opacity: .6; pointer-events: none;
}

.empty-tip {
  display: none; padding: 48px 20px; text-align: center;
  color: var(--muted); background: var(--surface);
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
}

/* ---------- 9. 文章正文 ---------- */
.article-header { padding: 52px 0 30px; border-bottom: 1px solid var(--border); }
.article-header .breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 16px; }
.article-header .breadcrumb a { color: var(--muted); }
.article-header .breadcrumb a:hover { color: var(--brand); }
.article-header h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); margin-bottom: .5em; }
.article-meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: .88rem; color: var(--muted); align-items: center; }

.prose { padding: 44px 0 20px; max-width: 760px; }
.prose h2 {
  font-size: 1.42rem; margin-top: 2.2em; padding-left: 14px;
  border-left: 4px solid var(--brand); border-radius: 2px;
}
.prose h3 { font-size: 1.14rem; margin-top: 1.8em; color: var(--text-soft); }
.prose p, .prose li { color: var(--text-soft); }
.prose strong { color: var(--text); }
.prose a { border-bottom: 1px solid var(--brand-soft); }
.prose a:hover { border-bottom-color: var(--brand); }

.prose blockquote {
  margin: 1.6em 0; padding: 16px 20px;
  background: var(--brand-soft); border-left: 4px solid var(--brand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-soft);
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose ul, .prose ol { margin-bottom: 1.2em; }
.prose img { border-radius: var(--radius); border: 1px solid var(--border); margin: 1.6em 0; }

/* 行内代码 */
.prose code:not(pre code) {
  padding: 2px 6px; margin: 0 2px;
  background: var(--code-bg); border: 1px solid var(--code-border);
  border-radius: 5px; font-family: var(--font-mono); font-size: .87em;
  color: var(--brand-dark); word-break: break-word;
}

/* 代码块 */
.code-block {
  margin: 1.6em 0; border: 1px solid var(--code-border);
  border-radius: var(--radius); overflow: hidden; background: var(--code-bg);
}
.code-block .code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; border-bottom: 1px solid var(--code-border);
  background: color-mix(in srgb, var(--code-bg) 60%, var(--surface));
}
.code-block .code-lang {
  font-family: var(--font-mono); font-size: .76rem;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.copy-btn {
  padding: 4px 11px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--muted); font-size: .76rem; font-family: inherit;
  transition: all .18s ease;
}
.copy-btn:hover { border-color: var(--brand); color: var(--brand); }
.copy-btn.done { background: #34c759; border-color: #34c759; color: #fff; }
.code-block pre {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  font-family: var(--font-mono); font-size: .855rem; line-height: 1.7;
  color: var(--text); tab-size: 2;
}
.code-block pre::-webkit-scrollbar { height: 8px; }
.code-block pre::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

/* 语法高亮配色（浅色） */
.tok-key { color: #a626a4; font-weight: 600; }
.tok-str { color: #16794b; }
.tok-num { color: #b3571a; }
.tok-com { color: #8c9aa6; font-style: italic; }
.tok-fn { color: #1a6f8e; }
.tok-obj { color: #b8860b; }
[data-theme="dark"] .tok-key { color: #d78ce0; }
[data-theme="dark"] .tok-str { color: #86d99c; }
[data-theme="dark"] .tok-num { color: #f0b27a; }
[data-theme="dark"] .tok-com { color: #6d8496; }
[data-theme="dark"] .tok-fn { color: #6cc7e6; }
[data-theme="dark"] .tok-obj { color: #e5c07b; }

/* 表格 */
.prose table {
  width: 100%; border-collapse: collapse; margin: 1.6em 0;
  font-size: .9rem; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.prose thead { background: var(--bg-soft); }
.prose th { text-align: left; padding: 11px 14px; font-weight: 700; color: var(--text); border-bottom: 1px solid var(--border); }
.prose td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-soft); }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover { background: var(--surface-2); }

/* 文末导航 */
.post-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  max-width: 760px; margin: 40px 0 0; padding-top: 30px; border-top: 1px solid var(--border);
}
.post-nav a {
  padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); transition: all .2s ease;
}
.post-nav a:hover { border-color: var(--brand); transform: translateY(-3px); box-shadow: var(--shadow); }
.post-nav .dir { display: block; font-size: .78rem; color: var(--muted); margin-bottom: 5px; }
.post-nav .ttl { display: block; color: var(--text); font-weight: 600; font-size: .94rem; }
.post-nav .next { text-align: right; }

/* ---------- 10. 关于页 / 通用内容页 ---------- */
.page-header { padding: 60px 0 34px; border-bottom: 1px solid var(--border); }
.page-header h1 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); margin-bottom: .4em; }
.page-header p { color: var(--muted); max-width: 46em; margin: 0; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }

.info-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm);
  transition: transform .22s ease, box-shadow .22s ease;
}
.info-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.info-card .ico { font-size: 1.8rem; margin-bottom: 12px; }
.info-card h3 { font-size: 1.04rem; margin-bottom: .5em; }
.info-card p { color: var(--text-soft); font-size: .91rem; margin: 0; }

/* 时间线 */
.timeline { position: relative; max-width: 720px; margin: 0 auto; padding-left: 30px; }
.timeline::before {
  content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px;
  width: 2px; background: linear-gradient(var(--brand), transparent);
}
.timeline-item { position: relative; padding-bottom: 32px; }
.timeline-item::before {
  content: ""; position: absolute; left: -30px; top: 7px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--brand);
}
.timeline-item time { font-size: .82rem; color: var(--brand); font-weight: 600; }
.timeline-item h3 { font-size: 1.06rem; margin: 6px 0 .35em; }
.timeline-item p { color: var(--text-soft); font-size: .92rem; margin: 0; }

/* ---------- 11. 页脚 ---------- */
.site-footer {
  margin-top: 40px; background: var(--surface);
  border-top: 1px solid var(--border);
}
.footer-inner {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr;
  gap: 40px; padding: 52px 0 38px;
}
.footer-inner .brand { margin-bottom: 12px; }
.footer-inner p { color: var(--muted); font-size: .88rem; margin: 0; max-width: 30em; }
.footer-col h4 { font-size: .86rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text); margin-bottom: 14px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 9px; }
.footer-col a { color: var(--muted); font-size: .89rem; }
.footer-col a:hover { color: var(--brand); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 20px 0 26px; text-align: center;
}
.footer-bottom .copyright { color: var(--muted); font-size: .84rem; margin: 0 0 8px; }

/* 备案信息区（预留位置，样式已就绪） */
.beian {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; flex-wrap: wrap; font-size: .82rem;
}
.beian a { color: var(--muted); }
.beian a:hover { color: var(--brand); }
.beian .sep { color: var(--border-strong); }
/* 公安备案：图标 + 编号，图标与文字垂直居中 */
.beian .gongan { display: inline-flex; align-items: center; gap: 4px; }
.beian .gongan img { width: 20px; height: 22px; display: block; }

/* ---------- 12. 回到顶部 ---------- */
.to-top {
  position: fixed; right: 26px; bottom: 26px; z-index: 90;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--brand); font-size: 17px; cursor: pointer;
  display: grid; place-items: center; box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transition: all .25s ease;
}
.to-top.show { opacity: 1; visibility: visible; }
.to-top:hover { background: var(--brand); color: #fff; transform: translateY(-3px); }
[data-theme="dark"] .to-top:hover { color: #0f1922; }

/* ---------- 13. 响应式 ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .hero { padding: 56px 0 52px; }
  .hero-card { max-width: 340px; margin: 0 auto; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 30px; }
}

@media (max-width: 720px) {
  .nav-toggle { display: grid; }
  .nav {
    position: absolute; top: 66px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 12px 20px 18px; margin-left: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 11px 14px; border-radius: var(--radius-sm); }

  .section { padding: 46px 0; }
  .post-grid { grid-template-columns: 1fr; }
  .search-box { margin-left: 0; width: 100%; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { text-align: left; }
  .footer-inner { grid-template-columns: 1fr; gap: 26px; padding: 38px 0 26px; }
  .hero-stats { gap: 24px; }
  .container { padding: 0 18px; }
}

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