/* ══════════════════════════════════════════════
   AI 學習寶庫 — Shared Stylesheet v2.0
   https://openclaw-ai-tracker.inariglobal.workers.dev/Openclaw/
══════════════════════════════════════════════ */

/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Tokens ── */
:root {
  --primary:      #2563eb;
  --primary-h:    #1d4ed8;
  --secondary:    #7c3aed;
  --teal:         #0891b2;

  --bg:           #f8fafc;
  --bg-2:         #f1f5f9;
  --bg-3:         #e2e8f0;
  --card:         #ffffff;
  --border:       rgba(0,0,0,0.07);

  --text:         #0f172a;
  --text-2:       #475569;
  --text-3:       #94a3b8;

  --nav-bg:       rgba(248,250,252,0.92);
  --nav-border:   #e2e8f0;

  --r:            14px;
  --r-sm:         8px;
  --r-xs:         4px;
  --shadow:       0 1px 3px rgba(0,0,0,0.06),0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg:    0 8px 24px rgba(0,0,0,0.08),0 2px 8px rgba(0,0,0,0.05);
}

[data-theme="dark"] {
  --bg:           #0f172a;
  --bg-2:         #1e293b;
  --bg-3:         #334155;
  --card:         #1e293b;
  --border:       rgba(255,255,255,0.07);
  --text:         #f1f5f9;
  --text-2:       #94a3b8;
  --text-3:       #64748b;
  --nav-bg:       rgba(15,23,42,0.94);
  --nav-border:   rgba(255,255,255,0.07);
  --shadow:       0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg:    0 8px 24px rgba(0,0,0,0.4);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.7; overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

/* ── Layout ── */
.container { max-width: 960px; margin: 0 auto; padding: 0 24px; }
.page-wrap { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }

/* ── Navbar ── */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--nav-bg); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--nav-border);
}
.nav-inner {
  max-width: 960px; margin: 0 auto; padding: 0 24px;
  height: 58px; display: flex; align-items: center; gap: 8px;
}
.nav-brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 15px; color: var(--text);
  flex-shrink: 0; margin-right: 8px;
}
.nav-brand .brand-emoji { font-size: 18px; }
.nav-links { display: flex; gap: 2px; margin: 0 auto; }
.nav-link {
  font-size: 13px; font-weight: 500; color: var(--text-2);
  padding: 6px 12px; border-radius: var(--r-sm);
  transition: background 0.15s, color 0.15s; white-space: nowrap;
}
.nav-link:hover { background: var(--bg-2); color: var(--primary); }
.nav-link.active {
  background: rgba(37,99,235,0.08); color: var(--primary); font-weight: 600;
}
.nav-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.theme-btn {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 6px 10px; cursor: pointer;
  font-size: 14px; transition: background 0.2s; line-height: 1;
}
.theme-btn:hover { background: var(--bg-3); }
.nav-burger {
  display: none; background: none; border: none;
  color: var(--text-2); cursor: pointer; font-size: 20px; padding: 4px;
}
@media (max-width: 680px) {
  .nav-links { display: none; }
  .nav-burger { display: block; }
  .site-nav.open .nav-links {
    display: flex; flex-direction: column; gap: 2px;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--nav-bg); backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--nav-border);
    padding: 12px; z-index: 99;
  }
  .nav-brand { margin-right: auto; }
}

/* ── Hero ── */
.hero {
  text-align: center; padding: 72px 24px 56px;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
.hero-badge {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
  color: var(--primary); background: rgba(37,99,235,0.08);
  border: 1px solid rgba(37,99,235,0.2); padding: 4px 14px;
  border-radius: 100px; margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; letter-spacing: -1px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 16px; line-height: 1.15;
}
.hero-sub {
  font-size: 16px; color: var(--text-2);
  max-width: 500px; margin: 0 auto 32px; line-height: 1.75;
}
.hero-stats {
  display: flex; justify-content: center; gap: 32px; flex-wrap: wrap; margin-top: 32px;
}
.hero-stat { text-align: center; }
.hero-stat-num { font-size: 22px; font-weight: 800; color: var(--text); }
.hero-stat-label { font-size: 12px; color: var(--text-3); }

/* ── Section ── */
.section { padding: 48px 0; }
.section + .section { padding-top: 0; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 8px;
}
.section-title {
  font-size: 18px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.see-all {
  font-size: 13px; font-weight: 500; color: var(--primary);
  transition: gap 0.2s;
}
.see-all:hover { text-decoration: underline; }

/* ── Category cards ── */
.cat-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.cat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 22px 18px;
  text-decoration: none; color: var(--text);
  box-shadow: var(--shadow); transition: all 0.2s;
  display: flex; flex-direction: column; gap: 8px;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: rgba(37,99,235,0.2); }
.cat-icon { font-size: 26px; line-height: 1; }
.cat-card h3 { font-size: 15px; font-weight: 700; }
.cat-card p { font-size: 12px; color: var(--text-2); line-height: 1.55; }
.cat-count { font-size: 11px; color: var(--text-3); font-weight: 600; margin-top: auto; padding-top: 4px; }

/* ── Article cards (grid) ── */
.article-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.article-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 18px 20px;
  box-shadow: var(--shadow); transition: all 0.2s;
  display: flex; flex-direction: column; gap: 8px;
}
.article-card:hover { box-shadow: var(--shadow-lg); border-color: rgba(37,99,235,0.15); transform: translateY(-2px); }
.article-cat-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase;
  color: var(--primary); background: rgba(37,99,235,0.08);
  padding: 3px 9px; border-radius: 100px; align-self: flex-start;
}
.article-card h3 { font-size: 14px; font-weight: 600; line-height: 1.45; }
.article-card h3 a { color: var(--text); transition: color 0.15s; }
.article-card h3 a:hover { color: var(--primary); }
.article-card .excerpt {
  font-size: 12px; color: var(--text-2); line-height: 1.65;
  flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.article-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-3); margin-top: auto; }
