/* ===================================
   Simon - Animations & Custom Styles
   For use with Tailwind CSS
   =================================== */

/* ===================================
   Base Styles
   =================================== */

html {
  scroll-behavior: smooth;
}

/* ===================================
   Global Background Grid
   =================================== */

.global-grid {
  background-image: linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 80px 80px;
}

/* ===================================
   Navigation Scrolled State
   =================================== */

#nav.scrolled {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 #eff3f4;
}

/* ===================================
   Employee Question Card (Hero Animation)
   =================================== */

.question-card {
  opacity: 0;
  animation: questionCardAppear 0.5s ease-out 0.3s forwards;
}

@keyframes questionCardAppear {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) translateY(15px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.question-card-inner {
  position: relative;
  transition: all 0.4s ease;
}

.question-card.floating .question-card-inner {
  box-shadow: 0 20px 40px rgba(0, 85, 255, 0.15);
}

/* Avatar gradient animation */
.question-avatar {
  animation: avatarPulse 3s ease-in-out infinite;
  animation-delay: 1.5s;
}

@keyframes avatarPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(0, 85, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(0, 85, 255, 0);
  }
}

/* Typing cursor blink */
.typing-cursor {
  animation: cursorBlink 0.8s step-end infinite;
  color: #0055ff;
  font-weight: 300;
}

@keyframes cursorBlink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}

/* Question ripple effect */
.question-ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border: 1px solid #0055ff;
  border-radius: 16px;
  opacity: 0;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: none;
}

.question-card.sending .question-ripple {
  animation: questionRipple 0.8s ease-out forwards;
}

.question-card.sending .question-ripple-2 {
  animation: questionRipple 0.8s ease-out 0.15s forwards;
}

@keyframes questionRipple {
  0% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.5);
  }
}

/* Fade out animation - when question is "sent" */
.question-card.floating {
  animation: questionFadeOut 0.6s ease-out forwards;
}

@keyframes questionFadeOut {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
}

/* Mobile-specific keyframes */
@keyframes questionCardAppearMobile {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(15px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
}

@keyframes questionFadeOutMobile {
  0% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(0.95);
  }
}

/* Hero elements hidden initially */
.hero-hidden {
  opacity: 0 !important;
  visibility: hidden;
}

.scattered-icons.hero-hidden,
.simon-stack.hero-hidden {
  transform: translateY(20px);
}

svg.connection-lines.hero-hidden {
  opacity: 0 !important;
}

.hero-revealed {
  visibility: visible;
  animation: heroReveal 0.5s ease-out forwards;
}

.scattered-icons.hero-revealed,
.simon-stack.hero-revealed {
  animation: heroRevealSlide 0.5s ease-out forwards;
}

svg.connection-lines.hero-revealed {
  animation: heroRevealFade 0.4s ease-out 0.3s forwards;
}

