:root {
  /* Dark cinema palette */
  --iagency-bg-deep: #020203;
  --iagency-bg-base: #050506;
  --iagency-bg-elevated: #0a0a0c;
  --iagency-surface: rgba(255, 255, 255, 0.05);
  --iagency-surface-strong: rgba(255, 255, 255, 0.08);
  --iagency-foreground: #ededef;
  --iagency-foreground-muted: #8a8f98;
  --iagency-blue: #0066ff;
  --iagency-blue-glow: rgba(0, 102, 255, 0.35);
  --iagency-cyan: #00d4ff;
  --iagency-cyan-glow: rgba(0, 212, 255, 0.35);
  --iagency-border: rgba(255, 255, 255, 0.08);
  --iagency-radius: 18px;
  --iagency-easing: cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--iagency-bg-base);
  color: var(--iagency-foreground);
}

/* Selection */
::selection {
  background: rgba(0, 212, 255, 0.25);
  color: #fff;
}

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, var(--iagency-blue) 0%, var(--iagency-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Hero gradient overlay */
.hero-gradient {
  background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 102, 255, 0.15), transparent),
              linear-gradient(180deg, rgba(2, 2, 3, 0.95) 0%, rgba(5, 5, 6, 0.85) 50%, rgba(5, 5, 6, 0.4) 100%);
}

/* Ambient blobs */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  pointer-events: none;
  will-change: transform;
}

.blob-blue {
  background: var(--iagency-blue);
  animation: float 12s ease-in-out infinite;
}

.blob-cyan {
  background: var(--iagency-cyan);
  animation: float 14s ease-in-out infinite reverse;
}

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

/* Glassmorphism */
.glass {
  background: var(--iagency-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--iagency-border);
}

.glass-card {
  background: var(--iagency-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--iagency-border);
  border-radius: var(--iagency-radius);
  transition: transform 0.35s var(--iagency-easing), box-shadow 0.35s var(--iagency-easing), border-color 0.35s var(--iagency-easing);
}

.glass-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 212, 255, 0.25);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.5), 0 0 40px -10px var(--iagency-blue-glow);
}

/* Glow effects */
.glow-cyan {
  box-shadow: 0 0 30px -8px var(--iagency-cyan-glow);
}

.glow-blue {
  box-shadow: 0 0 30px -8px var(--iagency-blue-glow);
}

.text-glow {
  text-shadow: 0 0 40px rgba(0, 212, 255, 0.3);
}

/* Button primary gradient */
.btn-primary {
  background: linear-gradient(135deg, var(--iagency-blue) 0%, var(--iagency-cyan) 100%);
  transition: transform 0.25s var(--iagency-easing), box-shadow 0.25s var(--iagency-easing);
  position: relative;
  z-index: 1;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--iagency-cyan) 0%, var(--iagency-blue) 100%);
  opacity: 0;
  transition: opacity 0.3s var(--iagency-easing);
  z-index: -1;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px -10px var(--iagency-cyan-glow);
}

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

.btn-primary:active {
  transform: translateY(0);
}

/* Secondary / outline button */
.btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--iagency-foreground);
  transition: all 0.25s var(--iagency-easing);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-2px);
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--iagency-easing), transform 0.6s var(--iagency-easing);
}

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

/* Stagger children */
.stagger-1 { transition-delay: 0.08s; }
.stagger-2 { transition-delay: 0.16s; }
.stagger-3 { transition-delay: 0.24s; }
.stagger-4 { transition-delay: 0.32s; }
.stagger-5 { transition-delay: 0.4s; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .blob { display: none; }
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* Form focus */
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--iagency-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

/* Demo frame */
.demo-frame {
  box-shadow: 0 25px 60px -20px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 212, 255, 0.2);
}

/* Pricing highlight */
.pricing-highlight {
  border: 1px solid rgba(0, 212, 255, 0.4);
  position: relative;
  box-shadow: 0 0 40px -12px var(--iagency-cyan-glow);
}

.pricing-highlight::before {
  content: "Populaire";
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--iagency-blue), var(--iagency-cyan));
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  box-shadow: 0 4px 20px -6px var(--iagency-cyan-glow);
}

