/* ==========================================
   TRANZISION — Performance & mobile production
   ========================================== */

/* ——— Base perf globale ——— */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (min-width: 768px) {
  html {
    scroll-behavior: smooth;
  }
}

@media (max-width: 767px) {
  html {
    scroll-behavior: auto;
  }
}

body {
  overflow-x: clip;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

/* Contenu hors écran : rendu différé (mobile) */
@media (max-width: 767px) {
  .perf-section {
    content-visibility: auto;
    contain-intrinsic-size: auto 480px;
  }

  #hero {
    content-visibility: visible;
  }
}

/* AOS désactivé : visible immédiatement */
.no-aos [data-aos] {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

/* Logo « T » hero */
.hero-logo .logo-t-initial {
  -webkit-text-fill-color: var(--white) !important;
  color: var(--white) !important;
  background: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
}

.burger {
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}

/* GPU : uniquement transform/opacity sur éléments animés desktop */
@media (min-width: 768px) {
  .scroll-reveal-card,
  .orb-node,
  #hero-canvas,
  .exp-visual-canvas {
    transform: translateZ(0);
  }
}

/* ==========================================
   EXPÉRIENCE — couches visuelles
   ========================================== */

.exp-visual-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 75% 60% at 58% 42%, rgba(74, 144, 217, 0.2) 0%, transparent 62%),
    radial-gradient(ellipse 40% 35% at 20% 80%, rgba(123, 184, 240, 0.08) 0%, transparent 70%),
    linear-gradient(165deg, #05050e 0%, #0d1a33 48%, #05050e 100%);
}

.exp-visual-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  display: block;
  opacity: 0;
  transition: opacity 0.7s ease;
  pointer-events: none;
  contain: strict;
}

.exp-visual-canvas.is-active {
  opacity: 1;
}

#exp-spline-mount {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  min-height: 100%;
  contain: layout style paint;
}

#exp-spline-mount spline-viewer {
  width: 100%;
  height: 100%;
  min-height: 320px;
  display: block;
  border: none;
}

.exp-spline.exp-spline-ready .exp-visual-canvas {
  opacity: 0 !important;
  transition: opacity 1.1s ease;
}

@media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
  .exp-spline.exp-visual-boot .exp-visual-bg {
    animation: exp-bg-pulse 6s ease-in-out infinite;
  }
}

@keyframes exp-bg-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.06);
  }
}

/* Fallback mobile */
.exp-spline-fallback {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 70% at 50% 35%, rgba(74, 144, 217, 0.28) 0%, transparent 55%),
    linear-gradient(160deg, #0a1628 0%, #1b3a6b 50%, #0a1628 100%);
}

.exp-fallback-orb {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 35% 30%,
    rgba(123, 184, 240, 0.55) 0%,
    rgba(74, 144, 217, 0.25) 40%,
    transparent 70%
  );
  border: 1px solid rgba(74, 144, 217, 0.45);
  box-shadow: 0 0 40px rgba(74, 144, 217, 0.28);
  position: relative;
  z-index: 2;
}

.exp-fallback-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(74, 144, 217, 0.22);
  pointer-events: none;
}

.exp-fallback-ring--1 {
  width: 200px;
  height: 200px;
}

.exp-fallback-ring--2 {
  width: 280px;
  height: 280px;
  border-color: rgba(123, 184, 240, 0.12);
}

/* Orbital statique mobile */
.orb-static .orb-ring-outer {
  animation: none !important;
}

.orb-static .orb-center {
  animation: none !important;
}

.orb-static .orb-center::before,
.orb-static .orb-center::after {
  animation: none !important;
  display: none;
}

/* ==========================================
   MOBILE — fluidité maximale
   ========================================== */

