/* ================================================
   吴用大闲人（一人电商）博客 — 公共样式
   主色：紫蓝渐变 + 橙色强调
   ================================================ */

:root {
  --primary:       #667eea;
  --primary-dark:  #5a67d8;
  --secondary:     #764ba2;
  --accent:        #f6820d;
  --accent-light:  #fff3e0;
  --text:          #1a202c;
  --text-muted:    #718096;
  --bg:            #f7f8fc;
  --bg-card:       #ffffff;
  --border:        #e2e8f0;
  --radius:        12px;
  --radius-lg:     20px;
  --shadow-sm:     0 2px 8px rgba(102,126,234,.10);
  --shadow-md:     0 8px 30px rgba(102,126,234,.18);
  --shadow-lg:     0 20px 60px rgba(102,126,234,.22);
  --gradient:      linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-warm: linear-gradient(135deg, #f6820d 0%, #f5a623 100%);
  --nav-h:         64px;
  --max-w:         1200px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--secondary); }

img { max-width: 100%; display: block; }

/* ── 容器 ── */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }

/* ================================================
   导航栏（旧版 .nav — 仅 tools.html 旧结构保留兼容）
   ================================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: box-shadow .3s;
}
.nav.scrolled { box-shadow: var(--shadow-md); }

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-burger {
  display: none; flex-direction: column; gap: 5px;
  cursor: pointer; padding: 4px;
}
.nav-burger span {
  display: block; width: 22px; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: .3s;
}

.nav-cta {
  background: var(--gradient) !important;
  color: #fff !important;
  padding: 7px 18px !important;
  border-radius: 20px !important;
  font-weight: 600 !important;
}
.nav-cta:hover { opacity: .9; transform: translateY(-1px); }

/* ================================================
   导航栏（新版统一 .navbar — 全站公共）
   ================================================ */
