/* 1:1 还原 baoyu.io 设计变量（提取自其生产 CSS）+ Sai 品牌 */
/* 浅色: bg #fff / fg hsl(0 0% 3.9%) / muted-fg hsl(0 0% 45.1%) / border hsl(0 0% 89.8%) / muted hsl(0 0% 96.1%) */
/* 深色: bg hsl(0 0% 3.9%) / fg hsl(0 0% 98%) / muted-fg hsl(0 0% 63.9%) / border hsl(0 0% 14.9%) / muted hsl(0 0% 14.9%) */

:root {
  --background: hsl(0, 0%, 100%);
  --foreground: hsl(0, 0%, 3.9%);
  --muted: hsl(0, 0%, 96.1%);
  --muted-foreground: hsl(0, 0%, 45.1%);
  --accent: hsl(0, 0%, 96.1%);
  --border: hsl(0, 0%, 89.8%);
  --max-w-list: 56rem;   /* max-w-4xl */
  --max-w-article: 48rem; /* max-w-3xl */
}

html.dark {
  --background: hsl(0, 0%, 3.9%);
  --foreground: hsl(0, 0%, 98%);
  --muted: hsl(0, 0%, 14.9%);
  --muted-foreground: hsl(0, 0%, 63.9%);
  --accent: hsl(0, 0%, 14.9%);
  --border: hsl(0, 0%, 14.9%);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  transition: background 0.2s ease, color 0.2s ease;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

.container-list {
  max-width: var(--max-w-list);
}

.container-article {
  max-width: var(--max-w-article);
}

/* ---------- 头部（h-20，站点名左、导航右） ---------- */
.site-header {
  z-index: 40;
  background: var(--background);
}

.header-inner {
  display: flex;
  height: 5rem;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--foreground);
}

.brand .logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--foreground);
  color: var(--background);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0;
}

.brand .site-name {
  font-size: 1.125rem;
  font-weight: 700;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-nav a {
  display: flex;
  align-items: center;
  font-size: 1.125rem;
  font-weight: 500;
  color: color-mix(in srgb, var(--foreground) 60%, transparent);
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-nav a:hover,
.site-nav a.active {
  color: color-mix(in srgb, var(--foreground) 80%, transparent);
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: color-mix(in srgb, var(--foreground) 60%, transparent);
  font-size: 18px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}

.theme-toggle:hover {
  color: var(--foreground);
  background: var(--accent);
}

/* ---------- 首页 Hero ---------- */
.hero {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.hero h1 {
  display: inline-block;
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

@media (min-width: 1024px) {
  .hero h1 { font-size: 3rem; }
}

.hero p {
  font-size: 1.25rem;
  color: var(--muted-foreground);
}

.hero hr,
.hr {
  border: none;
  border-top: 1px solid var(--border);
}

/* ---------- 文章卡片列表（整卡可点，title 2xl extrabold） ---------- */
.article-grid {
  display: grid;
  gap: 2.5rem;
}

.article-card {
  position: relative;
  display: flex;
  flex-direction: column;
  row-gap: 0.5rem;
}

.article-card h2 {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.01em;
  transition: color 0.15s ease;
}

.article-card:hover h2 {
  color: color-mix(in srgb, var(--foreground) 72%, var(--muted-foreground));
}

.article-card .excerpt {
  color: var(--muted-foreground);
  font-size: 1rem;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card .date {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.article-card a.card-link {
  position: absolute;
  inset: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 文章详情页 ---------- */
.article-page {
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.article-head {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.article-head time {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.article-head h1 {
  margin: 0.5rem 0;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

@media (min-width: 1024px) {
  .article-head h1 { font-size: 3rem; line-height: 1.2; }
}

.article-head .byline {
  margin-top: 0.5rem;
  display: flex;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  gap: 0.5rem;
  flex-wrap: wrap;
}

.article-cover {
  margin: 0.5rem 0 1.5rem;
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--muted);
}

/* ---------- 正文排版（prose） ---------- */
.prose {
  max-width: 100%;
  font-size: 1.125rem;
  line-height: 1.8;
}

.prose p {
  margin: 1.1em 0;
}

.prose h2 {
  font-size: 1.55em;
  font-weight: 700;
  line-height: 1.3;
  margin: 1.8em 0 0.7em;
  letter-spacing: -0.01em;
}

.prose h3 {
  font-size: 1.25em;
  font-weight: 700;
  margin: 1.5em 0 0.6em;
}

.prose ul,
.prose ol {
  margin: 1.1em 0;
  padding-left: 1.6em;
}

.prose li {
  margin: 0.45em 0;
}

.prose blockquote {
  margin: 1.4em 0;
  padding: 0.2em 0 0.2em 1.2em;
  border-left: 3px solid var(--border);
  color: var(--muted-foreground);
  font-style: normal;
}

.prose code {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--muted);
  border-radius: 4px;
  padding: 0.15em 0.4em;
  font-weight: 500;
}

.prose pre {
  margin: 1.4em 0;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  font-size: 0.9em;
  line-height: 1.6;
}

.prose pre code {
  background: none;
  padding: 0;
  font-size: 1em;
}

.prose img {
  max-width: 100%;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  margin: 1.2em 0;
}

.prose hr {
  margin: 2em 0;
}

.prose em {
  color: var(--muted-foreground);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2.5rem;
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  color: var(--foreground);
}

/* ---------- 关于页 ---------- */
.about-section {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

.about-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
  letter-spacing: -0.01em;
}

.about-section h2:first-child {
  margin-top: 0;
}

.about-section p {
  margin: 0.8em 0;
  color: var(--foreground);
}

.about-section p.lead {
  font-size: 1.15rem;
  color: var(--muted-foreground);
}

.about-links {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.about-links a {
  color: var(--foreground);
  text-decoration: none;
  font-size: 0.95rem;
  width: fit-content;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  transition: border-color 0.15s ease;
}

.about-links a:hover {
  border-color: var(--muted-foreground);
}

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 1.75rem 0 2.5rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.site-footer a {
  color: var(--muted-foreground);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--foreground);
  text-decoration: underline;
}

.empty-tip {
  padding: 3rem 0;
  color: var(--muted-foreground);
  font-size: 1rem;
}

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .header-inner {
    height: 4rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
  .site-nav a {
    font-size: 1rem;
  }
  .article-card h2 {
    font-size: 1.25rem;
  }
  .article-head h1 {
    font-size: 1.75rem;
  }
  .hero h1 {
    font-size: 1.75rem;
  }
}
