/* ========================================
   高克的思考空间 - 微信小程序风格 · 党建红
   ======================================== */

:root {
  --red: #C8161D;
  --red-dark: #9B0D14;
  --red-deeper: #6E0A0F;
  --red-light: #E83840;
  --gold: #D4A848;
  --gold-light: #F0DCA0;
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --text: #1F1F1F;
  --text-secondary: #666666;
  --text-light: #999999;
  --border: #E8E8E8;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --tab-height: 56px;
  --header-height: 48px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  min-height: 100vh;
}

/* ===== 顶部导航栏 ===== */
.wx-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
}

.wx-header .header-title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.05em;
}

.wx-header .header-back {
  position: absolute;
  left: 12px;
  color: #fff;
  text-decoration: none;
  font-size: 1.25rem;
  padding: 8px;
  display: none;
}

body:not(.page-home) .wx-header .header-back {
  display: block;
}

/* ===== 底部 TabBar ===== */
.wx-tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--tab-height);
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 200;
  padding-bottom: var(--safe-bottom);
}

.wx-tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-light);
  font-size: 0.625rem;
  gap: 2px;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.wx-tabbar a .tab-icon {
  font-size: 1.375rem;
  line-height: 1;
}

.wx-tabbar a .tab-label {
  font-weight: 500;
}

.wx-tabbar a.active {
  color: var(--red);
}

/* ===== 页面主体 ===== */
.wx-body {
  padding: 12px;
  padding-bottom: calc(var(--tab-height) + 20px);
  min-height: calc(100vh - var(--header-height));
}

/* ===== Banner / 欢迎区 ===== */
.wx-banner {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 60%, var(--red-deeper) 100%);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.wx-banner::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(212,168,72,0.25) 0%, transparent 70%);
  border-radius: 50%;
}

.wx-banner::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 30%;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  border-radius: 50%;
}

.wx-banner .banner-text {
  position: relative;
  z-index: 1;
  color: rgba(255,255,255,0.92);
  font-size: 0.9375rem;
  line-height: 2;
  letter-spacing: 0.03em;
}

.wx-banner .banner-text strong {
  color: var(--gold-light);
  font-weight: 600;
}

/* ===== 区块标题 ===== */
.wx-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 4px 10px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.wx-section-title .dot {
  width: 4px;
  height: 16px;
  background: var(--red);
  border-radius: 2px;
}

/* ===== 分类宫格 ===== */
.wx-cats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}

.wx-cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 4px;
  background: var(--card);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.wx-cat-item:active {
  transform: scale(0.96);
}

.wx-cat-item .cat-icon {
  font-size: 1.75rem;
  margin-bottom: 6px;
}

.wx-cat-item .cat-name {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.wx-cat-item .cat-count {
  font-size: 0.625rem;
  color: var(--text-light);
  margin-top: 2px;
}

/* ===== 文章卡片 ===== */
.wx-articles {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wx-article-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  display: block;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.wx-article-card:active {
  transform: scale(0.98);
}

.wx-article-card .art-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.6875rem;
  color: var(--red);
  background: rgba(200,22,29,0.08);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  margin-bottom: 8px;
}

.wx-article-card .art-date {
  font-size: 0.75rem;
  color: var(--text-light);
  float: right;
  line-height: 1.8;
}

.wx-article-card .art-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wx-article-card .art-summary {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wx-article-card .art-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  font-size: 0.8125rem;
  color: var(--red);
  font-weight: 500;
}

/* ===== 文章详情 ===== */
.wx-detail {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 18px;
  box-shadow: var(--shadow);
}

.wx-detail .detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 0.8125rem;
  color: var(--text-light);
}

.wx-detail .detail-meta .meta-tag {
  color: var(--red);
  background: rgba(200,22,29,0.08);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.wx-detail h1 {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 24px;
}

.wx-detail .detail-content {
  font-size: 0.9375rem;
  line-height: 1.9;
  color: var(--text);
}

.wx-detail .detail-content h2 {
  font-size: 1.25rem;
  color: var(--red-dark);
  margin: 2em 0 1em;
  font-weight: 600;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(200,22,29,0.15);
}

.wx-detail .detail-content h3 {
  font-size: 1.0625rem;
  color: var(--text);
  margin: 1.5em 0 0.8em;
  font-weight: 600;
}

.wx-detail .detail-content p {
  margin-bottom: 1.2em;
}

.wx-detail .detail-content ul, .wx-detail .detail-content ol {
  margin: 1em 0;
  padding-left: 1.5em;
}

.wx-detail .detail-content li {
  margin-bottom: 0.5em;
}

.wx-detail .detail-content blockquote {
  border-left: 3px solid var(--red);
  padding: 14px 18px;
  margin: 1.5em 0;
  background: rgba(200,22,29,0.03);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.wx-detail .detail-content code {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 0.85em;
  background: rgba(0,0,0,0.05);
  padding: 2px 5px;
  border-radius: 4px;
}

.wx-detail .detail-content pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 1.5em 0;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.wx-detail .detail-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* ===== 分类页头部 ===== */
.wx-cat-header {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.wx-cat-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.wx-cat-header p {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ===== 关于页 ===== */
.wx-about {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 18px;
  box-shadow: var(--shadow);
}

.wx-about h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--red-dark);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(200,22,29,0.15);
}

.wx-about h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 20px 0 10px;
}

.wx-about p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 10px;
}

.wx-about ul {
  list-style: none;
  padding: 0;
  margin: 10px 0 16px;
}

.wx-about li {
  padding: 8px 0 8px 20px;
  position: relative;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.wx-about li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
}

.wx-about-signature {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px dashed var(--border);
  text-align: right;
}

.wx-about-signature p {
  color: var(--text-light);
  font-style: italic;
  font-size: 0.875rem;
}

.wx-about-signature .motto {
  color: var(--red);
  font-style: normal;
  font-weight: 600;
  font-size: 1rem;
  margin-top: 4px;
}

/* ===== 空状态 ===== */
.wx-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.wx-empty .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.wx-empty p {
  font-size: 0.875rem;
}

.wx-empty a {
  color: var(--red);
  text-decoration: none;
}

/* ===== 加载中 ===== */
.wx-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  font-size: 0.875rem;
}

.wx-loading::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: wx-spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes wx-spin {
  to { transform: rotate(360deg); }
}

/* ===== 响应式 ===== */
@media (min-width: 481px) {
  body {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: 0 0 30px rgba(0,0,0,0.05);
  }
}