.navbar {
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  position: sticky;
  top: 0;
  z-index: 200;
}
.nav-container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Logo */
.nav-logo {
  display: flex; align-items: center; gap: 9px;
  font-size: 18px; font-weight: 800;
  text-decoration: none; white-space: nowrap; flex-shrink: 0;
}
.nav-logo-img {
  width: 36px; height: 36px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  border: 2px solid rgba(124,58,237,0.25);
}
.nav-logo-text {
  background: linear-gradient(135deg, #7c3aed, #db2777);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 导航链接 */
.nav-links {
  display: flex; align-items: center; gap: 4px; list-style: none;
  margin: 0; padding: 0;
}
.nav-links a {
  padding: 8px 14px; border-radius: 8px;
  text-decoration: none; font-size: 14px; font-weight: 600;
  color: #4a5568; transition: all .2s; white-space: nowrap;
}
.nav-links a:hover,
.nav-links a.active { background: #f3e8ff; color: #7c3aed; }
.nav-badge {
  font-size: 10px; background: #ef4444; color: #fff;
  padding: 1px 5px; border-radius: 20px;
  margin-left: 3px; vertical-align: middle;
}

/* 汉堡按钮 */
.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  cursor: pointer; padding: 8px; background: none; border: none; z-index: 210;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: #4a5568; border-radius: 2px; transition: all .3s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* 移动端展开 */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .nav-links {
    display: none; flex-direction: column; gap: 0;
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.12);
    padding: 12px 0 20px; z-index: 199; border-top: 1px solid #f1f5f9;
  }
  .nav-links.open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a { display: block; padding: 13px 24px; font-size: 15px; border-radius: 0; white-space: normal; }
  .nav-links a:hover,
  .nav-links a.active { background: #f8f7ff; color: #7c3aed; }
}

/* ================================================
   公共 Footer（新版 .site-footer）
   ================================================ */
.site-footer {
  background: #0f172a; color: rgba(255,255,255,0.5);
  text-align: center; padding: 32px 24px; font-size: 13px; line-height: 2;
}
.site-footer a { color: rgba(255,255,255,0.4); text-decoration: none; }
.site-footer a:hover { color: #fff; }
.site-footer .footer-links {
  display: flex; justify-content: center; gap: 20px;
  flex-wrap: wrap; margin-bottom: 10px;
}

/* ================================================
   通用页面头部偏移
   ================================================ */
.page-top { padding-top: var(--nav-h); }

/* ================================================
   按钮
   ================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border-radius: 50px;
  font-size: 15px; font-weight: 600;
  cursor: pointer; border: none;
  transition: transform .2s, box-shadow .2s, opacity .2s;
  text-decoration: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--gradient); color: #fff;
  box-shadow: 0 4px 15px rgba(102,126,234,.4);
}
.btn-secondary {
  background: #fff; color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-accent {
  background: var(--gradient-warm); color: #fff;
  box-shadow: 0 4px 15px rgba(246,130,13,.35);
}
.btn-sm { padding: 8px 20px; font-size: 13px; }
.btn-lg { padding: 16px 40px; font-size: 17px; }

/* ================================================
   卡片
   ================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform .25s, box-shadow .25s;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.card-body { padding: 24px; }

/* ================================================
   标签 / Badge
   ================================================ */
.tag {
  display: inline-block;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
  background: rgba(102,126,234,.1);
  color: var(--primary);
}
.tag-orange { background: var(--accent-light); color: var(--accent); }
.tag-green  { background: #f0fdf4; color: #16a34a; }
.tag-purple { background: #faf5ff; color: #7c3aed; }

/* ================================================
   Section 通用
   ================================================ */
.section { padding: 80px 0; }
.section-sm { padding: 48px 0; }

.section-header { text-align: center; margin-bottom: 56px; }
.section-label {
  display: inline-block;
  font-size: 12px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--primary); margin-bottom: 12px;
}
.section-title {
  font-size: clamp(24px, 4vw, 38px);
  font-weight: 800; color: var(--text);
  line-height: 1.25; margin-bottom: 16px;
}
.section-title span {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.section-desc {
  font-size: 16px; color: var(--text-muted);
  max-width: 560px; margin: 0 auto;
}

/* ================================================
   Grid
   ================================================ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ================================================
   文章卡片
   ================================================ */
.article-card .card-thumb {
  width: 100%; aspect-ratio: 16/9;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
}
.article-card .card-body { padding: 20px; }
.article-card .card-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-muted);
  margin-bottom: 10px;
}
.article-card .card-title {
  font-size: 16px; font-weight: 700;
  color: var(--text); margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.article-card .card-excerpt {
  font-size: 13px; color: var(--text-muted);
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 14px;
}
.article-card .card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
}

/* ================================================
   Footer
   ================================================ */
.footer {
  background: #1a202c; color: #a0aec0;
  padding: 60px 0 30px;
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px; margin-bottom: 48px;
}
.footer-brand .logo-text {
  font-size: 18px; font-weight: 800; color: #fff;
  margin-bottom: 12px;
}
.footer-brand p { font-size: 14px; line-height: 1.8; max-width: 260px; }
.footer-col h4 { font-size: 14px; font-weight: 700; color: #fff; margin-bottom: 16px; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul li a { font-size: 13px; color: #a0aec0; transition: color .2s; }
.footer-col ul li a:hover { color: var(--primary); }
.footer-bottom {
  padding-top: 24px; border-top: 1px solid #2d3748;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px;
}
.footer-bottom a { color: #a0aec0; }
.footer-bottom a:hover { color: var(--primary); }

/* ================================================
   响应式
   ================================================ */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .nav-burger { display: flex; }
  .nav-links.open {
    display: flex; flex-direction: column;
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    background: #fff; padding: 16px 24px 24px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    gap: 4px;
  }
  .section { padding: 56px 0; }
  .btn-lg { padding: 14px 28px; font-size: 15px; }
}

/* ================================================
   动画
   ================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeInUp .6s ease both; }
.fade-up-2 { animation: fadeInUp .6s .15s ease both; }
.fade-up-3 { animation: fadeInUp .6s .3s ease both; }

/* 滚动触发淡入 */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s, transform .6s; }
.reveal.visible { opacity: 1; transform: translateY(0); }
