/* file: css/animations.css */
/* All visual effects & animations:
    - custom cursor
    - reveal-on-scroll
    - animated background grid
    - floating Java code chips
    - hero code screens typing cursor
    - logo animated Java snippet
    - card / service hover
    - floating CTA hover
    - click pulse effect
*/

/* =========================
    Custom cursor
    ========================= */

.cursor-dot,
.cursor-outline {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 999;
  transform: translate(-50%, -50%);
  transition: opacity 0.2s ease;
}

.cursor-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f97316, #ec4899);
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.9);
}

.cursor-outline {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  box-shadow: 0 0 30px rgba(79, 70, 229, 0.7);
  backdrop-filter: blur(6px);
}

/* on mobile: keep native cursor */
@media (max-width: 800px) {
  body {
    cursor: auto;
  }

  .cursor-dot,
  .cursor-outline {
    display: none;
  }
}

/* =========================
    Reveal on scroll
    ========================= */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* =========================
    Animated background grid overlay
    ========================= */

.background-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 0 0, rgba(79, 70, 229, 0.16), transparent 55%),
    radial-gradient(circle at 100% 0, rgba(236, 72, 153, 0.18), transparent 55%),
    repeating-linear-gradient(
      to right,
      rgba(148, 163, 184, 0.11),
      rgba(148, 163, 184, 0.11) 1px,
      transparent 1px,
      transparent 32px
    ),
    repeating-linear-gradient(
      to bottom,
      rgba(148, 163, 184, 0.11),
      rgba(148, 163, 184, 0.11) 1px,
      transparent 1px,
      transparent 32px
    );
  mix-blend-mode: soft-light;
  opacity: 0.55;
  animation: bgParallax 40s linear infinite alternate;
}

@keyframes bgParallax {
  from {
    transform: translate3d(-20px, 0, 0) scale(1.02);
  }
  to {
    transform: translate3d(18px, -10px, 0) scale(1.04);
  }
}

/* =========================
    Floating Java code chips
    ========================= */

.code-chip {
  position: absolute;
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-family: "Space Grotesk", system-ui, sans-serif;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0.08;
  transform: translate(-50%, -50%);
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.85);
  color: #fecaca;
  box-shadow: 0 0 18px rgba(248, 113, 113, 0.35);
  filter: blur(0.1px);
  animation: codeChipFloat 22s linear infinite;
}

@keyframes codeChipFloat {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    transform: translate3d(-40px, -120px, 0);
    opacity: 0;
  }
}

/* =========================
    Hero code screen typing
    ========================= */

.code-screen {
  position: relative;
  background: radial-gradient(
    circle at top left,
    rgba(56, 189, 248, 0.12),
    rgba(15, 23, 42, 0.97)
  );
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  padding: 1.1rem 1rem 1rem;
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.95);
  font-family: "Space Grotesk", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.78rem;
  color: #e5e7eb;
  overflow: hidden;
}

.code-screen-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.code-screen-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.code-screen-dot:nth-child(1) {
  background: #f97316;
}

.code-screen-dot:nth-child(2) {
  background: #eab308;
}

.code-screen-dot:nth-child(3) {
  background: #22c55e;
}

.code-screen-title {
  margin-left: 0.4rem;
}

.code-screen-content {
  max-height: 230px;
  overflow: hidden;
  white-space: pre;
}

.code-screen-cursor {
  display: inline-block;
  width: 8px;
  height: 1rem;
  background: #e5e7eb;
  margin-left: 2px;
  animation: cursorBlink 0.9s steps(2, start) infinite;
}

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

/* =========================
    Logo animated code snippet
    ========================= */

/* wrapper for title + animated code (HTML: .logo-text-block) */
.logo-text-block {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

/* main title text */
.logo-text-main {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.9rem;
  background: linear-gradient(90deg, #f97316, #ec4899, #4f46e5);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  position: relative;
}

/* subtle animated underline under the title */
.logo-text-main::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.18rem;
  width: 60%;
  height: 2px;
  border-radius: 999px;
  background: radial-gradient(
    circle at 0 50%,
    #f97316,
    #ec4899,
    transparent
  );
  opacity: 0.8;
  transform-origin: left center;
  animation: logoUnderline 18s linear infinite;
}

@keyframes logoUnderline {
  0% {
    transform: scaleX(0.4) translateX(0);
    opacity: 0.4;
  }
  40% {
    transform: scaleX(1) translateX(10%);
    opacity: 1;
  }
  100% {
    transform: scaleX(0.6) translateX(80%);
    opacity: 0;
  }
}

/* little animated Java snippet under the logo title */
.logo-code {
  font-family: "Space Grotesk", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.7rem;
  padding: 0.18rem 0.55rem;
  margin-top: 0.2rem;
  border-radius: 999px;
  border: 1px solid rgba(45, 212, 191, 0.8);
  background: rgba(15, 23, 42, 0.95);
  color: #a5f3fc;
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.4);
  opacity: 0;
  transform: translateY(4px) scale(0.97);
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
}

.logo-code.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* =========================
    Card / service hover
    ========================= */

.card,
.service-card {
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    border-color var(--transition),
    background var(--transition);
}

.card:hover,
.service-card:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.98);
  border-color: rgba(248, 250, 252, 0.3);
}

/* service-card glow is defined via ::before in layout.css; we just animate opacity */

/* =========================
    Floating CTA hover (bottom-right)
    ========================= */

.floating-cta {
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    filter var(--transition);
}

.floating-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 55px rgba(15, 23, 42, 1);
  filter: brightness(1.05);
}

/* =========================
    Java click pulse
    ========================= */

.click-pulse {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 0.78rem;
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.85);
  color: #fee2e2;
  box-shadow: 0 0 24px rgba(248, 113, 113, 0.6);
  animation: clickPulse 0.9s ease-out forwards;
}

@keyframes clickPulse {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
  }
  35% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -80%) scale(1.15);
  }
}