@media (max-width: 767px) {
  /* Pas de WebGL / Spline */
  #hero-canvas,
  .adn-3d-deco,
  .exp-spotlight-svg,
  .exp-glow,
  .exp-visual-canvas,
  #exp-spline-mount {
    display: none !important;
  }

  .exp-spline-fallback,
  .exp-spline.exp-mobile-visual .exp-spline-fallback {
    display: flex !important;
  }

  .exp-loader {
    display: none !important;
  }

  .exp-visual-bg {
    display: block;
    animation: none !important;
    filter: none !important;
  }

  /* Animations infinies OFF */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .exp-fallback-orb,
  .logo-t-initial::after,
  .scroll-dot,
  .scroll-indicator {
    animation: none !important;
  }

  /* Restaurer transitions utiles (menus, modales) */
  .mobile-menu,
  .mobile-menu a,
  .modal-overlay,
  .modal,
  .burger span,
  #navbar,
  .btn-primary,
  .btn-secondary,
  .btn-submit,
  .form-group input,
  .form-group textarea,
  .form-group select {
    transition-duration: 0.25s !important;
  }

  /* Pas de blur GPU */
  #navbar,
  #navbar.scrolled,
  .process-step,
  .orb-card,
  .orb-center-dot,
  .mockup-nav,
  .modal-overlay {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  #navbar.scrolled {
    background: rgba(11, 25, 54, 0.97);
  }

  /* Ombres allégées */
  .counter-item,
  .service-card,
  .pricing-card,
  .team-card,
  .promise-card,
  .scroll-reveal-card,
  .maquette-card {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1) !important;
  }

  .scroll-reveal-card {
    transform: none !important;
    opacity: 1 !important;
    border-width: 2px;
  }

  .scroll-reveal-viewport {
    perspective: none;
  }

  .mockup-particle {
    display: none !important;
  }

  /* Pas de 3D / will-change */
  .promise-card,
  .pricing-card,
  .team-card,
  .counter-item,
  .process-step,
  .maquette-card,
  .scroll-reveal-card,
  .scroll-reveal-header,
  .orb-node {
    will-change: auto !important;
    transform-style: flat !important;
  }

  .maquette-card {
    animation: none !important;
  }

  /* Hover désactivé (évite repaint au tap) */
  .promise-card:hover,
  .service-card:hover,
  .pricing-card:hover,
  .team-card:hover,
  .counter-item:hover,
  .process-step:hover,
  .promise-card:hover h3,
  .promise-card:hover p,
  .service-card:hover h3,
  .service-card:hover p {
    transform: none !important;
    background: var(--white) !important;
    color: inherit !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1) !important;
  }

  .process-step:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    transform: none !important;
  }

  #processus .promise-card:hover {
    background: rgba(255, 255, 255, 0.06) !important;
  }

  /* Hero */
  #hero {
    min-height: 100svh;
    min-height: 100dvh;
    padding: 88px 5% 64px;
  }

  .hero-logo .logo-wordmark {
    font-size: clamp(26px, 7vw, 36px);
    letter-spacing: clamp(4px, 1.5vw, 8px);
  }

  .hero-logo .logo-t-initial {
    font-size: clamp(34px, 9vw, 48px);
  }

  .hero-ctas {
    flex-direction: column;
    width: 100%;
    max-width: min(100%, 340px);
    margin: 0 auto;
    gap: 12px;
  }

  .hero-ctas .btn-primary,
  .hero-ctas .btn-secondary,
  .btn-primary,
  .btn-secondary,
  .btn-submit,
  .nav-cta {
    min-height: 48px;
    padding: 14px 24px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  /* Sections */
  #adn,
  #promesse,
  #services,
  #processus,
  #maquette,
  #equipe,
  #contact,
  .scroll-reveal-section,
  #experience {
    padding-top: 72px;
    padding-bottom: 72px;
    padding-left: 5%;
    padding-right: 5%;
  }

  .section-inner {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
  }

  .section-title {
    font-size: clamp(24px, 6.5vw, 32px);
    hyphens: auto;
  }

  .section-text {
    font-size: 16px;
    margin-bottom: 40px;
  }

  /* Grilles */
  .promise-grid,
  .team-grid,
  .counters-grid,
  .maquette-steps,
  .form-row,
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  #tarifs.pricing-grid,
  .pricing-grid {
    grid-template-columns: 1fr !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .pricing-card.featured {
    transform: none !important;
    padding-top: 40px;
  }

  /* Experience */
  .experience-card {
    flex-direction: column;
    height: auto;
    min-height: 0;
  }

  .exp-text {
    padding: 32px 20px 16px;
  }

  .exp-text p {
    max-width: 100%;
  }

  .exp-spline {
    min-height: 280px;
    width: 100%;
  }

  .exp-text h2 {
    -webkit-text-fill-color: var(--white);
    color: var(--white);
    background: none;
  }

  /* Orbital */
  .orbital-timeline-wrapper {
    height: 360px;
    margin-top: 40px;
  }

  .orb-ring {
    width: 280px;
    height: 280px;
  }

  .orb-ring-outer {
    width: 300px;
    height: 300px;
  }

  .orb-card {
    width: min(220px, 88vw);
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(5, 5, 18, 0.97) !important;
  }

  /* Contact */
  .contact-inner {
    grid-template-columns: 1fr !important;
    gap: 32px;
  }

  .contact-form {
    padding: 24px 18px;
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    font-size: 16px;
  }

  /* Footer */
  .footer-grid {
    gap: 28px;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  /* Modal */
  .modal {
    width: calc(100% - 32px);
    max-height: 85svh;
    overflow-y: auto;
    padding: 28px 20px;
  }

  /* Scroll reveal compact */
  .scroll-reveal-section {
    padding-top: 48px;
    padding-bottom: 72px;
  }

  .scroll-reveal-inner {
    height: 220px;
  }

  .mockup-cards {
    display: none;
  }

  /* Menu mobile */
  .mobile-menu a {
    font-size: clamp(22px, 6vw, 28px);
    padding: 8px 0;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Tablette */
@media (min-width: 768px) and (max-width: 1024px) {
  .exp-spline-fallback {
    display: none !important;
  }

  .exp-spline {
    min-height: 420px;
  }
}

@media (min-width: 768px) {
  .exp-spline-fallback {
    display: none;
  }

  .exp-spline {
    min-height: 520px;
  }
}

/* Touch : pas de tilt glare */
.is-touch .js-tilt-glare {
  display: none !important;
}

/* Connexion lente / save-data */
.save-data .exp-visual-bg,
.is-low-end .exp-visual-bg {
  animation: none !important;
}

.save-data #exp-spline-mount,
.is-low-end #exp-spline-mount {
  display: none;
}

/* 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;
  }

  .exp-visual-canvas,
  #exp-spline-mount,
  #hero-canvas {
    display: none !important;
  }

  .exp-spline-fallback {
    display: flex !important;
  }
}

/* Hover uniquement sur devices avec souris */
@media (hover: none) {
  .promise-card:hover,
  .service-card:hover,
  .pricing-card:hover,
  .team-card:hover,
  .counter-item:hover {
    transform: none;
  }
}