/* Mobile menu */
.mobile-menu {
  transform: translateY(-10px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s var(--iagency-easing);
}

.mobile-menu.open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

/* Header glass */
.header-glass {
  background: rgba(5, 5, 6, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--iagency-border);
}

/* Section divider glow */
.section-glow {
  box-shadow: inset 0 1px 0 0 var(--iagency-border);
}

/* Icon container */
.icon-glow {
  background: rgba(0, 102, 255, 0.12);
  box-shadow: 0 0 20px -8px var(--iagency-blue-glow);
}

/* Pulse dot */
.pulse-dot {
  box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.5);
  animation: pulse-cyan 2s infinite;
}

@keyframes pulse-cyan {
  0% { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(0, 212, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0); }
}

/* Link hover glow */
.link-glow {
  transition: color 0.2s var(--iagency-easing), text-shadow 0.2s var(--iagency-easing);
}

.link-glow:hover {
  color: var(--iagency-cyan);
  text-shadow: 0 0 12px rgba(0, 212, 255, 0.35);
}

/* FAQ */
.faq-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s var(--iagency-easing), opacity 0.3s var(--iagency-easing);
  opacity: 0;
}

.faq-content.open {
  max-height: 500px;
  opacity: 1;
}

/* Chat bubbles */
.chat-bubble-bot {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-bubble-user {
  background: linear-gradient(135deg, var(--iagency-blue), var(--iagency-cyan));
}

/* Liquid glass morphism */
.liquid-glass {
  background: rgba(255, 255, 255, 0.01);
  background-blend-mode: luminosity;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: none;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.liquid-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.4px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.45) 0%,
    rgba(255, 255, 255, 0.15) 20%,
    transparent 40%,
    transparent 60%,
    rgba(255, 255, 255, 0.15) 80%,
    rgba(255, 255, 255, 0.45) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.liquid-glass-strong {
  background: rgba(255, 255, 255, 0.01);
  background-blend-mode: luminosity;
  backdrop-filter: blur(50px);
  -webkit-backdrop-filter: blur(50px);
  border: none;
  box-shadow:
    4px 4px 4px rgba(0, 0, 0, 0.05),
    inset 0 1px 1px rgba(255, 255, 255, 0.15);
  position: relative;
  overflow: hidden;
}

.liquid-glass-strong::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.4px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(255, 255, 255, 0.2) 20%,
    transparent 40%,
    transparent 60%,
    rgba(255, 255, 255, 0.2) 80%,
    rgba(255, 255, 255, 0.5) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.liquid-glass,
.liquid-glass-strong {
  transition: transform 0.25s var(--iagency-easing);
}

.liquid-glass:hover,
.liquid-glass-strong:hover {
  transform: scale(1.02);
}

/* =========================================================
   Page-stack SPA routing
   ========================================================= */

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

.page-stack {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  pointer-events: none;
}

 .page-layer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  pointer-events: auto;
  background: #000;
  will-change: transform, filter;
  display: flex;
  flex-direction: column;
}

/* Nested sheet: page opens like a card above its parent */
.page-layer.nested-sheet {
  margin-top: 5vh;
  margin-left: 3vw;
  margin-right: 3vw;
  width: 94vw;
  height: 95vh;
  border-radius: 2rem 2rem 0 0;
  overflow: hidden;
  box-shadow: 0 -30px 80px rgba(0, 0, 0, 0.6);
}

.page-layer > .layer-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* Nested parent dimming */
.page-layer.parent-nested {
  transform: scale(0.92);
  filter: brightness(0.45);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Push / Pop animations */
.page-layer.enter-from-bottom {
  transform: translateY(100%);
}

.page-layer.enter-from-bottom.animate-in {
  transform: translateY(0);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-layer.exit-to-bottom {
  transform: translateY(0);
}

.page-layer.exit-to-bottom.animate-out {
  transform: translateY(100%);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Active layer always on top during transitions */
.page-layer.active {
  z-index: 10;
}

/* Video background inside each layer */
.page-layer .layer-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.page-layer .layer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 0;
}

/* Scrollable panel inside a layer (mentions légales, contact form overflow) */
.layer-scroll {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.layer-scroll::-webkit-scrollbar {
  width: 6px;
}

.layer-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

/* Mobile safe area */
@supports (height: 100dvh) {
  .page-layer,
  .page-stack {
    height: 100dvh;
  }
}

/* Back button for nested screens */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.back-btn:hover {
  color: #00d4ff;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .page-layer,
  .page-layer.parent-nested {
    transition: none !important;
  }
}
