/* DATAVEYA design tokens */
:root {
  --background: 40 30% 97%;
  --foreground: 200 25% 15%;

  --card: 40 25% 100%;
  --card-foreground: 200 25% 15%;

  --primary: 185 45% 28%;
  --primary-foreground: 40 30% 97%;

  --secondary: 40 20% 92%;
  --secondary-foreground: 200 25% 15%;

  --muted: 40 15% 90%;
  --muted-foreground: 200 10% 45%;

  --accent: 170 35% 40%;
  --accent-foreground: 40 30% 97%;

  --border: 40 20% 88%;
  --input: 40 20% 88%;
  --ring: 185 45% 28%;

  --radius: 1rem;
}

/* Base resets relying on correct tailwind layer mapping */
html {
  font-size: 90%; /* Scales all rem-based units down while keeping 100% width elements full width */
}
html, body {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', sans-serif;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  -webkit-font-smoothing: antialiased;
}

/* Utilities */
.font-display {
  font-family: 'Playfair Display', serif;
}

/* Gorgeous background meshes */
.hero-bg {
  position: relative;
  background: hsl(var(--background));
  overflow: hidden;
}

.hero-bg::before,
.hero-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  z-index: 0;
  animation: pulse-glow 15s infinite alternate;
}

.hero-bg::before {
  top: -10%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, hsla(185, 45%, 28%, 0.15) 0%, transparent 70%);
}

.hero-bg::after {
  bottom: -20%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, hsla(170, 35%, 40%, 0.15) 0%, transparent 70%);
  animation-delay: -5s;
}

.bg-mesh {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
      radial-gradient(at 80% 0%, hsla(185, 45%, 28%, 0.1) 0px, transparent 50%),
      radial-gradient(at 0% 50%, hsla(170, 35%, 40%, 0.1) 0px, transparent 50%);
  z-index: 0;
  pointer-events: none;
}

/* Glassmorphism Classes */
.glass-panel {
  background: hsla(var(--card) / 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid hsla(var(--border) / 0.6);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}

.glass-nav {
  background: hsla(var(--background) / 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid hsla(var(--border) / 0.5);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.02);
}

/* Typographic Gradients */
.text-gradient {
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--accent)));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-alt {
  background: linear-gradient(135deg, hsl(var(--foreground)), hsl(185, 45%, 28%));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Animations */
@keyframes pulse-glow {
  0% { transform: scale(1) translate(0, 0); opacity: 0.8; }
  50% { transform: scale(1.1) translate(2%, 2%); opacity: 1; }
  100% { transform: scale(0.9) translate(-2%, -2%); opacity: 0.8; }
}

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-15px) rotate(1deg); }
}

@keyframes float-delayed {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(-1deg); }
}

.animate-float {
  animation: float 6s ease-in-out infinite;
}

.animate-float-delayed {
  animation: float-delayed 7s ease-in-out infinite;
  animation-delay: 2s;
}

/* Enhanced Bento Grid */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
}

.bento-item {
  position: relative;
  overflow: hidden;
  border-radius: 1.5rem;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.bento-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px -10px hsla(var(--primary) / 0.15);
}

.bento-col-span-12 { grid-column: span 12; }
.bento-col-span-8 { grid-column: span 8; }
.bento-col-span-7 { grid-column: span 7; }
.bento-col-span-6 { grid-column: span 6; }
.bento-col-span-5 { grid-column: span 5; }
.bento-col-span-4 { grid-column: span 4; }

@media (max-width: 991px) {
  .bento-col-span-8, .bento-col-span-7, .bento-col-span-6, .bento-col-span-5, .bento-col-span-4 {
    grid-column: span 12;
  }
}

/* Fancy Hover Button */
.btn-primary {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  z-index: 1;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(120deg, hsla(var(--accent) / 0.5), transparent);
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s ease;
}

.btn-primary:hover::before {
  opacity: 1;
}

/* FAQ Enhancements */
.faq-button {
  transition: background-color 0.2s ease;
}
.faq-button:hover {
  background-color: hsla(var(--primary) / 0.03);
}

/* Outline Animations */
.animated-border {
  position: relative;
  background: inherit;
  border-radius: inherit;
}
.animated-border::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  background: linear-gradient(45deg, hsla(var(--primary)/0.5), hsla(var(--accent)/0.5), hsla(var(--primary)/0.5));
  z-index: -1;
  border-radius: inherit;
  background-size: 200% 200%;
  animation: bg-pan 3s linear infinite;
  opacity: 0;
  transition: opacity 0.3s;
}
.animated-border:hover::before {
  opacity: 1;
}

