/* ============================================================
   aimag.me — Design System Styles
   Custom CSS beyond Tailwind CDN
   ============================================================ */

/* --- Base & Reset Enhancements --- */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow-x: hidden;
}

/* --- Card Flip Animation --- */
.card-container {
  perspective: 1000px;
}

.card-inner {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.card-inner.flipped {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  backface-visibility: hidden;
  position: absolute;
  inset: 0;
}

.card-back {
  transform: rotateY(180deg);
}

/* --- Glow Pulse Animation --- */
@keyframes glow-pulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(124, 91, 245, 0.2);
  }
  50% {
    box-shadow: 0 0 40px rgba(124, 91, 245, 0.4);
  }
}

.glow {
  animation: glow-pulse 3s ease-in-out infinite;
}

/* --- Subtle Float Animation --- */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.animate-float {
  animation: float 4s ease-in-out infinite;
}

.animate-float-slow {
  animation: float 6s ease-in-out infinite;
}

.animate-float-delay-1 {
  animation: float 5s ease-in-out 0.5s infinite;
}

.animate-float-delay-2 {
  animation: float 4.5s ease-in-out 1s infinite;
}

.animate-float-delay-3 {
  animation: float 5.5s ease-in-out 1.5s infinite;
}

/* --- Fade In Up Animation --- */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  animation: fade-in-up 0.6s ease-out forwards;
}

/* Pre-animation state for scroll-triggered elements */
[data-animate] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Staggered Children --- */
.stagger > * {
  opacity: 0;
}

.stagger.is-visible > *:nth-child(1) { animation: fade-in-up 0.5s ease-out 0ms forwards; }
.stagger.is-visible > *:nth-child(2) { animation: fade-in-up 0.5s ease-out 100ms forwards; }
.stagger.is-visible > *:nth-child(3) { animation: fade-in-up 0.5s ease-out 200ms forwards; }
.stagger.is-visible > *:nth-child(4) { animation: fade-in-up 0.5s ease-out 300ms forwards; }
.stagger.is-visible > *:nth-child(5) { animation: fade-in-up 0.5s ease-out 400ms forwards; }
.stagger.is-visible > *:nth-child(6) { animation: fade-in-up 0.5s ease-out 500ms forwards; }

/* --- Skeleton Loading Shimmer --- */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    transparent 25%,
    rgba(255, 255, 255, 0.08) 50%,
    transparent 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Light mode skeleton */
.light .skeleton,
:root:not(.dark) .skeleton {
  background: linear-gradient(
    90deg,
    transparent 25%,
    rgba(0, 0, 0, 0.04) 50%,
    transparent 75%
  );
  background-size: 200% 100%;
}

/* --- Typewriter Cursor --- */
.typewriter-cursor::after {
  content: '|';
  animation: blink 1s step-end infinite;
  margin-left: 2px;
  color: #7c5bf5;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* --- Cosmic Star Particles (CSS-only) --- */
@keyframes twinkle {
  0%, 100% {
    opacity: 0.2;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.4);
  }
}

.star {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
}

.star-1 {
  top: 15%;
  left: 10%;
  animation: twinkle 3s ease-in-out infinite, float 6s ease-in-out infinite;
}

.star-2 {
  top: 25%;
  right: 15%;
  animation: twinkle 4s ease-in-out 0.5s infinite, float 5s ease-in-out 0.3s infinite;
  width: 2px;
  height: 2px;
}

.star-3 {
  top: 60%;
  left: 20%;
  animation: twinkle 3.5s ease-in-out 1s infinite, float 7s ease-in-out 0.7s infinite;
}

.star-4 {
  top: 40%;
  right: 25%;
  animation: twinkle 5s ease-in-out 1.5s infinite, float 4.5s ease-in-out 1s infinite;
  width: 4px;
  height: 4px;
  background: rgba(124, 91, 245, 0.5);
}

.star-5 {
  bottom: 25%;
  left: 35%;
  animation: twinkle 4.5s ease-in-out 2s infinite, float 5.5s ease-in-out 0.5s infinite;
  width: 2px;
  height: 2px;
  background: rgba(201, 163, 83, 0.5);
}

