/* ==========================================================================
   CCKU 门户主题 - 前台样式
   ========================================================================== */
:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #1f2937;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --accent: #f97316;
  --success: #10b981;
  --danger: #ef4444;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -12px rgba(16, 24, 40, .14);
  --shadow-hover: 0 4px 8px rgba(16, 24, 40, .06), 0 16px 36px -14px rgba(37, 99, 235, .3);
  --max: 1240px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}
a { color: inherit; text-decoration: none; transition: color .18s; }
a:hover { color: var(--primary); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.35; font-weight: 700; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.empty { padding: 40px 0; text-align: center; color: var(--text-3); }

/* ---------------- 头部 ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 22px; height: 64px; }
.logo { display: flex; align-items: center; flex: 0 0 auto; }
.logo img { height: 34px; width: auto; }
.logo-text {
  font-size: 20px; font-weight: 800; letter-spacing: .5px;
  background: linear-gradient(120deg, var(--primary), #7c3aed);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.main-nav { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; overflow: hidden; }
.main-nav a {
  padding: 6px 11px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 14.5px; white-space: nowrap;
}
.main-nav a:hover { background: var(--primary-soft); color: var(--primary); }
.main-nav a.active { color: var(--primary); font-weight: 600; background: var(--primary-soft); }

.header-search { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 14px; flex: 0 0 auto; }
.header-search input { border: 0; background: transparent; outline: none; width: 168px; font-size: 14px; }
.header-search button {
  display: grid; place-items: center; width: 30px; height: 30px;
  border: 0; border-radius: 50%; background: var(--primary); color: #fff; cursor: pointer;
}
.header-search button:hover { background: var(--primary-dark); }

.site-notice {
  margin-top: 16px; padding: 10px 16px; border-radius: var(--radius-sm);
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
}
.notice-icon { flex: 0 0 auto; }

/* ---------------- 主体 ---------------- */
.site-main { padding: 26px 20px 60px; min-height: 60vh; }
.breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; font-size: 13px; color: var(--text-3); }
.breadcrumb i { font-style: normal; color: var(--line); }
.breadcrumb a:hover { color: var(--primary); }

.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 26px; }
.page-head p { color: var(--text-2); margin: 0; }

.section { margin-bottom: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.section-head h2 { font-size: 20px; margin: 0; position: relative; padding-left: 13px; }
.section-head h2::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 18px; border-radius: 4px; background: linear-gradient(180deg, var(--primary), #7c3aed);
}
.section-head .more { font-size: 13.5px; color: var(--text-2); }
.section-head .more:hover { color: var(--primary); }

/* ---------------- Hero ---------------- */
.hero {
  position: relative; overflow: hidden; margin-bottom: 38px; padding: 46px 40px;
  border-radius: 22px; color: #fff;
  background: radial-gradient(1000px 320px at 12% -20%, rgba(124, 58, 237, .75), transparent 60%),
              linear-gradient(120deg, #1e3a8a, #2563eb 55%, #0ea5e9);
  box-shadow: var(--shadow);
}
.hero::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.14) 1px, transparent 1px);
  background-size: 18px 18px; opacity: .5;
}
.hero-inner { position: relative; z-index: 1; max-width: 640px; }
.hero h1 { font-size: 32px; margin-bottom: 12px; letter-spacing: .5px; }
.hero p { color: rgba(255, 255, 255, .86); font-size: 15.5px; margin-bottom: 22px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 20px; border-radius: 999px; border: 1px solid transparent;
  font-size: 14.5px; font-weight: 600; cursor: pointer; transition: all .18s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .8); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); }
