/* ============================================================
   股市日记 - 主样式表
   暗色主题 + A股红涨绿跌配色
   ============================================================ */

/* ── CSS 变量 ─────────────────────────────────────────────── */
:root {
  --bg:          #0e0f14;
  --bg-card:     #161820;
  --bg-secondary:#1c1e27;
  --border:      #252733;
  --text:        #e2e4ec;
  --text-muted:  #6b7280;
  --text-faint:  #3d4155;
  --primary:     #e8532a;
  --primary-dim: rgba(232,83,42,.12);
  --primary-border: rgba(232,83,42,.25);
  --bull:        #e84040;   /* 上涨-红 */
  --bear:        #26a17b;   /* 下跌-绿 */
  --gold:        #f0a500;
  --blue:        #3b82f6;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 2px 16px rgba(0,0,0,.4);
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 15px; line-height: 1.7; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ── Layout ──────────────────────────────────────────────── */
.container { max-width: 860px; margin: 0 auto; padding: 0 1.25rem; }

/* ── Header ──────────────────────────────────────────────── */
.site-header { position: sticky; top: 0; z-index: 100; background: rgba(14,15,20,.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.header-inner { height: 56px; display: flex; align-items: center; justify-content: space-between; }
.site-logo { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.05rem; }
.site-logo:hover { color: var(--primary); }
.icon-chart { width: 20px; height: 20px; color: var(--primary); }
.site-nav { display: flex; align-items: center; gap: .25rem; }
.nav-link { padding: .35rem .75rem; border-radius: var(--radius-sm); font-size: .875rem; color: var(--text-muted); transition: color .15s, background .15s; }
.nav-link:hover { color: var(--text); background: var(--bg-secondary); }
.nav-link.active { color: var(--primary); background: var(--primary-dim); font-weight: 500; }
.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 6px; border-radius: var(--radius-sm); }
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: .2s; }
.nav-toggle:hover span { background: var(--primary); }

/* ── Main ────────────────────────────────────────────────── */
.site-main { padding: 2rem 0 3rem; min-height: calc(100vh - 56px - 80px); }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); padding: 1.5rem 0; }
.footer-inner { text-align: center; }
.footer-inner p { display: flex; align-items: center; justify-content: center; gap: .4rem; font-size: .8rem; color: var(--text-muted); }
.footer-note { font-size: .72rem !important; opacity: .55; margin-top: .35rem; }
.footer-icp a { color: var(--text-muted); font-size: .72rem; }
.icon-sm { width: 16px; height: 16px; flex-shrink: 0; }
.icon-xs { width: 12px; height: 12px; flex-shrink: 0; }

