/* ============================================
   UniFine AI Alliance - Universe Stone Theme
   Dark Space Design System
   ============================================ */

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

/* ---------- CSS Variables ---------- */
:root {
  /* Universe Stone Colors */
  --stone-power: #9B59B6;       /* Purple - Power Stone */
  --stone-power-glow: #8E44AD;
  --stone-time: #2ECC71;        /* Green - Time Stone */
  --stone-time-glow: #27AE60;
  --stone-reality: #E74C3C;     /* Red - Reality Stone */
  --stone-reality-glow: #C0392B;
  --stone-space: #3498DB;       /* Blue - Space Stone */
  --stone-space-glow: #2980B9;
  --stone-mind: #F1C40F;        /* Yellow - Mind Stone */
  --stone-mind-glow: #F39C12;
  --stone-soul: #E67E22;        /* Orange - Soul Stone */
  --stone-soul-glow: #D35400;

  /* Background & Text */
  --bg-deep: #0a0a1a;
  --bg-space: #0d0d2b;
  --bg-nebula: #12123a;
  --text-primary: #e8e8f0;
  --text-secondary: #a0a0c0;
  --text-dim: #6060a0;

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: 20px;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', 'Rajdhani', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  cursor: none;
}

/* Custom Cursor */
.cursor-dot {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  pointer-events: none;
  z-index: 10000;
  transition: transform 0.1s ease;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5), 0 0 20px rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
}

.cursor-ring {
  position: fixed;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  pointer-events: none;
  z-index: 10000;
  transition: width 0.3s ease, height 0.3s ease, border-color 0.3s ease, background 0.3s ease;
  transform: translate(-50%, -50%);
}

.cursor-ring.hover {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.05);
}

/* ---------- Canvas Background ---------- */
#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* ---------- Star Field Background ---------- */
.star-field {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(90, 40, 120, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(30, 60, 120, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(40, 100, 80, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at center, var(--bg-space) 0%, var(--bg-deep) 100%);
}

/* ---------- Horizon Effect ---------- */
.horizon {
  position: fixed;
  bottom: -65vh; /* Adjust based on desired curve height */
  left: 50%;
  transform: translateX(-50%);
  width: 250vw;
  height: 100vh;
  background: #00020a;
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
  box-shadow: 
    0 -10px 60px rgba(0, 120, 255, 0.6), /* Primary Blue Glow */
    0 -20px 120px rgba(0, 80, 255, 0.3),  /* Secondary Diffuse Glow */
    inset 0 20px 80px rgba(0, 0, 0, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  filter: blur(2px);
}

.horizon::after {
  content: '';
  position: absolute;
  top: -80px;
  left: 5%;
  width: 90%;
  height: 200px;
  background: radial-gradient(
    ellipse at center top,
    rgba(0, 160, 255, 0.25) 0%,
    rgba(0, 100, 255, 0.1) 40%,
    transparent 80%
  );
  filter: blur(50px);
  border-radius: 50%;
}

/* ---------- Main Container ---------- */
.main-container {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* ---------- Title Section ---------- */
.title-section {
  text-align: center;
  margin-bottom: 20px;
  position: relative;
}

.title-section .subtitle {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-weight: 300;
  letter-spacing: 12px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
  opacity: 0;
  animation: fadeInUp 1s ease 0.5s forwards;
}

.title-section .main-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(2.5rem, 7vw, 5.5rem);
  font-weight: 900;
  letter-spacing: 8px;
  text-transform: uppercase;
  line-height: 1.1;
  background: linear-gradient(
    135deg,
    #ffffff 0%,
    #cccccc 20%,
    #888888 40%,
    #ffffff 60%,
    #999999 80%,
    #e6e6e6 100%
  );
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 6s ease-in-out infinite, fadeInUp 1s ease 0.3s forwards;
  opacity: 0;
  filter: drop-shadow(0 4px 15px rgba(255, 255, 255, 0.15)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.title-section .tagline {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 6px;
  color: var(--text-secondary);
  margin-top: 12px;
  opacity: 0;
  animation: fadeInUp 1s ease 0.7s forwards;
}

/* ---------- Gauntlet Divider ---------- */
.gauntlet-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 15px 0;
  opacity: 0;
  animation: fadeInUp 1s ease 0.8s forwards;
}

.gauntlet-divider .line {
  width: 80px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--text-dim), transparent);
}

.gauntlet-divider .diamond {
  width: 8px;
  height: 8px;
  background: var(--text-dim);
  transform: rotate(45deg);
  animation: pulse 2s ease-in-out infinite;
}

/* ---------- Stones Grid ---------- */
.stones-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  padding: 20px;
  max-width: 1100px;
  opacity: 0;
  animation: fadeInUp 1s ease 1s forwards;
}

/* ---------- Stone Card ---------- */
.stone-card {
  position: relative;
  width: 150px;
  height: 190px;
  border-radius: 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
  cursor: none;
  animation: float 6s ease-in-out infinite;
}

.stone-card:nth-child(1) { animation-delay: 0s; }
.stone-card:nth-child(2) { animation-delay: 0.5s; }
.stone-card:nth-child(3) { animation-delay: 1s; }
.stone-card:nth-child(4) { animation-delay: 1.5s; }
.stone-card:nth-child(5) { animation-delay: 2s; }
.stone-card:nth-child(6) { animation-delay: 2.5s; }

/* Stone glow layer */
.stone-card::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.5s ease;
  filter: blur(30px);
}

