/**
 * Card Background Animation Styles
 * Custom styles for the interactive card animation in the hero section
 */

/* RGB values for JavaScript use and opacity control */
:root {
  --primary-rgb: 17, 152, 114; /* Shamrock Green */
  --secondary-rgb: 0, 129, 177; /* Cerulean */
  --accent-1-rgb: 243, 201, 139; /* Sunset */
  --accent-2-rgb: 218, 165, 136; /* Buff */
  --accent-3-rgb: 196, 109, 94; /* Indian Red */
}

#card-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: auto; /* Allow pointer events for cards within */
}

.bg-card {
  position: absolute;
  width: 120px;
  height: 180px;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1), 
              0 6px 30px rgba(0, 0, 0, 0.1),
              inset 0 1px 1px rgba(255, 255, 255, 0.1);
  user-select: none;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  justify-content: center;
  align-items: center;
  transform-origin: center center;
  pointer-events: auto; /* Make cards interactive */
  opacity: 0.75; /* Slightly transparent to not distract from content */
  animation: none !important; /* Completely remove fadeIn animation to avoid conflicts with JavaScript positioning */
  cursor: grab;
  z-index: 10;
}

/* Dragging state for visual feedback */
.bg-card.dragging {
  box-shadow: 0 8px 30px rgba(0,0,0,0.2), 
              0 12px 60px rgba(0,0,0,0.2),
              inset 0 1px 1px rgba(255, 255, 255, 0.2);
  opacity: 0.9;
  cursor: grabbing;
  z-index: 20;
}

.card-logo {
  width: 80%;
  height: 80%;
  background-image: url('../coldboot-icon.svg');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.5;
}

.card-pattern {
  width: 80%;
  height: 80%;
  background-image: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
  background-size: 10px 10px;
  opacity: 0.3;
}

/* Initial opacity animation for cards */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px) rotate(5deg); }
  to { opacity: 0.8; transform: translateY(0) rotate(0deg); }
}

/* Apply fade-in animation to cards with staggered delays */
.bg-card {
  animation-delay: calc(var(--i, 0) * 0.15s); /* Staggered animation */
}

/* Different card colors/styles */
.bg-card:nth-child(4n) {
  background-color: rgba(var(--primary-rgb), 0.1);
  border-color: rgba(var(--primary-rgb), 0.2);
  --i: 0;
}

.bg-card:nth-child(4n+1) {
  background-color: rgba(var(--secondary-rgb), 0.1);
  border-color: rgba(var(--secondary-rgb), 0.2);
  --i: 1;
}

.bg-card:nth-child(4n+2) {
  background-color: rgba(var(--accent-1-rgb), 0.1);
  border-color: rgba(var(--accent-1-rgb), 0.2);
  --i: 2;
}

.bg-card:nth-child(4n+3) {
  background-color: rgba(var(--accent-2-rgb), 0.1);
  border-color: rgba(var(--accent-2-rgb), 0.2);
  --i: 3;
}

/* Responsive styles */
@media (max-width: 768px) {
  #card-background {
    display: none; /* Hide on mobile devices for performance */
  }
}

/* Hero overlay to ensure text remains readable */
.hero::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(18, 18, 18, 0.3) 0%,
    rgba(18, 18, 18, 0.4) 100%
  );
  z-index: 1; /* Above card background, below hero text container */
  pointer-events: none; /* Allow overlay interactions */
  opacity: 0.5; /* Restore overlay opacity */
}

.hero .container {
  position: relative;
  z-index: 2; /* Above the card background and overlay */
}
