/* ============================================
   AI前沿观察 — Artistic Design System v3.0
   Modern editorial + neon tech aesthetic
   Principles: Bold typography, gradient accents, bento grid, dark-first
   ============================================ */

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

/* ===== 2. Design Tokens ===== */
:root {
  /* Light mode — warm editorial */
  --bg-primary: #faf8f5;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a68;
  --text-muted: #8b8ba7;
  --border-color: #e2dfd9;

  /* Gradient accents — violet to cyan */
  --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #2563eb 50%, #06b6d4 100%);
  --accent-solid: #7c3aed;
  --accent-hover: #6d28d9;
  --glow-violet: rgba(124, 58, 237, 0.15);
  --glow-cyan: rgba(6, 182, 212, 0.12);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Noto Serif SC', 'Songti SC', serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Layout */
  --max-width: 1280px;
  --header-height: 72px;

  /* Radius & shadow */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.08), 0 16px 48px rgba(124,58,237,0.1);

  /* Easing */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark mode — neon tech */
[data-theme="dark"] {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #16161f;
  --text-primary: #e8e4df;
  --text-secondary: #9d9bb3;
  --text-muted: #5c5b70;
  --border-color: #2a293d;
  --accent-solid: #a78bfa;
  --accent-hover: #c4b5fd;
  --glow-violet: rgba(167, 139, 250, 0.2);
  --glow-cyan: rgba(34, 211, 238, 0.15);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.2), 0 8px 32px rgba(0,0,0,0.3);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.3), 0 20px 60px rgba(167,139,250,0.15);
}

/* ===== 3. Base Reset ===== */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-sans) !important;
  line-height: 1.7 !important;
  margin-top: var(--header-height);
}

/* ===== 4. Animated Background Gradient ===== */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(ellipse at 20% 50%, var(--glow-violet) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, var(--glow-cyan) 0%, transparent 50%),
    radial-gradient(ellipse at 40% 80%, rgba(124, 58, 237, 0.06) 0%, transparent 40%);
  animation: bgDrift 20s ease-in-out infinite;
  z-index: -1;
  pointer-events: none;
}

@keyframes bgDrift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, -1%) rotate(1deg); }
  66% { transform: translate(-1%, 2%) rotate(-0.5deg); }
}

/* ===== 5. Header — Glassmorphism Nav ===== */
.default-header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: var(--header-height) !important;
  background: rgba(250, 248, 245, 0.8) !important;
  backdrop-filter: blur(16px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
  border-bottom: 1px solid var(--border-color) !important;
  z-index: 999 !important;
}

[data-theme="dark"] .default-header {
  background: rgba(10, 10, 15, 0.85) !important;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
}

.site-name {
  font-size: 1.25rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em !important;
  background: var(--accent-gradient) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Theme toggle button */
.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s var(--ease-out);
}

.theme-toggle-btn:hover {
  border-color: var(--accent-solid);
  color: var(--accent-solid);
  box-shadow: 0 0 20px var(--glow-violet);
}

/* Nav links */
.list-link {
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  color: var(--text-secondary) !important;
  padding: var(--space-xs) var(--space-sm) !important;
  border-radius: var(--radius-sm) !important;
  transition: all 0.2s ease !important;
  position: relative;
}

.list-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent-gradient);
  transition: all 0.3s var(--ease-out);
  transform: translateX(-50%);
  border-radius: 1px;
}

.list-link:hover {
  color: var(--text-primary) !important;
  background: var(--glow-violet);
}

.list-link:hover::after,
.list-link.active::after {
  width: 60%;
}

/* ===== 6. Hero Section — Editorial Style ===== */
.hero-section {
  padding: var(--space-3xl) var(--space-lg);
  text-align: center;
  max-width: var(--max-width);
  margin: 0 auto;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-solid);
  padding: 6px 16px;
  background: var(--glow-violet);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 100px;
  margin-bottom: var(--space-lg);
}

.hero-badge .pulse {
  width: 6px;
  height: 6px;
  background: var(--accent-solid);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.4); }
}

.hero-title {
  font-family: var(--font-serif) !important;
  font-size: clamp(2.5rem, 6vw, 4rem) !important;
  font-weight: 900 !important;
  line-height: 1.15 !important;
  letter-spacing: -0.03em !important;
  margin-bottom: var(--space-md) !important;
}

.hero-title .gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem) !important;
  color: var(--text-secondary) !important;
  max-width: 640px;
  margin: 0 auto var(--space-2xl);
  line-height: 1.7;
}

/* ===== 7. Bento Grid Layout ===== */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-lg);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg) var(--space-3xl);
}

/* Featured article spans full width */
.bento-card.featured {
  grid-column: span 12;
  min-height: 420px;
}

/* Large cards (7 cols) + medium (5 cols) */
.bento-card.large {
  grid-column: span 7;
  min-height: 360px;
}

.bento-card.medium {
  grid-column: span 5;
  min-height: 360px;
}

/* Standard cards (4 cols each) */
.bento-card.standard {
  grid-column: span 4;
  min-height: 280px;
}

/* Responsive — collapse to single column on mobile */
@media (max-width: 900px) {
  .bento-grid {
    gap: var(--space-md);
  }
  .bento-card.featured,
  .bento-card.large,
  .bento-card.medium,
  .bento-card.standard {
    grid-column: span 12;
    min-height: auto;
  }
}

/* ===== 8. Bento Card — Glass + Gradient Border ===== */
.bento-card {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: all 0.4s var(--ease-out);
  cursor: pointer;
}

/* Gradient border effect */
.bento-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  padding: 1.5px;
  background: linear-gradient(135deg, rgba(124,58,237,0.3), rgba(6,182,212,0.3));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.5;
  transition: opacity 0.4s ease;
}

