/* ============================================
   XFM Q&A Community — Modern Design System
   Misty Blue · Glassmorphism · Light/Dark
   ============================================ */

/* ── Design Tokens ── */
:root {
  /* Misty Blue Palette */
  --misty-50:  #f0f4f8;
  --misty-100: #e2eaf2;
  --misty-200: #c5d5e3;
  --misty-300: #a8c5d6;
  --misty-400: #8baec4;
  --misty-500: #6d97b0;
  --misty-600: #5a7e95;
  --misty-700: #4a667a;
  --misty-800: #3a4f5e;
  --misty-900: #2a3844;

  /* Core */
  --primary:        var(--misty-400);
  --primary-dark:   var(--misty-600);
  --primary-light:  var(--misty-200);
  --accent:         #5b8def;
  --accent-light:   #8bb3ff;

  /* Surfaces */
  --bg-body:        linear-gradient(135deg, #f5f7fa 0%, #eef2f6 50%, #e8ecf1 100%);
  --bg-card:        rgba(255, 255, 255, 0.72);
  --bg-card-border: rgba(168, 197, 214, 0.25);
  --bg-card-hover:  rgba(255, 255, 255, 0.88);
  --bg-glass:       rgba(255, 255, 255, 0.55);
  --bg-nav:         rgba(255, 255, 255, 0.82);
  --bg-footer:      linear-gradient(135deg, #3a4f5e 0%, #2a3844 100%);
  --bg-search:      rgba(255, 255, 255, 0.90);
  --bg-tag:         var(--misty-100);
  --bg-code:        #f1f4f8;

  /* Text */
  --text-primary:   #1a2332;
  --text-secondary: #4a5a6e;
  --text-tertiary:  #8a9aa8;
  --text-inverse:   #ffffff;
  --text-link:      var(--accent);

  /* Borders */
  --border-light:   rgba(168, 197, 214, 0.20);
  --border-medium:  rgba(168, 197, 214, 0.35);

  /* Shadows — soft misty */
  --shadow-sm:  0 1px 3px rgba(74, 102, 122, 0.06), 0 1px 2px rgba(74, 102, 122, 0.04);
  --shadow-md:  0 4px 16px rgba(74, 102, 122, 0.08), 0 2px 6px rgba(74, 102, 122, 0.04);
  --shadow-lg:  0 12px 40px rgba(74, 102, 122, 0.10), 0 4px 14px rgba(74, 102, 122, 0.05);
  --shadow-xl:  0 24px 60px rgba(74, 102, 122, 0.12);
  --shadow-glow: 0 0 30px rgba(91, 141, 239, 0.15);
  --shadow-inner: inset 0 2px 8px rgba(74, 102, 122, 0.06);

  /* Glassmorphism */
  --glass-blur: 16px;
  --glass-saturate: 1.6;

  /* Radius */
  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   20px;
  --radius-xl:   28px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Transitions */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth:   cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --duration-fast: 200ms;
  --duration-norm: 350ms;
  --duration-slow: 500ms;

  /* Layout */
  --content-max: 1360px;
  --nav-height: 68px;
}

/* ── Dark Mode Tokens ── */
[data-theme="dark"] {
  --bg-body:        linear-gradient(135deg, #0f151c 0%, #141c26 50%, #1a2430 100%);
  --bg-card:        rgba(30, 42, 56, 0.78);
  --bg-card-border: rgba(168, 197, 214, 0.10);
  --bg-card-hover:  rgba(40, 55, 72, 0.88);
  --bg-glass:       rgba(20, 30, 42, 0.60);
  --bg-nav:         rgba(15, 21, 30, 0.88);
  --bg-footer:      linear-gradient(135deg, #0f151c 0%, #080c12 100%);
  --bg-search:      rgba(30, 42, 56, 0.85);
  --bg-tag:         rgba(168, 197, 214, 0.10);
  --bg-code:        #1a2430;

  --text-primary:   #e2eaf2;
  --text-secondary: #a8c5d6;
  --text-tertiary:  #6d8aa0;
  --text-inverse:   #0f151c;

  --border-light:   rgba(168, 197, 214, 0.08);
  --border-medium:  rgba(168, 197, 214, 0.18);

  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.20), 0 1px 2px rgba(0, 0, 0, 0.15);
  --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.20);
  --shadow-lg:  0 12px 40px rgba(0, 0, 0, 0.30), 0 4px 14px rgba(0, 0, 0, 0.22);
  --shadow-xl:  0 24px 60px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 30px rgba(91, 141, 239, 0.08);
  --shadow-inner: inset 0 2px 8px rgba(0, 0, 0, 0.20);

  --primary:        var(--misty-300);
  --primary-dark:   var(--misty-400);
  --primary-light:  var(--misty-600);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-body:        linear-gradient(135deg, #0f151c 0%, #141c26 50%, #1a2430 100%);
    --bg-card:        rgba(30, 42, 56, 0.78);
    --bg-card-border: rgba(168, 197, 214, 0.10);
    --bg-card-hover:  rgba(40, 55, 72, 0.88);
    --bg-glass:       rgba(20, 30, 42, 0.60);
    --bg-nav:         rgba(15, 21, 30, 0.88);
    --bg-footer:      linear-gradient(135deg, #0f151c 0%, #080c12 100%);
    --bg-search:      rgba(30, 42, 56, 0.85);
    --bg-tag:         rgba(168, 197, 214, 0.10);
    --bg-code:        #1a2430;

    --text-primary:   #e2eaf2;
    --text-secondary: #a8c5d6;
    --text-tertiary:  #6d8aa0;
    --text-inverse:   #0f151c;

    --border-light:   rgba(168, 197, 214, 0.08);
    --border-medium:  rgba(168, 197, 214, 0.18);

    --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.20), 0 1px 2px rgba(0, 0, 0, 0.15);
    --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.20);
    --shadow-lg:  0 12px 40px rgba(0, 0, 0, 0.30), 0 4px 14px rgba(0, 0, 0, 0.22);
    --shadow-xl:  0 24px 60px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 30px rgba(91, 141, 239, 0.08);
    --shadow-inner: inset 0 2px 8px rgba(0, 0, 0, 0.20);

    --primary:        var(--misty-300);
    --primary-dark:   var(--misty-400);
    --primary-light:  var(--misty-600);
  }
}

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

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-body);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  transition: color var(--duration-norm) var(--ease-smooth),
              background var(--duration-norm) var(--ease-smooth);
}

