/* 艺简单付费阅读 — 主样式表
   CDN 路径: https://i.ejiandan.com/read/style.css
   字体说明: 字体文件经由 fetch.py 下载至 read/fonts/
             CDN 侧需将 Access-Control-Allow-Origin 设为 * 才可加载自定义字体；
             未配置时浏览器自动降级为下方 font-family 中的系统字体（宋体等）。
   TODO:     CDN 控制台 → 跨域配置 → 允许所有来源 → 勾选 GET 方法 → 保存
*/
/* @import url('./fonts.css'); — 暂停：CDN CORS 头返回无效值 '0'，待修复后恢复 */

:root {
  --primary:       #8b1a1a;
  --primary-light: #b52b2b;
  --gold:          #c9a96e;
  --bg:            #faf8f5;
  --card-bg:       #fff;
  --text:          #2c2c2c;
  --text-muted:    #7a7a7a;
  --border:        #e8e0d5;
  --preview-border:#d4c9b8;
  --tag-bg:        #f2ede6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Noto Serif SC', 'Noto Serif', Georgia, '宋体', serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
}

/* ── 顶部导航 ── */
.site-header {
  background: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  position: sticky; top: 0; z-index: 100;
}
.site-header .inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center;
  padding: 14px 20px; gap: 16px;
}
.site-logo {
  font-size: 1.35rem; font-weight: 700;
  color: #fff; text-decoration: none;
  letter-spacing: 2px; white-space: nowrap;
}
.site-logo span { color: var(--gold); }
.site-tagline {
  color: rgba(255,255,255,.6);
  font-size: .8rem;
  border-left: 1px solid rgba(255,255,255,.3);
  padding-left: 14px;
  white-space: nowrap;
}
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.search-box {
  display: flex; align-items: center;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 20px; padding: 5px 14px; gap: 8px;
}
.search-box input {
  background: transparent; border: none; outline: none;
  color: #fff; font-size: .86rem; width: 150px; font-family: inherit;
}
.search-box input::placeholder { color: rgba(255,255,255,.45); }
.search-icon { color: rgba(255,255,255,.55); font-size: .88rem; }

/* ── 主内容 ── */
.main-wrap {
  max-width: 1100px; margin: 0 auto;
  padding: 28px 20px 70px;
}

/* ── 筛选栏 ── */
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 26px; flex-wrap: wrap;
}
.filter-label { color: var(--text-muted); font-size: .84rem; }
.filter-btn {
  padding: 5px 15px;
  border-radius: 20px; border: 1px solid var(--border);
  background: var(--card-bg); color: var(--text);
  cursor: pointer; font-size: .82rem; font-family: inherit;
  transition: all .18s;
}
.filter-btn:hover, .filter-btn.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.filter-sep { width: 1px; height: 18px; background: var(--border); }
.article-count { margin-left: auto; color: var(--text-muted); font-size: .8rem; }

/* ── 文章卡片网格 ── */
.article-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 20px;
}
@media (max-width: 860px) { .article-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 540px)  { .article-grid { grid-template-columns: 1fr; } }

