/* ================================================================
   Apex Lab — Dark Premium Theme
   Inspired by parsimo.ai
   Deep black + teal/cyan glow + glassmorphic cards
   ================================================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --c-bg: #ffffff;
  --c-bg-2: #f5f5ff;
  --c-surface: rgba(255, 255, 255, 0.9);
  --c-surface-solid: #ffffff;
  --c-surface-hover: rgba(245, 245, 255, 0.95);
  --c-text: #1a1a2e;
  --c-text-2: #4a4a68;
  --c-text-3: #7a7a98;
  --c-accent: #7c6aff;
  --c-accent-hover: #6955ef;
  --c-accent-dim: rgba(124, 106, 255, 0.1);
  --c-accent-glow: rgba(124, 106, 255, 0.15);
  --c-cyan: #a78bfa;
  --c-blue: #60a5fa;
  --c-green: #818cf8;
  --c-violet: #c084fc;
  --c-border: rgba(0, 0, 0, 0.08);
  --c-border-hover: rgba(0, 0, 0, 0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow-glow: 0 0 30px rgba(124, 106, 255, 0.12);
  --shadow-glow-lg: 0 0 60px rgba(124, 106, 255, 0.15);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.06);
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  --transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --container: 1320px;
}

html { scroll-behavior: smooth; font-size: 17px; }

body {
  font-family: var(--font-body);
  color: var(--c-text);
  background: #f9f8ff;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* --- Container --- */
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

/* --- Typography --- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-body);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--c-text);
}

h1 { font-size: clamp(2.6rem, 6vw, 4.2rem); font-weight: 900; letter-spacing: -0.04em; }
h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h3 { font-size: 1.2rem; font-weight: 700; }
h4 { font-size: 1rem; font-weight: 600; }

.label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--c-accent);
}

.subtitle {
  font-size: 1.1rem;
  color: var(--c-text-2);
  line-height: 1.8;
  max-width: 540px;
}

.section-header { margin-bottom: 73px; }
.section-header .label { margin-bottom: 16px; }
.section-header h2 { margin-bottom: 16px; }

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, #60a5fa 0%, #7c6aff 40%, #a78bfa 70%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: gradientFlow 6s ease-in-out infinite;
}

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

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--c-accent);
  color: #ffffff;
  box-shadow: 0 0 20px rgba(124, 106, 255, 0.3), 0 4px 12px rgba(0,0,0,0.3);
}

.btn-primary:hover {
  background: var(--c-accent-hover);
  box-shadow: 0 0 40px rgba(124, 106, 255, 0.4), 0 4px 16px rgba(0,0,0,0.4);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--c-text-2);
  border: 1px solid var(--c-border);
  padding: 12px 26px;
}

.btn-ghost:hover {
  border-color: var(--c-border-hover);
  background: rgba(124,106,255,0.05);
  color: var(--c-text);
}

.btn-ghost .arrow { transition: transform var(--transition); }
.btn-ghost:hover .arrow { transform: translateX(4px); }

.btn-white {
  background: #1a1a2e;
  color: #ffffff;
  font-weight: 700;
}

.btn-white:hover {
  background: #2a2a42;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* --- Navigation --- */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: 100px;
  background: transparent;
  transition: background 0.4s, border-color 0.4s, backdrop-filter 0.4s;
  border-bottom: 1px solid transparent;
}

.site-nav.scrolled {
  background: rgba(244, 242, 255, 0.88);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom-color: var(--c-border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100px;
}

.nav-logo img {
  height: 80px;
}

.nav-links { display: flex; align-items: center; gap: 40px; }

.nav-links a {
  font-size: 1rem;
  font-weight: 500;
  color: var(--c-text-2);
  transition: color var(--transition);
  letter-spacing: 0.01em;
}

.nav-links a:hover, .nav-links a.active { color: var(--c-text); }

.nav-links a { position: relative; }

.nav-lang {
  font-family: var(--font-mono) !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.05em;
  color: var(--c-accent) !important;
  border: 1px solid var(--c-accent);
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.nav-lang:hover {
  background: var(--c-accent);
  color: #fff !important;
}

.nav-lang::after { display: none !important; }

.nav-cta {
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  color: #ffffff !important;
  background: var(--c-accent);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  box-shadow: 0 0 16px rgba(124, 106, 255, 0.2);
}

.nav-cta:hover {
  background: var(--c-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(124, 106, 255, 0.35);
}

.nav-cta::after { display: none !important; }

.nav-burger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 28px; height: 28px;
  position: relative;
}

.nav-burger span {
  display: block;
  width: 20px; height: 1.5px;
  background: #1a1a2e;
  position: absolute;
  left: 4px;
  transition: all 0.3s;
}

.nav-burger span:nth-child(1) { top: 8px; }
.nav-burger span:nth-child(2) { top: 13px; }
.nav-burger span:nth-child(3) { top: 18px; }

/* --- Sections --- */
section { padding: 120px 0; }

.section-alt {
  background: rgba(230, 225, 255, 0.4);
  position: relative;
  overflow: hidden;
}

.section-alt::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* --- Cards (Glassmorphic) --- */
.card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(124, 106, 255, 0.1);
  border-radius: var(--radius);
  padding: 47px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    600px circle at var(--mx, 50%) var(--my, 50%),
    rgba(124, 106, 255, 0.06),
    transparent 40%
  );
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

.card:hover::before { opacity: 1; }

.card:hover {
  border-color: var(--c-border-hover);
  box-shadow: var(--shadow-card);
  transform: translateY(-3px);
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-accent {
  background: var(--c-accent-dim);
  color: var(--c-accent);
  border: 1px solid rgba(124, 106, 255, 0.2);
}

.badge-accent::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--c-accent);
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* --- Divider --- */
.divider {
  width: 48px; height: 2px;
  background: var(--c-accent);
  border-radius: 2px;
  margin: 20px 0;
  opacity: 0.5;
}

/* --- Stat --- */
.stat-num {
  font-family: var(--font-body);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(180deg, #1a1a2e 30%, #7c6aff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--c-text-3);
  margin-top: 6px;
}

/* --- Reveal animation --- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* --- Grid overlay (hero background) --- */
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(124, 106, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 106, 255, 0.06) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, black 20%, transparent 70%);
  pointer-events: none;
}

