/* ============================================
   BASE STYLES
   ============================================ */
html, body {
  margin: 0;
  padding: 0;
}

canvas {
  display: block;
}

/* ============================================
   GALLERY STYLES
   ============================================ */
.gallery-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f0f1e 0%, #1a1a2e 100%);
  color: #fff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.gallery-header {
  text-align: center;
  padding: 60px 20px 40px;
}

.gallery-header h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  margin: 0 0 10px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gallery-header .subtitle {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.animation-card {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.animation-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.15);
}

.card-preview {
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.preview-icon {
  width: 64px;
  height: 64px;
  color: rgba(255, 255, 255, 0.4);
  transition: transform 0.3s ease, color 0.3s ease;
}

.animation-card:hover .preview-icon {
  transform: scale(1.1);
  color: rgba(255, 255, 255, 0.8);
}

.preview-icon svg {
  width: 100%;
  height: 100%;
}

.card-info {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-info h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0 0 8px;
  color: #fff;
}

.card-description {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 16px;
  flex: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 4px 12px;
  background: rgba(102, 126, 234, 0.15);
  color: #a5b4fc;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.gallery-footer {
  text-align: center;
  padding: 40px 20px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.9rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    padding: 15px;
    gap: 20px;
  }

  .gallery-header {
    padding: 40px 20px 30px;
  }

  .card-info {
    padding: 16px;
  }
}

/* ============================================
   ANIMATION PAGE BACK LINK
   ============================================ */
body:has(canvas) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #000;
  margin: 0;
  padding: 80px 20px 20px;
  box-sizing: border-box;
}

body:has(canvas) canvas {
  max-width: 100%;
  max-height: calc(100vh - 120px);
  border-radius: 8px;
}

.back-link {
  position: fixed;
  top: 20px;
  left: 20px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  backdrop-filter: blur(10px);
  transition: background 0.2s, transform 0.2s;
  z-index: 1000;
}

.back-link:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(-4px);
}

.back-link:active {
  transform: translateX(-2px);
}
