/* PortAI 博客样式 —— 单文件、零依赖、跟随系统深浅色 */

:root {
  --bg: #fbfaf8;
  --bg-soft: #f2f0ec;
  --fg: #1f2328;
  --fg-soft: #5b6470;
  --accent: #1f6feb;
  --accent-soft: rgba(31, 111, 235, 0.1);
  --border: #e3e0da;
  --code-bg: #f4f2ee;
  --radius: 10px;
  --wrap: 46rem;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

:root[data-theme="dark"] {
  --bg: #16181c;
  --bg-soft: #1e2126;
  --fg: #e6e6e3;
  --fg-soft: #9aa3ad;
  --accent: #6ba4ff;
  --accent-soft: rgba(107, 164, 255, 0.14);
  --border: #2c3037;
  --code-bg: #1c1f24;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.25rem;
}

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

.muted { color: var(--fg-soft); }

/* ---------- 头部 ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 1rem;
  padding-bottom: 0.9rem;
}

.brand { display: flex; align-items: baseline; gap: 0.6rem; color: var(--fg); }
.brand:hover { text-decoration: none; }
.brand-mark { font-weight: 700; font-size: 1.15rem; letter-spacing: 0.02em; }
.brand-sub { color: var(--fg-soft); font-size: 0.82rem; }

.site-nav { display: flex; align-items: center; gap: 1.1rem; font-size: 0.94rem; }
.site-nav a { color: var(--fg-soft); }
.site-nav a:hover { color: var(--accent); text-decoration: none; }

.theme-toggle {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg-soft);
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

main { padding: 2.5rem 0 4rem; }

/* ---------- 首页 ---------- */
.hero { margin-bottom: 2.8rem; }
.hero h1 { font-size: 2.1rem; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
.hero-sub { color: var(--fg-soft); margin: 0; }

.page-title { font-size: 1.6rem; margin: 0 0 1.8rem; }

.post-list { display: flex; flex-direction: column; }

.card {
  padding: 1.4rem 0;
  border-top: 1px solid var(--border);
}
.card:first-child { border-top: none; padding-top: 0; }
.card-title { font-size: 1.28rem; margin: 0 0 0.4rem; line-height: 1.5; }
.card-title a { color: var(--fg); }
.card-title a:hover { color: var(--accent); text-decoration: none; }
.card-summary { color: var(--fg-soft); margin: 0.5rem 0 0; font-size: 0.97rem; }

.meta {
  color: var(--fg-soft);
  font-size: 0.85rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.empty {
  color: var(--fg-soft);
  padding: 1.6rem 0;
  border-top: 1px solid var(--border);
}

.tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  font-size: 0.78rem;
}
.tag:hover { text-decoration: none; }

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}

/* ---------- 自留地 ---------- */
.services { margin-top: 3.5rem; padding-top: 1.6rem; border-top: 1px solid var(--border); }
.services h2 { font-size: 1rem; margin: 0 0 0.9rem; color: var(--fg-soft); font-weight: 600; }
.service-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.6rem 1.2rem;
}
.service-list li { display: flex; flex-direction: column; gap: 0.1rem; line-height: 1.5; font-size: 0.93rem; }
.service-list .muted { font-size: 0.78rem; }
.service-list .ext { font-size: 0.72em; margin-left: 0.1em; }

/* ---------- 文章 ---------- */
.post-header { margin-bottom: 2rem; }
.post-header h1 { font-size: 1.9rem; line-height: 1.4; margin: 0 0 0.7rem; letter-spacing: -0.01em; }

.post-body > *:first-child { margin-top: 0; }
.post-body h2 { font-size: 1.35rem; margin: 2.4rem 0 0.8rem; }
.post-body h3 { font-size: 1.14rem; margin: 2rem 0 0.6rem; }
.post-body h4 { font-size: 1rem; margin: 1.6rem 0 0.5rem; }
.post-body p { margin: 1.05rem 0; }
.post-body ul, .post-body ol { padding-left: 1.35rem; margin: 1.05rem 0; }
.post-body li { margin: 0.35rem 0; }
.post-body li > ul, .post-body li > ol { margin: 0.35rem 0; }

.post-body blockquote {
  margin: 1.4rem 0;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--fg-soft);
}
.post-body blockquote > *:first-child { margin-top: 0; }
.post-body blockquote > *:last-child { margin-bottom: 0; }

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

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.87em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.08em 0.35em;
}

.post-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 1.4rem 0;
  line-height: 1.65;
}
.post-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
}

.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
  margin: 1.6rem auto;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.92rem;
}
.post-body th, .post-body td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.7rem;
  text-align: left;
}
.post-body th { background: var(--bg-soft); font-weight: 600; }

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.3rem;
  border-top: 1px solid var(--border);
  font-size: 0.93rem;
}

/* ---------- 归档 / 标签 ---------- */
.archive-group { margin-bottom: 2.2rem; }
.archive-group h2 { font-size: 1.15rem; margin: 0 0 0.7rem; }
.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-list li {
  display: flex;
  gap: 0.9rem;
  padding: 0.3rem 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.96rem;
}
.archive-list time { color: var(--fg-soft); font-family: var(--font-mono); font-size: 0.85rem; }

.tag-cloud {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
}
.tag-cloud li { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.8rem 0 2.4rem;
  font-size: 0.86rem;
  color: var(--fg-soft);
  text-align: center;
}
.site-footer p { margin: 0.25rem 0; }
.site-footer .beian a { color: var(--fg-soft); }
.site-footer .beian a:hover { color: var(--accent); }

@media (max-width: 34rem) {
  body { font-size: 16px; }
  .hero h1 { font-size: 1.7rem; }
  .post-header h1 { font-size: 1.5rem; }
  .brand-sub { display: none; }
}

@media print {
  .site-header, .site-footer, .post-nav, .theme-toggle { display: none; }
}
