/* ============================================================
   common.css — 公共布局样式（移动端优先）
   主题配色在 theme-X.css 里用 CSS 变量覆盖
   ============================================================ */

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

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,.12);
  --transition: .2s ease;
  --container: 1200px;
  --header-h: 56px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { opacity: .85; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 16px;
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}

.site-header .container {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 16px;
}

.site-logo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -1px;
  background: var(--logo-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.site-nav a {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.site-nav a:hover {
  background: var(--surface);
  color: var(--text);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}

/* ============================================================
   Hero Search
   ============================================================ */
.search-hero {
  padding: 32px 0 24px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 4px 4px 4px 16px;
  transition: border-color var(--transition);
  gap: 8px;
}

.search-box:focus-within {
  border-color: var(--accent);
}

.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--text);
  padding: 10px 0;
}

.search-box input::placeholder { color: var(--text-muted); }

.search-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  padding: 10px 20px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.search-btn:hover { opacity: .9; transform: scale(1.02); }

/* ============================================================
   首页双栏布局
   ============================================================ */
.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 0 0 48px;
}

@media (min-width: 768px) {
  .home-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .home-grid {
    grid-template-columns: 420px 1fr;
  }
}

.home-left { }
.home-right { }

/* ============================================================
   栏目标题
   ============================================================ */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
}

/* ============================================================
   文章卡片（无图，左侧列表）
   ============================================================ */
.article-list { display: flex; flex-direction: column; gap: 1px; }

.article-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.article-item:last-child { border-bottom: none; }

.article-item:hover .article-item-title { color: var(--accent); }

.article-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .75rem;
  color: var(--text-muted);
}

.article-item-cat {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  font-size: .7rem;
  text-transform: uppercase;
}

.article-item-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  transition: color var(--transition);
}

/* ============================================================
   文章卡片（有图，右侧网格）
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 480px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.card-img-wrap {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--border);
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
  loading: lazy;
}

.card:hover .card-img-wrap img { transform: scale(1.05); }

.card-body { padding: 12px 14px 14px; }

.card-cat {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--accent);
  margin-bottom: 6px;
}

.card-title {
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-time {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ============================================================
   文章详情页
   ============================================================ */
.article-wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 32px 0 64px;
}

.article-header { margin-bottom: 24px; }

.article-cat-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.article-title {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 16px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: .85rem;
  color: var(--text-muted);
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.article-author { font-weight: 600; color: var(--text); }

.article-cover {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
}

/* AFS 广告位 */
.afs-unit {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 0 0 28px;
  text-align: center;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.article-intro {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 28px;
  padding-left: 16px;
  border-left: 4px solid var(--accent);
}

.article-content {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text);
}

.article-content h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin: 32px 0 12px;
}

.article-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 24px 0 10px;
}

.article-content p { margin-bottom: 16px; }

.article-content ul, .article-content ol {
  margin: 0 0 16px 20px;
}

.article-content li { margin-bottom: 6px; }

.article-content img {
  border-radius: var(--radius-md);
  margin: 20px auto;
}

.article-content strong { color: var(--text); }

/* ============================================================
   结果页
   ============================================================ */
.results-wrap { padding: 32px 0 64px; }

.results-search-bar {
  margin-bottom: 32px;
}

.results-label {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.afs-results-unit {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  margin-bottom: 40px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  color: var(--text-muted);
}

.related-list { display: flex; flex-direction: column; gap: 12px; }

.related-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.related-item:hover {
  border-color: var(--accent);
  transform: translateX(3px);
}

.related-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: .75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.related-num.first {
  background: var(--accent-2, #ff6b35);
}

.related-body { flex: 1; min-width: 0; }

.related-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-meta {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================================
   搜索页
   ============================================================ */
.search-wrap { padding: 32px 0 64px; }

.search-results-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 24px;
}

@media (min-width: 640px) {
  .search-results-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .search-results-grid { grid-template-columns: repeat(3, 1fr); }
}

.search-result-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: var(--transition);
}

.search-result-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.search-result-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.4;
}

.search-result-intro {
  font-size: .83rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-meta {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 10px;
}

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* ============================================================
   分类页
   ============================================================ */
.category-wrap { padding: 32px 0 64px; }

.category-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.cat-tab {
  padding: 8px 18px;
  border-radius: 20px;
  font-size: .85rem;
  font-weight: 600;
  border: 2px solid var(--border);
  color: var(--text-muted);
  transition: var(--transition);
  cursor: pointer;
}

.cat-tab.active, .cat-tab:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ============================================================
   合规页面
   ============================================================ */
.legal-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 0 80px;
}

.legal-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

.legal-date {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.legal-body h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 28px 0 10px;
  color: var(--text);
}

.legal-body p { margin-bottom: 14px; line-height: 1.8; color: var(--text); }
.legal-body ul { margin: 0 0 14px 20px; }
.legal-body li { margin-bottom: 6px; line-height: 1.7; }

/* ============================================================
   分页
   ============================================================ */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text);
  transition: var(--transition);
}

.pagination a:hover, .pagination .current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ============================================================
   关键词标签
   ============================================================ */
.keyword-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.keyword-tag {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
}

.keyword-tag:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* ============================================================
   Toast 提示
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 16px;
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: .875rem;
  font-weight: 500;
  z-index: 9999;
  transform: translateY(80px);
  opacity: 0;
  transition: all .3s ease;
  max-width: 300px;
}

.toast.show { transform: translateY(0); opacity: 1; }

/* ============================================================
   移动端响应式
   ============================================================ */
@media (max-width: 767px) {
  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--header-bg);
    flex-direction: column;
    padding: 12px 16px 20px;
    border-bottom: 1px solid var(--border);
    gap: 4px;
  }

  .site-nav.open { display: flex; }
  .nav-toggle { display: flex; }

  .article-wrap { padding: 20px 0 48px; }
  .legal-wrap { padding: 28px 0 60px; }
}

/* ============================================================
   懒加载占位
   ============================================================ */
img[data-src] {
  opacity: 0;
  transition: opacity .3s;
}
img.loaded { opacity: 1; }

/* ============================================================
   Utilities
   ============================================================ */
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }
.hidden { display: none !important; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 64px;
  padding: 32px 0;
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 16px;
}

.footer-links a {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color .2s;
}

.footer-links a:hover { color: var(--accent); }

.footer-copy {
  font-size: .8rem;
  color: var(--text-muted);
}