:root {
  --font-sans: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --color-bg: #fbfbfd;
  --color-bg-2: #f5f5f7;
  --color-surface: #ffffff;
  --color-text: #1d1d1f;
  --color-text-2: #6e6e73;
  --color-text-3: #86868b;
  --color-border: rgba(0, 0, 0, 0.08);
  --color-border-strong: rgba(0, 0, 0, 0.12);
  --color-blue: #0071e3;
  --color-blue-hover: #0077ed;
  --color-purple: #5856d6;
  --color-green: #34c759;
  --color-orange: #ff9500;
  --color-pink: #ff2d55;
  --shadow-sm: 0 1px 2px 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.1);
  --shadow-xl: 0 24px 80px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 28px;
  --max-width: 1280px;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

[data-theme="dark"] {
  --color-bg: #000000;
  --color-bg-2: #1c1c1e;
  --color-surface: #2c2c2e;
  --color-text: #f5f5f7;
  --color-text-2: #a1a1a6;
  --color-text-3: #6e6e73;
  --color-border: rgba(255, 255, 255, 0.1);
  --color-border-strong: rgba(255, 255, 255, 0.18);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 24px 80px rgba(0, 0, 0, 0.8);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  overflow-x: hidden;
}

body .en { display: none; }
body.lang-en .zh { display: none; }
body.lang-en .en { display: inline; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: rgba(251, 251, 253, 0.8);
  border-bottom: 1px solid var(--color-border);
}

[data-theme="dark"] .nav { background: rgba(0, 0, 0, 0.7); }

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 32px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.2px;
}

.logo-icon { font-size: 18px; }

.nav-center {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-2);
}

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

.lang-toggle {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 980px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--color-text);
  transition: all 0.2s var(--ease);
}
.lang-toggle:hover { background: rgba(0, 0, 0, 0.08); }
[data-theme="dark"] .lang-toggle { background: rgba(255, 255, 255, 0.1); }
[data-theme="dark"] .lang-toggle:hover { background: rgba(255, 255, 255, 0.18); }

.hero {
  position: relative;
  padding: 120px 32px 80px;
  overflow: hidden;
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 960px;
  margin: 0 auto;
  text-align: center;
}

.hero-blur {
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 120%;
  height: 80%;
  background: radial-gradient(ellipse at 30% 50%, rgba(0, 113, 227, 0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 50%, rgba(88, 86, 214, 0.06) 0%, transparent 50%);
  filter: blur(60px);
  pointer-events: none;
}

.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 980px;
  background: rgba(0, 113, 227, 0.08);
  color: var(--color-blue);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 24px;
  border: 1px solid rgba(0, 113, 227, 0.15);
}

.hero-title {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin-bottom: 24px;
  color: var(--color-text);
}

.hero-subtitle {
  font-size: clamp(17px, 1.8vw, 21px);
  line-height: 1.5;
  color: var(--color-text-2);
  max-width: 720px;
  margin: 0 auto 48px;
  font-weight: 400;
}

.hero-stats {
  display: inline-flex;
  align-items: center;
  padding: 20px 36px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  gap: 40px;
  margin-bottom: 60px;
}

.stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stat-num {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--color-blue), var(--color-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label { font-size: 13px; color: var(--color-text-2); font-weight: 500; }
.stat-divider {
  width: 1px; height: 40px;
  background: var(--color-border);
}

.hero-scroll {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--color-text-3);
  font-size: 13px;
  cursor: pointer;
  animation: bounce 2s var(--ease) infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(8px); opacity: 1; }
}

.categories-section {
  padding: 40px 32px;
}

.section-container {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-header { text-align: center; margin-bottom: 32px; }

.section-title {
  font-size: clamp(28px, 3.5vw, 40px);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 12px;
}

.section-desc {
  font-size: 17px;
  color: var(--color-text-2);
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: 980px;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  color: var(--color-text);
}
.cat-chip:hover {
  border-color: var(--color-border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.cat-chip.active {
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.cat-chip-icon { font-size: 18px; }
.cat-chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 980px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.06);
}
.cat-chip.active .cat-chip-count { background: rgba(255, 255, 255, 0.25); }

.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 32px 120px;
}

.category-section {
  margin-bottom: 80px;
  scroll-margin-top: 80px;
}

.category-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 28px 32px;
  border-radius: var(--radius-xl);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.category-header::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background: linear-gradient(135deg, currentColor, transparent 70%);
  pointer-events: none;
}

.category-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.category-meta { position: relative; z-index: 1; flex: 1; }

.category-name {
  font-size: clamp(24px, 2.5vw, 30px);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.category-desc {
  font-size: 15px;
  color: var(--color-text-2);
  max-width: 640px;
}

.category-count {
  position: relative;
  z-index: 1;
  align-self: center;
  padding: 8px 20px;
  border-radius: 980px;
  background: var(--color-surface);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.cases-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.case-card {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
  transition: all 0.4s var(--ease);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.case-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-border-strong);
}

.case-card-header {
  padding: 24px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.case-accent {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  opacity: 0.9;
}

.case-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.04);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-2);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  width: fit-content;
}

.case-name {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.case-short {
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-text-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.case-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
}

.case-tag {
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--color-bg-2);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-2);
}

.case-card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.case-author {
  font-size: 12px;
  color: var(--color-text-3);
  font-weight: 500;
}

