/* ============================================
   我与AI的那些事 — Blog Stylesheet
   ============================================ */

/* --- Design Tokens --- */
:root {
  /* Brand */
  --brand: #FF6B35;
  --brand-dark: #E8541C;
  --brand-light: #FF8A5C;
  --brand-soft: rgba(255, 107, 53, 0.1);
  --brand-gradient: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);

  /* Light theme */
  --bg: #FAFAF8;
  --bg-card: #FFFFFF;
  --bg-elevated: #F5F5F3;
  --bg-code: #1e1e2e;
  --text: #1a1a2e;
  --text-secondary: #555;
  --text-muted: #999;
  --border: #E8E8E5;
  --border-light: #F0F0EE;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
  --shadow-brand: 0 8px 24px rgba(255,107,53,0.25);

  /* Typography */
  --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Layout */
  --nav-height: 64px;
  --max-width: 860px;
  --max-width-wide: 1100px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #0F0F1A;
  --bg-card: #1A1A2E;
  --bg-elevated: #232340;
  --text: #E8E8F0;
  --text-secondary: #B0B0C0;
  --text-muted: #6B6B80;
  --border: #2A2A45;
  --border-light: #1F1F35;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
  --brand-soft: rgba(255, 107, 53, 0.15);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; transition: color var(--transition); }
img { max-width: 100%; display: block; }

/* --- Reading Progress --- */
.reading-progress {
  position: fixed;
  top: 0; left: 0;
  width: 0%;
  height: 3px;
  background: var(--brand-gradient);
  z-index: 1000;
  transition: width 0.1s linear;
  opacity: 0;
}
.reading-progress.active { opacity: 1; }

/* --- Navbar --- */
.navbar {
  position: sticky;
  top: 0;
  height: var(--nav-height);
  background: rgba(250, 250, 248, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  transition: background var(--transition), border-color var(--transition);
}
[data-theme="dark"] .navbar {
  background: rgba(15, 15, 26, 0.85);
}

.nav-container {
  max-width: var(--max-width-wide);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--brand-gradient);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: var(--shadow-brand);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.nav-link:hover { color: var(--brand); background: var(--brand-soft); }
.nav-link.active { color: var(--brand); background: var(--brand-soft); }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.theme-toggle:hover { background: var(--brand-soft); color: var(--brand); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.nav-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-menu-btn span {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}

/* --- Main Container --- */
.app-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 24px 80px;
  min-height: calc(100vh - var(--nav-height) - 200px);
  animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Hero --- */
.hero {
  text-align: center;
  padding: 60px 0 48px;
  margin-bottom: 24px;
}

.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 16px;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 36px;
}

.hero-stat {
  text-align: center;
}
.hero-stat-num {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.hero-stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Search --- */
.search-wrapper {
  max-width: 500px;
  margin: 0 auto 40px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  border: 2px solid var(--border);
  border-radius: 100px;
  font-size: 1rem;
  font-family: var(--font-sans);
  background: var(--bg-card);
  color: var(--text);
  transition: all var(--transition);
}
.search-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.search-input::placeholder { color: var(--text-muted); }

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* --- Section Title --- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: var(--brand-gradient);
  border-radius: 2px;
}

.section-back {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color var(--transition);
}
.section-back:hover { color: var(--brand); }

/* --- Article Card --- */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.article-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--brand-gradient);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform var(--transition);
}

.article-card:hover {
  border-color: var(--brand-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.article-card:hover::before { transform: scaleY(1); transform-origin: top; }

.article-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.article-card-date {
  display: flex;
  align-items: center;
  gap: 5px;
}

.article-card-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.4;
  margin-bottom: 10px;
  color: var(--text);
  transition: color var(--transition);
}
.article-card:hover .article-card-title { color: var(--brand); }

.article-card-excerpt {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-pill {
  display: inline-block;
  padding: 4px 12px;
  background: var(--bg-elevated);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  cursor: pointer;
}
.tag-pill:hover {
  background: var(--brand-soft);
  color: var(--brand);
}
.tag-pill.active {
  background: var(--brand);
  color: #fff;
}

/* --- Tag Cloud Page --- */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.tag-cloud-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  cursor: pointer;
}
.tag-cloud-item:hover {
  background: var(--brand-soft);
  border-color: var(--brand-light);
  color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.tag-cloud-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* --- Article Detail --- */
.article-detail {
  max-width: var(--max-width);
  margin: 0 auto;
}

.article-detail-header {
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.article-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.article-detail-title {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.3;
  margin-bottom: 16px;
  color: var(--text);
}

.article-detail-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.article-detail-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* --- Markdown Content --- */
.markdown-body {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2em;
  margin-bottom: 0.8em;
  scroll-margin-top: 80px;
}

.markdown-body h1 { font-size: 1.8rem; }
.markdown-body h2 {
  font-size: 1.5rem;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--border);
}
.markdown-body h3 { font-size: 1.25rem; }
.markdown-body h4 { font-size: 1.1rem; }

.markdown-body p { margin-bottom: 1.2em; }

.markdown-body a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--brand-soft);
  transition: text-decoration-color var(--transition);
}
.markdown-body a:hover { text-decoration-color: var(--brand); }

