/* 官网文章页（服务端渲染）样式。视觉照 SPA 官网：近白中性灰底、细边框、圆角 8 / 24、蓝到紫点缀。
   不依赖前端构建；正文排版 .a-prose 和管理后台编辑器预览共用一份规则（web/src/styles/article-prose.css），改一边记得同步另一边。 */

:root {
  --ink: #111827; --ink-2: #1F2937; --ink-3: #374151; --sub: #6B7280; --faint: #9CA3AF;
  --line: #E6E7EB; --line-soft: #EEF0F3; --line-faint: #F3F4F6;
  --bg: #F9FAFB; --accent: #4F46E5;
  --grad: linear-gradient(135deg, #3C82F6, #8B5DF6);
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
main { flex: 1; }
a { color: inherit; }
img { max-width: 100%; display: block; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 50; background: #fff; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
:focus-visible { outline: 2px solid #8B5DF6; outline-offset: 2px; border-radius: 6px; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 8px; font-size: 14px; text-decoration: none; white-space: nowrap; transition: background-color .2s, border-color .2s; }
.btn-lg { min-height: 48px; padding: 0 24px; font-size: 15px; }
.btn-ink { background: var(--ink); color: #fff; font-weight: 500; }
.btn-ink:hover { background: var(--ink-2); }
.btn-line { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-line:hover { background: #F6F7F9; }
.btn.off { color: var(--faint); pointer-events: none; }

/* 页头占位：真正的顶栏页脚由 /site-chrome.js 挂载前端同一套组件替换，这里只求加载前看起来一致、不跳动 */
#icx-site-header, #icx-site-footer { display: contents; }
.hd { position: sticky; top: 0; z-index: 30; background: rgba(249, 250, 251, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.hd-in { box-sizing: border-box; max-width: 1200px; height: 72px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 18px; line-height: 28px; font-weight: 600; letter-spacing: -.01em; color: var(--ink-2); text-decoration: none; margin-right: 12px; flex: none; }
.brand-tail { font-weight: 400; color: var(--sub); }
.nav { box-sizing: border-box; flex: 1 1 auto; display: flex; align-items: center; column-gap: 4px; min-height: 44px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, .85); }
.nav a { position: relative; display: flex; align-items: center; min-height: 42px; padding: 0 14px; font-size: 14px; color: rgba(31, 41, 55, .6); text-decoration: none; }
.nav a[aria-current] { color: var(--ink); }
.nav a[aria-current]::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 14px; height: 2px; margin-left: -7px; border-radius: 999px; background: var(--ink); }
.hd-fill { display: none; flex: 1 1 auto; }
.hd-btn { min-height: 44px; padding: 0 18px; flex: none; }
.btn-line.hd-btn { color: var(--ink-3); }
html[data-auth="in"] .auth-out, html:not([data-auth="in"]) .auth-in { display: none; }
.menu-btn { display: none; flex: none; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink-3); }
@media (max-width: 1023px) {
  .nav { display: none; }
  .hd-fill { display: block; }
  .menu-btn { display: inline-flex; }
}
@media (max-width: 639px) {
  .hd-in { padding: 0 16px; }
  .hd-btn { display: none !important; }
}

/* 标签 */
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.tag { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 13px; color: var(--ink-3); text-decoration: none; transition: border-color .2s, color .2s; }
.tag:hover { border-color: #C9CCD4; color: var(--ink); }
.tag.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* 列表页 */
.list-hd { padding-top: 56px; padding-bottom: 32px; }
.list-hd h1 { margin: 0; font-size: 40px; line-height: 1.15; font-weight: 600; letter-spacing: -.03em; }
.list-hd > p { margin: 12px 0 0; font-size: 15px; color: var(--sub); }
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.grid > li { display: flex; }
.card { flex: 1; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: #fff; text-decoration: none; transition: border-color .2s, transform .2s; }
.card:hover { border-color: #C9CCD4; transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .card:hover { transform: none; } }
.cover { display: block; aspect-ratio: 1200 / 630; background: #F6F7F9; border-bottom: 1px solid var(--line-soft); overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse 60% 80% at 80% 0%, rgba(139, 93, 246, .08), transparent 70%), radial-gradient(ellipse 60% 80% at 0% 100%, rgba(60, 130, 246, .08), transparent 70%), #F6F7F9; }
.card-body { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 20px 24px 22px; }
.card-tags { display: flex; gap: 6px; }
.card-tags span { font-size: 12px; color: #6D28D9; background: #F3EEFF; border-radius: 6px; padding: 2px 8px; }
.card-t { font-size: 18px; line-height: 1.4; font-weight: 500; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-s { font-size: 14px; line-height: 1.7; color: var(--sub); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { margin-top: auto; padding-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; font-size: 13px; color: var(--faint); }
.meta i { font-style: normal; }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 40px 0 8px; }
.pager-n { font-size: 13px; color: var(--sub); }
.empty { padding: 72px 24px; border: 1px dashed var(--line); border-radius: 24px; background: #fff; text-align: center; color: var(--sub); }
.empty p { margin: 6px 0 0; font-size: 14px; }
.empty .empty-t { margin: 0; font-size: 16px; color: var(--ink); font-weight: 500; }
.empty a { color: var(--accent); }
@media (max-width: 1023px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px) {
  .wrap { padding: 0 16px; }
  .list-hd { padding-top: 36px; }
  .list-hd h1 { font-size: 30px; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}

/* 详情页 */
.post { padding-top: 40px; }
.post-hd { max-width: 760px; }
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--faint); }
.crumb a { color: var(--sub); text-decoration: none; }
.crumb a:hover { color: var(--ink); }
.post-hd h1 { margin: 16px 0 0; font-size: 40px; line-height: 1.25; font-weight: 600; letter-spacing: -.03em; color: var(--ink); }
.lead { margin: 16px 0 0; font-size: 17px; line-height: 1.75; color: var(--sub); }
.post-hd .meta { margin-top: 20px; padding: 0; }
.post-cover { margin: 32px 0 0; overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: #F6F7F9; }
.post-cover img { width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; }
.post-grid { display: grid; grid-template-columns: minmax(0, 760px) 220px; justify-content: space-between; gap: 48px; margin-top: 40px; }
.toc { position: sticky; top: 104px; align-self: start; max-height: calc(100vh - 128px); overflow-y: auto; padding-left: 16px; border-left: 1px solid var(--line); }
.toc-t { display: block; margin-bottom: 10px; font-size: 12px; font-weight: 500; letter-spacing: .04em; color: var(--faint); }
.toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.toc a { display: block; padding: 5px 0; font-size: 13px; line-height: 1.5; color: var(--sub); text-decoration: none; }
.toc a:hover { color: var(--ink); }
.toc .l3 a { padding-left: 12px; font-size: 12.5px; }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; max-width: 760px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line-soft); }
@media (max-width: 1023px) {
  .post-grid { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 639px) {
  .post { padding-top: 24px; }
  .post-hd h1 { font-size: 28px; }
  .lead { font-size: 16px; }
  .post-cover { border-radius: 16px; margin-top: 24px; }
  .post-grid { margin-top: 28px; }
}

/* 底部 CTA（同首页） */
@property --cta-ang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes cta-ang { to { --cta-ang: 360deg; } }
.cta { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 32px; margin: 72px 0 0; padding: 48px 56px; border-radius: 28px; border: 1px solid transparent; background: linear-gradient(#fff, #fff) padding-box, conic-gradient(from var(--cta-ang), #E6E7EB 0deg, #E6E7EB 200deg, #3C82F6 270deg, #8B5DF6 320deg, #E6E7EB 360deg) border-box; animation: cta-ang 7s linear infinite; }
.cta-grid { position: absolute; inset: 0; background: linear-gradient(#EEF0F3 1px, transparent 1px), linear-gradient(90deg, #EEF0F3 1px, transparent 1px); background-size: 40px 40px; -webkit-mask-image: radial-gradient(ellipse 60% 90% at 80% 50%, #000, transparent 70%); mask-image: radial-gradient(ellipse 60% 90% at 80% 50%, #000, transparent 70%); }
.cta-glow { position: absolute; top: 50%; right: 8%; width: 360px; height: 260px; margin-top: -130px; border-radius: 50%; background: var(--grad); opacity: .16; filter: blur(90px); }
.cta-txt, .cta-btns { position: relative; }
.cta-txt { flex: 1 1 420px; min-width: 0; }
.cta h2 { margin: 0; font-size: 32px; line-height: 1.25; font-weight: 400; letter-spacing: -.025em; }
.cta p { margin: 14px 0 0; font-size: 15px; color: var(--sub); }
.cta-btns { display: flex; flex-wrap: wrap; gap: 12px; }
@media (prefers-reduced-motion: reduce) { .cta { animation: none; } }
@media (max-width: 639px) {
  .cta { margin-top: 48px; padding: 32px 24px; border-radius: 22px; }
  .cta h2 { font-size: 26px; }
  .cta-btns { width: 100%; flex-direction: column; }
}

.related { padding-top: 64px; }
.related h2 { margin: 0 0 24px; font-size: 24px; font-weight: 500; letter-spacing: -.02em; }

/* 404 */
.nf { padding-top: 96px; padding-bottom: 48px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.nf-code { font: 600 64px/1 var(--mono); background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nf h1 { margin: 20px 0 0; font-size: 26px; font-weight: 500; letter-spacing: -.02em; }
.nf p { margin: 10px 0 0; color: var(--sub); }
.nf-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 28px; }

/* 页脚 */
.ft { margin-top: 88px; border-top: 1px solid var(--line-soft); background: #fff; }
.ft-in { max-width: 1200px; margin: 0 auto; padding: 40px 24px 32px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 40px; }
.ft-brand { max-width: 360px; display: flex; flex-direction: column; gap: 10px; }
.ft-brand .brand { margin-right: 0; }
.ft-brand p { margin: 0; font-size: 14px; line-height: 1.7; color: var(--ink-3); }
.ft-brand p.faint { font-size: 13px; color: var(--faint); }
.ft-cols { display: flex; flex-wrap: wrap; gap: 56px; }
.ft-cols div { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.ft-cols span { font-size: 13px; font-weight: 500; color: var(--ink); }
.ft-cols a { color: var(--sub); text-decoration: none; }
.ft-cols a:hover { color: var(--ink); }
.ft-copy { max-width: 1200px; margin: 0 auto; padding: 16px 24px 24px; border-top: 1px solid var(--line-faint); font-size: 13px; color: var(--sub); }

/* ---------- 正文排版（与 web/src/styles/article-prose.css 保持一致） ---------- */
.a-prose { min-width: 0; font-size: 16px; line-height: 1.85; color: var(--ink-3); overflow-wrap: break-word; }
.a-prose > :first-child { margin-top: 0; }
.a-prose > :last-child { margin-bottom: 0; }
.a-prose p { margin: 1em 0; }
.a-prose h2, .a-prose h3, .a-prose h4 { color: var(--ink); letter-spacing: -.02em; scroll-margin-top: 96px; }
.a-prose h2 { margin: 2.2em 0 .7em; font-size: 24px; line-height: 1.35; font-weight: 600; }
.a-prose h3 { margin: 1.8em 0 .6em; font-size: 19px; line-height: 1.4; font-weight: 600; }
.a-prose h4 { margin: 1.6em 0 .5em; font-size: 16px; font-weight: 600; }
.a-prose a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(79, 70, 229, .3); text-underline-offset: 3px; }
.a-prose a:hover { text-decoration-color: currentColor; }
.a-prose strong { color: var(--ink); font-weight: 600; }
.a-prose ul, .a-prose ol { margin: 1em 0; padding-left: 1.4em; }
.a-prose ul { list-style: disc; }
.a-prose ol { list-style: decimal; }
.a-prose li { margin: .35em 0; }
.a-prose li > ul, .a-prose li > ol { margin: .35em 0; }
.a-prose li::marker { color: var(--faint); }
.a-prose li:has(> input[type="checkbox"]) { list-style: none; margin-left: -1.4em; }
.a-prose input[type="checkbox"] { margin: 0 .5em 0 0; vertical-align: -.1em; accent-color: #4F46E5; }
.a-prose blockquote { margin: 1.4em 0; padding: .2em 0 .2em 1.1em; border-left: 3px solid #DCD3FF; color: var(--sub); }
.a-prose blockquote p { margin: .5em 0; }
.a-prose code { font-family: var(--mono); font-size: .875em; padding: .15em .4em; border-radius: 6px; background: var(--line-faint); color: var(--ink-2); }
.a-prose pre { margin: 1.4em 0; padding: 16px 18px; overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 12px; background: #F6F7F9; font-size: 13.5px; line-height: 1.7; }
.a-prose pre code { padding: 0; background: none; font-size: inherit; color: var(--ink-2); white-space: pre; }
.a-prose img { max-width: 100%; height: auto; margin: 1.4em auto; border: 1px solid var(--line-soft); border-radius: 12px; }
.a-prose hr { margin: 2.4em 0; border: 0; border-top: 1px solid var(--line); }
.a-prose table { display: block; width: max-content; max-width: 100%; margin: 1.4em 0; overflow-x: auto; border-collapse: collapse; font-size: 14px; line-height: 1.6; }
.a-prose th, .a-prose td { padding: 9px 14px; border: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.a-prose th { background: #F9FAFB; color: var(--ink); font-weight: 500; white-space: nowrap; }
.a-prose del { color: var(--faint); }
@media (max-width: 639px) {
  .a-prose { font-size: 15.5px; }
  .a-prose h2 { font-size: 21px; }
  .a-prose h3 { font-size: 17.5px; }
}
