/* Animations CSS for Harbor Landing Page */

/* General Animation Keyframes */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes slideInLeft {
  from {
    transform: translateX(-50px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(50px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

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

@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink {
  50% {
    border-color: transparent;
  }
}

@keyframes ripple {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 102, 204, 0.5);
  }
  70% {
    box-shadow: 0 0 0 20px rgba(0, 102, 204, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 102, 204, 0);
  }
}

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

@keyframes fadeInScale {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-20px);
  }
  60% {
    transform: translateY(-10px);
  }
}

@keyframes glow {
  0% {
    box-shadow: 0 0 5px rgba(255, 120, 0, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 120, 0, 0.8), 0 0 30px rgba(255, 120, 0, 0.5);
  }
  100% {
    box-shadow: 0 0 5px rgba(255, 120, 0, 0.5);
  }
}

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

@keyframes strokeDraw {
  0% {
    stroke-dashoffset: 1000;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

/* Animate on Scroll Classes */
.animate {
  transition: all 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  opacity: 0;
  transform: translateY(30px);
}

.animate.active {
  opacity: 1;
  transform: translateY(0) translateX(0);
}

.animate.fade-in {
  animation: fadeIn 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.animate.slide-up {
  animation: slideInUp 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.animate.slide-left {
  animation: slideInLeft 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.animate.slide-right {
  animation: slideInRight 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.animate.bounce {
  animation: bounce 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Staggered animations for multiple elements */
.stagger-animation > * {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.stagger-animation.active > *:nth-child(1) {
  transition-delay: 0.1s;
}

.stagger-animation.active > *:nth-child(2) {
  transition-delay: 0.3s;
}

.stagger-animation.active > *:nth-child(3) {
  transition-delay: 0.5s;
}

.stagger-animation.active > *:nth-child(4) {
  transition-delay: 0.7s;
}

.stagger-animation.active > * {
  opacity: 1;
  transform: translateY(0);
}

/* Section animations */
.section-fade-in {
  opacity: 0;
  animation: fadeIn 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Hero section animations */
.hero-content h1 {
  opacity: 0;
  transform: translateY(30px);
  animation: slideInUp 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.hero-content p {
  opacity: 0;
  transform: translateY(30px);
  animation: slideInUp 1s cubic-bezier(0.22, 1, 0.36, 1) 0.2s forwards;
}

.hero-content .hero-subtext {
  opacity: 0;
  transform: translateY(30px);
  animation: slideInUp 1s cubic-bezier(0.22, 1, 0.36, 1) 0.4s forwards;
}

.hero-cta {
  opacity: 0;
  transform: translateY(30px);
  animation: slideInUp 1s cubic-bezier(0.22, 1, 0.36, 1) 0.6s forwards;
}

.product-classification {
  opacity: 0;
  transform: translateX(50px);
  animation: slideInRight 1s cubic-bezier(0.22, 1, 0.36, 1) 0.3s forwards;
}

/* Floating animation for hero image */
.floating-animation {
  animation: float 6s ease-in-out infinite;
}

/* Pulse animation for elements */
.pulse-animation {
  animation: pulse 2.5s infinite;
}

/* Problem section card hover */
.card {
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.card:hover {
  transform: translateY(-15px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Problem section specific animations */
.problem .card-icon {
  opacity: 0;
  transform: scale(0.5);
  animation: fadeInScale 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 0.2s;
}

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

.problem .card:nth-child(3) .card-icon {
  animation-delay: 0.6s;
}

/* Red glow for mistake cost line */
.problem .card:nth-child(2) h3 {
  position: relative;
  animation: glow 3s infinite;
}

/* Guide section step number hover */
.step-number {
  transition: transform 0.3s ease, background-color 0.3s ease;
}

.step-number:hover {
  animation: pulse 1s infinite;
  background-color: var(--primary-dark);
}

/* Progress wheel animation for guide section */
.step {
  position: relative;
}

.step::before {
  content: '';
  position: absolute;
  top: 40px;
  left: 50%;
  width: 80px;
  height: 80px;
  border: 3px solid rgba(0, 102, 204, 0.1);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  transform: translateX(-50%);
  opacity: 0;
  animation: rotate 1.5s linear infinite;
}

.step.active::before {
  opacity: 1;
}

/* Network diagram animations */
.network-steps {
  position: relative;
}

.network-arrow {
  position: relative;
  animation: pulse 2s infinite;
}

.network-image {
  position: relative;
}

.network-image path {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: strokeDraw 3s ease forwards;
}

/* Interactive demo animations */
.upload-form button {
  position: relative;
  overflow: hidden;
}

.upload-form button:after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.upload-form button:active:after {
  width: 300px;
  height: 300px;
}

.upload-image label {
  transition: transform 0.3s ease, background-color 0.3s ease;
}

.upload-image label:hover {
  transform: translateY(-5px) rotate(2deg);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Loading animation for demo */
.loading {
  display: inline-block;
  position: relative;
  width: 80px;
  height: 80px;
}

.loading div {
  position: absolute;
  top: 33px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--primary);
  animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.loading div:nth-child(1) {
  left: 8px;
  animation: loading1 0.6s infinite;
}

.loading div:nth-child(2) {
  left: 8px;
  animation: loading2 0.6s infinite;
}

.loading div:nth-child(3) {
  left: 32px;
  animation: loading2 0.6s infinite;
}

.loading div:nth-child(4) {
  left: 56px;
  animation: loading3 0.6s infinite;
}

@keyframes loading1 {
  0% {
    transform: scale(0);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes loading3 {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(0);
  }
}

@keyframes loading2 {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(24px, 0);
  }
}

/* Result animation typing effect */
.result-explanation p {
  overflow: hidden;
  border-right: 2px solid var(--primary);
  white-space: normal;
  animation: typing 3.5s steps(40, end), blink 0.75s step-end infinite;
}

/* Risk flag animation */
.risk-flag {
  position: relative;
  overflow: hidden;
  animation: glow 3s infinite;
}

.risk-flag:after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shine 2s infinite;
}

@keyframes shine {
  100% {
    left: 100%;
  }
}

/* Stakeholder table animations */
.stakeholder-row {
  transition: all 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  transform: translateX(-30px);
  opacity: 0;
}

.stakeholder-row.active {
  transform: translateX(0);
  opacity: 1;
}

.stakeholder-row:hover {
  background-color: rgba(0, 102, 204, 0.1);
  transform: scale(1.02);
}

/* Tooltip style */
.tooltip {
  position: absolute;
  background-color: var(--secondary);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-md);
  font-size: 0.95rem;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  z-index: 10;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  animation: fadeInScale 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: 250px;
}

.tooltip:after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -8px;
  border-width: 8px;
  border-style: solid;
  border-color: var(--secondary) transparent transparent transparent;
}

/* Security features animation */
.security-item {
  overflow: hidden;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.security-item:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.security-icon {
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.security-item:hover .security-icon {
  transform: scale(1.2) rotate(10deg);
}

/* Lock icon animation */
.security-item:nth-child(1) .security-icon {
  animation: pulse 3s infinite;
}

/* SOC2 badge highlight */
.security-item:nth-child(3) {
  position: relative;
}

.security-item:nth-child(3)::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, rgba(0, 102, 204, 0.2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.security-item:nth-child(3):hover::after {
  opacity: 1;
}

/* Pricing plan animation */
.plan {
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  transform-style: preserve-3d;
  perspective: 1000px;
}

.plan:hover:not(.featured) {
  transform: translateY(-15px) rotateX(5deg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.plan.featured {
  position: relative;
  animation: pulse 3s infinite;
}

.plan.featured:before {
  content: '';
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border-radius: var(--border-radius-lg);
  background: linear-gradient(45deg, var(--primary), var(--primary-light));
  z-index: -1;
  animation: pulse 3s infinite;
}

/* Form animation */
.signup-form .form-group {
  transition: transform 0.3s ease;
}

.signup-form .form-group:focus-within {
  transform: translateY(-5px);
}

.signup-form input:focus,
.signup-form select:focus,
.signup-form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.15);
}

/* CTA water ripple effect */
.cta {
  position: relative;
  overflow: hidden;
}

.cta::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary), var(--primary-dark));
  background-size: 200% 100%;
  animation: wave 10s linear infinite;
  opacity: 0.3;
}

/* Mobile menu animation */
.mobile-menu-toggle span {
  transition: all 0.3s ease;
}

.mobile-menu-active .mobile-menu-toggle span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-active .mobile-menu-toggle span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-active .mobile-menu-toggle span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Button hover animation */
.button {
  position: relative;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.button:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.button:after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.button:active:after {
  width: 300px;
  height: 300px;
}

/* CTA button pulse */
.cta .button {
  animation: pulse 3s infinite;
}

/* Page load animation */
.loaded body {
  animation: fadeIn 0.5s ease-out;
}

/* Make everything visible in a no-js environment */
.no-js .animate,
.no-js .stagger-animation > *,
.no-js .hero-content h1,
.no-js .hero-content p,
.no-js .hero-content .hero-subtext,
.no-js .hero-cta,
.no-js .product-classification,
.no-js .section-fade-in,
.no-js .stakeholder-row {
  opacity: 1;
  transform: none;
  animation: none;
}

/* Media Query for reducing animations on small screens or when user prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}