/* ── Global polish ────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ── Subtle transition for all interactive elements ──── */
a, button, input, textarea, select {
  transition: all .2s ease;
}

/* ── Focus ring ──────────────────────────────────────── */
:focus-visible {
  outline: 2px solid rgba(56,189,248,.6);
  outline-offset: 2px;
}

/* ── Smooth image loading ────────────────────────────── */
img {
  transition: opacity .4s ease, transform .5s ease;
}

/* ── Card hover lift ─────────────────────────────────── */
.card-lift {
  transition: transform .3s ease, box-shadow .3s ease;
}
.card-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}

/* ── Hero gradient overlay used on background images ── */
.hero-overlay {
  position: relative;
}
.hero-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15,23,42,.85) 0%, rgba(15,23,42,.6) 100%);
  z-index: 0;
}
.hero-overlay > * {
  position: relative;
  z-index: 1;
}

/* ── RTL support ─────────────────────────────────────── */
html[dir="rtl"] body {
  text-align: right;
}

html[dir="rtl"] nav,
html[dir="rtl"] header,
html[dir="rtl"] footer {
  direction: rtl;
}

html[dir="rtl"] .flex-row {
  flex-direction: row-reverse;
}

/* ── Scrollbar (webkit) ──────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ── Animations ──────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}

.animate-fade-in {
  animation: fadeIn .6s ease both;
}

.animate-fade-in-delay {
  animation: fadeIn .6s ease .15s both;
}

.animate-fade-in-up {
  animation: fadeInUp .5s ease both;
}

/* Stagger children animation */
.stagger-children > *:nth-child(1) { animation-delay: 0s; }
.stagger-children > *:nth-child(2) { animation-delay: .07s; }
.stagger-children > *:nth-child(3) { animation-delay: .14s; }
.stagger-children > *:nth-child(4) { animation-delay: .21s; }
.stagger-children > *:nth-child(5) { animation-delay: .28s; }
.stagger-children > *:nth-child(6) { animation-delay: .35s; }
.stagger-children > *:nth-child(7) { animation-delay: .42s; }
.stagger-children > *:nth-child(8) { animation-delay: .49s; }

/* Privacy TOC active state */
.privacy-content section:target h2 {
  color: rgb(56, 189, 248);
}

/* ══════════════════════════════════════════════════════════
   KI / TECH HOMEPAGE ENHANCEMENTS
   ══════════════════════════════════════════════════════════ */

/* ── Neural-network canvas ───────────────────────────── */
#neural-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .45;
}

/* ── Typewriter cursor blink ─────────────────────────── */
.typewriter-cursor {
  display: inline-block;
  width: 3px;
  height: 1em;
  background: #38bdf8;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink .7s steps(1) infinite;
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ── Glow-border cards ───────────────────────────────── */
.glow-card {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  background: linear-gradient(to bottom, #0f172a, #020617);
  transition: transform .35s ease, box-shadow .35s ease;
}
.glow-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(56,189,248,.35), rgba(139,92,246,.35), rgba(56,189,248,.1));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  transition: background .4s ease;
}
.glow-card:hover::before {
  background: linear-gradient(135deg, rgba(56,189,248,.7), rgba(139,92,246,.7), rgba(56,189,248,.3));
}
.glow-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 0 40px rgba(56,189,248,.12), 0 20px 50px rgba(0,0,0,.4);
}

/* ── Pulsing glow dot (used next to "AI powered" labels) */
.glow-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px 2px rgba(56,189,248,.6);
  animation: glowPulse 2s ease-in-out infinite;
}
@keyframes glowPulse {
  0%,100% { box-shadow: 0 0 8px 2px rgba(56,189,248,.5); }
  50%     { box-shadow: 0 0 20px 6px rgba(56,189,248,.8); }
}

/* ── Floating orbs (decorative) ──────────────────────── */
.floating-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  animation: orbFloat 8s ease-in-out infinite;
}
@keyframes orbFloat {
  0%,100% { transform: translate(0,0) scale(1); }
  33%     { transform: translate(30px,-20px) scale(1.1); }
  66%     { transform: translate(-20px,15px) scale(.95); }
}

