/* === 基础变量 === */
:root {
  --bg: #0f0f0f;
  --bg-card: #1a1a1a;
  --bg-hover: #222;
  --text: #e8e8e8;
  --text-muted: #888;
  --accent: #6c63ff;
  --accent-light: #8b83ff;
  --border: #2a2a2a;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* === Header === */
.header {
  text-align: center;
  padding: 64px 24px 40px;
  border-bottom: 1px solid var(--border);
}

.header-title {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.header-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* === Filter Bar === */
.filter-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 15, 15, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.filter-bar .container {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

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

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

#filter-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box {
  margin-left: auto;
}

.search-box input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  width: 200px;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--accent);
}

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

/* === Projects Grid === */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
  padding: 40px 0;
}

/* === Project Card === */
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  cursor: pointer;
}

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

.project-cover {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--bg-hover);
  display: block;
}

.project-cover-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, var(--bg-hover), var(--border));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 2rem;
}

.project-info {
  padding: 20px;
}

.project-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-title a {
  color: var(--text);
  text-decoration: none;
}

.project-title a:hover {
  color: var(--accent-light);
}

.project-link-icon {
  width: 14px;
  height: 14px;
  opacity: 0;
  transition: opacity 0.2s;
}

.project-card:hover .project-link-icon {
  opacity: 1;
}

.project-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-tag {
  background: rgba(108, 99, 255, 0.12);
  color: var(--accent-light);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
}

.project-category {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 12px;
}

/* === Loading === */
.loading {
  text-align: center;
  padding: 80px 0;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 80px 0;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* === Footer === */
.footer {
  text-align: center;
  padding: 32px 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* === Responsive === */
@media (max-width: 768px) {
  .header-title {
    font-size: 1.8rem;
  }

  .projects-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 24px 0;
  }

  .filter-bar .container {
    flex-direction: column;
    align-items: stretch;
  }

  #filter-buttons {
    justify-content: flex-start;
  }

  .search-box {
    margin-left: 0;
  }

  .search-box input {
    width: 100%;
  }
}
