/* ============================================================
   站群主题系统样式表
   基础变量由 <body style="--tb-*"> 注入（见 registry.php::theme_vars）
   本文件：① 主题变量→基础变量映射 ② 布局骨架 ③ 各主题差异化
   ============================================================ */

/* ---------- ① 变量映射：把主题配色接到原有组件的 --* 变量 ---------- */
body.th {
  --bg: var(--tb-bg); --card: var(--tb-card); --line: var(--tb-line);
  --text: var(--tb-text); --muted: var(--tb-muted);
  --brand: var(--tb-brand); --brand-soft: var(--tb-soft);
  --radius: var(--tb-radius);
  font-family: var(--tb-font);
  background: var(--bg); color: var(--text);
}
body.th a:hover { color: var(--brand) }

/* 主内容区 */
body.th .main { padding: 22px 0 44px }
body.th .page-head { margin: 10px 0 20px }
body.th .page-head.slim { border-bottom: 1px solid var(--line); padding-bottom: 12px }

/* ---------- ② 布局骨架 ---------- */
.th-layout { display: block }
.th-layout.with-side {
  display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 22px; align-items: start;
}
.th-layout.with-side.side-left { grid-template-columns: 300px minmax(0,1fr) }
.th-layout.with-side.side-left .th-main-col { order: 2 }
.th-layout.with-side.side-left .th-side-col { order: 1 }
.th-main-col { min-width: 0 }
.th-side-col { position: sticky; top: 74px; display: flex; flex-direction: column; gap: 14px }
.th-cards { display: grid; gap: 16px }
.row-stack { grid-template-columns: 1fr }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)) }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)) }

/* 统一卡片 */
.th-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden }
.card-thumb, .card-cover-img {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-soft));
  background-size: cover; background-position: center; color: #fff; font-size: 30px; font-weight: 700;
}
.card-thumb span, .card-cover-img span { text-shadow: 0 1px 4px rgba(0,0,0,.4) }
.th-card h3 { font-size: 16px; line-height: 1.45 }
.th-card h3 a { display: block }
.th-card .excerpt { color: var(--muted); font-size: 13px; line-height: 1.65; margin: 6px 0 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden }
.th-card .card-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; margin-top: auto }

/* rows 横排图文 */
.card-rows { display: flex; gap: 16px; padding: 14px }
.card-rows .card-thumb { width: 190px; height: 120px; border-radius: 8px }
.card-rows .card-body { flex: 1; min-width: 0; display: flex; flex-direction: column }

/* cover 图片卡片 */
.card-cover { display: flex; flex-direction: column }
.card-cover-img { width: 100%; height: 150px }
.card-cover-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1 }
.card-cover-body .card-date { color: var(--muted); font-size: 12px; margin-top: auto }

/* compact 紧凑 */
.card-compact { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 0; border: none; border-bottom: 1px solid var(--line); background: transparent }
.compact-idx { color: var(--brand); font: 700 14px Consolas,monospace; opacity: .55; min-width: 22px }
.compact-title { flex: 1; font-size: 14.5px; line-height: 1.5; min-width: 0;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden }
.compact-date { color: var(--muted); font-size: 12px; white-space: nowrap }

/* bordered 描边 */
.card-bordered { padding: 16px 18px }
.card-bordered .card-meta { margin-top: 12px }

/* minimal 极简 */
.card-minimal { display: flex; justify-content: space-between; gap: 20px; padding: 14px 2px;
  border: none; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent }
.card-minimal a { font-size: 15.5px; line-height: 1.5; flex: 1 }
.card-minimal time { color: var(--muted); font-size: 12px; white-space: nowrap; align-self: center }

/* listonly 纯目录 */
.card-only { display: flex; align-items: center; gap: 16px; padding: 12px 4px;
  border: none; border-bottom: 1px dotted var(--line); border-radius: 0; background: transparent }
.only-no { color: var(--muted); font: 12px Consolas,monospace }
.card-only a { flex: 1; font-size: 13.5px }
.card-only time { color: var(--muted); font-size: 12px }

