/* 淘客APP.cn — 现代个人博客 UI */
:root {
  --bg: #f4f6fb;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --line: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-glow: rgba(37, 99, 235, 0.12);
  --accent: #06b6d4;
  --accent-soft: #ecfeff;
  --tag-bg: #f1f5f9;
  --tag-text: #334155;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 12px 40px rgba(15, 23, 42, 0.1);
  --header-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--text-secondary);
  background: var(--bg);
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-hover); }

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}

.container-wide {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

/* —— 顶栏 —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  gap: 16px;
}

.brand,
.logo,
.masthead .site-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand:hover,
.masthead .site-title:hover { color: var(--primary); text-decoration: none; }

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.logo-icon { display: none; }

/* 旧结构兼容 */
.site-header .container-wide:has(.masthead) {
  padding-top: 0;
}
.masthead { display: none; }
.header-bar {
  display: contents;
}
.header-inner:has(.header-bar) {
  display: flex;
}
.site-header:has(.masthead) {
  height: auto;
  padding: 0;
}
.site-header:has(.masthead) .container-wide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  gap: 16px;
}
.site-header:has(.masthead) .header-bar {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
  gap: 16px;
  border: none;
  padding: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-nav a {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 500;
  border-bottom: none;
  transition: background 0.2s, color 0.2s;
}

.site-nav a:hover {
  color: var(--primary);
  background: var(--primary-soft);
  text-decoration: none;
}

.site-nav a.active {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 600;
}

.header-extra {
  font-size: 13px;
  white-space: nowrap;
}

.header-extra a { font-weight: 600; }

.menu-toggle {
  display: none;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 16px;
  cursor: pointer;
  color: var(--text);
}

/* —— 首页 Hero —— */
.home-hero {
  padding: 56px 0 40px;
  position: relative;
  overflow: hidden;
}

.home-hero::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -80px;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.home-hero::after {
  content: "";
  position: absolute;
  bottom: -100px;
  left: -60px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.home-hero .container-wide { position: relative; z-index: 1; }

.hero-label {
  display: inline-block;
  padding: 5px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.home-hero h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
  max-width: 640px;
}

.home-hero p {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.8;
}

.home-hero strong { color: var(--text); font-weight: 600; }

/* 博主介绍 */
.blog-intro {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  margin: 0 0 32px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--primary);
}

.blog-intro p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.blog-intro strong { color: var(--text); }

/* —— 文章列表 —— */
.post-feed { padding: 8px 0 48px; }

.feed-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
  border: none;
  padding: 0;
  display: block;
}

.post-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.post-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
  text-decoration: none;
  color: inherit;
  min-height: 180px;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: #cbd5e1;
  text-decoration: none;
}

.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.post-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
}

.post-date {
  font-size: 12px;
  color: var(--text-muted);
}

.post-card h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.45;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.post-card:hover h2 { color: var(--primary); }

.post-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: auto;
  flex: 1;
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

/* topic-grid 兼容 */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 8px 0 48px;
}

.topic-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s, box-shadow 0.25s;
}

.topic-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  text-decoration: none;
}

.topic-card .icon { display: none; }

.topic-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.topic-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.topic-card .link {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
}

/* —— 文章页布局 —— */
.layout-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  max-width: 1140px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  align-items: start;
}

.article-main {
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  box-shadow: var(--shadow-sm);
}

.page-hero {
  padding: 0;
  background: none;
  margin-bottom: 28px;
}

.page-hero .breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.page-hero .breadcrumb a { color: var(--text-muted); }
.page-hero .breadcrumb a:hover { color: var(--primary); }

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.page-hero h1 {
  font-size: clamp(26px, 3.5vw, 34px);
  font-weight: 800;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 14px;
  letter-spacing: -0.03em;
}

.page-hero .lead {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.8;
  border: none;
  padding: 0;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.page-hero .lead strong { color: var(--text); }

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* 正文 */
.article-body { padding: 0; }

.article-body h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 36px 0 14px;
  letter-spacing: -0.02em;
}

.article-body h2:first-child { margin-top: 0; }

.article-body h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 28px 0 10px;
}

.article-body p {
  margin-bottom: 16px;
  color: var(--text-secondary);
  font-size: 15px;
}

.article-body ul,
.article-body ol {
  margin: 0 0 20px 22px;
  font-size: 15px;
  color: var(--text-secondary);
}

.article-body li { margin-bottom: 8px; }
.article-body li::marker { color: var(--primary); }

