/* ============================================
   LegelpTech — Modern Design System
   Tailwind CDN handles utilities; this file
   handles only custom elements Tailwind can't.
   ============================================ */

/* --- Three.js Canvas --- */
#hero-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* --- Smooth Scroll --- */
html {
  scroll-behavior: smooth;
}

/* --- Custom scrollbar --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* --- GSAP initial states (before animation) --- */
.gs-reveal {
  opacity: 0;
  transform: translateY(40px);
  will-change: transform, opacity;
}
.gs-reveal-left {
  opacity: 0;
  transform: translateX(-60px);
  will-change: transform, opacity;
}
.gs-reveal-right {
  opacity: 0;
  transform: translateX(60px);
  will-change: transform, opacity;
}
.gs-reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  will-change: transform, opacity;
}

/* --- Gradient text --- */
.gradient-text {
  background: linear-gradient(135deg, #3B82F6, #14B8A6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Animated gradient border --- */
.gradient-border {
  position: relative;
  background: white;
  border-radius: 16px;
  overflow: hidden;
}
.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg, #3B82F6, #14B8A6, #3B82F6);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.gradient-border:hover::before {
  opacity: 1;
}

/* --- Dot grid pattern --- */
.dot-pattern {
  background-image: radial-gradient(circle, #e2e8f0 1px, transparent 1px);
  background-size: 24px 24px;
}

/* --- Service card top bar on hover --- */
.service-card-modern {
  position: relative;
  overflow: hidden;
}
.service-card-modern::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3B82F6, #14B8A6);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}
.service-card-modern:hover::after {
  transform: scaleX(1);
}

/* --- Counter pulse effect --- */
@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.05); opacity: 0.4; }
  100% { transform: scale(0.95); opacity: 0.7; }
}
.stat-icon {
  animation: pulse-ring 3s ease-in-out infinite;
}

/* --- Mobile menu overlay --- */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.97);
  backdrop-filter: blur(20px);
  z-index: 998;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.mobile-menu-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.mobile-menu-overlay a {
  font-size: 1.5rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  transition: color 0.2s ease;
}
.mobile-menu-overlay a:hover {
  color: #3B82F6;
}

/* --- Hamburger animation --- */
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: #1E3A5F;
  border-radius: 2px;
  transition: all 0.3s ease;
}
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
  background: #fff;
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
  background: #fff;
}

/* --- Timeline connector --- */
.timeline-line {
  position: absolute;
  left: 24px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, #3B82F6, #14B8A6);
}
@media (min-width: 768px) {
  .timeline-line {
    left: 50%;
    transform: translateX(-50%);
  }
}

/* --- Contact form focus ring --- */
.form-input:focus {
  outline: none;
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* --- Smooth link underline --- */
.nav-link-modern {
  position: relative;
}
.nav-link-modern::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: #3B82F6;
  transition: width 0.3s ease;
}
.nav-link-modern:hover::after {
  width: 100%;
}

/* --- Process step counter --- */
.process-step {
  counter-increment: process;
}
.process-step::before {
  content: counter(process, decimal-leading-zero);
  font-size: 3rem;
  font-weight: 800;
  color: rgba(59, 130, 246, 0.08);
  line-height: 1;
  display: block;
  margin-bottom: 16px;
}

/* --- Tag pill --- */
.tag-pill {
  display: inline-block;
  padding: 4px 14px;
  background: rgba(59, 130, 246, 0.08);
  color: #3B82F6;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 50px;
  letter-spacing: 0.5px;
}