/* --- Orb animations --- */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  will-change: transform;
}

.orb-1 {
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(124, 106, 255, 0.15), transparent 70%);
  top: -200px; right: -150px;
  animation: orb1 22s ease-in-out infinite;
}

.orb-2 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.12), transparent 70%);
  bottom: -150px; left: -100px;
  animation: orb2 28s ease-in-out infinite;
}

.orb-3 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.12), transparent 70%);
  top: 40%; left: 50%;
  animation: orb3 32s ease-in-out infinite;
}

/* Cloud orbs for sections */
.cloud-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  will-change: transform;
}

@keyframes orb1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-40px, 30px) scale(1.1); }
  66% { transform: translate(20px, -20px) scale(0.95); }
}

@keyframes orb2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -40px) scale(0.9); }
  66% { transform: translate(-20px, 20px) scale(1.05); }
}

@keyframes orb3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-30px, 30px) scale(1.15); }
}

/* --- Footer --- */
.site-footer {
  padding: 73px 0;
  background: rgba(230, 225, 255, 0.35);
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--c-border);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
  flex-wrap: wrap;
}

.footer-brand img {
  height: 56px;
  opacity: 0.85;
  margin-bottom: 14px;
}

.footer-brand p {
  font-size: 0.9rem;
  max-width: 260px;
  line-height: 1.6;
  color: var(--c-text-3);
}

.footer-col h4 {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--c-text-2);
  margin-bottom: 16px;
  letter-spacing: 0.03em;
}

.footer-col a {
  display: block;
  font-size: 0.9rem;
  color: var(--c-text-3);
  margin-bottom: 10px;
  transition: color var(--transition);
}

.footer-col a:hover { color: var(--c-text); }

.footer-bottom {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--c-border);
  font-size: 0.85rem;
  color: var(--c-text-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* --- Page Hero (subpages) --- */
.page-hero {
  padding: 208px 0 104px;
  position: relative;
  overflow: hidden;
}

.page-hero::before {
  content: '';
  position: absolute;
  top: -200px; right: -200px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(124, 106, 255, 0.1), transparent 70%);
  filter: blur(60px);
  pointer-events: none;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-burger { display: block; }
  .site-nav.open .nav-links {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100px; left: 0; right: 0;
    background: rgba(244, 242, 255, 0.97);
    backdrop-filter: blur(24px);
    padding: 24px;
    border-bottom: 1px solid var(--c-border);
    gap: 16px;
  }
  section { padding: 104px 0; }
  .footer-inner { flex-direction: column; }
}

/* --- Tilt 3D hover on cards --- */
.card-tilt {
  transform-style: preserve-3d;
  perspective: 800px;
}

/* --- Floating particles background --- */
.particles-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
}

/* --- Glitch text effect for hero --- */
.glitch-wrap {
  position: relative;
  display: inline-block;
}

/* --- Magnetic button effect --- */
.btn-magnetic {
  transition: transform 0.2s ease-out;
}

/* --- Number counter animation --- */
.stat-num, .case-stat-val, .case-result-val, .svc-metric-val, .sv-num, .trust-item .stat-num {
  transition: transform 0.3s ease;
}

/* --- Glow pulse on hover --- */
.glow-hover {
  transition: box-shadow 0.4s ease;
}
.glow-hover:hover {
  box-shadow: 0 0 40px rgba(124, 106, 255, 0.15), 0 0 80px rgba(124, 106, 255, 0.06);
}

/* --- Horizontal scroll indicator line --- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--c-accent), var(--c-cyan), var(--c-blue));
  z-index: 1001;
  transform-origin: left;
  transform: scaleX(0);
  transition: none;
}

/* --- Stagger reveal for grids --- */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-stagger.visible > *:nth-child(1) { transition-delay: 0.05s; }
.reveal-stagger.visible > *:nth-child(2) { transition-delay: 0.1s; }
.reveal-stagger.visible > *:nth-child(3) { transition-delay: 0.15s; }
.reveal-stagger.visible > *:nth-child(4) { transition-delay: 0.2s; }
.reveal-stagger.visible > *:nth-child(5) { transition-delay: 0.25s; }
.reveal-stagger.visible > *:nth-child(6) { transition-delay: 0.3s; }

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

/* --- Smooth parallax-ready section --- */
.parallax-section {
  will-change: transform;
}

/* --- Typing cursor for terminal --- */
.hero-terminal::after {
  content: '█';
  animation: blink 1s step-end infinite;
  color: #7c6aff;
  margin-left: 2px;
}

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

/* --- Shimmer loading effect on cards --- */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.card:hover .bento-icon,
.bento-item:hover .bento-icon,
.value-card:hover .value-icon {
  animation: iconPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes iconPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* --- Smooth underline animation for nav --- */
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 0;
  height: 1.5px;
  background: var(--c-accent);
  border-radius: 1px;
  transition: width 0.3s ease, left 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
  left: 0;
}

@media (max-width: 600px) {
  section { padding: 78px 0; }
  .card { padding: 32px; }
  .section-header { margin-bottom: 47px; }
}
