/* ==========================================================================
   CSharp技术心得分享 — 全站样式
   纯静态站点，无外部依赖
   ========================================================================== */

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-alt: #fbfcfe;
  --border: #e3e8ef;
  --border-strong: #cfd8e3;
  --text: #131a24;
  --text-soft: #3d4a5c;
  --muted: #6b7a8f;
  --accent: #1a5fb4;
  --accent-dark: #124480;
  --accent-soft: #ecf3fc;
  --code-bg: #10192a;
  --code-text: #e6edf6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 25, 42, 0.05);
  --shadow-md: 0 8px 24px -12px rgba(16, 25, 42, 0.18);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Cascadia Code",
    Consolas, "Liberation Mono", Menlo, monospace;
  --maxw: 1080px;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

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

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  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;
  gap: 20px;
  height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #1a5fb4, #2f86d8);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.5px;
  box-shadow: 0 4px 10px -4px rgba(26, 95, 180, 0.6);
}

.brand-sub {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-top: -4px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 14.5px;
  font-weight: 500;
}

.nav a:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
  text-decoration: none;
}

.nav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
}

/* ---------------------------------------------------------------- Hero --- */

.hero {
  padding: 68px 0 56px;
  background:
    radial-gradient(900px 380px at 15% -10%, #e7f0fc 0%, rgba(231, 240, 252, 0) 70%),
    radial-gradient(700px 320px at 92% 0%, #eef6f1 0%, rgba(238, 246, 241, 0) 65%);
  border-bottom: 1px solid var(--border);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 48px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid #cfe0f6;
  border-radius: 999px;
  background: #fff;
  color: var(--accent-dark);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22a06b;
}

.hero h1 {
  margin: 18px 0 14px;
  font-size: clamp(28px, 4.2vw, 42px);
  line-height: 1.25;
  letter-spacing: -0.5px;
  font-weight: 800;
}

.hero h1 .accent {
  color: var(--accent);
}

.hero p.lead {
  margin: 0;
  max-width: 52ch;
  color: var(--text-soft);
  font-size: 16.5px;
  line-height: 1.85;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(26, 95, 180, 0.9);
}

.btn-primary:hover {
  background: var(--accent-dark);
  color: #fff;
}

.btn-ghost {
  background: #fff;
  border-color: var(--border-strong);
  color: var(--text-soft);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

/* Hero 右侧代码卡 */

.hero-code {
  position: relative;
  border-radius: var(--radius);
  background: var(--code-bg);
  box-shadow: 0 24px 48px -28px rgba(16, 25, 42, 0.55);
  overflow: hidden;
  border: 1px solid #1d2b42;
}

.hero-code .bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 14px;
  background: #0b1320;
  border-bottom: 1px solid #1d2b42;
}

.hero-code .bar i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #33415a;
}

.hero-code .bar span {
  margin-left: 6px;
  color: #7d8ea8;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.hero-code pre {
  margin: 0;
  padding: 18px 20px 22px;
  overflow-x: auto;
  color: var(--code-text);
  font-family: var(--font-mono);
  font-size: 12.2px;
  line-height: 1.8;
}

/* -------------------------------------------------------------- 通用区块 --- */

.section {
  padding: 60px 0;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.section-head h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.2px;
}

.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14.5px;
}

.section-head .more {
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- 卡片 --- */

.grid {
  display: grid;
  gap: 18px;
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  display: block;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: #bcd4f2;
  box-shadow: var(--shadow-md);
}

.card .icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.card h3 {
  margin: 0 0 6px;
  font-size: 16.5px;
  font-weight: 650;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

/* 文章列表项 */

.post-list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 22px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.post-item:hover {
  border-color: #bcd4f2;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.post-date {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  padding-top: 3px;
}

.post-date b {
  display: block;
  color: var(--text-soft);
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.3px;
}

.post-body h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.5;
}

.post-body h3 a {
  color: var(--text);
}

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

.post-body p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.75;
}

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

.tag {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.tag.blue {
  background: var(--accent-soft);
  border-color: #cfe0f6;
  color: var(--accent-dark);
}

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

.page-head {
  padding: 44px 0 34px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #fafbfd);
}

.breadcrumb {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumb a {
  color: var(--muted);
}

.breadcrumb .sep {
  margin: 0 8px;
  color: var(--border-strong);
}

.page-head h1 {
  margin: 0 0 16px;
  font-size: clamp(24px, 3.4vw, 34px);
  line-height: 1.35;
  font-weight: 780;
  letter-spacing: -0.4px;
  max-width: 30ch;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 13.5px;
}

.post-meta .sep {
  color: var(--border-strong);
}

.layout-article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 236px;
  gap: 44px;
  align-items: start;
  padding: 44px 0 20px;
}

.prose {
  min-width: 0;
  font-size: 16px;
  line-height: 1.95;
  color: var(--text-soft);
}

.prose > *:first-child {
  margin-top: 0;
}

.prose h2 {
  margin: 44px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 21px;
  font-weight: 720;
  letter-spacing: -0.2px;
  scroll-margin-top: 88px;
}

.prose h3 {
  margin: 30px 0 10px;
  color: var(--text);
  font-size: 17.5px;
  font-weight: 680;
  scroll-margin-top: 88px;
}

.prose p {
  margin: 0 0 16px;
}

.prose strong {
  color: var(--text);
  font-weight: 650;
}

.prose ul,
.prose ol {
  margin: 0 0 18px;
  padding-left: 22px;
}

.prose li {
  margin-bottom: 8px;
}

.prose li::marker {
  color: var(--accent);
}

.prose blockquote {
  margin: 22px 0;
  padding: 14px 20px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-soft);
  color: var(--text-soft);
  font-size: 15px;
}