@keyframes heroReveal {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes heroRevealSlide {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroRevealFade {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* Responsive adjustments for question card */

/* Desktop - card centered in hero visualization area */
.question-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Tablet and below (≤1024px) - hide card, show icons/stack immediately */
@media (max-width: 1024px) {
  .question-card {
    display: none !important;
  }

  /* Show icons and stack immediately without animation */
  .scattered-icons.hero-hidden,
  .simon-stack.hero-hidden,
  svg.connection-lines.hero-hidden {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
  }

  .scattered-icons.hero-revealed,
  .simon-stack.hero-revealed,
  svg.connection-lines.hero-revealed {
    animation: none !important;
  }

  /* Icons should be visible and activated immediately */
  .icon-node {
    opacity: 1 !important;
    transform: translate(-50%, -50%) scale(1) !important;
  }
}

/* Mobile landscape and small tablets (≤768px) */
@media (max-width: 768px) {
  .question-card-inner {
    padding: 1rem;
    gap: 0.875rem;
  }

  .question-avatar {
    width: 44px !important;
    height: 44px !important;
  }

  .question-text {
    font-size: 1rem;
    white-space: normal !important;
  }

  .question-name {
    font-size: 0.8125rem;
  }
}

/* Mobile portrait (≤480px) */
@media (max-width: 480px) {
  .question-card-inner {
    padding: 0.875rem;
    gap: 0.75rem;
  }

  .question-avatar {
    width: 40px !important;
    height: 40px !important;
  }

  .question-text {
    font-size: 0.9375rem;
  }

  .question-name {
    font-size: 0.75rem;
  }
}

/* ===================================
   Icon Nodes (Hero Visualization)
   =================================== */

.icon-node {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%) scale(0.9);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 0 0 1px #eff3f4;
  transition: transform 0.6s ease, box-shadow 0.3s ease, opacity 0.6s ease;
  opacity: 0.4;
}

/* Icons activate when question is sent */
.icon-node.activated {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.icon-node.activated .icon-pulse {
  animation: iconPulse 3s ease-out infinite;
}

/* Icon pulse initially paused */
.icon-pulse {
  animation: none;
}

.icon-node.activated:hover {
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1), 0 0 0 1px #cfd9de;
}

.icon-node img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.icon-pulse {
  position: absolute;
  inset: -4px;
  border: 1px solid #0055ff;
  border-radius: 16px;
  opacity: 0;
  animation: iconPulse 3s ease-out infinite;
}

.icon-node:nth-child(1) .icon-pulse {
  animation-delay: 0s;
}
.icon-node:nth-child(2) .icon-pulse {
  animation-delay: 0.3s;
}
.icon-node:nth-child(3) .icon-pulse {
  animation-delay: 0.6s;
}
.icon-node:nth-child(4) .icon-pulse {
  animation-delay: 0.9s;
}
.icon-node:nth-child(5) .icon-pulse {
  animation-delay: 1.2s;
}
.icon-node:nth-child(6) .icon-pulse {
  animation-delay: 1.5s;
}
.icon-node:nth-child(7) .icon-pulse {
  animation-delay: 1.8s;
}
.icon-node:nth-child(8) .icon-pulse {
  animation-delay: 2.1s;
}
.icon-node:nth-child(9) .icon-pulse {
  animation-delay: 2.4s;
}

@keyframes iconPulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* Responsive icon sizes */
@media (max-width: 1024px) {
  .icon-node {
    width: 40px;
    height: 40px;
  }
  .icon-node img {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 768px) {
  .icon-node {
    width: 35px;
    height: 35px;
  }
  .icon-node img {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 480px) {
  .icon-node {
    width: 30px;
    height: 30px;
  }
  .icon-node img {
    width: 16px;
    height: 16px;
  }
}

/* ===================================
   Connection Lines (SVG Paths)
   =================================== */

.connection-path {
  fill: none;
  stroke: #0055ff;
  stroke-width: 1.5;
  opacity: 0.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===================================
   Data Flow Dots
   =================================== */

.data-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #0055ff;
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 0 8px #0055ff, 0 0 16px rgba(0, 85, 255, 0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.data-dot.active {
  opacity: 1;
}

/* ===================================
   Simon Stack Layers
   =================================== */

.stack-layer {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  width: 96%;
  z-index: 5;
  transition: transform 0.4s ease-out, opacity 0.4s ease-out;
  opacity: 0;
}

.stack-layer-1 {
  z-index: 5;
}
.stack-layer-2 {
  z-index: 4;
}
.stack-layer-3 {
  z-index: 3;
}
.stack-layer-4 {
  z-index: 2;
}
.stack-layer-5 {
  z-index: 1;
}

/* Layer Info Box - Desktop Only */
.layer-info {
  display: none;
}

@media (min-width: 1024px) {
  .stack-layer {
    cursor: pointer;
  }

  .stack-layer img {
    transition: transform 0.2s ease;
  }

  .stack-layer:hover img,
  .stack-layer.simulated-hover img {
    filter: brightness(0) saturate(100%) invert(18%) sepia(100%) saturate(7500%)
      hue-rotate(220deg) brightness(100%) contrast(105%)
      drop-shadow(0 4px 12px rgba(0, 85, 255, 0.25));
  }

  .layer-info {
    display: block;
    position: absolute;
    top: 50%;
    width: 180px;
    padding: 1rem;
    background: #ffffff;
    border: 1px solid #eff3f4;
    border-radius: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) scale(0);
    transform-origin: center center;
    transition: opacity 0.25s ease,
      transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .layer-corner {
    position: absolute;
    width: 16px;
    height: 16px;
    border-color: #0f1419;
    border-style: solid;
    border-width: 0;
    z-index: 10;
  }

  .layer-corner-tl {
    top: -4px;
    left: -4px;
    border-top-width: 2px;
    border-left-width: 2px;
  }
  .layer-corner-tr {
    top: -4px;
    right: -4px;
    border-top-width: 2px;
    border-right-width: 2px;
  }
  .layer-corner-bl {
    bottom: -4px;
    left: -4px;
    border-bottom-width: 2px;
    border-left-width: 2px;
  }
  .layer-corner-br {
    bottom: -4px;
    right: -4px;
    border-bottom-width: 2px;
    border-right-width: 2px;
  }

  .stack-layer[data-side="left"] .layer-info {
    right: calc(100% + 20px);
    left: auto;
    transform: translateY(-50%) scale(0);
  }

  .stack-layer:hover,
  .stack-layer.simulated-hover {
    opacity: 1 !important;
  }

  .stack-layer:hover .layer-info,
  .stack-layer.simulated-hover .layer-info {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) scale(1);
  }
}

/* Mobile stack adjustments */
@media (max-width: 768px) {
  .stack-container {
    width: 200px !important;
  }

  .stack-layer {
    top: 40px;
  }
}

@media (max-width: 480px) {
  .stack-container {
    width: 160px !important;
  }
}

/* ===================================
   Module Corner Brackets
   =================================== */

.module-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: #0f1419;
  border-style: solid;
  border-width: 0;
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 10;
}

.module-corner-tl {
  top: -4px;
  left: -4px;
  border-top-width: 2px;
  border-left-width: 2px;
}
.module-corner-tr {
  top: -4px;
  right: -4px;
  border-top-width: 2px;
  border-right-width: 2px;
}
.module-corner-bl {
  bottom: -4px;
  left: -4px;
  border-bottom-width: 2px;
  border-left-width: 2px;
}
.module-corner-br {
  bottom: -4px;
  right: -4px;
  border-bottom-width: 2px;
  border-right-width: 2px;
}

.arch-module:hover .module-corner {
  opacity: 1;
}

/* ===================================
   Card Corner Brackets (Process Cards)
   =================================== */

.card-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: #0f1419;
  border-style: solid;
  border-width: 0;
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 10;
}

.card-corner-tl {
  top: -4px;
  left: -4px;
  border-top-width: 2px;
  border-left-width: 2px;
}
.card-corner-tr {
  top: -4px;
  right: -4px;
  border-top-width: 2px;
  border-right-width: 2px;
}
.card-corner-bl {
  bottom: -4px;
  left: -4px;
  border-bottom-width: 2px;
  border-left-width: 2px;
}
.card-corner-br {
  bottom: -4px;
  right: -4px;
  border-bottom-width: 2px;
  border-right-width: 2px;
}

.process-card-inner:hover .card-corner {
  opacity: 1;
}

/* ===================================
   Status Dot Pulse
   =================================== */

.status-dot {
  animation: pulse 2s ease-in-out infinite;
}

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

/* ===================================
   Orbit Animations (Process Cards)
   =================================== */

.orbit-ring-1 {
  animation: orbitSpin 30s linear infinite;
}

.orbit-ring-2 {
  animation: orbitSpin 20s linear infinite reverse;
}

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

/* Orbit Dots */
.orbit-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #0055ff;
  border-radius: 50%;
  box-shadow: 0 0 8px #0055ff;
}

