:root {
  /* Vibrant BioEcho Palette */
  --bg: #0b1221;
  --bg-gradient: radial-gradient(circle at 50% 0%, #1a2c4e 0%, transparent 60%),
    radial-gradient(circle at 85% 20%, rgba(126, 227, 197, 0.15) 0%, transparent 50%);

  --panel: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(110, 168, 254, 0.5);

  --text: #e8eefc;
  --text-muted: #a7b4d6;

  /* Brand Colors */
  --brand-blue: #6ea8fe;
  --brand-green: #7ee3c5;
  --brand-gradient: linear-gradient(135deg, #6ea8fe, #7ee3c5);

  --radius: 24px;
  --max-width: 1280px;
  /* Wider container for 4-col grid */

  --shadow-glow: 0 0 40px rgba(110, 168, 254, 0.15);
}

html {
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  background-color: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  /* Parallax-like static bg */
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Gorgeous Flowing Text */
@keyframes flowGradient {
  0% {
    background-position: 0% center;
  }

  100% {
    background-position: 200% center;
  }
}

.text-flow {
  /* High saturation Blue -> Green -> Blue */
  background: linear-gradient(90deg, #6ea8fe, #7ee3c5, #6ea8fe);
  background-size: 200% auto;

  /* Text Clip */
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;

  /* Animation */
  animation: flowGradient 2s linear infinite;

  /* Neon Glow */
  filter: drop-shadow(0 0 8px rgba(126, 227, 197, 0.5));

  display: inline-block;
  font-weight: 800;
  /* Extra bold for visibility */
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s;
}

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

section {
  padding: 100px 0;
  position: relative;
}

/* Nav */
.nav {
  position: fixed;
  top: 0;
  width: 100%;
  height: 64px;
  background: rgba(11, 18, 33, 0.8);
  backdrop-filter: blur(16px);
  z-index: 100;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}

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

.logo {
  height: 32px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
}

/* Ensure white logo if transparent */

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

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}

.nav-links a:hover {
  color: #fff;
}

.lang-btn {
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.2s;
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--brand-blue);
}

.menu-toggle {
  display: none;
  /* Hidden on desktop by default */
}

/* Mobile Nav: Hide generic links, keep Lang/Logo */
@media (max-width: 768px) {

  /* Navigation Drawer */
  .nav-inner {
    justify-content: space-between;
  }

  .menu-toggle {
    display: block;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
  }

  .nav-links {
    position: fixed;
    /* Fixed relative to viewport guarantees 100% width */
    top: 64px;
    left: 0;
    width: 100%;
    /* Spans full viewport */
    margin: 0;
    /* No offsets needed */

    padding: 20px 0;
    background: rgba(11, 18, 33, 0.98);
    backdrop-filter: blur(20px);

    /* Layout */
    flex-direction: column;
    align-items: center;
    gap: 0;
    /* Removing gap, using padding on links */

    border-bottom: 1px solid var(--border);
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.5);

    /* Hidden State */
    display: none;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Show when active */
  .nav-links.active {
    display: flex;
    animation: mobileMenuSlide 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  }

  @keyframes mobileMenuSlide {
    from {
      opacity: 0;
      transform: translateY(-20px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Remove old animation keyframes since we use transition on class toggle */

  .nav-links a {
    font-size: 16px;
    width: 100%;
    text-align: center;
    padding: 16px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #ccc;
  }

  .nav-links a:first-child {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }

  .nav-links a:active {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
  }

  /* Typography Fixes */
  .hero-title {
    font-size: 32px;
    text-wrap: balance;
    /* Prevent single words */
    word-break: keep-all;
    /* CJK friendly */
  }

  /* Contact Section Fix */
  #contact .bento-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Typography */
.text-gradient {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-title {
  font-size: clamp(48px, 6vw, 72px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 24px;
  text-wrap: balance;
  /* Desktop too */
}

.section-title {
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 700;
  margin-bottom: 10px;
}

.lead {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 600px;
}

/* Cards & Bento */
.glass-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  padding: 30px;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
}

/* Interaction: Hover Glow Border */
.glass-card:hover {
  transform: translateY(-5px) scale(1.01);
  border-color: rgba(110, 168, 254, 0.4);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(110, 168, 254, 0.1);
}

/* Mouse spotlight handled by JS (updating --x, --y) */
.glass-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(800px circle at var(--x, 50%) var(--y, 50%), rgba(255, 255, 255, 0.06), transparent 40%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

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

.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 40px;
}

.span-2 {
  grid-column: span 2;
}

/* Specific 4-col grid for Features to prevent wrapping/overlap */
#features .bento-grid {
  grid-template-columns: repeat(4, 1fr);
  min-width: 0;
  gap: 32px;
  /* Increased gap for separation */
}

/* Force 4 columns on Desktop as requested, but switch to 2 on Tablet, 1 on Mobile */
@media (max-width: 1024px) {
  #features .bento-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  #features .bento-grid {
    grid-template-columns: 1fr;
  }
}

/* Safe Z-index for tilting cards to prevent ugly clipping/overlap */
.flip-container:hover,
.tilt-card:hover {
  z-index: 10;
}

@media (max-width:768px) {
  .span-2 {
    grid-column: 1;
  }
}

/* Stats styling within cards */
.stat-val {
  font-size: 56px;
  font-weight: 700;
  background: linear-gradient(to bottom right, #fff, #999);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-lbl {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--brand-green);
  font-weight: 600;
  margin-bottom: 8px;
}

.stat-desc {
  color: var(--text-muted);
  font-size: 15px;
}

/* Image Containers */
.img-card {
  padding: 0;
  /* No padding for image cards */
}

.hero-frame,
.product-frame {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  /* Ensure mask respects radius */
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  /* GPU Clip */
  transform: translateZ(0);
}

.hero-frame {
  max-width: 640px;
  width: 100%;
  aspect-ratio: 16/10;
  margin: 0 auto;
  padding: 0;
  border-radius: var(--radius);
}

/* Inner Glow/Vignette Effect */
.hero-frame::after,
.product-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 50px 10px rgba(11, 18, 33, 0.6);
  border-radius: var(--radius);
  pointer-events: none;
  z-index: 2;
}

.product-frame {
  width: 100%;
  height: 180px;
  margin-bottom: 20px;
  background: var(--bg);
}

.img-cover,
.product-frame img {
  display: block;
  /* Remove inline gaps */
  width: 102%;
  height: 102%;
  margin: -1%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.glass-card:hover .img-cover,
.glass-card:hover .product-frame img {
  transform: scale(1.08);
  /* Adjusted scale */
}

/* AI Embedded Text */
.ai-text {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  text-align: center;
  font-weight: 800;
  font-size: 20px;
  line-height: 1.2;
  z-index: 10;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 15px;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.btn-primary {
  background: var(--brand-gradient);
  color: #0b1221;
  border: none;
  box-shadow: 0 4px 15px rgba(110, 168, 254, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(126, 227, 197, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Canvas */
#ripple-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  opacity: 0.3;
  /* Fainter */
  filter: blur(8px);
  /* Blurrier */
}

/* 3D TILT EFFECT */
.tilt-card {
  perspective: 1000px;
  transform-style: preserve-3d;
  transition: transform 0.1s ease-out;
  /* Fast response for mouse tracking */
  will-change: transform;
  /* Optimize rendering */
}

/* Fix Text Flickering by moving content forward in Z-space */
.tilt-card h3,
.tilt-card p,
.tilt-card .stat-val,
.tilt-card .stat-desc {
  transform: translateZ(30px);
  backface-visibility: hidden;
  -webkit-font-smoothing: subpixel-antialiased;
}

.tilt-card-inner {
  transform: translateZ(20px);
  /* Hardware accel */
  pointer-events: none;
}

/* FLIP CARD STYLES */
.flip-container {
  perspective: 1000px;
  cursor: pointer;
  height: 380px;
  width: 100%;
  /* Force valid width in grid */
}

.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
  border-radius: var(--radius);
}

.flip-container.flipped .flip-inner {
  transform: rotateY(180deg);
}

/* Front & Back Faces */
.flip-front,
.flip-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: var(--radius);
  overflow: hidden;
  /* Use glass card styles basically */
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  padding: 30px;
  /* Restored comfy padding */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.flip-front:hover {
  border-color: var(--brand-blue);
  box-shadow: 0 0 30px rgba(110, 168, 254, 0.15);
}

.flip-back {
  transform: rotateY(180deg);
  background: rgba(11, 18, 33, 0.95);
  /* More opaque for text reading */
  border-color: var(--brand-green);
  padding: 30px;
  align-items: flex-start;
  /* Left align text on back */
  text-align: left;
}

/* New Icon Style */
.card-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 20px;
  color: var(--brand-green);
  opacity: 0.9;
  filter: drop-shadow(0 0 10px rgba(126, 227, 197, 0.3));
}

.flip-front .stat-val {
  font-size: 32px;
  /* Adjusted size for titles */
  line-height: 1.2;
  margin-bottom: 8px;
}

.flip-front .stat-lbl {
  font-size: 13px;
  opacity: 0.7;
  color: #fff;
  letter-spacing: 1.5px;
}

/* Animations */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Footer */
footer {
  padding: 60px 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 60px;
}