.bento-card:hover::before {
  opacity: 1;
}

.bento-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

/* Card image */
.card-image-wrapper {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.featured .card-image-wrapper {
  height: 260px;
}

.large .card-image-wrapper,
.medium .card-image-wrapper {
  height: 220px;
}

.standard .card-image-wrapper {
  height: 180px;
}

.card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out);
}

.bento-card:hover .card-image-wrapper img {
  transform: scale(1.05);
}

/* Image overlay gradient */
.card-image-wrapper::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(to top, var(--bg-card) 0%, transparent 100%);
  pointer-events: none;
}

/* Card placeholder (no image) */
.card-placeholder {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.5rem;
  background: linear-gradient(135deg, var(--glow-violet), var(--glow-cyan));
  color: var(--accent-solid);
  letter-spacing: -0.02em;
}

/* Card content */
.card-content {
  padding: var(--space-lg) var(--space-xl) var(--space-xl);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.featured .card-content {
  padding: var(--space-xl) var(--space-2xl) var(--space-2xl);
}

.card-category {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-solid);
  margin-bottom: var(--space-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.card-category::before {
  content: '';
  width: 4px;
  height: 4px;
  background: var(--accent-solid);
  border-radius: 50%;
}

.card-title {
  font-family: var(--font-serif) !important;
  font-size: clamp(1.2rem, 2vw, 1.6rem) !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
  line-height: 1.35 !important;
  margin-bottom: var(--space-sm) !important;
}

.featured .card-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem) !important;
}

.card-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--space-md);
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-color);
}

.card-meta .date {
  font-variant-numeric: tabular-nums;
}

.read-more-link {
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  color: var(--accent-solid) !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.2s ease !important;
}

.read-more-link:hover {
  gap: 8px;
}

/* ===== 9. Category Pills — Floating Nav ===== */
.category-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm);
  max-width: var(--max-width);
  margin: 0 auto var(--space-2xl);
  padding: 0 var(--space-lg);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none !important;
  transition: all 0.3s var(--ease-out) !important;
}

.pill:hover {
  border-color: var(--accent-solid);
  color: var(--accent-solid);
  background: var(--glow-violet);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--glow-violet);
}

/* ===== 10. Single Post — Immersive Reading ===== */
.post-single {
  max-width: 75ch !important;
  margin: 0 auto !important;
  padding: var(--space-3xl) var(--space-lg) !important;
}

.single-title {
  font-family: var(--font-serif) !important;
  font-size: clamp(2rem, 4vw, 3rem) !important;
  font-weight: 900 !important;
  line-height: 1.2 !important;
  letter-spacing: -0.03em !important;
  margin-bottom: var(--space-lg) !important;
}

.post-content {
  font-family: var(--font-serif) !important;
  font-size: clamp(1rem, 1.2vw, 1.1rem) !important;
  line-height: 1.85 !important;
}

/* Drop cap for first paragraph */
.post-content > p:first-of-type::first-letter {
  float: left !important;
  font-family: var(--font-serif) !important;
  font-size: clamp(3.5rem, 6vw, 4.5rem) !important;
  line-height: 0.85 !important;
  color: var(--accent-solid);
  padding-right: 8px !important;
  padding-top: 4px !important;
}

/* Blockquotes */
.post-content blockquote {
  border-left: 3px solid var(--accent-solid) !important;
  background: var(--glow-violet) !important;
  border-radius: 0 var(--radius-md) var(--radius-md) 0 !important;
}

/* Code blocks */
.post-content pre {
  background: #1a1a2e !important;
  border-radius: var(--radius-md) !important;
  padding: var(--space-lg) !important;
  margin-bottom: var(--space-xl) !important;
  overflow-x: auto !important;
}

/* Tables */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-xl) 0;
  font-size: 0.9rem;
}

.post-content th, .post-content td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

.post-content th {
  font-weight: 600;
  color: var(--accent-solid);
  background: var(--glow-violet);
}

/* ===== 11. Footer — Minimal ===== */
.footer {
  background: var(--bg-secondary) !important;
  border-top: 1px solid var(--border-color) !important;
  padding: var(--space-3xl) var(--space-lg) !important;
  margin-top: var(--space-3xl);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-2xl);
}

/* ===== 12. Scroll Reveal Animation ===== */
.bento-card {
  opacity: 0;
  transform: translateY(24px);
  animation: cardReveal 0.6s var(--ease-out) forwards;
}

.bento-card:nth-child(1) { animation-delay: 0.05s; }
.bento-card:nth-child(2) { animation-delay: 0.1s; }
.bento-card:nth-child(3) { animation-delay: 0.15s; }
.bento-card:nth-child(4) { animation-delay: 0.2s; }
.bento-card:nth-child(5) { animation-delay: 0.25s; }

@keyframes cardReveal {
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 13. Scroll Progress Bar ===== */
.reading-progress {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--accent-gradient);
  z-index: 1000;
}

/* ===== 14. Mobile Responsive ===== */
@media (max-width: 768px) {
  .hero-section { padding: var(--space-2xl) var(--space-md); }
  .bento-grid { grid-template-columns: 1fr; gap: var(--space-md); padding: 0 var(--space-md) var(--space-xl); }
  .featured .card-image-wrapper,
  .large .card-image-wrapper,
  .medium .card-image-wrapper { height: 200px; }
  .standard .card-image-wrapper { height: 160px; }
  .card-content { padding: var(--space-md) var(--space-lg); }
  .featured .card-content { padding: var(--space-lg); }
}

/* ===== 15. Selection & Scrollbar ===== */
::selection {
  background: rgba(124, 58, 237, 0.2);
  color: var(--text-primary);
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-solid);
}
