/* =========================================================
   GENICOTIK : Effets futuristes globaux (toutes pages)
   ========================================================= */

/* ---- Arrière-plans animés ---- */
.fx-bg-layers {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
}

.fx-cyber-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(42, 168, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 168, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: center center;
  opacity: 0.55;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, black 15%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, black 15%, transparent 75%);
  animation: fxGridDrift 60s linear infinite;
}

.fx-aurora {
  position: absolute;
  inset: -20% -10%;
  background:
    radial-gradient(ellipse 600px 400px at 20% 10%, rgba(42, 168, 255, 0.12), transparent 70%),
    radial-gradient(ellipse 500px 350px at 80% 20%, rgba(77, 195, 255, 0.08), transparent 70%),
    radial-gradient(ellipse 700px 500px at 50% 80%, rgba(49, 208, 170, 0.05), transparent 70%);
  animation: fxAuroraShift 18s ease-in-out infinite alternate;
}

.fx-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(42, 168, 255, 0.015) 3px,
    rgba(42, 168, 255, 0.015) 4px
  );
  opacity: 0.4;
  animation: fxScanDrift 12s linear infinite;
}

.fx-particles-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Curseur glow (desktop) */
.fx-cursor-glow {
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(42, 168, 255, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease;
  opacity: 0;
}

body.fx-ready .fx-cursor-glow {
  opacity: 1;
}

/* ---- Body & contenu ---- */
body.fx-ready {
  position: relative;
}

body.fx-ready > header,
body.fx-ready > .fx-header {
  position: sticky;
  top: 0;
  z-index: 10050;
}

body.fx-ready > main,
body.fx-ready > section,
body.fx-ready > footer {
  position: relative;
  z-index: 1;
}

/* ---- Header amélioré ---- */
header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(42, 168, 255, 0.6), rgba(77, 195, 255, 0.8), rgba(42, 168, 255, 0.6), transparent);
  animation: fxHeaderPulse 4s ease-in-out infinite;
}

.brand img {
  animation: fxLogoGlow 5s ease-in-out infinite;
}

/* ---- Page header futuriste ---- */
.page-header {
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 600px;
  height: 300px;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, rgba(42, 168, 255, 0.15) 0%, transparent 70%);
  pointer-events: none;
  animation: fxHeaderGlow 6s ease-in-out infinite alternate;
}

.page-header h1 {
  position: relative;
  background: linear-gradient(135deg, #ffffff 30%, #4dc3ff 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 30px rgba(42, 168, 255, 0.3));
}

.page-header h1::after {
  content: "";
  display: block;
  width: 80px;
  height: 3px;
  margin: 16px auto 0;
  background: linear-gradient(90deg, transparent, #2aa8ff, #4dc3ff, transparent);
  border-radius: 2px;
  animation: fxLineExpand 2s ease-out forwards;
}

.page-header .wrap {
  position: relative;
  z-index: 1;
}

/* ---- Sections ---- */
section {
  position: relative;
}

section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(200px, 30%);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(42, 168, 255, 0.3), transparent);
}

.sec-title {
  position: relative;
  display: inline-block;
}

.sec-title::before {
  content: "//";
  color: rgba(42, 168, 255, 0.5);
  margin-right: 8px;
  font-family: monospace;
  font-weight: 400;
}

/* ---- Cartes glassmorphism ---- */
.card {
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: linear-gradient(145deg, rgba(15, 22, 39, 0.85), rgba(10, 15, 25, 0.75)) !important;
  border-color: rgba(42, 168, 255, 0.2) !important;
}

.card::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(77, 195, 255, 0.08), transparent);
  transition: none;
  animation: fxCardShimmer 5s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.card:hover {
  border-color: rgba(42, 168, 255, 0.55) !important;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.5),
    0 0 25px rgba(42, 168, 255, 0.12),
    inset 0 0 30px rgba(42, 168, 255, 0.03) !important;
}

.card > * {
  position: relative;
  z-index: 1;
}