/* ── Hero ────────────────────────────────────────────────── */
.hero { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.75rem; }
.hero-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--primary-dim); display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 1px solid var(--primary-border); }
.hero-icon svg { width: 26px; height: 26px; color: var(--primary); }
.hero-title { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.hero-desc { font-size: .85rem; color: var(--text-muted); margin-top: .25rem; }

/* ── Stats ───────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-bottom: 2.5rem; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; text-align: center; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; }

/* ── Section ─────────────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.section-title { display: flex; align-items: center; gap: .4rem; font-size: .95rem; font-weight: 600; }
.section-link { display: flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--text-muted); }
.section-link:hover { color: var(--primary); }
.subsection-title { display: flex; align-items: center; gap: .4rem; font-size: .875rem; font-weight: 500; color: var(--text-muted); }

/* ── Post Card ───────────────────────────────────────────── */
.post-list { display: flex; flex-direction: column; gap: 1rem; }
.post-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .2s, box-shadow .2s; }
.post-card:hover { border-color: var(--primary-border); box-shadow: 0 4px 20px rgba(232,83,42,.08); }
.post-card-link { display: block; padding: 1.25rem; }
.post-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .65rem; }
.tag { font-size: .72rem; padding: .2rem .55rem; border-radius: 20px; background: var(--primary-dim); color: var(--primary); border: 1px solid var(--primary-border); }
.tag-link:hover { background: rgba(232,83,42,.22); }
.tag-sm { font-size: .68rem; padding: .15rem .45rem; }
.post-title { font-size: .975rem; font-weight: 600; line-height: 1.45; margin-bottom: .5rem; transition: color .15s; }
.post-card:hover .post-title { color: var(--primary); }
.post-summary { font-size: .83rem; color: var(--text-muted); line-height: 1.65; margin-bottom: .85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-meta { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.meta-item { display: flex; align-items: center; gap: .3rem; font-size: .75rem; color: var(--text-muted); }
.read-more { margin-left: auto; font-size: .75rem; color: var(--primary); opacity: 0; transition: opacity .15s; }
.post-card:hover .read-more { opacity: 1; }
.empty-state { padding: 2.5rem; text-align: center; color: var(--text-muted); background: var(--bg-card); border: 1px dashed var(--border); border-radius: var(--radius); }

/* ── Post Detail ─────────────────────────────────────────── */
.post-detail { max-width: 720px; margin: 0 auto; }
.back-btn { display: inline-flex; align-items: center; gap: .3rem; font-size: .83rem; color: var(--text-muted); margin-bottom: 1.5rem; transition: color .15s; }
.back-btn:hover { color: var(--text); }
.post-header { margin-bottom: 2.25rem; }
.post-header-meta { margin-top: .85rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.post-detail-title { font-size: 1.5rem; font-weight: 700; line-height: 1.4; margin-top: .75rem; }

/* ── Prose (Markdown) ────────────────────────────────────── */
.prose { color: var(--text); }
.prose h1 { font-size: 1.5rem; font-weight: 700; margin: 2rem 0 1rem; padding-bottom: .6rem; border-bottom: 1px solid var(--border); }
.prose h2 { font-size: 1.2rem; font-weight: 700; margin: 2rem 0 .85rem; display: flex; align-items: center; gap: .5rem; }
.prose h2::before { content: ''; display: inline-block; width: 3px; height: 1.1em; background: var(--primary); border-radius: 2px; flex-shrink: 0; }
.prose h3 { font-size: 1.05rem; font-weight: 600; margin: 1.5rem 0 .65rem; }
.prose p { margin-bottom: 1.1rem; line-height: 1.8; color: rgba(226,228,236,.88); }
.prose ul, .prose ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.prose li { margin-bottom: .35rem; line-height: 1.75; color: rgba(226,228,236,.88); }
.prose ul li { list-style: disc; }
.prose ol li { list-style: decimal; }
.prose blockquote { border-left: 3px solid var(--primary); padding: .75rem 1rem; margin: 1.25rem 0; background: var(--bg-card); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-muted); font-style: italic; }
.prose table { width: 100%; margin-bottom: 1.5rem; border-collapse: collapse; font-size: .875rem; }
.prose th { background: var(--bg-secondary); padding: .6rem 1rem; text-align: left; border: 1px solid var(--border); font-weight: 600; }
.prose td { padding: .55rem 1rem; border: 1px solid var(--border); color: rgba(226,228,236,.8); }
.prose tr:nth-child(even) td { background: rgba(28,30,39,.5); }
.prose code { font-family: "JetBrains Mono","Fira Code",monospace; font-size: .85em; background: var(--bg-secondary); color: var(--primary); padding: .15em .4em; border-radius: 4px; }
.prose pre { margin-bottom: 1.5rem; border-radius: var(--radius); overflow-x: auto; border: 1px solid var(--border); }
.prose pre code { background: none; color: inherit; padding: 0; font-size: .85rem; }
.prose a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { opacity: .8; }
.prose strong { font-weight: 700; color: var(--text); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.prose img { border-radius: var(--radius); max-width: 100%; }

/* ── Post Nav ────────────────────────────────────────────── */
.post-nav { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.post-nav-item { display: block; padding: .85rem 1rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .2s; }
.post-nav-item:hover { border-color: var(--primary-border); }
.nav-dir { display: flex; align-items: center; gap: .3rem; font-size: .72rem; color: var(--text-muted); margin-bottom: .35rem; }
.next .nav-dir { justify-content: flex-end; }
.nav-title { font-size: .83rem; font-weight: 500; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.next .nav-title { text-align: right; }

/* ── Tags Page ───────────────────────────────────────────── */
.page-title-block { margin-bottom: 1.5rem; }
.page-title { font-size: 1.5rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.page-subtitle { font-size: .83rem; color: var(--text-muted); }
.tag-cloud-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.5rem; }
.tag-cloud-card .subsection-title { margin-bottom: .85rem; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: .5rem; }
.tag-cloud-item { font-size: .8rem; padding: .3rem .7rem; border-radius: 20px; background: var(--bg-secondary); color: var(--text-muted); border: 1px solid var(--border); transition: all .15s; }
.tag-cloud-item em { font-style: normal; opacity: .6; margin-left: .2rem; }
.tag-cloud-item:hover { color: var(--text); border-color: var(--primary-border); }
.tag-cloud-item.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.post-list-compact { display: flex; flex-direction: column; gap: .6rem; }
.compact-item { display: flex; align-items: stretch; gap: 1rem; padding: .85rem 1rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .15s; }
.compact-item:hover { border-color: var(--primary-border); }
.compact-date { flex-shrink: 0; text-align: center; width: 44px; }
.date-ym { display: block; font-size: .68rem; color: var(--text-muted); }
.date-d { display: block; font-size: 1.2rem; font-weight: 700; line-height: 1.2; color: var(--text); }
.compact-divider { width: 1px; background: var(--border); flex-shrink: 0; }
.compact-body { flex: 1; min-width: 0; }
.compact-title { font-size: .875rem; font-weight: 500; line-height: 1.4; margin-bottom: .35rem; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; transition: color .15s; }
.compact-item:hover .compact-title { color: var(--primary); }
.compact-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }

/* ── About Page ──────────────────────────────────────────── */
.about-page { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
.about-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 1.75rem; display: flex; align-items: flex-start; gap: 1.25rem; }
.about-avatar { width: 60px; height: 60px; border-radius: 16px; background: var(--primary-dim); display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 1px solid var(--primary-border); }
.about-avatar svg { width: 30px; height: 30px; color: var(--primary); }
.about-name { font-size: 1.25rem; font-weight: 700; margin-bottom: .2rem; }
.about-role { font-size: .83rem; color: var(--text-muted); margin-bottom: .65rem; }
.about-badges { display: flex; flex-wrap: wrap; gap: .4rem; }
.badge { font-size: .72rem; padding: .2rem .55rem; background: var(--bg-secondary); color: var(--text-muted); border: 1px solid var(--border); border-radius: 20px; }
.about-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.about-h2 { display: flex; align-items: center; gap: .45rem; font-size: .975rem; font-weight: 600; margin-bottom: 1rem; }
.about-text p { font-size: .875rem; color: var(--text-muted); line-height: 1.75; margin-bottom: .6rem; }
.about-text strong { color: var(--primary); }
.about-stats { display: flex; gap: 2rem; padding-top: 1rem; margin-top: 1rem; border-top: 1px solid var(--border); }
.about-stats div { text-align: center; }
.about-stats strong { display: block; font-size: 1.3rem; font-weight: 700; color: var(--primary); }
.about-stats span { font-size: .72rem; color: var(--text-muted); }
.metrics-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .65rem; }
.metric-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .85rem; }
.metric-label { font-size: .72rem; color: var(--text-muted); margin-bottom: .25rem; }
.metric-value { font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.metric-desc { font-size: .68rem; color: var(--text-muted); margin-top: .2rem; }
.rules-list { display: flex; flex-direction: column; gap: 0; }
.rule-row { display: flex; justify-content: space-between; align-items: center; padding: .6rem 0; border-bottom: 1px solid rgba(37,39,51,.6); font-size: .83rem; }
.rule-row:last-child { border-bottom: none; }
.rule-name { font-weight: 500; }
.rule-desc { color: var(--text-muted); font-size: .77rem; }
.version-item { display: flex; align-items: flex-start; gap: .85rem; padding: .75rem; background: var(--bg); border-radius: var(--radius-sm); border: 1px solid var(--border); margin-bottom: .5rem; }
.version-item:last-child { margin-bottom: 0; }
.version-tag { font-family: monospace; font-weight: 700; color: var(--primary); font-size: .875rem; width: 28px; flex-shrink: 0; }
.version-badge { font-size: .68rem; padding: .15rem .45rem; border-radius: 20px; border: 1px solid; margin-bottom: .3rem; display: inline-block; }
.badge-gold { background: rgba(240,165,0,.1); color: var(--gold); border-color: rgba(240,165,0,.25); }
.badge-blue { background: rgba(59,130,246,.1); color: var(--blue); border-color: rgba(59,130,246,.25); }
.badge-green { background: rgba(38,161,123,.1); color: var(--bear); border-color: rgba(38,161,123,.25); }
.version-desc { font-size: .78rem; color: var(--text-muted); line-height: 1.55; }
.disclaimer-box { margin-top: .85rem; padding: .75rem 1rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .78rem; color: var(--text-muted); line-height: 1.65; }
.about-cta { text-align: center; padding: .5rem 0; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1.4rem; background: var(--primary); color: #fff; border-radius: var(--radius-sm); font-size: .875rem; font-weight: 500; transition: opacity .15s; }
.btn-primary:hover { opacity: .88; }

/* ── Error Page ──────────────────────────────────────────── */
.error-page { text-align: center; padding: 5rem 0; }
.error-code { font-size: 5rem; font-weight: 800; color: var(--primary); opacity: .4; }
.error-msg { font-size: 1.1rem; color: var(--text-muted); margin: .75rem 0 1.75rem; }

/* ── Responsive：平板 ≤768px ─────────────────────── */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .site-nav {
    display: none;
    position: absolute; top: 56px; left: 0; right: 0;
    flex-direction: column;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: .5rem 1.25rem .75rem;
    gap: .25rem;
    z-index: 99;
  }
  .site-nav.open { display: flex; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); gap: .5rem; }
  .stat-value { font-size: 1.3rem; }
  .post-nav { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .about-card { flex-direction: column; gap: .85rem; }
  /* 文章详情：减小标题和内边距 */
  .post-detail-title { font-size: 1.2rem; }
  .prose h1 { font-size: 1.25rem; }
  .prose h2 { font-size: 1.05rem; }
  .prose h3 { font-size: .95rem; }
  .prose table { display: block; overflow-x: auto; white-space: nowrap; }
  .prose pre { font-size: .8rem; }
}

/* ── Responsive：手机 ≤480px ─────────────────────── */
@media (max-width: 480px) {
  .container { padding: 0 .75rem; }
  .hero { flex-direction: column; align-items: flex-start; gap: .5rem; }
  .hero-title { font-size: 1.2rem; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); gap: .35rem; }
  .stat-card { padding: .65rem .3rem; }
  .stat-value { font-size: 1.1rem; }
  .stat-label { font-size: .65rem; }
  .metrics-grid { grid-template-columns: 1fr; }
  .about-stats { flex-direction: column; gap: .75rem; }
  .post-card-link { padding: .85rem; }
  .post-title { font-size: .9rem; }
  .post-summary { font-size: .78rem; -webkit-line-clamp: 2; }
  .post-detail-title { font-size: 1.05rem; }
  .prose { font-size: .9rem; }
  .prose h1 { font-size: 1.1rem; }
  .prose h2 { font-size: 1rem; }
  .prose h3 { font-size: .9rem; }
  .post-nav { gap: .5rem; }
  .nav-title { font-size: .78rem; }
  .compact-item { flex-direction: column; gap: .4rem; }
  .compact-divider { width: 100%; height: 1px; }
}

