/* ==========================================================================
   ThunWind 个人技术博客 · 主题样式
   ========================================================================== */

/* ---- 设计令牌 ---- */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
    sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", "Fira Code", Consolas,
    "Roboto Mono", Menlo, "Courier New", monospace;

  --maxw: 760px;
  --radius: 12px;
  --radius-sm: 8px;

  --accent: #2f6feb;
  --accent-soft: rgba(47, 111, 235, 0.12);

  --transition: 0.2s ease;
}

/* 浅色（默认） */
:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-elev: #ffffff;
  --text: #1c2024;
  --text-soft: #57606a;
  --text-faint: #8b949e;
  --border: #e6e8eb;
  --border-soft: #eef0f2;
  --code-bg: #f6f8fa;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04);
  --header-bg: rgba(255, 255, 255, 0.82);
}

/* 深色 */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-soft: #11161d;
  --bg-elev: #161b22;
  --text: #e6edf3;
  --text-soft: #adbac7;
  --text-faint: #768390;
  --border: #22272e;
  --border-soft: #1c2128;
  --code-bg: #161b22;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, 0.14);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  --header-bg: rgba(13, 17, 23, 0.82);
}

/* 跟随系统 */
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --bg: #0d1117;
    --bg-soft: #11161d;
    --bg-elev: #161b22;
    --text: #e6edf3;
    --text-soft: #adbac7;
    --text-faint: #768390;
    --border: #22272e;
    --border-soft: #1c2128;
    --code-bg: #161b22;
    --accent: #58a6ff;
    --accent-soft: rgba(88, 166, 255, 0.14);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
    --header-bg: rgba(13, 17, 23, 0.82);
  }
}

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

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

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

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

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

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

/* ---- 页头 ---- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #7b4dff);
  color: #fff; font-weight: 700; font-size: 14px; letter-spacing: 0.5px;
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; font-weight: 650; }
.brand-text small { font-weight: 400; font-size: 11px; color: var(--text-faint); }

.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a {
  color: var(--text-soft); font-size: 14.5px; font-weight: 500;
  padding: 6px 11px; border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.site-nav a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.site-nav a.active { color: var(--accent); background: var(--accent-soft); }

.theme-toggle {
  margin-left: 4px; cursor: pointer;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text-soft); font-size: 16px; line-height: 1;
  display: grid; place-items: center;
  transition: transform var(--transition), color var(--transition), border-color var(--transition);
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: rotate(20deg); }

/* ---- 主体 ---- */
main.container { padding-top: 36px; padding-bottom: 64px; min-height: 60vh; }

/* Hero */
.hero { margin-bottom: 40px; }
.hero h1 { font-size: 30px; line-height: 1.3; margin: 0 0 8px; letter-spacing: -0.5px; }
.hero-sub { color: var(--text-soft); font-size: 16px; margin: 0 0 12px; font-weight: 500; }
.hero-desc { color: var(--text-soft); font-size: 15px; margin: 0; }

/* ---- 文章卡片列表 ---- */
.post-list { display: flex; flex-direction: column; gap: 8px; }
.post-card {
  padding: 20px 22px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg-elev);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.post-card:hover {
  transform: translateY(-2px); box-shadow: var(--shadow);
  border-color: var(--accent); text-decoration: none;
}
.post-card-title { font-size: 19px; margin: 0 0 6px; line-height: 1.4; letter-spacing: -0.2px; }
.post-card-title a { color: var(--text); }
.post-card-title a:hover { color: var(--accent); text-decoration: none; }
.post-summary { color: var(--text-soft); font-size: 14.5px; margin: 8px 0 12px; line-height: 1.65; }

.post-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  color: var(--text-faint); font-size: 13px;
}
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag {
  display: inline-block; font-size: 12px; padding: 2px 9px;
  border-radius: 999px; background: var(--bg-soft);
  color: var(--text-soft); border: 1px solid var(--border-soft);
  transition: all var(--transition);
}
.tag:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }

/* ---- 页面标题 ---- */
.page-title { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.4px; }
.page-sub { color: var(--text-faint); font-size: 14px; margin: 0 0 24px; }

/* ---- 归档 / 列表 ---- */
.archive-year {
  font-size: 15px; color: var(--accent); margin: 28px 0 8px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.archive-year:first-child { margin-top: 0; }
.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-item { display: flex; align-items: baseline; gap: 14px; padding: 7px 0; }
.archive-item a { color: var(--text); font-size: 15.5px; }
.archive-item a:hover { color: var(--accent); }
.archive-date {
  font-family: var(--font-mono); font-size: 13px; color: var(--text-faint);
  flex-shrink: 0; width: 82px;
}

/* ---- 标签云 ---- */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 32px; }
.tag-chip {
  font-size: 13.5px; padding: 5px 13px; border-radius: 999px;
  background: var(--bg-soft); color: var(--text-soft);
  border: 1px solid var(--border); transition: all var(--transition);
}
.tag-chip:hover { color: #fff; background: var(--accent); border-color: var(--accent); text-decoration: none; }
.tag-chip span { opacity: 0.6; font-size: 12px; margin-left: 2px; }
.tag-section h2 { font-size: 17px; margin: 26px 0 6px; color: var(--accent); }

/* ---- 文章详情 ---- */
.post-full { animation: fadeUp 0.35s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.post-header { margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.post-title { font-size: 30px; line-height: 1.3; margin: 0 0 12px; letter-spacing: -0.6px; }
.post-header .post-meta { margin-bottom: 10px; }
.post-source { color: var(--text-faint); font-size: 13px; margin-top: 24px; }

.post-content { font-size: 16.5px; line-height: 1.85; color: var(--text); }
.post-content h1, .post-content h2, .post-content h3, .post-content h4 {
  line-height: 1.35; margin: 1.8em 0 0.7em; font-weight: 650; letter-spacing: -0.2px;
  scroll-margin-top: 76px;
}
.post-content h1 { font-size: 26px; }
.post-content h2 {
  font-size: 22px; padding-bottom: 8px; border-bottom: 1px solid var(--border-soft);
}
.post-content h3 { font-size: 18.5px; }
.post-content h4 { font-size: 16.5px; color: var(--text-soft); }
.post-content p { margin: 1em 0; }
.post-content ul, .post-content ol { padding-left: 1.5em; margin: 1em 0; }
.post-content li { margin: 0.4em 0; }
.post-content li::marker { color: var(--text-faint); }

.post-content blockquote {
  margin: 1.4em 0; padding: 4px 18px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-soft);
}
.post-content blockquote p { margin: 0.6em 0; }

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

/* 行内代码 */
.post-content code {
  font-family: var(--font-mono); font-size: 0.86em;
  background: var(--code-bg); color: #d6336c;
  padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border-soft);
}
:root[data-theme="dark"] .post-content code { color: #ff7b9c; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .post-content code { color: #ff7b9c; }
}

/* 代码块 */
.post-content pre {
  margin: 1.4em 0; padding: 0; overflow: hidden;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: #272822;
}
.post-content pre code {
  display: block; padding: 16px 18px; overflow-x: auto;
  background: transparent; color: #f8f8f2; border: none;
  font-size: 13.5px; line-height: 1.65;
}
.highlight { margin: 1.4em 0; }
.highlight pre { margin: 0; }

/* 表格 */
.post-content table {
  border-collapse: collapse; width: 100%; margin: 1.4em 0;
  font-size: 14.5px; display: block; overflow-x: auto;
}
.post-content th, .post-content td { border: 1px solid var(--border); padding: 9px 13px; text-align: left; }
.post-content th { background: var(--bg-soft); font-weight: 600; }
.post-content tr:nth-child(even) td { background: var(--bg-soft); }

.post-content img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }

/* 上一篇 / 下一篇 */
.post-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border);
}
.post-nav a {
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); background: var(--bg-elev); transition: all var(--transition);
  display: flex; flex-direction: column; gap: 4px; overflow: hidden;
}
.post-nav a:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.post-nav a span { font-size: 12px; color: var(--text-faint); }
.post-nav a.next { text-align: right; }
.post-nav .prev { grid-column: 1; }
.post-nav .next { grid-column: 2; }

/* ---- 404 ---- */
.notfound { text-align: center; padding: 80px 0; }
.notfound h1 { font-size: 80px; margin: 0; color: var(--accent); line-height: 1; }
.notfound p { color: var(--text-soft); font-size: 18px; margin: 12px 0 28px; }
.btn {
  display: inline-block; padding: 10px 22px; border-radius: 999px;
  background: var(--accent); color: #fff !important; font-weight: 500;
  transition: opacity var(--transition), transform var(--transition);
}
.btn:hover { opacity: 0.9; transform: translateY(-1px); text-decoration: none; }

/* ---- 页脚 ---- */
.site-footer {
  border-top: 1px solid var(--border); padding: 32px 0 40px;
  color: var(--text-faint); font-size: 13.5px; text-align: center;
  background: var(--bg-soft);
}
.site-footer p { margin: 6px 0; }
.site-footer a { color: var(--text-soft); }
.site-footer a:hover { color: var(--accent); }
.footer-links { letter-spacing: 0.2px; }
.powered { font-size: 12px; opacity: 0.7; }

/* ---- 响应式 ---- */
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .header-inner { height: 56px; }
  .brand-text small { display: none; }
  .site-nav { gap: 0; }
  .site-nav a { padding: 6px 7px; font-size: 13.5px; }
  .theme-toggle { display: grid; width: 30px; height: 30px; }
  main.container { padding-top: 24px; }
  .hero h1 { font-size: 24px; }
  .post-title { font-size: 24px; }
  .post-card { padding: 16px 16px; }
  .post-card-title { font-size: 17px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { grid-column: 1; text-align: left; }
  .archive-item { flex-direction: column; gap: 2px; }
  .archive-date { width: auto; }
}