@keyframes bg-pan {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: hsl(var(--background));
}
::-webkit-scrollbar-thumb {
  background: hsl(var(--border));
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--primary) / 0.5);
}

/* Custom Hamburger Menu classes */
.menu-open body {
  overflow: hidden;
}
.mobile-menu-overlay {
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Pattern background for features */
.bg-pattern {
  background-image: radial-gradient(hsla(var(--primary) / 0.1) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Custom Cursor */
* {
  cursor: url('data:image/svg+xml;utf8,<svg width="22" height="22" viewBox="0 0 24 24" fill="%231E2A31" stroke="white" stroke-width="1.5" xmlns="http://www.w3.org/2000/svg"><path d="M5.06 4.34v15.93c0 .54.63.83 1.05.47l4.77-4.14c.16-.14.36-.21.58-.21h5.81c.53 0 .81-.62.47-1.02L5.06 4.34z"/></svg>'), auto !important;
}
a, button, [role="button"], .cursor-pointer {
  cursor: url('data:image/svg+xml;utf8,<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="%231E2A31" stroke-width="1.5" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><path d="M8 13.5V5a2 2 0 1 1 4 0v4 M12 9a2 2 0 1 1 4 0v1.5 M16 10.5a2 2 0 1 1 4 0v4c0 3.5-2.5 6.5-6 6.5s-6-3-6-6.5L8 13.5zM8 12.5L5 15" fill="%231E2A31" stroke="white" stroke-width="1.2"/></svg>') 6 2, pointer !important;
}

/* Premium scroll motion system */
.scroll-progress {
  position: fixed;
  inset: 0 0 auto;
  height: 2px;
  z-index: 500;
  pointer-events: none;
  background: transparent;
}

.scroll-progress__bar {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, hsl(var(--primary)), hsl(var(--accent)));
  box-shadow: 0 0 10px hsla(var(--accent) / 0.35);
}

#navbar .glass-nav {
  transition: background-color 220ms ease, border-color 220ms ease, box-shadow 220ms ease, backdrop-filter 220ms ease;
}

#navbar.is-scrolled .glass-nav {
  background: hsla(var(--background) / 0.93);
  border-bottom-color: hsla(var(--primary) / 0.16);
  box-shadow: 0 10px 30px rgba(10, 31, 34, 0.075);
  backdrop-filter: blur(24px) saturate(1.08);
  -webkit-backdrop-filter: blur(24px) saturate(1.08);
}

.motion-line-mask {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.motion-line {
  display: inline-block;
}

[data-motion="expertise-card"],
[data-motion="applied-card"] {
  isolation: isolate;
}

[data-motion="expertise-card"]::after,
[data-motion="applied-card"]::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(380px circle at var(--pointer-x, 50%) var(--pointer-y, 50%), hsla(var(--accent) / 0.12), transparent 60%);
  transition: opacity 240ms ease;
}

[data-motion="expertise-card"] > *,
[data-motion="applied-card"] > * {
  position: relative;
  z-index: 1;
}

[data-motion="expertise-card"]:hover::after,
[data-motion="applied-card"]:hover::after {
  opacity: 1;
}

.stats-progress {
  width: min(100%, 64rem);
  height: 1px;
  margin: 0 auto 3rem;
  overflow: hidden;
  background: hsla(var(--background) / 0.13);
}

.stats-progress > span {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, transparent, hsl(var(--accent)), transparent);
}

[data-motion="cta-panel"] {
  --cta-glow: 0;
}

[data-motion="cta-panel"]::after {
  content: '';
  position: absolute;
  inset: -25%;
  z-index: -2;
  pointer-events: none;
  opacity: var(--cta-glow);
  background: radial-gradient(circle, hsla(var(--accent) / 0.2), transparent 62%);
}

.orchestration-step {
  position: relative;
}

.orchestration-step::before {
  content: '';
  position: absolute;
  width: 9px;
  height: 9px;
  left: -2.32rem;
  top: 0.55rem;
  border-radius: 999px;
  background: hsl(var(--primary));
  box-shadow: 0 0 0 6px hsla(var(--primary) / 0.1);
}