/* ── Tech-marquee ────────────────────────────────────── */
.marquee-track {
  display: flex;
  gap: 2rem;
  animation: marqueeScroll 30s linear infinite;
  width: max-content;
}
@keyframes marqueeScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.marquee-track:hover { animation-play-state: paused; }

.tech-pill {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  white-space: nowrap;
  padding: .5rem 1rem;
  border-radius: 9999px;
  border: 1px solid rgba(56,189,248,.2);
  background: rgba(15,23,42,.7);
  backdrop-filter: blur(8px);
  color: #94a3b8;
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .02em;
  transition: border-color .3s, color .3s;
}
.tech-pill:hover {
  border-color: rgba(56,189,248,.5);
  color: #e2e8f0;
}

/* ── AI chat demo widget ─────────────────────────────── */
.ai-demo-window {
  background: linear-gradient(145deg, #0f172a 0%, #020617 100%);
  border-radius: 1rem;
  border: 1px solid rgba(56,189,248,.2);
  overflow: hidden;
  box-shadow: 0 0 60px rgba(56,189,248,.08), 0 25px 60px rgba(0,0,0,.5);
}
.ai-demo-titlebar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1rem;
  background: rgba(30,41,59,.6);
  border-bottom: 1px solid rgba(56,189,248,.1);
  font-size: .75rem;
  color: #64748b;
}
.ai-demo-titlebar .dot { width: 10px; height: 10px; border-radius: 50%; }
.ai-demo-titlebar .dot-r { background: #ef4444; }
.ai-demo-titlebar .dot-y { background: #eab308; }
.ai-demo-titlebar .dot-g { background: #22c55e; }
.ai-demo-body {
  padding: 1.25rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: .8rem;
  line-height: 1.7;
  min-height: 180px;
}
.ai-msg {
  opacity: 0;
  animation: aiMsgIn .5s ease forwards;
}
.ai-msg:nth-child(1) { animation-delay: .5s; }
.ai-msg:nth-child(2) { animation-delay: 2s; }
.ai-msg:nth-child(3) { animation-delay: 3.5s; }
.ai-msg:nth-child(4) { animation-delay: 5s; }
.ai-msg:nth-child(5) { animation-delay: 6.5s; }
@keyframes aiMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Animated counter ────────────────────────────────── */
.counter-value {
  font-variant-numeric: tabular-nums;
}

/* ── Scroll reveal ───────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity .7s ease, transform .7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Gradient text util ──────────────────────────────── */
.text-gradient {
  background: linear-gradient(135deg, #38bdf8, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Data-flow line (decorative SVG line animation) ─── */
@keyframes dashFlow {
  to { stroke-dashoffset: -40; }
}
.data-flow-line {
  stroke-dasharray: 8 12;
  animation: dashFlow 1.5s linear infinite;
}

/* ── Scan-line overlay (subtle CRT feel) ─────────────── */
.scanlines::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(56,189,248,.015) 2px,
    rgba(56,189,248,.015) 4px
  );
  z-index: 2;
}

/* ── Process / Pipeline steps ────────────────────────── */
.pipeline-step {
  position: relative;
  padding-left: 2.5rem;
}
.pipeline-step::before {
  content: '';
  position: absolute;
  left: .75rem;
  top: 2rem;
  bottom: -.75rem;
  width: 2px;
  background: linear-gradient(to bottom, rgba(56,189,248,.4), transparent);
}
.pipeline-step:last-child::before {
  display: none;
}
.pipeline-step .step-dot {
  position: absolute;
  left: .375rem;
  top: .375rem;
  width: .95rem;
  height: .95rem;
  border-radius: 50%;
  border: 2px solid #38bdf8;
  background: #0f172a;
}

/* ── Hover-glow for service icons ────────────────────── */
.icon-glow {
  transition: filter .3s ease, transform .3s ease;
}
.group:hover .icon-glow {
  filter: drop-shadow(0 0 8px rgba(56,189,248,.5));
  transform: scale(1.1);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .marquee-track {
    animation: none !important;
    transform: none !important;
  }

  .floating-orb,
  #neural-canvas {
    display: none !important;
  }
}