.stone-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  border: 1px solid transparent;
  transition: border-color 0.4s ease;
}

/* Shared SVG Icon Styles */
.stone-card .stone-icon {
  width: 55px;
  height: 55px;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 15px currentColor);
  transition: transform 0.4s ease, filter 0.4s ease;
  z-index: 2;
}

.stone-card:hover .stone-icon {
  transform: scale(1.25) rotate(5deg);
  animation: stoneGlow 1.5s ease-in-out infinite;
}

/* Individual stone colors */
.stone-card[data-stone="power"]::before { background: var(--stone-power); }
.stone-card[data-stone="power"]:hover::after { border-color: var(--stone-power); }
.stone-card[data-stone="power"] .stone-icon {
  color: var(--stone-power);
}

.stone-card[data-stone="time"]::before { background: var(--stone-time); }
.stone-card[data-stone="time"]:hover::after { border-color: var(--stone-time); }
.stone-card[data-stone="time"] .stone-icon {
  color: var(--stone-time);
}

.stone-card[data-stone="reality"]::before { background: var(--stone-reality); }
.stone-card[data-stone="reality"]:hover::after { border-color: var(--stone-reality); }
.stone-card[data-stone="reality"] .stone-icon {
  color: var(--stone-reality);
}

.stone-card[data-stone="space"]::before { background: var(--stone-space); }
.stone-card[data-stone="space"]:hover::after { border-color: var(--stone-space); }
.stone-card[data-stone="space"] .stone-icon {
  color: var(--stone-space);
}

.stone-card[data-stone="mind"]::before { background: var(--stone-mind); }
.stone-card[data-stone="mind"]:hover::after { border-color: var(--stone-mind); }
.stone-card[data-stone="mind"] .stone-icon {
  color: var(--stone-mind);
}

.stone-card[data-stone="soul"]::before { background: var(--stone-soul); }
.stone-card[data-stone="soul"]:hover::after { border-color: var(--stone-soul); }
.stone-card[data-stone="soul"] .stone-icon {
  color: var(--stone-soul);
}

/* Hover state */
.stone-card:hover {
  transform: translateY(-12px) scale(1.05);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.stone-card:hover::before {
  opacity: 0.4;
  transform: translate(-50%, -50%) scale(2.5);
}

.stone-card:hover .stone-orb {
  transform: scale(1.25) rotate(5deg);
  animation: stoneGlow 1.5s ease-in-out infinite;
}

.stone-card:hover .stone-name {
  opacity: 1;
  letter-spacing: 3px;
  transform: translateY(-8px);
}

/* ---------- Stone Orb (Photorealistic Stone Images) ---------- */
.stone-orb {
  width: 90px;
  height: 90px;
  background-size: 130%;
  background-position: center;
  background-repeat: no-repeat;
  transition: transform 0.4s ease, filter 0.4s ease;
  position: relative;
  z-index: 2;
  mix-blend-mode: screen; /* Removes dark background from the sliced stone images */
  filter: drop-shadow(0 0 15px currentColor);
  /* Feather the hard rectangular edges of the cropped images */
  -webkit-mask-image: radial-gradient(circle at center, black 48%, transparent 72%);
  mask-image: radial-gradient(circle at center, black 48%, transparent 72%);
}

/* ---------- Stone Name & Description ---------- */
.stone-desc {
  position: absolute;
  bottom: 22px;
  font-family: 'Inter', 'Rajdhani', sans-serif;
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-secondary);
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.4s ease;
  width: 90%;
  line-height: 1.3;
  z-index: 2;
  pointer-events: none;
  word-break: keep-all;
}

.stone-card:hover .stone-desc {
  opacity: 1;
  transform: translateY(0);
}

.stone-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.7;
  transition: all 0.3s ease;
  z-index: 2;
  text-align: center;
}



/* ---------- Footer ---------- */
.footer {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 4px;
  text-transform: uppercase;
  z-index: 5;
  opacity: 0;
  animation: fadeInUp 1s ease 1.5s forwards;
}

/* ---------- Animations ---------- */
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  25% { background-position: 100% 0%; }
  50% { background-position: 100% 100%; }
  75% { background-position: 0% 100%; }
}

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

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

@keyframes stoneGlow {
  0%, 100% { transform: scale(1.25); filter: drop-shadow(0 0 20px currentColor) drop-shadow(0 0 40px currentColor); }
  50% { transform: scale(1.35) rotate(3deg); filter: brightness(1.2) drop-shadow(0 0 30px currentColor) drop-shadow(0 0 80px currentColor); }
}

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

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .title-section .main-title {
    font-size: clamp(2rem, 10vw, 3rem);
    letter-spacing: 4px;
  }

  .title-section .subtitle {
    font-size: 0.8rem;
    letter-spacing: 6px;
  }

  .stones-grid {
    gap: 12px;
    padding: 10px;
  }

  .stone-card {
    width: 130px;
    height: 160px;
  }

  .stone-orb {
    width: 65px;
    height: 65px;
  }

  /* Show touch cursor on mobile */
  .cursor-dot, .cursor-ring {
    display: none;
  }

  html, body {
    cursor: default;
  }

  .stone-card {
    cursor: pointer;
  }
}

@media (max-width: 480px) {
  .stones-grid {
    gap: 10px;
  }

  .stone-card {
    width: 100px;
    height: 140px;
  }

  .stone-name {
    font-size: 0.55rem;
  }

  .gauntlet-divider .line {
    width: 40px;
  }
}