.btn-ghost { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .4); }
.btn-ghost:hover { background: rgba(255, 255, 255, .24); color: #fff; }
.btn-outline { background: #fff; border-color: var(--line); color: var(--text-2); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13.5px; }
.btn-block { width: 100%; }

/* ---------------- 卡片网格 ---------------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 20px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.card-cover { display: block; position: relative; aspect-ratio: 16 / 9; background: #eef2f7; overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.card:hover .card-cover img { transform: scale(1.05); }
.card-body { padding: 15px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { font-size: 16px; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-body .excerpt { font-size: 13.5px; color: var(--text-2); margin-bottom: 12px; flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); }
.meta .tag { color: var(--primary); background: var(--primary-soft); padding: 1px 8px; border-radius: 999px; }
.badge { background: var(--accent); color: #fff; font-size: 11.5px; padding: 1px 8px; border-radius: 999px; font-weight: 600; }
.badge-top { position: absolute; top: 10px; left: 10px; background: var(--danger); }

/* ---------------- 简列表 ---------------- */
.list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 6px 22px; }
.list-item { display: flex; align-items: center; gap: 9px; padding: 9px 4px; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.list-item:hover .t { color: var(--primary); }
.list-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); flex: 0 0 auto; opacity: .55; }
.list-item .t { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .d { flex: 0 0 auto; font-size: 12.5px; color: var(--text-3); }

/* ---------------- 软件卡片 ---------------- */
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.dl-card {
  display: flex; gap: 14px; padding: 14px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.dl-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.dl-card img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; flex: 0 0 auto; background: #eef2f7; }
.dl-info { min-width: 0; flex: 1; }
.dl-info h3 { font-size: 15px; margin-bottom: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-info p { font-size: 13px; color: var(--text-2); margin-bottom: 6px; }

/* ---------------- 文章列表 ---------------- */
.article-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 28px; }
.post-item {
  display: flex; gap: 18px; padding: 18px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.post-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.post-thumb { flex: 0 0 208px; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 16 / 10; background: #eef2f7; }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.post-main h2 { font-size: 18px; margin-bottom: 8px; }
.post-main .excerpt { font-size: 14px; color: var(--text-2); flex: 1; margin-bottom: 10px; }

/* ---------------- 筛选 ---------------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  font-size: 13.5px; color: var(--text-2);
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip em { font-style: normal; font-size: 12px; opacity: .7; }

/* ---------------- 文章详情 ---------------- */
.post-detail, .single-page, .dl-detail {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 34px 38px; margin-bottom: 32px;
}
.post-header h1 { font-size: 28px; margin-bottom: 14px; }
.post-header .meta { padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.post-body { font-size: 16px; line-height: 1.9; color: #374151; word-wrap: break-word; }
.post-body h2 { font-size: 21px; margin: 1.5em 0 .6em; }
.post-body h3 { font-size: 18px; margin: 1.3em 0 .5em; }
.post-body a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.post-body img { border-radius: var(--radius-sm); margin: 14px 0; }
.post-body pre {
  background: #0f172a; color: #e2e8f0; padding: 16px 18px; border-radius: var(--radius-sm);
  overflow-x: auto; font-size: 13.5px; line-height: 1.65; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.post-body code { background: rgba(37, 99, 235, .08); color: #b91c1c; padding: 2px 6px; border-radius: 5px; font-size: .92em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.post-body pre code { background: none; color: inherit; padding: 0; }
.post-body blockquote { margin: 16px 0; padding: 12px 18px; border-left: 4px solid var(--primary); background: var(--primary-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-2); }
.post-body table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14.5px; }
.post-body th, .post-body td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; }
.post-body th { background: var(--bg); font-weight: 600; }
.post-body ul, .post-body ol { padding-left: 1.5em; list-style: revert; margin-bottom: 1em; }

.post-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--text-3); }
.post-tags .tag { background: var(--primary-soft); color: var(--primary); padding: 3px 12px; border-radius: 999px; }
.post-share { display: flex; justify-content: space-between; gap: 14px; margin-top: 20px; font-size: 14px; }
.post-share a { color: var(--text-2); max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-share a:hover { color: var(--primary); }

.related { margin-bottom: 34px; }
.related h2 { font-size: 18px; margin-bottom: 14px; }

/* ---------------- 软件详情 ---------------- */
.dl-header { display: flex; gap: 26px; padding-bottom: 24px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.dl-cover { width: 104px; height: 104px; border-radius: 20px; object-fit: cover; flex: 0 0 auto; background: #eef2f7; box-shadow: var(--shadow); }
.dl-head-info { flex: 1; min-width: 0; }
.dl-head-info h1 { font-size: 24px; margin-bottom: 10px; }
.dl-props { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 20px; margin: 16px 0 20px; font-size: 14px; }
.dl-props li { display: flex; gap: 10px; }
.dl-props li span { color: var(--text-3); flex: 0 0 46px; }
.dl-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.dl-actions .file-name, .dl-actions .netdisk-pwd { font-size: 13.5px; color: var(--text-2); }
.netdisk-pwd b { color: var(--accent); letter-spacing: 1px; }
.dl-tips { margin: 12px 0 0; font-size: 13px; color: var(--text-3); }
.netdisk-tip { margin-bottom: 20px; padding: 11px 16px; border-radius: var(--radius-sm); background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 14px; }
.official { margin-top: 22px; font-size: 14px; }

/* ---------------- 分页 ---------------- */
.pagination { display: flex; justify-content: center; margin: 34px 0 10px; }
.pagination ul { display: flex; gap: 7px; flex-wrap: wrap; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 38px;
  padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; font-size: 14px; color: var(--text-2);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .active span { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pagination .disabled span { color: var(--text-3); background: #f9fafb; }
.pagination .ellipsis span { border: 0; background: none; color: var(--text-3); }

/* ---------------- 搜索页 ---------------- */
.search-page-form { display: flex; gap: 10px; margin-bottom: 30px; flex-wrap: wrap; }
.search-page-form input[type=search] { flex: 1 1 260px; padding: 10px 18px; border: 1px solid var(--line); border-radius: 999px; background: #fff; outline: none; }
.search-page-form input[type=search]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.search-page-form select { padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px; background: #fff; outline: none; }
mark { background: #fef08a; color: inherit; padding: 0 2px; border-radius: 3px; }

/* ---------------- 评论 ---------------- */
.comment-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 32px; }
.comment-box > h2 { font-size: 19px; margin-bottom: 20px; }
.comment-box > h2 em { font-style: normal; color: var(--primary); }
.comment-list { display: flex; flex-direction: column; gap: 20px; margin-bottom: 28px; }
.comment-item { display: flex; gap: 13px; }
.comment-item .avatar { width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto; background: #eef2f7; }
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 10px; font-size: 13.5px; margin-bottom: 5px; }
.comment-head strong { font-size: 14px; }
.comment-head a { color: var(--primary); font-size: 12.5px; }
.comment-head time { color: var(--text-3); font-size: 12.5px; margin-left: auto; }
.comment-content { font-size: 14.5px; color: #374151; }
.comment-content p { margin: 0 0 6px; }
.reply-btn { font-size: 12.5px; color: var(--text-3); }
.reply-btn:hover { color: var(--primary); }
.comment-children { margin-top: 16px; padding-left: 16px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 16px; }

.comment-form { border-top: 1px solid var(--line); padding-top: 22px; }
.comment-form h3 { font-size: 16px; margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 10px; }
.comment-form input, .comment-form textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; outline: none; font-size: 14px; resize: vertical;
}
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.reply-to { font-size: 13px; color: var(--text-3); }
.form-tip { margin: 10px 0 0; font-size: 12.5px; color: var(--text-3); }

/* ---------------- 错误页 ---------------- */
.error-page { text-align: center; padding: 70px 20px; }
.error-code { font-size: 96px; font-weight: 800; line-height: 1; background: linear-gradient(120deg, var(--primary), #7c3aed); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-page h1 { font-size: 22px; margin: 16px 0 10px; }
.error-page p { color: var(--text-2); margin-bottom: 26px; }
.error-page .hero-actions { justify-content: center; }
.error-page .btn-ghost { color: var(--primary); border-color: var(--line); background: #fff; }

/* ---------------- 页脚 ---------------- */
.site-footer { background: #0f172a; color: #cbd5e1; margin-top: 40px; }
.footer-inner { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 34px; padding: 46px 20px 34px; }
.footer-col h4 { color: #fff; font-size: 15px; margin-bottom: 14px; }
.footer-col p { font-size: 13.5px; color: #94a3b8; line-height: 1.8; }
.footer-col a, .footer-col span { display: block; font-size: 13.5px; color: #94a3b8; padding: 3px 0; }
.footer-col a:hover { color: #fff; }
.copyright { border-top: 1px solid rgba(255, 255, 255, .08); padding: 18px 20px; text-align: center; }
.copyright p { margin: 0; font-size: 13px; color: #64748b; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.copyright a { color: #94a3b8; }
.copyright a:hover { color: #fff; }

.back-top {
  position: fixed; right: 26px; bottom: 30px; z-index: 40;
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; color: var(--text-2); font-size: 18px; cursor: pointer;
  box-shadow: var(--shadow); opacity: 0; visibility: hidden; transition: all .25s;
}
.back-top.show { opacity: 1; visibility: visible; }
.back-top:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1080px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; }
  .main-nav { order: 3; flex: 1 1 100%; overflow-x: auto; padding-bottom: 4px; }
  .main-nav a { padding: 6px 9px; }
  .header-search { margin-left: auto; }
  .header-search input { width: 120px; }
  .post-detail, .single-page, .dl-detail { padding: 24px 20px; }
  .post-thumb { flex: 0 0 150px; }
}
@media (max-width: 700px) {
  .hero { padding: 32px 22px; border-radius: 16px; }
  .hero h1 { font-size: 24px; }
  .post-item { flex-direction: column; }
  .post-thumb { flex: none; width: 100%; aspect-ratio: 16 / 9; }
  .dl-header { flex-direction: column; gap: 18px; }
  .dl-cover { width: 82px; height: 82px; }
  .dl-props { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; padding: 32px 20px 24px; }
  .comment-box { padding: 20px 18px; }
  .list-grid { grid-template-columns: 1fr; }
  .post-header h1 { font-size: 22px; }
  .back-top { right: 16px; bottom: 18px; }
}
