/*
Theme Name: Yuanguo
Theme URI: https://www.cccn.xyz
Author: Yuanguo
Description: 元果分享自用轻量主题：无外部字体与 JS 依赖，纯系统字体栈，面向技术笔记阅读体验优化。
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: yuanguo
*/

:root {
  --c-bg: #f6f7f9;
  --c-card: #ffffff;
  --c-text: #1f2328;
  --c-text-soft: #4b5563;
  --c-muted: #667085;   /* 白底 4.97:1、灰底 4.64:1，过 WCAG AA 正文 4.5 */
  --c-border: #e7eaee;
  --c-accent: #2563eb;
  --c-code-bg: #0d1117;
  --c-code-text: #e6edf3;
  --radius-card: 14px;
  --radius-article: 16px;
  --shadow-hover: 0 10px 28px rgba(16, 24, 40, .09);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

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

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

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

img { max-width: 100%; height: auto; display: block; }

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

.wrap {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- 头部 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--c-border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 62px;
}

.brand {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--c-text);
}
.brand:hover { text-decoration: none; color: var(--c-accent); }

.nav { display: flex; align-items: center; gap: 22px; }
.nav a {
  font-size: 15px;
  color: var(--c-text-soft);
}
.nav a:hover { color: var(--c-text); text-decoration: none; }
.nav a.is-active { color: var(--c-text); font-weight: 600; }

/* ---------- 主体 ---------- */
.site-main { padding: 0 0 72px; }

/* 首页 hero */
.hero { padding: 60px 0 28px; }
.hero h1 {
  margin: 0 0 18px;
  font-size: 40px;
  line-height: 1.28;
  font-weight: 800;
  letter-spacing: -.022em;
}
.hero .lead { max-width: 720px; }
.hero .lead p {
  margin: 0 0 14px;
  font-size: 17px;
  line-height: 1.85;
  color: var(--c-text-soft);
}

/* 分区标题 */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 34px 0 18px;
}
.section-head h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.section-head .more { font-size: 14px; color: var(--c-muted); }

/* 卡片网格 */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  padding: 22px 22px 20px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: #d8dee6;
}

.card h3 {
  margin: 0 0 10px;
  font-size: 17.5px;
  line-height: 1.55;
  font-weight: 650;
}
.card h3 a { color: var(--c-text); }
.card h3 a:hover { color: var(--c-accent); text-decoration: none; }

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

.card .meta {
  margin-top: auto;
  font-size: 13px;
  color: #667085;
  letter-spacing: .01em;
}

/* 文章 / 页面容器 */
.article {
  max-width: 790px;
  margin: 36px auto 0;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-article);
  padding: 44px 48px 40px;
}

.entry-title {
  margin: 0 0 14px;
  font-size: 31px;
  line-height: 1.42;
  font-weight: 800;
  letter-spacing: -.02em;
}

.entry-meta {
  margin: 0 0 30px;
  padding-bottom: 22px;
  border-bottom: 1px solid #eef0f3;
  font-size: 13.5px;
  color: var(--c-muted);
}

/* 正文排版 */
.entry-content { font-size: 16.5px; line-height: 1.92; color: #24292f; }
.entry-content > *:first-child { margin-top: 0; }

.entry-content h2 {
  margin: 42px 0 16px;
  padding-left: 13px;
  border-left: 4px solid var(--c-accent);
  font-size: 22px;
  line-height: 1.5;
  font-weight: 750;
  letter-spacing: -.01em;
}
.entry-content h3 {
  margin: 30px 0 12px;
  font-size: 18px;
  font-weight: 700;
}
.entry-content p { margin: 0 0 18px; }
.entry-content ul, .entry-content ol { margin: 0 0 18px; padding-left: 24px; }
.entry-content li { margin: 7px 0; }
.entry-content li::marker { color: #b3bcc6; }

.entry-content strong { font-weight: 700; color: #111827; }

.entry-content code {
  padding: 2px 6px;
  border-radius: 5px;
  background: #f2f4f7;
  border: 1px solid #e8ebef;
  font-family: var(--font-mono);
  font-size: .89em;
  color: #0f172a;
  word-break: break-word;
}

.entry-content pre {
  margin: 0 0 22px;
  padding: 18px 20px;
  border-radius: 12px;
  background: var(--c-code-bg);
  color: var(--c-code-text);
  overflow-x: auto;
  line-height: 1.72;
  font-size: 13.5px;
}
.entry-content pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  white-space: pre;
}

.entry-content table {
  width: 100%;
  margin: 0 0 22px;
  border-collapse: collapse;
  font-size: 15px;
}

/*
 * 窄屏：表格列多时 min-content 会超过容器宽度，把整页撑出横向滚动。
 * display:block + overflow-x:auto 让表格在自己的盒子里滚，页面不滚。
 */
@media (max-width: 720px) {
  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 0 22px;
  }
  .table-scroll > table {
    margin: 0;
    min-width: 520px;   /* 太窄会把数字列挤成两行，反而不如滚 */
  }
}
.entry-content th, .entry-content td {
  padding: 10px 13px;
  text-align: left;
  border-bottom: 1px solid #eef0f3;
  vertical-align: top;
}
.entry-content th {
  background: #f9fafb;
  font-weight: 650;
  color: #374151;
  white-space: nowrap;
}
.entry-content tr:last-child td { border-bottom: 0; }

.entry-content blockquote {
  margin: 0 0 20px;
  padding: 4px 0 4px 16px;
  border-left: 3px solid #d7dce2;
  color: var(--c-text-soft);
}

.entry-content hr {
  margin: 32px 0;
  border: 0;
  border-top: 1px solid var(--c-border);
}

/* 返回链接 */
.back-link {
  display: inline-block;
  margin-top: 34px;
  font-size: 14px;
  color: var(--c-muted);
}

/* 分页 */
.pagination { margin: 30px 0 0; text-align: center; font-size: 14px; }
.pagination .page-numbers { display: inline-block; padding: 6px 12px; color: var(--c-text-soft); }
.pagination .current { font-weight: 700; color: var(--c-text); }

/* 空状态 */
.empty {
  padding: 40px 0;
  text-align: center;
  color: var(--c-muted);
  font-size: 15px;
}

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--c-border);
  background: #fff;
  padding: 34px 0 40px;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.site-footer p { margin: 0; font-size: 13.5px; color: var(--c-muted); }
.site-footer .foot-links { display: flex; gap: 18px; font-size: 13.5px; }
.site-footer .foot-links a { color: var(--c-muted); }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .hero { padding: 40px 0 20px; }
  .hero h1 { font-size: 28px; }
  .hero .lead p { font-size: 16px; }
  .article { margin-top: 20px; padding: 26px 22px 28px; border-radius: 0; border-left: 0; border-right: 0; }
  .entry-title { font-size: 24px; }
  .entry-content { font-size: 16px; line-height: 1.85; }
  .entry-content h2 { font-size: 19.5px; }
  .entry-content pre { font-size: 12.5px; padding: 14px 16px; }
  .cards { grid-template-columns: 1fr; gap: 14px; }
  .nav { gap: 14px; }
  .nav a { font-size: 14px; }
  .site-header .wrap { height: 56px; }
}

@media (max-width: 400px) {
  .hero h1 { font-size: 25px; }
  .brand { font-size: 17px; }
  .nav { gap: 11px; }
  .nav a { font-size: 13px; }
}