::selection {
  background: var(--primary);
  color: var(--text-inverse);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--misty-300);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--misty-400);
}

/* ── Container ── */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* ==========================================
   NAVBAR — Glassmorphism, Sticky
   ========================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-nav);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border-bottom: 1px solid var(--border-light);
  height: var(--nav-height);
  transition: background var(--duration-norm) var(--ease-smooth),
              border-color var(--duration-norm) var(--ease-smooth);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: var(--space-lg);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  flex-shrink: 0;
}

.logo img {
  height: 36px;
  width: auto;
  border-radius: var(--radius-sm);
}

.logo-text {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  transition: color var(--duration-norm) var(--ease-smooth);
}

.logo-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: super;
  font-size: 0;
}

/* ── Desktop Nav ── */
.nav-menu {
  display: flex;
  align-items: center;
  list-style: none;
  gap: var(--space-xs);
}

.nav-menu li a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.925rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  transition: all var(--duration-fast) var(--ease-smooth);
  position: relative;
  white-space: nowrap;
}

.nav-menu li a i {
  font-size: 0.9em;
  opacity: 0.7;
  transition: opacity var(--duration-fast);
}

.nav-menu li a:hover,
.nav-menu li a.active {
  color: var(--accent);
  background: rgba(91, 141, 239, 0.08);
}

.nav-menu li a:hover i,
.nav-menu li a.active i {
  opacity: 1;
}

.nav-menu li a.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}