/* ---- pygments (monokai) ---- */
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #49483e }
.highlight { background: #272822; color: #F8F8F2 }
.highlight .c { color: #959077 } /* Comment */
.highlight .err { color: #ED007E; background-color: #1E0010 } /* Error */
.highlight .esc { color: #F8F8F2 } /* Escape */
.highlight .g { color: #F8F8F2 } /* Generic */
.highlight .k { color: #66D9EF } /* Keyword */
.highlight .l { color: #AE81FF } /* Literal */
.highlight .n { color: #F8F8F2 } /* Name */
.highlight .o { color: #FF4689 } /* Operator */
.highlight .x { color: #F8F8F2 } /* Other */
.highlight .p { color: #F8F8F2 } /* Punctuation */
.highlight .ch { color: #959077 } /* Comment.Hashbang */
.highlight .cm { color: #959077 } /* Comment.Multiline */
.highlight .cp { color: #959077 } /* Comment.Preproc */
.highlight .cpf { color: #959077 } /* Comment.PreprocFile */
.highlight .c1 { color: #959077 } /* Comment.Single */
.highlight .cs { color: #959077 } /* Comment.Special */
.highlight .gd { color: #FF4689 } /* Generic.Deleted */
.highlight .ge { color: #F8F8F2; font-style: italic } /* Generic.Emph */
.highlight .ges { color: #F8F8F2; font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #FF4689 } /* Generic.Error */
.highlight .gh { color: #F8F8F2 } /* Generic.Heading */
.highlight .gi { color: #A6E22E } /* Generic.Inserted */
.highlight .go { color: #66D9EF } /* Generic.Output */
.highlight .gp { color: #FF4689; font-weight: bold } /* Generic.Prompt */
.highlight .gs { color: #F8F8F2; font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #959077 } /* Generic.Subheading */
.highlight .gt { color: #66D9EF } /* Generic.Traceback */
.highlight .kc { color: #66D9EF } /* Keyword.Constant */
.highlight .kd { color: #66D9EF } /* Keyword.Declaration */
.highlight .kn { color: #FF4689 } /* Keyword.Namespace */
.highlight .kp { color: #66D9EF } /* Keyword.Pseudo */
.highlight .kr { color: #66D9EF } /* Keyword.Reserved */
.highlight .kt { color: #66D9EF } /* Keyword.Type */
.highlight .ld { color: #E6DB74 } /* Literal.Date */
.highlight .m { color: #AE81FF } /* Literal.Number */
.highlight .s { color: #E6DB74 } /* Literal.String */
.highlight .na { color: #A6E22E } /* Name.Attribute */
.highlight .nb { color: #A6E22E } /* Name.Builtin */
.highlight .nc { color: #A6E22E } /* Name.Class */
.highlight .no { color: #66D9EF } /* Name.Constant */
.highlight .nd { color: #A6E22E } /* Name.Decorator */
.highlight .ni { color: #F8F8F2 } /* Name.Entity */
.highlight .ne { color: #A6E22E } /* Name.Exception */
.highlight .nf { color: #A6E22E } /* Name.Function */
.highlight .nl { color: #F8F8F2 } /* Name.Label */
.highlight .nn { color: #F8F8F2 } /* Name.Namespace */
.highlight .nx { color: #A6E22E } /* Name.Other */
.highlight .py { color: #F8F8F2 } /* Name.Property */
.highlight .nt { color: #FF4689 } /* Name.Tag */
.highlight .nv { color: #F8F8F2 } /* Name.Variable */
.highlight .ow { color: #FF4689 } /* Operator.Word */
.highlight .pm { color: #F8F8F2 } /* Punctuation.Marker */
.highlight .w { color: #F8F8F2 } /* Text.Whitespace */
.highlight .mb { color: #AE81FF } /* Literal.Number.Bin */
.highlight .mf { color: #AE81FF } /* Literal.Number.Float */
.highlight .mh { color: #AE81FF } /* Literal.Number.Hex */
.highlight .mi { color: #AE81FF } /* Literal.Number.Integer */
.highlight .mo { color: #AE81FF } /* Literal.Number.Oct */
.highlight .sa { color: #E6DB74 } /* Literal.String.Affix */
.highlight .sb { color: #E6DB74 } /* Literal.String.Backtick */
.highlight .sc { color: #E6DB74 } /* Literal.String.Char */
.highlight .dl { color: #E6DB74 } /* Literal.String.Delimiter */
.highlight .sd { color: #E6DB74 } /* Literal.String.Doc */
.highlight .s2 { color: #E6DB74 } /* Literal.String.Double */
.highlight .se { color: #AE81FF } /* Literal.String.Escape */
.highlight .sh { color: #E6DB74 } /* Literal.String.Heredoc */
.highlight .si { color: #E6DB74 } /* Literal.String.Interpol */
.highlight .sx { color: #E6DB74 } /* Literal.String.Other */
.highlight .sr { color: #E6DB74 } /* Literal.String.Regex */
.highlight .s1 { color: #E6DB74 } /* Literal.String.Single */
.highlight .ss { color: #E6DB74 } /* Literal.String.Symbol */
.highlight .bp { color: #A6E22E } /* Name.Builtin.Pseudo */
.highlight .fm { color: #A6E22E } /* Name.Function.Magic */
.highlight .vc { color: #F8F8F2 } /* Name.Variable.Class */
.highlight .vg { color: #F8F8F2 } /* Name.Variable.Global */
.highlight .vi { color: #F8F8F2 } /* Name.Variable.Instance */
.highlight .vm { color: #F8F8F2 } /* Name.Variable.Magic */
.highlight .il { color: #AE81FF } /* Literal.Number.Integer.Long */