.case-expand {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-blue);
  transition: gap 0.2s var(--ease);
}
.case-card:hover .case-expand { gap: 8px; }

.case-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: stretch;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.case-detail-overlay.open {
  display: flex;
  opacity: 1;
}

.case-detail-panel {
  width: 100%;
  max-width: 760px;
  background: var(--color-bg);
  height: 100%;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: var(--shadow-xl);
}
.case-detail-overlay.open .case-detail-panel { transform: translateX(0); }

.detail-hero {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 60px 48px 32px;
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  background: rgba(251, 251, 253, 0.85);
}
[data-theme="dark"] .detail-hero { background: rgba(28, 28, 30, 0.85); }

.detail-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-2);
  color: var(--color-text-2);
  font-size: 20px;
  transition: all 0.2s var(--ease);
  border: 1px solid var(--color-border);
}
.detail-close:hover {
  background: var(--color-surface);
  color: var(--color-text);
  transform: scale(1.05);
}

.detail-accent-bar {
  height: 4px;
  width: 60px;
  border-radius: 2px;
  margin-bottom: 20px;
}

.detail-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 980px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
  color: white;
}

.detail-name {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin-bottom: 12px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--color-text-2);
}

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

.detail-body { padding: 32px 48px 80px; }

.detail-section { margin-bottom: 36px; }

.detail-section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-3);
  margin-bottom: 12px;
  padding-left: 12px;
  border-left: 3px solid var(--color-border-strong);
}

.markdown-content {
  font-size: 15px;
  line-height: 1.7;
  color: var(--color-text);
}
.markdown-content h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 28px 0 12px;
  letter-spacing: -0.01em;
}
.markdown-content h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 20px 0 10px;
}
.markdown-content p { margin-bottom: 12px; }
.markdown-content ul, .markdown-content ol {
  margin: 12px 0;
  padding-left: 24px;
}
.markdown-content li { margin-bottom: 6px; }
.markdown-content strong { font-weight: 600; }
.markdown-content code {
  display: inline-block;
  padding: 2px 7px;
  font-size: 13px;
  font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
  background: var(--color-bg-2);
  border-radius: 6px;
  border: 1px solid var(--color-border);
}
.markdown-content pre {
  margin: 16px 0;
  padding: 16px 20px;
  background: var(--color-bg-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
}
.markdown-content pre code {
  display: block;
  padding: 0;
  background: none;
  border: none;
}
.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}
.markdown-content th, .markdown-content td {
  padding: 10px 14px;
  text-align: left;
  border: 1px solid var(--color-border);
}
.markdown-content th {
  background: var(--color-bg-2);
  font-weight: 600;
}
.markdown-content blockquote {
  margin: 16px 0;
  padding: 12px 20px;
  border-left: 3px solid var(--color-blue);
  background: rgba(0, 113, 227, 0.04);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--color-text-2);
  font-style: italic;
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.skill-chip {
  padding: 6px 14px;
  border-radius: 980px;
  background: var(--color-bg-2);
  border: 1px solid var(--color-border);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
}

.detail-actions {
  position: sticky;
  bottom: 0;
  padding: 20px 48px 32px;
  background: linear-gradient(to bottom, transparent, var(--color-bg) 40%);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 980px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s var(--ease);
  cursor: pointer;
}
.btn-primary {
  background: var(--color-blue);
  color: white;
}
.btn-primary:hover { background: var(--color-blue-hover); transform: translateY(-1px); }
.btn-secondary {
  background: var(--color-bg-2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: var(--color-surface); border-color: var(--color-border-strong); }

.footer {
  background: var(--color-bg-2);
  border-top: 1px solid var(--color-border);
  padding: 48px 32px 32px;
}
.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
}
.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--color-border);
}
.footer-logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}
.footer-desc {
  font-size: 14px;
  color: var(--color-text-2);
  max-width: 400px;
}
.footer-bottom {
  padding-top: 24px;
  font-size: 12px;
  color: var(--color-text-3);
  line-height: 1.6;
}

@media (max-width: 1024px) {
  .cases-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-stats { gap: 28px; padding: 18px 28px; }
  .stat-num { font-size: 30px; }
  .stat-divider { height: 36px; }
}

@media (max-width: 640px) {
  .nav-container { padding: 0 16px; }
  .nav-title { display: none; }
  .hero { padding: 80px 20px 60px; }
  .hero-stats {
    flex-direction: column;
    gap: 20px;
    padding: 24px 32px;
    width: 100%;
    max-width: 280px;
  }
  .stat-divider { width: 60px; height: 1px; }
  .categories-section { padding: 24px 20px; }
  .main-content { padding: 8px 20px 80px; }
  .category-chips { gap: 8px; }
  .cat-chip { padding: 10px 18px; font-size: 14px; gap: 8px; }
  .cases-grid { grid-template-columns: 1fr; gap: 16px; }
  .category-header {
    flex-direction: column;
    gap: 16px;
    padding: 24px 20px;
    border-radius: var(--radius-lg);
  }
  .category-icon { width: 52px; height: 52px; font-size: 26px; border-radius: 16px; }
  .category-section { margin-bottom: 56px; }
  .detail-hero { padding: 52px 20px 24px; }
  .detail-body { padding: 24px 20px 60px; }
  .detail-actions { padding: 16px 20px 24px; }
  .footer { padding: 32px 20px 24px; }
  .footer-top { flex-direction: column; gap: 16px; }
}