/* newspaper 报纸 */
.card-paper { border: none; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 16px 0 }
.card-paper h3 { margin-bottom: 6px }
.card-paper p { color: #55504a; font-size: 13.5px; line-height: 1.8; margin-bottom: 8px }
.paper-masthead { text-align: center; border-top: 3px double var(--text); border-bottom: 3px double var(--text); padding: 16px 0; margin-bottom: 20px }
.paper-masthead h1 { font-size: 30px; letter-spacing: 4px }
.paper-masthead p { color: var(--muted); font-size: 13px; margin-top: 4px }

/* columns 双栏 */
.columns-2 { column-count: 2; column-gap: 28px }
.card-column { break-inside: avoid; border: none; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 0 0 16px; margin-bottom: 18px }
.card-column p { color: #555; font-size: 13px; line-height: 1.8; margin: 8px 0 }

/* magazine 头条 */
.mag-lead { display: block; position: relative; min-height: 340px; border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(135deg,var(--brand),#333); background-size: cover; background-position: center; margin-bottom: 24px }
.mag-lead-body { position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 30px; color: #fff }
.mag-lead-body h2 { font-size: 27px; line-height: 1.35; margin: 10px 0 8px }
.mag-lead-body p { color: rgba(255,255,255,.86); font-size: 14px; max-width: 640px }
.mag-badge { background: var(--brand); color: #fff; font-size: 12px; padding: 3px 12px; border-radius: 999px }
.mag-subtitle { display: flex; align-items: center; gap: 14px; margin-bottom: 16px }
.mag-subtitle span { font-size: 17px; font-weight: 700; color: var(--brand) }
.mag-subtitle i { flex: 1; height: 1px; background: var(--line) }

/* gallery 画廊 */
.gallery-grid { grid-template-columns: repeat(4, minmax(0,1fr)) }
.card-cover.gallery-item .card-cover-img { height: 170px }

/* timeline 时间轴 */
.timeline { position: relative; padding-left: 32px }
.timeline::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--brand-soft) }
.tl-item { position: relative; padding: 0 0 26px }
.tl-dot { position: absolute; left: -28px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft) }
.tl-date { color: var(--brand); font: 600 12px Consolas,monospace }
.tl-body { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-top: 6px }
.tl-body h3 { font-size: 16px; margin-bottom: 6px }
.tl-body p { color: var(--muted); font-size: 13px; line-height: 1.7 }

/* hero 焦点 */
.hero-figure { position: relative; min-height: 440px; border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(135deg,var(--brand),#334); background-size: cover; background-position: center; display: flex; align-items: flex-end }
.hero-inner { padding: 42px 46px; color: #fff; max-width: 760px }
.hero-kicker { display: inline-block; background: var(--brand); padding: 4px 14px; border-radius: 999px; font-size: 12px }
.hero-inner h1 { font-size: 36px; line-height: 1.3; margin: 14px 0 10px }
.hero-inner p { color: rgba(255,255,255,.85); font-size: 15px; margin-bottom: 18px }
.hero-btn { display: inline-block; background: #fff; color: var(--brand); padding: 9px 24px; border-radius: 999px; font-weight: 700; font-size: 14px }
.hero-btn:hover { color: var(--brand); opacity: .9 }

/* portfolio 作品陈列 */
.portfolio-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px }
.pf-item { display: flex; flex-direction: column }
.pf-featured { grid-column: 1 / -1 }
.pf-img { display: flex; align-items: center; justify-content: center; height: 180px; background: linear-gradient(135deg,var(--brand),var(--brand-soft)); background-size: cover; background-position: center; color: #fff; font-size: 34px; font-weight: 700 }
.pf-featured .pf-img { height: 300px }
.pf-body { padding: 14px 16px }
.pf-body p { color: var(--muted); font-size: 13px; line-height: 1.7; margin-top: 6px }

/* ---------- 文章页：窄栏 / 宽屏 ---------- */
.th-layout.narrow { max-width: 760px; margin: 0 auto }
.post-kicker { color: var(--brand); font-size: 13px; font-weight: 700; letter-spacing: 1px; margin-bottom: 8px }
.post-wide .post-content { font-size: 16px }
.wide-head { text-align: center; padding-bottom: 20px; border-bottom: 1px solid var(--line); margin-bottom: 24px }
.wide-cat { display: inline-block; background: var(--brand-soft); color: var(--brand); padding: 3px 14px; border-radius: 999px; font-size: 12px; margin-bottom: 12px }
.wide-head .entry-info { justify-content: center; border: none; margin: 0; padding: 0 }
.rel-list-simple { list-style: none }
.rel-list-simple li { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px }
.rel-list-simple time { color: var(--muted); font-size: 12px; white-space: nowrap }

/* ============================================================
   ③ 各主题差异化（页头 / 卡片细节 / 特殊质感）
   ============================================================ */

/* 02 杂志头条 */
.th-magazine .page-head h1 { border-left: 5px solid var(--brand); padding-left: 12px }

/* 03 极简直列 */
.th-minimal .site-header { border-bottom: 2px solid var(--text); background: #fff }
.th-minimal .card-minimal a { color: var(--text) }
.th-minimal .post { border: none; box-shadow: none; padding: 0 }

/* 05 暗夜科技 */
.th-dark .site-header, .th-dark .widget, .th-dark .post, .th-dark .comments, .th-dark .entry-related { box-shadow: 0 0 0 1px rgba(56,217,192,.08) }
/* 暗色主题：只给无图占位元素设底色，不能用 background 简写，否则会覆盖模板内联的 background-image 封面图 */
.th-dark .card-thumb span, .th-dark .card-cover-img span, .th-dark .latest-thumb span, .th-dark .hot-thumb span, .th-dark .c-avatar { background: linear-gradient(135deg,#183a38,#12201f) }
.th-dark .rel-ph { background: linear-gradient(135deg,#183a38,#12201f) }
.th-dark .post-content pre { background: #0c1014 }
.th-dark .post-content blockquote { background: var(--soft); color: #b9e8e2; border-left-color: var(--brand) }
.th-dark .mag-lead, .th-dark .hero-figure { background-color: #183a38 }

/* 06 报纸 / 16 学术 */
.th-newspaper .post { border: none; background: transparent; padding: 0 }
.th-newspaper .post-title { text-align: center; font-family: Georgia,"Songti SC",serif; font-size: 30px }
.th-academic .post-title, .th-newspaper .post-title { letter-spacing: 1px }
.th-academic .columns-2 { column-count: 2 }

/* 08 悬浮卡片 / 15 暖阳橙 */
.th-cards .card-cover, .th-sunset .card-cover { box-shadow: 0 8px 24px rgba(0,0,0,.08); border: none; transition: transform .2s, box-shadow .2s }
.th-cards .card-cover:hover, .th-sunset .card-cover:hover { transform: translateY(-4px); box-shadow: 0 14px 32px rgba(0,0,0,.14) }
.th-sunset .card-cover-img { height: 170px }

/* 09 紧凑 */
.th-compact .compact-list-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 6px }

/* 10 图片画廊 */
.th-gallery .gallery-grid .card-cover-img { height: 180px }
.th-gallery .card-cover-body h3 { font-size: 14.5px }

/* 13 焦点大图 */
/* 页头保持深色，保证白色 Logo/导航文字可读（原来设 transparent 导致白字在浅背景上看不见） */
.th-hero .site-header, .th-hero .head-overlay {
  background: linear-gradient(120deg, var(--brand), #1b2430);
}
.th-hero .hero-figure { margin-top: -1px }

/* 14 描边方框 */
.th-bordered .card-bordered { border: 1px solid var(--line); border-radius: 0 }
.th-bordered .post { border-radius: 0 }

/* 17 青碧 */
.th-cyan .mag-lead, .th-cyan .hero-figure { background-color: #0e7490 }

/* 18 紫罗兰渐变头 */
.head-gradient { background: linear-gradient(120deg, var(--brand), #c084fc); color: #fff; border: none }
.head-gradient .logo { color: #fff }
.head-gradient .nav a { color: rgba(255,255,255,.85) }
.head-gradient .nav a.on, .head-gradient .nav a:hover { background: rgba(255,255,255,.18); color: #fff }
.head-gradient .head-slogan { color: rgba(255,255,255,.8); font-size: 13px }
.th-violet .wrap, .head-gradient .wrap { text-align: center; padding: 22px 16px }
.th-violet .head-gradient .nav { justify-content: center; margin-top: 10px }

/* 19 纯目录 */
.th-listonly .page-head h1 { font-family: Consolas,monospace; font-size: 18px; text-transform: uppercase; letter-spacing: 2px }

/* 20 作品陈列 */
.th-portfolio .pf-img { border-radius: 6px }

/* ---------- 各页头样式细节 ---------- */
.head-minimal { background: #fff; border-bottom: 1px solid var(--line) }
.head-minimal .wrap { text-align: center; padding: 18px 16px 10px }
.head-minimal .logo { display: block; font-size: 22px; margin-bottom: 8px }
.head-minimal .nav { justify-content: center }
.head-minimal .search-inline input { border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; font-size: 12px; width: 140px; outline: none; background: var(--bg) }
.head-dark { background: #171b21; border-bottom: 1px solid #2c343f }
.head-dark .logo { color: var(--brand) }
.head-dark .logo-mark { color: var(--brand) }
.head-dark .nav a { color: #9aa5b1 }
.head-dark .nav a.on, .head-dark .nav a:hover { background: var(--soft); color: var(--brand) }
.head-dark .search { background: #232a33 }
.head-dark .search input { color: #e6edf3 }
.head-paper { background: var(--card); border-bottom: 3px double var(--text) }
.head-paper .wrap { text-align: center; padding: 12px 16px 8px }
.head-paper .paper-top { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 8px }
.head-paper .logo { display: block; font-size: 28px; letter-spacing: 4px; color: var(--text); font-family: Georgia,"Songti SC",serif }
.head-paper .nav { justify-content: center; margin-top: 8px }
.head-split .logo { display: flex; align-items: center; gap: 10px }
.logo-sq { width: 16px; height: 16px; background: var(--brand); border-radius: 3px; display: inline-block; transform: rotate(45deg) }
.head-split { border-top: 4px solid var(--brand) }
.head-overlay { position: relative; background: linear-gradient(120deg, var(--brand), #222); color: #fff; border: none }
.head-overlay .logo, .head-overlay .nav a { color: #fff }
.head-overlay .nav a.on, .head-overlay .nav a:hover { background: rgba(255,255,255,.18) }
.head-overlay .head-slogan { color: rgba(255,255,255,.8); font-size: 13px }
.head-overlay .search { background: rgba(255,255,255,.18) }
.head-overlay .search input { color: #fff }
.overlay-inner { padding: 26px 16px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap }
.overlay-inner .head-slogan { margin: 0 }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .th-layout.with-side, .th-layout.with-side.side-left { grid-template-columns: 1fr }
  .th-layout.with-side.side-left .th-main-col, .th-layout.with-side.side-left .th-side-col { order: initial }
  .th-side-col { position: static }
  .grid-3, .gallery-grid { grid-template-columns: repeat(2, minmax(0,1fr)) }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .gallery-grid, .portfolio-grid, .pf-featured { grid-template-columns: 1fr; grid-column: auto }
  .columns-2 { column-count: 1 }
  .card-rows { flex-direction: column }
  .card-rows .card-thumb { width: 100%; height: 180px }
  .mag-lead { min-height: 260px }
  .mag-lead-body h2 { font-size: 21px }
  .hero-figure { min-height: 320px }
  .hero-inner { padding: 26px 22px }
  .hero-inner h1 { font-size: 26px }
  .overlay-inner { gap: 12px }
  .head-minimal .search-inline, .head-paper .search-inline { display: none }
}