.markdown-body strong { font-weight: 700; color: var(--text); }

.markdown-body ul, .markdown-body ol {
  margin-bottom: 1.2em;
  padding-left: 1.5em;
}
.markdown-body li { margin-bottom: 0.5em; }
.markdown-body ul li::marker { color: var(--brand); }

.markdown-body blockquote {
  margin: 1.5em 0;
  padding: 16px 24px;
  border-left: 4px solid var(--brand);
  background: var(--brand-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-style: italic;
}
.markdown-body blockquote p { margin-bottom: 0; }

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 2px 6px;
  background: var(--bg-elevated);
  border-radius: 4px;
  color: var(--brand);
}
[data-theme="dark"] .markdown-body code {
  color: var(--brand-light);
}

.markdown-body pre {
  margin: 1.5em 0;
  padding: 20px 24px;
  background: var(--bg-code);
  border-radius: var(--radius-md);
  overflow-x: auto;
  border: 1px solid var(--border);
}

.markdown-body pre code {
  padding: 0;
  background: none;
  color: #e8e8f0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.markdown-body img {
  border-radius: var(--radius-md);
  margin: 1.5em auto;
  box-shadow: var(--shadow-md);
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.95rem;
}
.markdown-body th, .markdown-body td {
  padding: 10px 16px;
  border: 1px solid var(--border);
  text-align: left;
}
.markdown-body th {
  background: var(--bg-elevated);
  font-weight: 700;
}
.markdown-body tr:nth-child(even) { background: var(--bg-elevated); }

.markdown-body hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 2.5em 0;
}

/* --- Article Nav (prev/next) --- */
.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 60px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.article-nav-item {
  flex: 1;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
  cursor: pointer;
}
.article-nav-item:hover {
  border-color: var(--brand-light);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.article-nav-item.next { text-align: right; }

.article-nav-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.article-nav-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  transition: color var(--transition);
}
.article-nav-item:hover .article-nav-title { color: var(--brand); }

/* --- About Page --- */
.about-page {
  max-width: 720px;
  margin: 0 auto;
}

.about-hero {
  text-align: center;
  margin-bottom: 48px;
}

.about-avatar {
  width: 100px;
  height: 100px;
  margin: 0 auto 24px;
  background: var(--brand-gradient);
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  box-shadow: var(--shadow-brand);
}

.about-hero h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.about-hero p {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

.about-section {
  margin-bottom: 40px;
}

.about-section h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.about-section h2::before {
  content: '';
  width: 4px;
  height: 22px;
  background: var(--brand-gradient);
  border-radius: 2px;
}

.about-section p {
  color: var(--text-secondary);
  margin-bottom: 1em;
  line-height: 1.85;
}

.about-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.about-tag {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.about-tag:hover {
  background: var(--brand-soft);
  border-color: var(--brand-light);
  color: var(--brand);
}

.about-links {
  display: flex;
  gap: 16px;
  margin-top: 20px;
}

.about-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text);
  transition: all var(--transition);
}
.about-link:hover {
  background: var(--brand-soft);
  border-color: var(--brand-light);
  color: var(--brand);
  transform: translateY(-2px);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}
.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-state p {
  font-size: 1.05rem;
}

/* --- Footer --- */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 48px 24px;
  margin-top: 40px;
  transition: background var(--transition), border-color var(--transition);
}

.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: center;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.footer-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 20px;
}
.footer-links a {
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--brand); }

.footer-copy {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* --- Back to Top --- */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border: none;
  background: var(--brand-gradient);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-brand);
  opacity: 0;
  transform: translateY(20px);
  transition: all var(--transition);
  z-index: 90;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}
.back-to-top:hover { transform: translateY(-4px); }

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-card);
    padding: 16px;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
  }
  .nav-links.open .nav-link { width: 100%; padding: 12px 16px; }
  .nav-menu-btn { display: flex; }

  .hero h1 { font-size: 2rem; }
  .hero p { font-size: 1rem; }
  .hero-stats { gap: 24px; }

  .article-card { padding: 22px 20px; }
  .article-card-title { font-size: 1.2rem; }

  .article-detail-title { font-size: 1.6rem; }
  .markdown-body { font-size: 1rem; }
  .markdown-body h1 { font-size: 1.5rem; }
  .markdown-body h2 { font-size: 1.3rem; }

  .article-nav { flex-direction: column; }
  .article-nav-item.next { text-align: left; }

  .app-container { padding: 32px 16px 60px; }
  .back-to-top { bottom: 20px; right: 20px; }
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- Selection --- */
::selection { background: var(--brand-soft); color: var(--brand); }