.orchestration-network {
  position: absolute;
  inset: 2rem;
  width: calc(100% - 4rem);
  height: calc(100% - 4rem);
  overflow: visible;
  pointer-events: none;
}

.orchestration-network path {
  fill: none;
  stroke: hsl(var(--primary));
  stroke-width: 3;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px hsla(var(--accent) / 0.45));
}

.orchestration-network circle {
  fill: hsl(var(--accent));
  stroke: white;
  stroke-width: 4;
  filter: drop-shadow(0 0 7px hsla(var(--accent) / 0.55));
}

.orchestration-network .orchestration-hub {
  fill: hsl(var(--primary));
}

.orchestration-agent {
  z-index: 4;
}

.pipeline-layout {
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  align-items: stretch;
  gap: 2rem;
}

.pipeline-rail {
  position: relative;
  align-self: stretch;
  z-index: 20;
  height: auto;
  min-height: 0;
  padding: 1.25rem;
  border: 1px solid hsla(var(--border) / 0.78);
  border-radius: 1.5rem;
  background: hsla(40, 30%, 97%, 0.9);
  backdrop-filter: blur(18px) saturate(1.05);
  -webkit-backdrop-filter: blur(18px) saturate(1.05);
  box-shadow: 0 15px 38px rgba(10, 31, 34, 0.07);
  overflow: hidden;
}

.pipeline-rail__line {
  position: absolute;
  top: 2.35rem;
  left: calc(2.35rem - 1px);
  width: 2px;
  height: calc(100% - 4.7rem);
  overflow: hidden;
}

.pipeline-rail__track,
.pipeline-rail__progress {
  fill: none;
  stroke-linecap: round;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.pipeline-rail__track { stroke: hsla(var(--primary) / 0.14); }
.pipeline-rail__progress {
  stroke: hsl(var(--accent));
  filter: drop-shadow(0 0 4px hsla(var(--accent) / 0.35));
}

.pipeline-rail__nodes {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100%;
  flex-direction: column;
  justify-content: space-between;
}

.pipeline-node {
  display: flex;
  min-height: 2.2rem;
  flex-direction: row;
  align-items: center;
  gap: 0.7rem;
  color: hsl(var(--muted-foreground));
  text-align: left;
  transform-origin: left center;
}

.pipeline-node span {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border: 1px solid hsla(var(--primary) / 0.28);
  border-radius: 999px;
  background: hsl(var(--background));
  color: hsl(var(--primary));
  font-size: 0.7rem;
  font-weight: 700;
}

.pipeline-node strong {
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pipeline-card {
  position: relative;
  transform-origin: center center;
}

@media (max-width: 1023px) {
  .pipeline-layout {
    grid-template-columns: 8.5rem minmax(0, 1fr);
    gap: 1.25rem;
  }

  .pipeline-node strong {
    font-size: 0.62rem;
  }
}

@media (max-width: 639px) {
  .pipeline-layout {
    grid-template-columns: 3.7rem minmax(0, 1fr);
    gap: 0.75rem;
  }

  .pipeline-rail {
    height: auto;
    min-height: 0;
    padding: 0.75rem;
    border-radius: 1.15rem;
  }

  .pipeline-rail__line {
    top: 1.85rem;
    left: calc(1.85rem - 1px);
    height: calc(100% - 3.7rem);
  }

  .pipeline-node {
    min-height: 2.2rem;
  }

  .pipeline-node strong {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .pipeline-card {
    border-radius: 1.5rem !important;
    padding: 1.5rem !important;
  }

  .orchestration-network {
    inset: 1rem;
    width: calc(100% - 2rem);
    height: calc(100% - 2rem);
  }

  .orchestration-agent {
    padding: 0.55rem 0.75rem !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html, body { scroll-behavior: auto !important; }

  .scroll-progress,
  .stats-progress,
  .orchestration-network,
  .pipeline-rail__line {
    display: none;
  }

  .motion-line,
  [data-motion],
  [data-motion-step],
  [data-motion-node],
  [data-motion-agent],
  .pipeline-card,
  .stat-item {
    opacity: 1 !important;
    transform: none !important;
  }

  .dataveya-agent-float,
  .dataveya-agent-float-b,
  .dataveya-eye-blink,
  .animate-float,
  .animate-float-delayed,
  .animated-border::before,
  .hero-bg::before,
  .hero-bg::after {
    animation: none !important;
  }
}