/* ── Nav Actions (right side) ── */
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-light);
  border-radius: 50%;
  background: var(--bg-glass);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--duration-fast) var(--ease-smooth);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.theme-toggle:hover {
  background: var(--bg-card);
  color: var(--accent);
  border-color: var(--border-medium);
  transform: rotate(15deg);
}

.btn-ask {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out-expo);
  box-shadow: 0 4px 14px rgba(91, 141, 239, 0.25);
}

.btn-ask:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(91, 141, 239, 0.35);
}

.btn-ask:active {
  transform: translateY(0);
}

/* ── Hamburger (mobile) ── */
.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--bg-glass);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--duration-fast);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.hamburger:hover {
  background: var(--bg-card);
  border-color: var(--border-medium);
}

/* ==========================================
   HERO SEARCH SECTION
   ========================================== */
.hero-section {
  position: relative;
  padding: var(--space-3xl) 0 var(--space-2xl);
  text-align: center;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -40%;
  left: -10%;
  right: -10%;
  height: 100%;
  background: radial-gradient(ellipse at 40% 50%, rgba(168, 197, 214, 0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 30%, rgba(91, 141, 239, 0.08) 0%, transparent 50%);
  pointer-events: none;
}

[data-theme="dark"] .hero-section::before,
:root:not([data-theme="light"])@media (prefers-color-scheme: dark) .hero-section::before {
  background: radial-gradient(ellipse at 40% 50%, rgba(168, 197, 214, 0.05) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 30%, rgba(91, 141, 239, 0.04) 0%, transparent 50%);
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
  transition: color var(--duration-norm) var(--ease-smooth);
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
  font-weight: 400;
  transition: color var(--duration-norm) var(--ease-smooth);
}

/* ── Search Box ── */
.search-wrap {
  max-width: 680px;
  margin: 0 auto var(--space-2xl);
  position: relative;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-search);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 4px 4px 4px 20px;
  box-shadow: var(--shadow-md), var(--shadow-inner);
  transition: all var(--duration-norm) var(--ease-smooth);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg), var(--shadow-glow), var(--shadow-inner);
  transform: scale(1.01);
}

.search-box .search-icon {
  color: var(--text-tertiary);
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: color var(--duration-fast);
}

.search-box:focus-within .search-icon {
  color: var(--accent);
}

.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 14px 16px;
  font-size: 1rem;
  color: var(--text-primary);
  outline: none;
  font-family: var(--font-sans);
}

.search-box input::placeholder {
  color: var(--text-tertiary);
}

.search-box button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
  flex-shrink: 0;
  white-space: nowrap;
}

.search-box button:hover {
  transform: translateX(2px);
  box-shadow: 0 4px 16px rgba(91, 141, 239, 0.30);
}

/* ── Hot Tags Below Search ── */
.hot-tags {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-md);
}

.hot-tags-label {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.hot-tag {
  display: inline-flex;
  padding: 4px 14px;
  background: var(--bg-tag);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-smooth);
  border: 1px solid var(--border-light);
}

.hot-tag:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* ==========================================
   MAIN LAYOUT — Grid
   ========================================== */
.main-content {
  padding: 0 0 var(--space-3xl);
}

.grid-container {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--space-xl);
  align-items: start;
}

.left-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  position: sticky;
  top: calc(var(--nav-height) + var(--space-lg));
  align-self: start;
}

/* ==========================================
   SECTION HEADERS
   ========================================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-light);
}

.section-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  letter-spacing: -0.01em;
}

.section-header h2 i {
  color: var(--accent);
  font-size: 1em;
}

.section-more {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color var(--duration-fast);
}

.section-more:hover {
  color: var(--accent);
}

/* ==========================================
   GLASS CARD
   ========================================== */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  box-shadow: var(--shadow-md);
  transition: all var(--duration-norm) var(--ease-smooth);
  overflow: hidden;
}

.glass-card:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-medium);
}

.glass-card-body {
  padding: var(--space-lg);
}

/* ==========================================
   FEATURED CARDS (Grid Layout)
   ========================================== */