.container.article-body {
  max-width: 760px;
  padding: 32px 20px 64px;
  background: transparent;
  border: none;
  box-shadow: none;
}

/* 摘要 */
.answer-box {
  background: linear-gradient(135deg, var(--primary-soft) 0%, var(--accent-soft) 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 28px;
}

.answer-box .label {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.answer-box .label::before { content: none; }

.answer-box p {
  font-size: 15px;
  margin: 0;
  line-height: 1.8;
  color: var(--text-secondary);
}

/* 卡片 */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 20px 0;
}

.feature-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 1px solid var(--line);
  transition: border-color 0.2s;
}

.feature-card:hover { border-color: #cbd5e1; }

.feature-card h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.feature-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

/* 表格 */
.compare-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin: 20px 0;
  background: var(--bg-card);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 13px;
}

.compare-table th,
.compare-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.6;
}

.compare-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}

.compare-table tr:last-child td { border-bottom: none; }

.compare-table .highlight { background: var(--primary-soft); }

.compare-table .tag-rec {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  margin-left: 4px;
}

/* FAQ */
.faq-list {
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.faq-item { border-bottom: 1px solid var(--line); }
.faq-item:last-child { border-bottom: none; }

.faq-q {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border: none;
  background: var(--bg-card);
  text-align: left;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font);
  transition: background 0.2s;
}

.faq-q:hover { background: var(--bg); }

.faq-q .mark {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.faq-a {
  padding: 0 18px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  background: var(--bg);
}

.faq-item.open .faq-a {
  max-height: 400px;
  padding: 0 18px 16px 54px;
}

.faq-a p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.75;
}

/* CTA */
.cta-banner {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  margin: 36px 0 0;
  text-align: left;
}

.cta-banner h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.cta-banner p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 14px;
}

.cta-banner .btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.cta-banner .btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

/* 相关阅读 */
.related-pages {
  border-top: 1px solid var(--line);
  padding-top: 28px;
  margin-top: 32px;
}

.related-pages h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.related-links a {
  display: inline-block;
  padding: 7px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
}

.related-links a:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  text-decoration: none;
}

/* 侧边栏 */
.sidebar { position: sticky; top: calc(var(--header-h) + 20px); }

.sidebar-widget {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.sidebar-widget h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-widget ul { list-style: none; margin: 0; }

.sidebar-widget li {
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.5;
}

.sidebar-widget a {
  color: var(--text-secondary);
  text-decoration: none;
}

.sidebar-widget a:hover { color: var(--primary); }

.sidebar-about p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 8px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

.btn-lg { padding: 12px 24px; font-size: 15px; }

/* 分类索引 */
.keyword-index {
  padding: 48px 0 64px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}

.keyword-index h2 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 24px;
  text-align: left;
}

.keyword-groups {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.keyword-group {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.keyword-group h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.keyword-group ul { list-style: none; margin: 0; }
.keyword-group li { margin-bottom: 6px; }

.keyword-group a {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
}

.keyword-group a:hover { color: var(--primary); }

/* 页脚 */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  padding: 32px 0 28px;
  font-size: 13px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 28px;
  margin-bottom: 24px;
}

.footer-brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.footer-desc,
.footer-col a {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
}

.footer-col h5 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.footer-col a {
  display: block;
  margin-bottom: 6px;
  text-decoration: none;
}

.footer-col a:hover { color: var(--primary); }

.footer-bottom {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  text-align: center;
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-muted);
}

.footer-bottom a { color: var(--text-muted); }
.footer-bottom a:hover { color: var(--primary); }

.footer-beian {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  margin-top: 6px;
}

.footer-beian .sep { opacity: 0.45; }

/* 响应式 */
@media (max-width: 960px) {
  .layout-with-sidebar { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .article-main { padding: 28px 24px; }
}

@media (max-width: 768px) {
  .site-nav {
    display: none;
    position: absolute;
    top: calc(var(--header-h) + 4px);
    left: 16px;
    right: 16px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    z-index: 50;
    box-shadow: var(--shadow);
  }
  .site-nav.open { display: flex; }
  .site-nav a { border-radius: 8px; }
  .header-extra { display: none; }
  .menu-toggle { display: block; }
  .post-list,
  .topic-grid,
  .feature-grid,
  .keyword-groups,
  .footer-grid { grid-template-columns: 1fr; }
  .home-hero { padding: 40px 0 28px; }
  .page-hero h1 { font-size: 26px; }
}
