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

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #141824;
  --text-primary: #ffffff;
  --text-secondary: #a0a8b8;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --border: rgba(255, 255, 255, 0.1);
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-hover: rgba(255, 255, 255, 0.08);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

#particleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* Header */
.header {
  text-align: center;
  padding: 4rem 0 3rem;
  position: relative;
  animation: fadeInDown 0.8s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.title {
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 900;
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.title-word {
  background: linear-gradient(135deg, #ffffff 0%, #a0a8b8 50%, #6366f1 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease infinite, float 6s ease-in-out infinite;
  position: relative;
  display: inline-block;
}

.title-word:nth-child(2) {
  animation-delay: 0.3s, 0s;
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.title-word::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: 2px;
  opacity: 0;
  animation: underlineGlow 2s ease infinite;
}

@keyframes underlineGlow {
  0%, 100% {
    opacity: 0;
    transform: scaleX(0);
  }
  50% {
    opacity: 1;
    transform: scaleX(1);
  }
}

.subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  font-weight: 400;
  animation: fadeInUp 0.8s ease-out 0.3s both;
}

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

.author-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  display: inline-block;
}

.author-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 0.3s ease;
}

.author-link:hover {
  color: var(--accent-hover);
  transform: translateY(-2px);
}

.author-link:hover::after {
  width: 100%;
}

/* Main Content */
.main {
  flex: 1;
  padding: 2rem 0;
}

.demos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

/* Demo Card */
.demo-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(30px) scale(0.95);
  animation: cardEntrance 0.6s ease-out forwards;
}

.demo-card[data-delay="0"] {
  animation-delay: 0.5s;
}

.demo-card[data-delay="1"] {
  animation-delay: 0.7s;
}

@keyframes cardEntrance {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.demo-card:hover .card-glow {
  opacity: 1;
  animation: rotateGlow 3s linear infinite;
}

@keyframes rotateGlow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.demo-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transform: scaleX(0);
  transition: transform 0.4s ease;
}

.demo-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 20px;
  padding: 2px;
  background: linear-gradient(135deg, var(--accent), transparent, var(--accent));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.demo-card:hover {
  background: var(--card-hover);
  border-color: var(--accent);
  transform: translateY(-8px) scale(1.02);
  box-shadow: 
    0 20px 60px rgba(99, 102, 241, 0.3),
    0 0 40px rgba(99, 102, 241, 0.2),
    inset 0 0 30px rgba(99, 102, 241, 0.1);
}

.demo-card:hover::before {
  transform: scaleX(1);
}

.demo-card:hover::after {
  opacity: 1;
}

.demo-icon {
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.4));
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: inline-block;
  animation: iconFloat 3s ease-in-out infinite;
}

.demo-card:nth-child(1) .demo-icon {
  animation-delay: 0s;
}

.demo-card:nth-child(2) .demo-icon {
  animation-delay: 1.5s;
}

@keyframes iconFloat {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-10px) rotate(5deg);
  }
}

.demo-card:hover .demo-icon {
  transform: scale(1.2) rotate(10deg);
  filter: drop-shadow(0 0 30px rgba(99, 102, 241, 0.6));
}

.demo-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

.demo-card:hover .demo-title {
  color: var(--accent-hover);
}

.demo-description {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex: 1;
  transition: color 0.3s ease;
}

.demo-card:hover .demo-description {
  color: var(--text-primary);
}

.demo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
}

.tag {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid rgba(99, 102, 241, 0.2);
  transition: all 0.3s ease;
  transform: scale(1);
}

.demo-card:hover .tag {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent);
  transform: scale(1.05);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.card-arrow {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  font-size: 1.5rem;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.4s ease;
}

.demo-card:hover .card-arrow {
  opacity: 1;
  transform: translateX(0);
  animation: arrowPulse 1s ease infinite;
}

@keyframes arrowPulse {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(5px);
  }
}

/* Coming Soon Card */
.coming-soon {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.coming-soon:hover {
  transform: none;
  border-color: var(--border);
}

.coming-soon .demo-icon {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.8;
  }
}

/* Footer */
.footer {
  text-align: center;
  padding: 3rem 0 2rem;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  animation: fadeInUp 0.8s ease-out 0.9s both;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  position: relative;
  display: inline-block;
}

.footer-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 0.3s ease;
}

.footer-link:hover {
  color: var(--accent);
  transform: translateY(-2px);
}

.footer-link:hover::after {
  width: 100%;
}

/* Background Effects */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
  animation: rotate 25s linear infinite;
  z-index: -1;
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.05) 0%, transparent 70%);
  animation: rotate 30s linear infinite reverse;
  z-index: -1;
  pointer-events: none;
}

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

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 1.5rem;
  }

  .header {
    padding: 2rem 0 1rem;
  }

  .title {
    gap: 0.5rem;
  }

  .demos-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .demo-card {
    padding: 2rem;
  }
}

@media (max-width: 480px) {
  .title {
    font-size: 2.5rem;
    flex-direction: column;
    gap: 0;
  }

  .subtitle {
    font-size: 1rem;
  }

  .demo-card {
    padding: 1.5rem;
  }

  .demo-icon {
    font-size: 2.5rem;
  }
}
