:root {
  --bg: #ffffff;
  --bg-soft: #f5f6f8;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --card-bg: #ffffff;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.08);
  --radius: 12px;
}

[data-theme="dark"] {
  --bg: #0f1115;
  --bg-soft: #161922;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --border: #262a35;
  --accent: #60a5fa;
  --card-bg: #171a22;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.5);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.2s ease, color 0.2s ease;
}

a { color: inherit; text-decoration: none; }

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  font-weight: 700;
  font-size: 1.05rem;
}

.nav-inner nav {
  display: flex;
  gap: 24px;
  flex: 1;
  justify-content: center;
}

.nav-inner nav a {
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: color 0.15s ease;
}

.nav-inner nav a:hover { color: var(--text); }

.nav-inner nav a.active { color: var(--text); font-weight: 600; }

#theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hero */
.hero {
  max-width: 960px;
  margin: 0 auto;
  padding: 100px 24px 80px;
  text-align: center;
}

.hero h1 {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hero .dot { color: var(--accent); }

.hero .subtitle {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.btn {
  display: inline-block;
  margin-top: 32px;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* Sections */
section {
  max-width: 960px;
  margin: 0 auto;
  padding: 60px 24px;
}

section h2 {
  font-size: 1.6rem;
  margin-bottom: 28px;
  font-weight: 700;
}

/* Filters */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.filter-btn {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover { color: var(--text); }

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Project grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.card-emoji {
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  flex: 1;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0;
}

.tag {
  font-size: 0.72rem;
  background: var(--bg-soft);
  color: var(--text-muted);
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.card-links {
  display: flex;
  gap: 14px;
  margin-top: auto;
}

.card-links a {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.card-links a:hover { text-decoration: underline; }

.empty {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 32px;
}

.page-btn {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-muted);
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.page-btn:hover:not(:disabled) { color: var(--text); }

.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* About / Contact */
.about p, .contact p {
  color: var(--text-muted);
  max-width: 640px;
}

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

.contact .links a {
  font-weight: 600;
  color: var(--accent);
}

.contact .links a:hover { text-decoration: underline; }

footer {
  text-align: center;
  padding: 32px 24px;
  color: var(--text-muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
}

footer .icp {
  margin-top: 6px;
}

footer .icp a {
  color: var(--text-muted);
}

footer .icp a:hover {
  color: var(--text);
  text-decoration: underline;
}

@media (max-width: 560px) {
  .hero h1 { font-size: 2rem; }
  .nav-inner nav { gap: 14px; }
}