.featured-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.featured-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-norm) var(--ease-out-expo);
  cursor: pointer;
  overflow: hidden;
}

.featured-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  opacity: 0;
  transition: opacity var(--duration-norm);
}

.featured-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: rgba(91, 141, 239, 0.2);
}

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

.featured-card .card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-sm);
}

.featured-card .card-badge.hot {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.featured-card .card-badge.new {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.featured-card .card-badge.featured {
  background: rgba(91, 141, 239, 0.12);
  color: var(--accent);
}

.featured-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: var(--space-sm);
}

.featured-card h3 a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--duration-fast);
}

.featured-card h3 a:hover {
  color: var(--accent);
}

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

.featured-card .card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.featured-card .card-footer span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================
   LIST ITEMS
   ========================================== */
.item {
  display: flex;
  flex-direction: column;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-light);
  transition: all var(--duration-fast) var(--ease-smooth);
  border-radius: var(--radius-sm);
}

.item:last-child {
  border-bottom: none;
}

.item:hover {
  padding-left: var(--space-sm);
  padding-right: var(--space-sm);
  background: rgba(168, 197, 214, 0.04);
}

.tit {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 6px;
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
}

.tit i {
  color: var(--accent);
  font-size: 0.75rem;
  margin-top: 5px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity var(--duration-fast);
}

.item:hover .tit i {
  opacity: 1;
}

.tit a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--duration-fast);
  flex: 1;
}

.tit a:hover {
  color: var(--accent);
}

.desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 4px 0 var(--space-sm);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-left: calc(0.75rem + var(--space-sm));
}

.meta {
  display: flex;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  gap: var(--space-md);
  flex-wrap: wrap;
  padding-left: calc(0.75rem + var(--space-sm));
}

.meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta i {
  color: var(--primary);
  opacity: 0.7;
}

/* ── Item Variants ── */
.item-feature { }
.item-hot .tit i { color: #f59e0b; }
.item-new .tit i { color: #10b981; }

/* ── Sidebar Items ── */
.item-side {
  padding: var(--space-sm) 0;
}

.item-side .tit {
  font-size: 0.925rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.item-side .tit i {
  font-size: 0.65rem;
  color: var(--primary);
}

.item-side .meta {
  padding-left: calc(0.75rem + var(--space-sm));
}

.item-side .meta span {
  font-size: 0.75rem;
}

/* ==========================================
   RANKING LIST
   ========================================== */
.ranking-list {
  counter-reset: rank;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-light);
  transition: all var(--duration-fast) var(--ease-smooth);
}

.ranking-item:last-child {
  border-bottom: none;
}

.ranking-item:hover {
  padding-left: var(--space-sm);
}

.ranking-num {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 50%;
  background: var(--bg-tag);
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.ranking-item:nth-child(1) .ranking-num,
.ranking-item:nth-child(2) .ranking-num,
.ranking-item:nth-child(3) .ranking-num {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff;
  font-size: 0.7rem;
}

.ranking-item .ranking-title {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--duration-fast);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-item .ranking-title:hover {
  color: var(--accent);
}

.ranking-item .ranking-score {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* ==========================================
   EXPERT / ANSWERER LIST
   ========================================== */
.expert-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.expert-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  transition: background var(--duration-fast);
}

.expert-item:hover {
  background: rgba(168, 197, 214, 0.06);
}

.expert-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--misty-200), var(--misty-300));
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--misty-600);
  font-weight: 700;
  font-size: 0.9rem;
  overflow: hidden;
}

.expert-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.expert-info {
  flex: 1;
  min-width: 0;
}

.expert-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.expert-meta {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.expert-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.10);
  color: #d97706;
  flex-shrink: 0;
}

/* ==========================================
   TOPIC TAGS (Grid)
   ========================================== */
.topic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.topic-tag {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tag);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.topic-tag:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(91, 141, 239, 0.15);
}

.topic-tag i {
  color: var(--accent);
  font-size: 0.9rem;
  transition: color var(--duration-fast);
}