.article-card {
  background: var(--card-bg);
  border-radius: 8px; border: 1px solid var(--border);
  overflow: hidden;
  display: flex; flex-direction: column;
  cursor: pointer; text-decoration: none; color: inherit;
  transition: box-shadow .22s, transform .22s;
}
.article-card:hover {
  box-shadow: 0 6px 22px rgba(139,26,26,.12);
  transform: translateY(-3px);
}
.card-accent { height: 5px; background: var(--primary); }
.card-accent.en  { background: #1a5b8b; }

.card-body { padding: 16px 18px 14px; flex: 1; display: flex; flex-direction: column; }

.lang-badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 3px; font-size: .68rem;
  letter-spacing: 1px; font-weight: 700; margin-bottom: 9px;
}
.lang-badge.zh { background: #f9e8e8; color: var(--primary); }
.lang-badge.en { background: #e8f1f9; color: #1a5b8b; }

.card-title {
  font-size: .98rem; font-weight: 700; line-height: 1.45;
  margin-bottom: 7px; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { font-size: .76rem; color: var(--text-muted); margin-bottom: 9px; }
.card-excerpt {
  font-size: .84rem; color: #555; line-height: 1.7; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 13px;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.card-tag {
  background: var(--tag-bg); color: var(--text-muted);
  font-size: .7rem; padding: 2px 7px; border-radius: 3px;
}
.card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 11px; border-top: 1px solid var(--border);
}
.card-price { font-size: .86rem; color: var(--primary); font-weight: 700; }
.card-price.paid-price { color: #2e7d5e; }

.btn-read {
  padding: 5px 15px; background: var(--primary); color: #fff;
  border: none; border-radius: 4px; font-size: .8rem;
  cursor: pointer; font-family: inherit; transition: background .18s;
}
.btn-read:hover { background: var(--primary-light); }
.btn-read.paid { background: #2e7d5e; }
.btn-read.paid:hover { background: #3aab7a; }

.no-results {
  grid-column: 1/-1; text-align: center;
  padding: 80px 20px; color: var(--text-muted);
}

/* ── 阅读页 ── */
.read-wrap { max-width: 760px; margin: 0 auto; padding: 30px 20px 80px; }

.read-back {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--primary); text-decoration: none; font-size: .86rem;
  margin-bottom: 22px; transition: color .18s;
}
.read-back:hover { color: var(--primary-light); }

.read-header { border-bottom: 2px solid var(--border); padding-bottom: 20px; margin-bottom: 26px; }
.read-title  { font-size: 1.65rem; font-weight: 700; line-height: 1.35; margin-bottom: 14px; color: #1a1a1a; }
.read-meta   { display: flex; flex-wrap: wrap; gap: 5px 16px; font-size: .8rem; color: var(--text-muted); margin-bottom: 12px; }
.read-tags   { display: flex; flex-wrap: wrap; gap: 4px; }
.read-tag    { background: var(--tag-bg); color: var(--text-muted); font-size: .7rem; padding: 3px 9px; border-radius: 3px; }

/* 文章正文 */
.article-body { font-size: 1.02rem; line-height: 2; color: var(--text); }
.article-body p { margin-bottom: 1em; }

/* 付费锁定 */
.paywall-fade {
  position: relative; max-height: 90px; overflow: hidden; pointer-events: none;
}
.paywall-fade::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 90px;
  background: linear-gradient(transparent, var(--bg));
}
.paywall-box {
  background: var(--card-bg); border: 1px dashed var(--preview-border);
  border-radius: 8px; padding: 30px 22px;
  text-align: center; margin-top: 8px;
}
.paywall-icon  { font-size: 1.9rem; margin-bottom: 10px; }
.paywall-title { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.paywall-desc  { font-size: .86rem; color: var(--text-muted); margin-bottom: 18px; line-height: 1.55; }
.paywall-price { font-size: 1.4rem; color: var(--primary); font-weight: 700; margin-bottom: 14px; }
.paywall-price small { font-size: .85rem; font-weight: 400; }

.btn-pay {
  display: inline-block; padding: 11px 34px;
  background: var(--primary); color: #fff;
  border: none; border-radius: 5px; font-size: .98rem;
  font-family: inherit; cursor: pointer; letter-spacing: 1px;
  transition: background .18s, box-shadow .18s;
}
.btn-pay:hover { background: var(--primary-light); box-shadow: 0 4px 14px rgba(139,26,26,.28); }
.paywall-note  { margin-top: 10px; font-size: .74rem; color: var(--text-muted); }

.paid-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: #f0faf5; border: 1px solid #a8d8bf; color: #2e7d5e;
  border-radius: 5px; padding: 6px 14px; font-size: .83rem; margin-bottom: 18px;
}

/* ── 支付弹窗 ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 1000;
  align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }

.modal-box {
  background: #fff; border-radius: 10px;
  width: 340px; max-width: 95vw;
  padding: 28px 22px 22px; position: relative;
  animation: slideUp .22s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; font-size: 1.25rem;
  cursor: pointer; color: #aaa; line-height: 1;
}
.modal-close:hover { color: #444; }
.modal-title    { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.modal-subtitle { font-size: .8rem; color: var(--text-muted); margin-bottom: 18px; }
.modal-qr-area  { display: flex; justify-content: center; min-height: 260px; align-items: center; margin-bottom: 14px; }
.modal-status   { text-align: center; font-size: .86rem; color: var(--text-muted); }
.modal-status.success { color: #2e7d5e; font-weight: 700; }
.modal-status.error   { color: var(--primary); }
.wechat-hint {
  display: flex; justify-content: center; align-items: center;
  gap: 5px; font-size: .76rem; color: #07c160; margin-top: 8px;
}

.spinner {
  border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; width: 26px; height: 26px;
  animation: spin .75s linear infinite; margin: auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 页脚 ── */
.site-footer {
  background: #2a2a2a; color: rgba(255,255,255,.45);
  text-align: center; padding: 18px; font-size: .76rem;
}
.site-footer a { color: rgba(255,255,255,.55); text-decoration: none; }
.site-footer a:hover { color: var(--gold); }

/* ── 响应式 ── */
@media (max-width: 620px) {
  .site-tagline { display: none; }
  .search-box input { width: 100px; }
  .read-title { font-size: 1.3rem; }
}