.article-meta .sep { color: var(--bg-3); }

/* ── Article list (category pages) ── */
.art-list { list-style: none; }
.art-item {
  display: block; padding: 22px 0;
  border-bottom: 1px solid var(--nav-border);
  color: inherit; text-decoration: none;
  transition: background 0.15s;
}
.art-item:first-child { border-top: 1px solid var(--nav-border); }
.art-item:hover h3 { color: var(--primary); }
.art-item h3 {
  font-size: 16px; font-weight: 700; margin-bottom: 7px; line-height: 1.45;
  color: var(--text); transition: color 0.15s;
}
.art-item p {
  font-size: 13px; color: var(--text-2); line-height: 1.65; margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.art-item-badge {
  display: inline-block; font-size: 10px; font-weight: 600; letter-spacing: 0.4px;
  padding: 2px 9px; border-radius: var(--r-xs); margin-bottom: 8px;
  background: var(--bg-2); color: var(--primary); border: 1px solid var(--border);
}
.art-item-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-3);
}
.art-item-meta .sep { opacity: 0.4; }
.art-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block; font-size: 10px; font-weight: 500;
  padding: 2px 8px; border-radius: var(--r-xs);
  background: var(--bg-2); color: var(--text-2); border: 1px solid var(--border);
}

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-3); margin-bottom: 24px;
}
.breadcrumb a { color: var(--primary); transition: text-decoration 0.15s; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep, .breadcrumb .bc-sep { opacity: 0.5; }

/* ── Page header ── */
.page-header { padding: 36px 0 28px; }
.page-header-icon { font-size: 36px; margin-bottom: 10px; }
.page-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 800; letter-spacing: -0.5px;
  margin-bottom: 8px; line-height: 1.2;
}
.page-header p { font-size: 15px; color: var(--text-2); max-width: 560px; }

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--nav-border); margin: 0; }

/* ── Article body (for article pages) ── */
.article-wrap { max-width: 740px; margin: 0 auto; padding: 36px 24px 80px; }
.article-header { margin-bottom: 32px; }
.article-title {
  font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 800;
  letter-spacing: -0.5px; line-height: 1.25; margin-bottom: 14px;
}
.article-info {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  font-size: 13px; color: var(--text-3);
  padding-bottom: 20px; border-bottom: 1px solid var(--border);
}
.article-body { font-size: 16px; line-height: 1.85; color: var(--text); }
.article-body h2 { font-size: 1.4rem; font-weight: 700; margin: 2rem 0 0.7rem; letter-spacing: -0.3px; color: var(--text); }
.article-body h3 { font-size: 1.15rem; font-weight: 600; margin: 1.5rem 0 0.5rem; color: var(--text); }
.article-body h4 { font-size: 1rem; font-weight: 600; margin: 1.2rem 0 0.4rem; }
.article-body p { margin-bottom: 1rem; }
.article-body ul, .article-body ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.article-body li { margin-bottom: 0.4rem; font-size: 15px; }
.article-body a { color: var(--primary); text-decoration: underline; text-decoration-color: rgba(37,99,235,0.3); }
.article-body a:hover { text-decoration-color: var(--primary); }
.article-body strong { font-weight: 600; }
.article-body table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 14px; }
.article-body th { background: var(--bg-2); font-weight: 600; }
.article-body th, .article-body td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; }
.article-body tr:hover td { background: var(--bg-2); }
.article-body pre {
  background: #1e293b; color: #e2e8f0;
  padding: 18px 20px; border-radius: var(--r-sm);
  overflow-x: auto; margin: 1.5rem 0; font-size: 13px; line-height: 1.7;
}
.article-body code { background: var(--bg-2); color: var(--primary); padding: 2px 6px; border-radius: 4px; font-size: 0.88em; }
.article-body pre code { background: transparent; color: inherit; padding: 0; }
.article-body blockquote {
  border-left: 3px solid var(--primary); padding: 12px 18px;
  background: rgba(37,99,235,0.04); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  margin: 1.5rem 0; color: var(--text-2);
}
.article-body hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* Reading progress bar */
.read-progress {
  position: fixed; top: 0; left: 0; z-index: 200;
  height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transform-origin: left; transform: scaleX(0);
  transition: transform 0.1s linear;
}

/* ── Footer ── */
.site-footer {
  padding: 36px 0; border-top: 1px solid var(--nav-border); margin-top: 48px;
}
.footer-inner {
  max-width: 960px; margin: 0 auto; padding: 0 24px;
  display: flex; flex-wrap: wrap; gap: 20px;
  justify-content: space-between; align-items: center;
}
.footer-brand { font-weight: 800; font-size: 14px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.footer-nav a { font-size: 12px; color: var(--text-2); padding: 4px 10px; border-radius: var(--r-xs); transition: color 0.15s; }
.footer-nav a:hover { color: var(--primary); }
.footer-copy { font-size: 11px; color: var(--text-3); }

/* ── Scroll reveal ── */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }
.reveal-d1 { transition-delay: 0.06s; }
.reveal-d2 { transition-delay: 0.12s; }
.reveal-d3 { transition-delay: 0.18s; }
.reveal-d4 { transition-delay: 0.24s; }

/* ── Utility ── */
@media (max-width: 680px) {
  .hero { padding: 48px 24px 36px; }
  .section { padding: 32px 0; }
  .article-wrap { padding: 24px 16px 60px; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 16px; }
  .hero-stats { gap: 20px; }
}