.topic-tag:hover i {
  color: #fff;
}

.topic-tag .topic-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: color var(--duration-fast);
}

.topic-tag:hover .topic-name {
  color: #fff;
}

.topic-tag .topic-count {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-left: auto;
  transition: color var(--duration-fast);
}

.topic-tag:hover .topic-count {
  color: rgba(255, 255, 255, 0.7);
}

/* ==========================================
   ASK / ANSWER BLOCK
   ========================================== */
.answer-wrap {
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  transition: all var(--duration-norm) var(--ease-smooth);
}

.answer-wrap:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
}

.answer-wrap.best-answer {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.03);
}

.answer-wrap.best-answer::before {
  content: '🏆 最佳回答';
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #d97706;
  margin-bottom: var(--space-sm);
  padding: 2px 10px;
  background: rgba(245, 158, 11, 0.10);
  border-radius: var(--radius-full);
}

.user-row {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-md);
  gap: var(--space-sm);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--misty-200);
  flex-shrink: 0;
}

.info {
  display: flex;
  flex-direction: column;
}

.name {
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--text-primary);
}

.time {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.time i {
  margin-right: 4px;
}

.text {
  font-size: 0.975rem;
  line-height: 1.75;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.like-row {
  display: flex;
  justify-content: flex-end;
}

.like-row span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.like-row i {
  color: var(--accent);
}

/* ==========================================
   ARTICLE PAGE
   ========================================== */
.breadcrumb {
  padding: 0 0 var(--space-md);
  font-size: 0.85rem;
  color: var(--text-tertiary);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--duration-fast);
}

.breadcrumb a:hover {
  color: var(--accent);
}

.breadcrumb span {
  color: var(--text-primary);
  font-weight: 500;
}

.breadcrumb span::before {
  content: "›";
  margin: 0 6px;
  color: var(--text-tertiary);
  font-weight: 400;
}

.breadcrumb span:first-child::before {
  display: none;
}

.article-title {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.article-meta {
  display: flex;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  flex-wrap: wrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

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

.article-meta i {
  color: var(--accent);
}

.article-content {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text-secondary);
}

.article-content p {
  margin-bottom: 1.5rem;
}

.article-content h2,
.article-content h3,
.article-content h4 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.article-content h2 { font-size: 1.5rem; }
.article-content h3 { font-size: 1.25rem; }
.article-content h4 { font-size: 1.1rem; }

.article-content ul,
.article-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.article-content li {
  margin-bottom: 0.5rem;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 1.5rem 0;
  box-shadow: var(--shadow-sm);
}

.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding: var(--space-md) var(--space-lg);
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
  background: var(--bg-glass);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.article-content code {
  background: var(--bg-code);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--accent);
  font-family: var(--font-mono);
}

.article-content pre {
  background: #1a2430;
  color: #e2eaf2;
  padding: var(--space-lg);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.article-content pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: 0.9rem;
}

/* ==========================================
   FOOTER
   ========================================== */
.footer {
  background: var(--bg-footer);
  color: rgba(255, 255, 255, 0.75);
  padding: var(--space-2xl) 0 var(--space-xl);
  margin-top: var(--space-3xl);
  transition: background var(--duration-norm) var(--ease-smooth);
}

.footer-content {
  text-align: center;
}

.footer-brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: var(--space-sm);
  letter-spacing: -0.01em;
}

.footer-desc {
  font-size: 0.9rem;
  opacity: 0.6;
  margin-bottom: var(--space-md);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.footer-copy {
  font-size: 0.82rem;
  opacity: 0.5;
  margin-bottom: var(--space-sm);
}

.footer-links {
  margin-top: var(--space-md);
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  font-size: 0.82rem;
  transition: color var(--duration-fast);
}

.footer-links a:hover {
  color: #fff;
}

.footer-divider {
  width: 40px;
  height: 2px;
  background: var(--accent);
  margin: var(--space-md) auto;
  border-radius: 2px;
  opacity: 0.4;
}

/* ==========================================
   BACK TO TOP
   ========================================== */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  transition: all var(--duration-fast) var(--ease-out-expo);
  opacity: 0;
  visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  background: var(--bg-card-hover);
  color: var(--accent);
  border-color: var(--accent);
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.fade-in-up {
  animation: fadeInUp var(--duration-slow) var(--ease-out-expo) both;
}

/* Scroll-triggered fade-in (JS adds .visible) */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-slow) var(--ease-out-expo),
              transform var(--duration-slow) var(--ease-out-expo);
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.stagger-children > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--duration-norm) var(--ease-out-expo),
              transform var(--duration-norm) var(--ease-out-expo);
}