.orbit-dot-success {
  background: #00ba7c;
  box-shadow: 0 0 8px #00ba7c;
}

.orbit-dot-1 {
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  animation: orbitDot1 8s ease-in-out infinite;
}

.orbit-dot-2 {
  bottom: 20%;
  right: 5%;
  animation: orbitDot2 10s ease-in-out infinite 2s;
}

.orbit-dot-3 {
  top: 57%;
  left: 2%;
  animation: orbitDot3 12s ease-in-out infinite 4s;
}

@keyframes orbitDot1 {
  0%,
  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
  50% {
    opacity: 0.5;
    transform: translateX(-50%) scale(0.7);
  }
}

@keyframes orbitDot2 {
  0%,
  100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

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

/* ===================================
   Flow Particles (Step 1) - Lines flowing from orbit dots to center
   =================================== */

.flow-particle {
  position: absolute;
  width: 2px;
  border-radius: 1px;
  background: linear-gradient(to bottom, transparent, #0055ff, transparent);
  opacity: 0;
}

/* Line from top dot (orbit-dot-1 position) - points down toward center */
.flow-particle-1 {
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  height: 20px;
  animation: flowLine1 2.5s ease-out infinite;
}

/* Line from bottom-right dot (orbit-dot-2 position) - points toward center */
.flow-particle-2 {
  bottom: 30%;
  right: 12%;
  transform: rotate(-45deg);
  transform-origin: bottom center;
  height: 20px;
  animation: flowLine2 2.5s ease-out infinite 0.8s;
}

/* Line from left dot (orbit-dot-3 position) - points toward center */
.flow-particle-3 {
  top: 44%;
  left: 12%;
  transform: rotate(-90deg);
  transform-origin: bottom center;
  height: 20px;
  animation: flowLine3 2.5s ease-out infinite 1.6s;
}

@keyframes flowLine1 {
  0% {
    opacity: 0;
    top: 3px;
  }
  8% {
    opacity: 0.8;
    top: 3px;
  }
  70% {
    opacity: 0.6;
    top: calc(50% - 35px);
  }
  85%,
  100% {
    opacity: 0;
    top: calc(50% - 35px);
  }
}

@keyframes flowLine2 {
  0% {
    opacity: 0;
    bottom: 30%;
    right: 12%;
  }
  8% {
    opacity: 0.8;
    bottom: 30%;
    right: 12%;
  }
  70% {
    opacity: 0.6;
    bottom: 52%;
    right: 40%;
  }
  85%,
  100% {
    opacity: 0;
    bottom: 52%;
    right: 40%;
  }
}

@keyframes flowLine3 {
  0% {
    opacity: 0;
    left: 12%;
  }
  8% {
    opacity: 0.8;
    left: 12%;
  }
  70% {
    opacity: 0.6;
    left: 40%;
  }
  85%,
  100% {
    opacity: 0;
    left: 40%;
  }
}

/* ===================================
   Chat Pulse Rings (Step 2)
   =================================== */

.chat-pulse {
  position: absolute;
  width: 60px;
  height: 60px;
  border: 1px solid #0055ff;
  border-radius: 12px;
  opacity: 0;
  animation: chatPulseExpand 3s ease-out infinite;
}

.chat-pulse-1 {
  animation-delay: 0s;
}
.chat-pulse-2 {
  animation-delay: 1.5s;
}

@keyframes chatPulseExpand {
  0% {
    transform: scale(0.8);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

/* ===================================
   Check Sparks (Step 3)
   =================================== */

.spark {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #00ba7c;
  border-radius: 50%;
  opacity: 0;
  animation: sparkBurst 4s ease-out infinite;
}

.spark-1 {
  --tx: 40px;
  --ty: -30px;
  animation-delay: 0s;
}
.spark-2 {
  --tx: -35px;
  --ty: -25px;
  animation-delay: 1s;
}
.spark-3 {
  --tx: 30px;
  --ty: 35px;
  animation-delay: 2s;
}
.spark-4 {
  --tx: -40px;
  --ty: 30px;
  animation-delay: 3s;
}

@keyframes sparkBurst {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(0);
    opacity: 0;
  }
}

/* ===================================
   Connector Pulse
   =================================== */

.connector-pulse {
  fill: #0055ff;
  opacity: 0.6;
  animation: connectorPulse 2s ease-in-out infinite;
}

@keyframes connectorPulse {
  0%,
  100% {
    opacity: 0.3;
    r: 3;
  }
  50% {
    opacity: 0.8;
    r: 5;
  }
}

/* ===================================
   Use Case Tabs
   =================================== */

.use-cases-tabs {
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}

.use-cases-tabs::-webkit-scrollbar {
  display: none; /* Chrome, Safari and Opera */
}

.use-case-tab.active {
  background: #0f1419;
  color: #ffffff;
  border-color: #0f1419;
}

.use-case-panel {
  animation: fadeIn 0.3s ease-out;
}

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

/* ===================================
   Security Section
   =================================== */

.security-grid-bg {
  background-image: linear-gradient(
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

.grid-scan-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 200, 150, 0.5),
    transparent
  );
  animation: scanDown 8s ease-in-out infinite;
}

@keyframes scanDown {
  0%,
  100% {
    top: 0;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    top: 100%;
    opacity: 0;
  }
}

/* Shield Rings */
.shield-ring-1 {
  animation: rotateRing 30s linear infinite;
}

.shield-ring-2 {
  animation: rotateRing 20s linear infinite reverse;
}

.shield-ring-3 {
  animation: rotateRing 15s linear infinite;
}

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

/* Shield Pulse */
.shield-pulse {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  border: 1px solid rgba(0, 200, 150, 0.3);
  animation: shieldPulse 2s ease-out infinite;
}

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

/* Feature Indicator Pulse */
.feature-indicator {
  animation: indicatorPulse 2s ease-in-out infinite;
}

@keyframes indicatorPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* Security Feature Hover */
.security-feature:hover .security-feature-bar {
  opacity: 1;
}

/* ===================================
   Responsive Hero Layout
   =================================== */

@media (max-width: 1024px) {
  .hero-visualization {
    min-height: 400px !important;
    width: 100%;
    margin: 0 auto;
    padding-top: 100px !important;
    padding-left: 40px;
    padding-right: 40px;
    box-sizing: border-box;
  }

  /* Scattered icons - center within hero-visualization */
  .scattered-icons {
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }


  /* Center the Simon stack */
  .simon-stack {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: calc(4rem + 80px) !important;
  }
}

@media (max-width: 768px) {
  .hero-visualization {
    min-height: 350px !important;
    padding-top: 50px !important;
  }
}

@media (max-width: 480px) {
  .hero-visualization {
    min-height: 300px !important;
  }
}