/* --- Steps Connector Line --- */
.steps-connector {
  position: relative;
}

.steps-connector::before {
  content: '';
  position: absolute;
  top: 28px;
  left: 28px;
  right: 28px;
  height: 2px;
  background: repeating-linear-gradient(
    to right,
    rgba(124, 91, 245, 0.3) 0px,
    rgba(124, 91, 245, 0.3) 6px,
    transparent 6px,
    transparent 12px
  );
}

@media (max-width: 768px) {
  .steps-connector::before {
    top: 28px;
    left: 50%;
    right: auto;
    width: 2px;
    height: calc(100% - 56px);
    background: repeating-linear-gradient(
      to bottom,
      rgba(124, 91, 245, 0.3) 0px,
      rgba(124, 91, 245, 0.3) 6px,
      transparent 6px,
      transparent 12px
    );
  }
}

/* --- Hamburger Menu Animation --- */
.hamburger-line {
  display: block;
  width: 24px;
  height: 2px;
  background: currentColor;
  transition: transform 0.3s ease, opacity 0.3s ease;
  border-radius: 1px;
}

.hamburger.is-active .hamburger-line:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.hamburger.is-active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger.is-active .hamburger-line:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* --- Mobile Menu Slide --- */
.mobile-menu {
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu.is-open {
  transform: translateX(0);
}

/* --- Custom Scrollbar (Dark Mode) --- */
.dark ::-webkit-scrollbar,
.dark::-webkit-scrollbar {
  width: 8px;
}

.dark ::-webkit-scrollbar-track,
.dark::-webkit-scrollbar-track {
  background: transparent;
}

.dark ::-webkit-scrollbar-thumb,
.dark::-webkit-scrollbar-thumb {
  background: rgba(124, 91, 245, 0.3);
  border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb:hover,
.dark::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 91, 245, 0.5);
}

/* --- Custom Focus Ring --- */
*:focus-visible {
  outline: 2px solid #7c5bf5;
  outline-offset: 2px;
}

/* --- Cookie Consent Banner --- */
.cookie-banner {
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cookie-banner.is-visible {
  transform: translateY(0);
}

/* --- Hero Gradient (additional layer for depth) --- */
.hero-gradient {
  background: linear-gradient(180deg, #0a0a1a 0%, #1a1040 50%, #2d1b69 100%);
}

.hero-gradient::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 60% 50% at 50% 40%,
    rgba(124, 91, 245, 0.08) 0%,
    transparent 100%
  );
  pointer-events: none;
}

/* Light mode hero */
:root:not(.dark) .hero-gradient {
  background: linear-gradient(180deg, #faf8f5 0%, #f0ecff 50%, #e8e0ff 100%);
}

:root:not(.dark) .hero-gradient::after {
  background: radial-gradient(
    ellipse 60% 50% at 50% 40%,
    rgba(124, 91, 245, 0.06) 0%,
    transparent 100%
  );
}

/* --- Glass Card Hover --- */
.glass-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.glass-card:hover {
  transform: translateY(-2px);
}

.dark .glass-card:hover {
  box-shadow: 0 8px 32px rgba(124, 91, 245, 0.12);
  border-color: rgba(124, 91, 245, 0.2);
}

/* --- Step Number Ring --- */
.step-number {
  position: relative;
}

.step-number::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid rgba(201, 163, 83, 0.3);
}

/* --- Gradient Text --- */
.gradient-text {
  background: linear-gradient(135deg, #7c5bf5, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Section Divider --- */
.section-divider {
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(124, 91, 245, 0.2),
    transparent
  );
}

/* --- Button Glow on Hover --- */
.btn-glow {
  position: relative;
}

.btn-glow::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s ease;
  box-shadow: 0 0 24px rgba(124, 91, 245, 0.4);
  pointer-events: none;
}

.btn-glow:hover::after {
  opacity: 1;
}

/* --- Responsive Adjustments --- */
@media (max-width: 640px) {
  .hero-gradient {
    min-height: calc(100vh - 64px);
    min-height: calc(100dvh - 64px);
  }
}

/* Accessibility: respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