.prose blockquote p {
  margin: 0;
}

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

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

/* 行内代码 */

.prose code {
  padding: 2px 6px;
  border: 1px solid #dde6f2;
  border-radius: 5px;
  background: #f2f6fc;
  color: #124480;
  font-family: var(--font-mono);
  font-size: 0.885em;
  word-break: break-word;
}

/* 代码块 */

.code-block {
  margin: 20px 0 24px;
  border-radius: var(--radius);
  background: var(--code-bg);
  border: 1px solid #1d2b42;
  overflow: hidden;
  box-shadow: 0 12px 28px -22px rgba(16, 25, 42, 0.8);
}

.code-block .code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  background: #0b1320;
  border-bottom: 1px solid #1d2b42;
}

.code-block .code-bar .lang {
  color: #7d8ea8;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.code-block .copy {
  padding: 2px 9px;
  border: 1px solid #26364f;
  border-radius: 6px;
  background: transparent;
  color: #8ea3bf;
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.code-block .copy:hover {
  color: #cfe0f6;
  border-color: #3a5075;
}

.code-block pre {
  margin: 0;
  padding: 16px 18px 18px;
  overflow-x: auto;
  color: var(--code-text);
  font-family: var(--font-mono);
  font-size: 13.2px;
  line-height: 1.78;
  tab-size: 4;
}

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

/* 高亮 token */

.tok-cmt { color: #6b8299; font-style: italic; }
.tok-str { color: #a5d6a7; }
.tok-kw { color: #7ab8ff; }
.tok-num { color: #ffc978; }
.tok-type { color: #67d5c4; }
.tok-attr { color: #d3a2ff; }

/* 表格 */

.table-wrap {
  margin: 20px 0 24px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

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

.prose th,
.prose td {
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.prose th {
  background: var(--surface-alt);
  color: var(--text);
  font-weight: 650;
  white-space: nowrap;
}

.prose tbody tr:last-child td {
  border-bottom: 0;
}

/* 侧栏目录 */

.aside-toc {
  position: sticky;
  top: 90px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.aside-toc h4 {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.aside-toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13.5px;
  line-height: 1.6;
}

.aside-toc li {
  margin-bottom: 9px;
}

.aside-toc a {
  display: block;
  color: var(--text-soft);
  border-left: 2px solid transparent;
  padding-left: 10px;
  margin-left: -2px;
}

.aside-toc a:hover {
  color: var(--accent);
  border-left-color: var(--accent);
  text-decoration: none;
}

.aside-toc a.sub {
  padding-left: 22px;
  color: var(--muted);
  font-size: 13px;
}

/* 文末导航 */

.post-foot {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 46px 0 0;
  padding-top: 26px;
  border-top: 1px solid var(--border);
}

.post-foot a {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.post-foot a:hover {
  border-color: #bcd4f2;
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.post-foot .label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.5px;
}

.post-foot .title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
}

.post-foot .next {
  text-align: right;
}

/* ------------------------------------------------------------------ 关于 --- */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.info-card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.info-card h3 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 650;
}

.info-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14.5px;
}

.info-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}

.info-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.info-list .k {
  color: var(--muted);
  white-space: nowrap;
}

.info-list .v {
  color: var(--text);
  font-weight: 550;
  text-align: right;
  word-break: break-all;
}

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

.site-footer {
  margin-top: 40px;
  padding: 40px 0 34px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

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

.footer-brand {
  max-width: 42ch;
}

.footer-brand .name {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 15.5px;
  font-weight: 700;
}

.footer-brand p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.8;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-size: 13.5px;
}

.footer-links a {
  color: var(--text-soft);
}

.footer-bottom {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  color: var(--muted);
  font-size: 13px;
}

.beian {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.beian a {
  color: var(--text-soft);
  font-weight: 500;
}

.beian a:hover {
  color: var(--accent);
}

/* 备案号：首页底部需清晰可辨，故用徽标样式而非普通灰字 */
.beian .icp {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.beian .icp:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  text-decoration: none;
}

/* -------------------------------------------------------------- 响应式 --- */

@media (max-width: 960px) {
  .hero-inner,
  .layout-article,
  .about-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero {
    padding: 48px 0 40px;
  }

  .hero-code {
    order: -1;
  }

  .grid.cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .aside-toc {
    display: none;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15.5px;
  }

  .container {
    padding: 0 18px;
  }

  .header-inner {
    height: auto;
    flex-wrap: wrap;
    padding: 10px 0 2px;
    gap: 6px;
  }

  .brand {
    font-size: 15.5px;
    gap: 8px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    font-size: 13px;
    border-radius: 8px;
  }

  .brand-sub {
    display: none;
  }

  .nav {
    width: 100%;
    gap: 2px;
    padding-bottom: 6px;
  }

  .nav a {
    padding: 5px 10px;
    font-size: 13.5px;
  }

  .prose h2,
  .prose h3 {
    scroll-margin-top: 116px;
  }

  .grid.cols-4,
  .grid.cols-3,
  .grid.cols-2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 18px;
  }

  .post-date {
    display: flex;
    align-items: baseline;
    gap: 8px;
  }

  .post-date b {
    font-size: 15px;
  }

  .post-foot {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-foot .next {
    text-align: left;
  }

  .section {
    padding: 44px 0;
  }

  .prose {
    font-size: 15.5px;
  }

  .footer-inner {
    flex-direction: column;
    gap: 20px;
  }
}

@media print {
  .site-header,
  .site-footer,
  .aside-toc,
  .post-foot,
  .hero-code {
    display: none;
  }
}