/* ─── WORD ROTATOR (Typewriter Morph) ─── */
.word-rotator {
  display: inline-block;
  position: relative;
  min-width: 280px;
  text-align: left;
}
.word-rotator .rotating-word {
  display: inline-block;
  background: linear-gradient(135deg, #60A5FA, #14B8A6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
}
.word-rotator .rotating-word::after {
  content: '|';
  position: absolute;
  right: -8px;
  top: 0;
  -webkit-text-fill-color: #60A5FA;
  animation: cursor-blink 0.8s step-end infinite;
}
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ─── PARALLAX GEOMETRIC SHAPES ─── */
.geo-shape {
  position: absolute;
  pointer-events: none;
  z-index: 1;
}
.geo-hex {
  width: 60px;
  height: 60px;
  background: rgba(59, 130, 246, 0.06);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.geo-diamond {
  width: 40px;
  height: 40px;
  background: rgba(20, 184, 166, 0.08);
  transform: rotate(45deg);
  border-radius: 4px;
}
.geo-circle {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(59, 130, 246, 0.1);
  border-radius: 50%;
}
.geo-ring {
  width: 80px;
  height: 80px;
  border: 2px solid rgba(20, 184, 166, 0.06);
  border-radius: 50%;
}
.geo-cross {
  width: 24px;
  height: 24px;
  position: relative;
}
.geo-cross::before,
.geo-cross::after {
  content: '';
  position: absolute;
  background: rgba(59, 130, 246, 0.08);
  border-radius: 2px;
}
.geo-cross::before {
  width: 100%;
  height: 3px;
  top: 50%;
  transform: translateY(-50%);
}
.geo-cross::after {
  width: 3px;
  height: 100%;
  left: 50%;
  transform: translateX(-50%);
}
.geo-dots {
  width: 48px;
  height: 48px;
  background-image: radial-gradient(circle, rgba(59, 130, 246, 0.12) 2px, transparent 2px);
  background-size: 12px 12px;
}

/* ─── PROBLEM → SOLUTION FLIP CARDS ─── */
.flip-card {
  perspective: 1000px;
  cursor: pointer;
}
.flip-card-inner {
  position: relative;
  width: 100%;
  min-height: 280px;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}
.flip-card.flipped .flip-card-inner {
  transform: rotateY(180deg);
}
.flip-card-front,
.flip-card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 16px;
  padding: 32px;
  display: flex;
  flex-direction: column;
}
.flip-card-front {
  background: white;
  border: 1px solid #e2e8f0;
}
.flip-card-back {
  background: linear-gradient(135deg, #1E3A5F, #2A4F7A);
  transform: rotateY(180deg);
  color: white;
}

/* ─── HOW IT WORKS — HORIZONTAL ZIGZAG ─── */
.zigzag-step {
  position: relative;
}
.zigzag-connector {
  position: absolute;
  height: 3px;
  background: linear-gradient(90deg, #3B82F6, #14B8A6);
  top: 32px;
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
}
@media (min-width: 768px) {
  .zigzag-connector {
    width: calc(100% + 32px);
    right: -32px;
    left: auto;
  }
}

/* ─── INDUSTRY CARDS (overlapping tilt) ─── */
.industry-card {
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.industry-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(20, 184, 166, 0.05));
  opacity: 0;
  transition: opacity 0.4s ease;
}
.industry-card:hover::before {
  opacity: 1;
}
.industry-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(30, 58, 95, 0.12);
}

/* ─── CAPABILITIES HEX GRID ─── */
.hex-item {
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.hex-item::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, #3B82F6, #14B8A6);
  transition: all 0.3s ease;
  transform: translateX(-50%);
  border-radius: 2px;
}
.hex-item:hover::after {
  width: 60%;
}
.hex-item:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 24px rgba(30, 58, 95, 0.1);
}

/* ─── STATS — RADIAL PROGRESS STYLE ─── */
.stat-ring {
  position: relative;
  width: 120px;
  height: 120px;
}
.stat-ring svg {
  transform: rotate(-90deg);
}
.stat-ring .stat-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #1E3A5F;
}

/* ─── SOLUTIONS MEGA MENU ─── */
.mega-menu-trigger {
  position: relative;
}
.mega-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  width: 720px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
  padding: 32px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}
.mega-menu-trigger:hover .mega-menu,
.mega-menu-trigger:focus-within .mega-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.mega-menu-col h5 {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #94a3b8;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}
.mega-menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  transition: all 0.2s ease;
  text-decoration: none;
}
.mega-menu-link:hover {
  background: #f8fafc;
}
.mega-menu-link .mm-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mega-menu-link .mm-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1E3A5F;
}
.mega-menu-link .mm-desc {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.3;
}

/* ─── MOBILE SOLUTIONS ACCORDION ─── */
.mobile-solutions-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.mobile-solutions-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
.mobile-solutions-panel.open {
  max-height: 600px;
}
.mobile-solutions-panel a {
  font-size: 1rem !important;
  padding-left: 16px;
  opacity: 0.7;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .process-step::before {
    font-size: 2rem;
  }
  .mega-menu {
    display: none !important;
  }
  .word-rotator {
    min-width: 200px;
  }
  .flip-card-inner {
    min-height: 240px;
  }
}
@media (max-width: 1024px) {
  .mega-menu {
    width: 580px;
  }
}
