/* ═══════════════════════════════════════════
   墨迹博客 · 公共样式
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;900&family=Noto+Serif+SC:wght@400;500;600;700;900&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #fafaf8;
  --bg-2: #f4f3f0;
  --surface: #ffffff;
  --border: rgba(0,0,0,0.07);
  --border-2: rgba(0,0,0,0.12);
  --text: #1a1a1a;
  --text-2: #4a4a4a;
  --text-muted: #8a8a8a;
  --accent: #d4542a;
  --accent-light: rgba(212,84,42,0.08);
  --accent-2: #2a7d5f;
  --accent-3: #5b6abf;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.08);
  --radius: 12px;
  --max-w: 720px;
  --max-w-wide: 1100px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Noto Sans SC', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection { background: var(--accent); color: #fff; }
a { color: inherit; }

/* ─── Topbar ─── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(250,250,248,0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  transition: box-shadow 0.3s;
}
.topbar.scrolled { box-shadow: var(--shadow-sm); }
.topbar-inner {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 2rem;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}
.site-name {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.3rem; font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.site-name em { font-style: normal; color: var(--accent); }
.topnav { display: flex; align-items: center; gap: 2rem; list-style: none; }
.topnav a {
  color: var(--text-2); text-decoration: none;
  font-size: 0.9rem; font-weight: 500;
  transition: color 0.2s; position: relative; padding-bottom: 4px;
}
.topnav a:hover { color: var(--accent); }
.topnav a.active { color: var(--accent); }
.topnav a.active::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 2px; background: var(--accent); border-radius: 1px;
}

/* Mobile menu */
.menu-btn {
  display: none; background: none; border: none; cursor: pointer;
  width: 32px; height: 32px; flex-direction: column; justify-content: center; gap: 5px;
}
.menu-btn span { display: block; width: 20px; height: 2px; background: var(--text); transition: all 0.3s; }

/* ─── Buttons ─── */
.btn {
  padding: 0.7rem 1.6rem; border-radius: 8px;
  font-size: 0.9rem; font-weight: 600;
  text-decoration: none; transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 0.4rem;
  cursor: pointer; border: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #c04820; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border-2); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Tags ─── */
.tag {
  display: inline-block; padding: 0.2rem 0.6rem; border-radius: 4px;
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.tag-design { background: rgba(212,84,42,0.1); color: var(--accent); }
.tag-tech { background: rgba(42,125,95,0.1); color: var(--accent-2); }
.tag-life { background: rgba(91,106,191,0.1); color: var(--accent-3); }
.tag-thought { background: rgba(180,130,40,0.1); color: #a07820; }
.tag-code { background: rgba(100,100,100,0.1); color: #555; }

/* ─── Card ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s;
}
.card:hover { box-shadow: var(--shadow-md); }

/* ─── Post Meta ─── */
.post-meta {
  display: flex; align-items: center; gap: 0.8rem;
  color: var(--text-muted); font-size: 0.8rem;
}
.post-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted); }

/* ─── Section Head ─── */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 2rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.section-head h2 {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.4rem; font-weight: 700;
  display: flex; align-items: center; gap: 0.5rem;
}
.section-head h2::before {
  content: ''; width: 3px; height: 1.2em;
  background: var(--accent); border-radius: 2px;
}

/* ─── Reveal ─── */
.reveal {
  opacity: 0; transform: translateY(24px);
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ─── Footer ─── */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 3rem 2rem;
  background: var(--surface);
}
.footer-inner {
  max-width: var(--max-w-wide); margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
}
.footer-left { font-size: 0.85rem; color: var(--text-muted); }
.footer-right { display: flex; gap: 1.5rem; }
.footer-right a { color: var(--text-muted); font-size: 0.85rem; text-decoration: none; transition: color 0.2s; }
.footer-right a:hover { color: var(--accent); }

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .topnav { display: none; }
  .topnav.open {
    display: flex; flex-direction: column;
    position: absolute; top: 64px; left: 0; right: 0;
    background: rgba(250,250,248,0.98); backdrop-filter: blur(16px);
    padding: 1rem 2rem; gap: 1rem;
    border-bottom: 1px solid var(--border);
  }
  .menu-btn { display: flex; }
  .footer-inner { flex-direction: column; gap: 1rem; text-align: center; }
  .topbar-inner { padding: 0 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
