/* ==========================================================================
   Ceylon Computer Service - Animations & Effects
   ========================================================================== */

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes brandScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-16px); }
}

@keyframes floatRotate {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(3deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink {
  50% { border-color: transparent; }
}

@keyframes particleFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); opacity: 0.3; }
  25% { transform: translate(10px, -20px) rotate(90deg); opacity: 0.6; }
  50% { transform: translate(-5px, -40px) rotate(180deg); opacity: 0.4; }
  75% { transform: translate(-15px, -20px) rotate(270deg); opacity: 0.5; }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}

/* Scroll Reveal (AOS-like) — initial state; premium-ui.css handles .revealed animation */
[data-reveal] {
  opacity: 0;
}
[data-reveal="fade-up"] { transform: translateY(40px); }
[data-reveal="fade-down"] { transform: translateY(-40px); }
[data-reveal="fade-left"] { transform: translateX(-40px); }
[data-reveal="fade-right"] { transform: translateX(40px); }
[data-reveal="zoom-in"] { transform: scale(0.92); }
/* .revealed final state applied via premium-ui.css keyframe animations */

/* Stagger delays */
[data-delay="100"] { transition-delay: 0.1s; }
[data-delay="200"] { transition-delay: 0.2s; }
[data-delay="300"] { transition-delay: 0.3s; }
[data-delay="400"] { transition-delay: 0.4s; }
[data-delay="500"] { transition-delay: 0.5s; }

/* Hero floating items */
.hero__float-item:nth-child(1) { animation: float 4s ease-in-out infinite; top: 10%; left: 10%; }
.hero__float-item:nth-child(2) { animation: floatRotate 5s ease-in-out infinite 0.5s; top: 30%; right: 5%; }
.hero__float-item:nth-child(3) { animation: float 4.5s ease-in-out infinite 1s; bottom: 25%; left: 5%; }
.hero__float-item:nth-child(4) { animation: floatRotate 5.5s ease-in-out infinite 1.5s; top: 55%; right: 15%; }
.hero__float-item:nth-child(5) { animation: float 4s ease-in-out infinite 2s; bottom: 10%; right: 25%; }
.hero__float-item:nth-child(6) { animation: floatRotate 6s ease-in-out infinite 0.8s; top: 15%; left: 40%; }
.hero__float-item:nth-child(7) { animation: float 5s ease-in-out infinite 1.2s; bottom: 40%; left: 30%; }

/* Typing effect */
.typing-text {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  border-right: 3px solid var(--accent);
  animation: typing 3s steps(40) 1s forwards, blink 0.75s step-end infinite;
  width: 0;
}

/* Particles */
.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  animation: particleFloat 8s ease-in-out infinite;
}
.particle:nth-child(odd) { width: 4px; height: 4px; background: rgba(0, 188, 212, 0.5); }
.particle:nth-child(3n) { width: 8px; height: 8px; background: rgba(255, 255, 255, 0.25); }

/* Animated gradient background */
.animated-gradient {
  background: linear-gradient(-45deg, #0F4C81, #1565C0, #00BCD4, #0F4C81);
  background-size: 400% 400%;
  animation: gradientShift 12s ease infinite;
}

/* Icon bounce on hover */
.icon-bounce:hover svg { animation: float 0.6s ease; }

/* Counter animation ready state */
.counter { display: inline-block; }

/* Card shine effect */
.card-shine {
  position: relative;
  overflow: hidden;
}
.card-shine::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    to bottom right,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0) 100%
  );
  transform: rotate(45deg) translateX(-100%);
  transition: transform 0.6s;
}
.card-shine:hover::before { transform: rotate(45deg) translateX(100%); }

/* Ripple container */
.ripple-container { position: relative; overflow: hidden; }
.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

/* Page transition — opacity only so fixed elements (FAB rail, modals) stay viewport-fixed */
.page-transition {
  animation: fadeInPage 0.5s ease forwards;
}

@keyframes fadeInPage {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Loading dots */
.loading-dots span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin: 0 3px;
  animation: pulse 1.2s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

/* SVG decoration animation */
.svg-decoration {
  position: absolute;
  pointer-events: none;
  opacity: 0.08;
}
.svg-decoration circle,
.svg-decoration path {
  animation: float 6s ease-in-out infinite;
}

/* Hover lift */
.hover-lift { transition: transform var(--transition), box-shadow var(--transition); }
.hover-lift:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }

/* Glow effect */
.glow-accent { box-shadow: 0 0 20px var(--accent-glow); }

/* Animated border */
.animated-border {
  position: relative;
}
.animated-border::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}
.animated-border:hover::after { width: 100%; }

/* Success checkmark animation */
@keyframes checkmark {
  0% { stroke-dashoffset: 100; }
  100% { stroke-dashoffset: 0; }
}
.success-check svg path {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: checkmark 0.6s ease forwards 0.2s;
}

/* Parallax layers */
.parallax-layer {
  will-change: transform;
  transition: transform 0.1s linear;
}

/* Mobile menu slide */
.mobile-menu {
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.mobile-menu.open { transform: translateX(0); }

/* Form submit loading */
.btn.loading {
  pointer-events: none;
  opacity: 0.8;
}
.btn.loading .btn-text { visibility: hidden; }
.btn.loading::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}