/* Coins HUD sur les cartes (injectés par JS) */
.fx-hud-corners {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.card:hover .fx-hud-corners,
.projects .item:hover .fx-hud-corners {
  opacity: 1;
}

.fx-hud-corners span {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: #4dc3ff;
  border-style: solid;
  border-width: 0;
}

.fx-hud-corners span:nth-child(1) { top: 10px; left: 10px; border-top-width: 2px; border-left-width: 2px; }
.fx-hud-corners span:nth-child(2) { top: 10px; right: 10px; border-top-width: 2px; border-right-width: 2px; }
.fx-hud-corners span:nth-child(3) { bottom: 10px; left: 10px; border-bottom-width: 2px; border-left-width: 2px; }
.fx-hud-corners span:nth-child(4) { bottom: 10px; right: 10px; border-bottom-width: 2px; border-right-width: 2px; }

.card h3 {
  color: #fff !important;
  transition: text-shadow 0.3s ease;
}

.card:hover h3 {
  text-shadow: 0 0 15px rgba(42, 168, 255, 0.4);
}

/* ---- Boutons globaux ---- */
.btn:not(.nav-desktop .btn):not(.nav-mobile a) {
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
  pointer-events: none;
}

.btn:hover::after {
  transform: translateX(100%);
}

/* ---- Liens & texte néon ---- */
.neon-text,
.accent {
  text-shadow: 0 0 10px rgba(42, 168, 255, 0.6), 0 0 25px rgba(42, 168, 255, 0.3);
}

a:not(.btn):hover {
  text-shadow: 0 0 8px rgba(42, 168, 255, 0.4);
}

/* ---- Formulaires ---- */
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
textarea,
select {
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,
textarea:focus,
select:focus {
  border-color: rgba(42, 168, 255, 0.6) !important;
  box-shadow: 0 0 0 3px rgba(42, 168, 255, 0.15), 0 0 20px rgba(42, 168, 255, 0.1) !important;
  outline: none;
}

/* ---- Reveal amélioré ---- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1), transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.in {
  opacity: 1;
  transform: none;
}

.reveal.fx-delay-1 { transition-delay: 0.1s; }
.reveal.fx-delay-2 { transition-delay: 0.2s; }
.reveal.fx-delay-3 { transition-delay: 0.3s; }

/* ---- Footer futuriste ---- */
footer {
  position: relative;
}

footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(42, 168, 255, 0.4), transparent);
}

/* ---- Éléments interactifs projets/contact ---- */
.projects .item,
.contact-cards .cc,
.social a {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.projects .item:hover,
.contact-cards .cc:hover {
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(42, 168, 255, 0.15) !important;
}

/* ---- Tilt 3D subtil ---- */
.fx-tilt {
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out;
}

/* ---- Animations ---- */
@keyframes fxGridDrift {
  0% { background-position: 0 0; }
  100% { background-position: 48px 48px; }
}

@keyframes fxAuroraShift {
  0% { transform: translate(0, 0) scale(1); opacity: 0.8; }
  50% { transform: translate(2%, -1%) scale(1.02); opacity: 1; }
  100% { transform: translate(-1%, 2%) scale(0.98); opacity: 0.85; }
}

@keyframes fxScanDrift {
  0% { transform: translateY(0); }
  100% { transform: translateY(4px); }
}

@keyframes fxHeaderPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@keyframes fxLogoGlow {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(77, 195, 255, 0.25)); }
  50% { filter: drop-shadow(0 0 18px rgba(77, 195, 255, 0.5)); }
}

@keyframes fxHeaderGlow {
  0% { opacity: 0.6; transform: translate(-50%, -50%) scale(0.95); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

@keyframes fxLineExpand {
  from { width: 0; opacity: 0; }
  to { width: 80px; opacity: 1; }
}

@keyframes fxCardShimmer {
  0%, 100% { left: -100%; }
  50% { left: 150%; }
}

/* ---- Chatbot flottant ---- */
.chatbot-toggle {
  box-shadow:
    0 8px 24px rgba(42, 168, 255, 0.4),
    0 0 30px rgba(42, 168, 255, 0.2),
    inset 0 0 15px rgba(255, 255, 255, 0.1) !important;
}

.chatbot-toggle::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(77, 195, 255, 0.4);
  animation: fxChatPulse 3s ease-in-out infinite;
  pointer-events: none;
}

.chatbot-window {
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-color: rgba(42, 168, 255, 0.35) !important;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 30px rgba(42, 168, 255, 0.15) !important;
}

@keyframes fxChatPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 0.2; }
}

/* ---- Accessibilité ---- */
@media (prefers-reduced-motion: reduce) {
  .fx-cyber-grid,
  .fx-aurora,
  .fx-scanlines,
  .fx-cursor-glow,
  .card::after,
  .brand img,
  header::after,
  .page-header::before,
  .page-header h1::after {
    animation: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .fx-cursor-glow {
    display: none;
  }
}

@media (max-width: 768px) {
  .fx-cursor-glow {
    display: none;
  }

  .fx-cyber-grid {
    background-size: 32px 32px;
    opacity: 0.35;
  }
}