@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --text-primary: #f0f0f5;
  --text-secondary: #8888a0;
  --text-muted: #55556a;
  --accent-cosmic: #7b5ea7;
  --accent-nature: #4a9e6e;
  --accent-geometric: #d4843e;
  --accent-fluid: #3e8fd4;
  --accent-interactive: #d43e6e;
  --glow-cosmic: rgba(123, 94, 167, 0.3);
  --glow-nature: rgba(74, 158, 110, 0.3);
  --glow-geometric: rgba(212, 132, 62, 0.3);
  --glow-fluid: rgba(62, 143, 212, 0.3);
  --glow-interactive: rgba(212, 62, 110, 0.3);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  width: 100%;
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== Hero Section ===== */
.hero {
  position: relative;
  width: 100%;
  padding: 80px 40px 40px;
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(123, 94, 167, 0.12) 0%, transparent 65%);
  pointer-events: none;
}

.hero-title {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #f0f0f5 0%, #8888a0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.hero-subtitle {
  font-size: clamp(0.95rem, 1.5vw, 1.15rem);
  color: var(--text-secondary);
  font-weight: 300;
  letter-spacing: 0.02em;
}

.hero-count {
  display: inline-block;
  margin-top: 20px;
  padding: 6px 18px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ===== Category Tabs ===== */
.tabs-container {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 40px;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.tabs {
  display: flex;
  gap: 4px;
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 100px;
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  outline: none;
}

.tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.tab.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.tab .tab-icon {
  font-size: 1rem;
}

.tab .tab-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 7px;
  border-radius: 100px;
  font-weight: 600;
}

.tab[data-category="cosmic"].active { color: #b89edf; background: rgba(123, 94, 167, 0.15); }
.tab[data-category="nature"].active { color: #7dd4a0; background: rgba(74, 158, 110, 0.15); }
.tab[data-category="geometric"].active { color: #e8a76a; background: rgba(212, 132, 62, 0.15); }
.tab[data-category="fluid"].active { color: #6ab8e8; background: rgba(62, 143, 212, 0.15); }
.tab[data-category="interactive"].active { color: #e86a92; background: rgba(212, 62, 110, 0.15); }

/* ===== Grid ===== */
.gallery {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 40px 80px;
}

.category-section {
  margin-bottom: 48px;
  animation: fadeInUp 0.5s ease both;
}

.category-section[hidden] {
  display: none;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.category-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.category-label {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.category-desc {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 400;
  margin-left: 4px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

/* ===== Card ===== */
.card {
  position: relative;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  color: inherit;
  display: block;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 20px 60px -15px rgba(0, 0, 0, 0.5);
}

.card-preview {
  position: relative;
  width: 100%;
  height: 200px;
  background: var(--bg-secondary);
  overflow: hidden;
}

.card-preview canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(10, 10, 15, 0.8) 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.card:hover .card-overlay {
  opacity: 1;
}

.card-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition-normal);
}

.card:hover .card-play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.card-play::after {
  content: '';
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 14px;
  border-color: transparent transparent transparent white;
  margin-left: 3px;
}

.card-info {
  padding: 18px 20px 20px;
}

.card-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.card-name-cn {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-bottom: 8px;
}

.card-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  font-weight: 300;
}

.card-tags {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.card-tag {
  font-size: 0.68rem;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.03em;
}

/* Category-specific card glow on hover */
.card[data-category="cosmic"]:hover {
  border-color: rgba(123, 94, 167, 0.3);
  box-shadow: 0 20px 60px -15px rgba(123, 94, 167, 0.15);
}
.card[data-category="nature"]:hover {
  border-color: rgba(74, 158, 110, 0.3);
  box-shadow: 0 20px 60px -15px rgba(74, 158, 110, 0.15);
}
.card[data-category="geometric"]:hover {
  border-color: rgba(212, 132, 62, 0.3);
  box-shadow: 0 20px 60px -15px rgba(212, 132, 62, 0.15);
}
.card[data-category="fluid"]:hover {
  border-color: rgba(62, 143, 212, 0.3);
  box-shadow: 0 20px 60px -15px rgba(62, 143, 212, 0.15);
}
.card[data-category="interactive"]:hover {
  border-color: rgba(212, 62, 110, 0.3);
  box-shadow: 0 20px 60px -15px rgba(212, 62, 110, 0.15);
}

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero { padding: 60px 20px 30px; }
  .tabs-container { padding: 0 16px; }
  .gallery { padding: 24px 16px 60px; }
  .cards-grid { grid-template-columns: 1fr; }
  .tab { padding: 8px 14px; font-size: 0.8rem; }
}

/* ===== Back button (for effect pages) ===== */
.back-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 100px;
  background: rgba(10, 10, 15, 0.6);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-color: rgba(255, 255, 255, 0.2);
}

.back-btn svg {
  width: 16px;
  height: 16px;
}

/* ===== Effect page base ===== */
.effect-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

.effect-title {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 0.05em;
  pointer-events: none;
}