.stagger-children.visible > *:nth-child(1) { transition-delay: 0.05s; }
.stagger-children.visible > *:nth-child(2) { transition-delay: 0.10s; }
.stagger-children.visible > *:nth-child(3) { transition-delay: 0.15s; }
.stagger-children.visible > *:nth-child(4) { transition-delay: 0.20s; }
.stagger-children.visible > *:nth-child(5) { transition-delay: 0.25s; }
.stagger-children.visible > *:nth-child(6) { transition-delay: 0.30s; }
.stagger-children.visible > *:nth-child(7) { transition-delay: 0.35s; }
.stagger-children.visible > *:nth-child(8) { transition-delay: 0.40s; }
.stagger-children.visible > *:nth-child(9) { transition-delay: 0.45s; }
.stagger-children.visible > *:nth-child(10) { transition-delay: 0.50s; }

.stagger-children.visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1024px) {
  .grid-container {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
  }

  .featured-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --nav-height: 60px;
  }

  .container {
    padding: 0 var(--space-md);
  }

  .hamburger {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    top: var(--nav-height);
    left: -100%;
    width: 100%;
    height: calc(100vh - var(--nav-height));
    background: var(--bg-nav);
    backdrop-filter: blur(24px) saturate(1.8);
    -webkit-backdrop-filter: blur(24px) saturate(1.8);
    flex-direction: column;
    align-items: center;
    padding: var(--space-xl) var(--space-lg);
    transition: left var(--duration-norm) var(--ease-smooth);
    z-index: 999;
    overflow-y: auto;
    gap: var(--space-xs);
    border-top: 1px solid var(--border-light);
  }

  .nav-menu.active {
    left: 0;
  }

  .nav-menu li {
    width: 100%;
    text-align: center;
  }

  .nav-menu li a {
    display: flex;
    justify-content: center;
    padding: 12px 20px;
    font-size: 1.05rem;
  }

  .nav-menu li a.active::after {
    display: none;
  }

  .nav-actions .btn-ask {
    display: none;
  }

  .nav-actions .btn-ask-mobile {
    display: flex;
    width: 100%;
    justify-content: center;
    margin-top: var(--space-md);
  }

  .hero-section {
    padding: var(--space-2xl) 0 var(--space-xl);
  }

  .search-box {
    padding: 3px 3px 3px 16px;
  }

  .search-box input {
    padding: 10px 12px;
    font-size: 0.95rem;
  }

  .search-box button {
    padding: 8px 18px;
    font-size: 0.85rem;
  }

  .search-box button span {
    display: none;
  }

  .sidebar {
    grid-template-columns: 1fr;
  }

  .topic-grid {
    grid-template-columns: 1fr;
  }

  .main-content {
    padding: 0 0 var(--space-2xl);
  }

  .glass-card-body {
    padding: var(--space-md);
  }

  .featured-card {
    padding: var(--space-md);
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.6rem;
  }

  .hot-tags-label {
    display: none;
  }

  .search-box button {
    padding: 8px 14px;
  }
}

/* ==========================================
   PRINT
   ========================================== */
@media print {
  .header,
  .footer,
  .back-to-top,
  .sidebar {
    display: none;
  }

  .grid-container {
    grid-template-columns: 1fr;
  }

  .glass-card {
    box-shadow: none;
    border: 1px solid #ddd;
    background: #fff;
  }
}
