* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
  background: #000;
  font-family: Arial, Helvetica, sans-serif;
  color: #fff;
  overflow: hidden; 
  overscroll-behavior: none;
}

/* =========================================
   2. BACKGROUNDS (VERSION FINALE : SOL FIXE)
   ========================================= */
#galaxy-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  
  /* On garde 120vh pour que le JS puisse le faire scroller (Parallaxe) */
  height: 120vh; 
  top: 0;        
  z-index: 0;
  
  background-color: #000005; /* Noir profond */
  will-change: transform;
}

/* La micro-trame (Scanlines) */
#galaxy-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1; 
  background-image: radial-gradient(rgba(0, 255, 255, 0.15) 1px, transparent 1px);
  background-size: 4px 4px; 
  opacity: 0.5; 
  pointer-events: none;
}

/* =========================================
   NOUVEAU PLANCHER (DYNAMIQUE AVEC VARIABLES)
   ========================================= */
:root {
  /* VALEURS PAR DÉFAUT (État 1 - Intro) */
  --grid-rotate: 80deg;   
  --grid-persp: 1000px;   
  --grid-height: 50%;     
}

#cyber-grid {
  position: absolute; 
  bottom: 0;          
  left: 0;
  width: 100%;
  
  /* HAUTEUR DYNAMIQUE */
  height: var(--grid-height);        
  
  z-index: 0; 
  pointer-events: none; 
  
  /* PERSPECTIVE DYNAMIQUE */
  perspective: var(--grid-persp); 
  
  overflow: hidden;
  will-change: height, perspective; 
}

#cyber-grid::before {
  content: "";
  position: absolute;
  top: 0;
  left: -50%; 
  width: 200%;
  height: 200%;
  
  /* ROTATION DYNAMIQUE */
  transform: rotateX(var(--grid-rotate)); 
  transform-origin: center top;
  will-change: transform;

  /* DESSIN DE LA GRILLE (CYAN UNIFIÉ) */
  background-image: 
    linear-gradient(to right, rgba(0, 229, 255, 0.4) 2px, transparent 2px),
    linear-gradient(to bottom, rgba(0, 229, 255, 0.4) 2px, transparent 2px);
    
  background-size: 100px 100px; 

  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, transparent 5%, black 40%, black 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, transparent 5%, black 40%, black 100%);
  
  animation: none !important;
}

/* Assure-toi de SUPPRIMER ou COMMENTER le bloc @keyframes grid-move s'il traîne encore dans ton fichier */

/* ÉTOILES (inchangé) */
#starfield {
  position: fixed !important; 
  inset: 0;
  height: 100%; 
  z-index: 1; 
  pointer-events: none;
  opacity: 0.7; 
}

//* =========================================
   NOUVEAU PLANCHER (DYNAMIQUE AVEC VARIABLES)
   ========================================= */
:root {
  /* VALEURS PAR DÉFAUT (État 1 - Intro) */
  /* Le JS va modifier ces valeurs en temps réel */
  --grid-rotate: 80deg;   /* Très plat au départ */
  --grid-persp: 1000px;   /* Profondeur infinie */
  --grid-height: 50%;     /* Horizon au milieu (50%) */
}

#cyber-grid {
  position: absolute; 
  bottom: 0;          
  left: 0;
  width: 100%;
  
  /* HAUTEUR DYNAMIQUE */
  height: var(--grid-height);        
  
  z-index: 0; 
  pointer-events: none; 
  
  /* PERSPECTIVE DYNAMIQUE */
  perspective: var(--grid-persp); 
  
  overflow: hidden;
  will-change: height, perspective; /* Optimisation */
}

#cyber-grid::before {
  content: "";
  position: absolute;
  top: 0;
  left: -50%; 
  width: 200%;
  height: 200%;
  
  /* ROTATION DYNAMIQUE */
  transform: rotateX(var(--grid-rotate)); 
  transform-origin: center top;
  will-change: transform;

  /* --- DESSIN DE LA GRILLE (CYAN UNIFIÉ) --- */
  background-image: 
    linear-gradient(to right, rgba(0, 229, 255, 0.4) 2px, transparent 2px),
    linear-gradient(to bottom, rgba(0, 229, 255, 0.4) 2px, transparent 2px);
    
  background-size: 100px 100px; 

  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, transparent 5%, black 40%, black 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, transparent 5%, black 40%, black 100%);
  
  animation: none !important;
}

#accueil {
  position: relative;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#logo {
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30vw; 
  min-width: 300px;
  max-width: none;
  transform-style: preserve-3d;
  z-index: 5;
}

#logo .logo-part {
  position: absolute;
  inset: 0;
  width: 100%;
  height: auto;
  opacity: 1;
}

#intro-triangles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.triangle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 22vw;
  max-width: 500px; 
}

.triangle-gauche { left: 8vw; }
.triangle-droit { right: 8vw; }

.triangle img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: auto;
}

#zones {
  min-height: 100vh;
  display: flex;
  align-items: center; 
  justify-content: center;
  position: relative;
  margin-top: -20vh; 
  padding-top: 0;
  padding-bottom: 0;
  z-index: 20; 
  pointer-events: auto; 
}

.panels-container {
  display: flex;        
  flex-direction: row; 
  width: 100%;        
  height: 80vh;       
  min-height: 30vh;  
  gap: 30px;
  justify-content: center;
  padding: 0 1vw; 
  transition: padding 1.5s cubic-bezier(0.76, 0, 0.24, 1);
  pointer-events: auto; 
  opacity: 1; 
  transform: none; 
}

.panels-container.narrow {
  padding: 0 20vw; 
}

.panel:nth-child(1) { --c-top: #6a00ff; --c-bottom: #ff00aa; } 
.panel:nth-child(2) { --c-top: #00e940; --c-bottom: #ffcc00; } 
.panel:nth-child(3) { --c-top: #ff0055; --c-bottom: #aa00ff; } 

.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 180px; 
  min-width: 0; 
  height: 100%;
  border-radius: 35px;
  cursor: pointer;
  border: none; 
  overflow: hidden;
  opacity: 1;
  background-color: rgba(0, 0, 0, 0.4);
  transition: 
    flex 1.5s cubic-bezier(0.76, 0, 0.24, 1), 
    background-color 0.4s ease,
    opacity 0.4s ease;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 35px;
  pointer-events: none;
  z-index: 50;
  padding: 2px; 
  background: linear-gradient(to bottom, var(--c-top), var(--c-bottom));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  will-change: padding;
  transition: padding 0.1s linear;
}

.panel:hover::before {
  padding: 4px;
}

.panel.active-small,
.panel.active-full {
  background-color: rgba(0, 0, 0, 0.1) !important; 
}

.panel.active-small::before,
.panel.active-full::before {
  padding: 6px; 
  transition: padding 0.3s ease-out;
}

.panel::after {
  content: none;
  display: none;
}

.panel.active-small, .panel.active-full { flex: 5 1 180px; } 
.panel.collapsed-small, .panel.collapsed-full { flex: 0.001 1 180px; }

.panel-header {
  position: relative;
  z-index: 60;
  width: 100%;
  height: 60px; 
  padding: 0 10px;
  display: flex;
  align-items: center;      
  justify-content: center; 
  flex-shrink: 0; 
  background: transparent; 
}

.panel-title {
  font-family: "Orbitron", sans-serif;
  text-transform: uppercase;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transform: translateZ(0); 
  font-weight: 700 !important;
  font-size: 14px !important;       
  letter-spacing: 2px !important; 
  text-shadow: 0 0 5px rgba(93, 244, 151, 0.5);
  white-space: nowrap;
  text-align: center;
  width: auto;
  transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  background-color: transparent;
  padding: 0;
  border-radius: 0;
}

.panel.active-small .panel-title,
.panel.active-full .panel-title {
  background-color: rgba(0, 0, 0, 0.8); 
  border-radius: 50px;
  padding: 8px 30px; 
  width: fit-content; 
  margin: 0 auto;
  box-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

.close-btn {
  position: absolute; 
  right: 20px;        
  top: 50%;
  transform: translateY(-50%); 
  border: 2px solid #fff;
  background: none;
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: 18px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s cubic-bezier(0.645, 0.045, 0.355, 1);
}

.panel.active-small .close-btn,
.panel.active-full .close-btn {
  opacity: 1;
  pointer-events: auto;
}

.panel-body {
  position: absolute;
  inset: 0; 
  width: 100%;
  height: 100%;
  padding: 0; 
  display: none; 
  opacity: 0;
  z-index: 1;
  overflow: hidden; 
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: opacity, transform;
}

.panel.active-small .panel-body,
.panel.active-full .panel-body {
  display: block;
  animation: fadeInBody 0.6s ease forwards 1.1s;
}

@keyframes fadeInBody {
  from { opacity: 0; } 
  to { opacity: 1; }
}

#star-trails {
  position: fixed;
  inset: 0;
  z-index: 2; 
  pointer-events: none;
  overflow: hidden;
}

.star-trail {
  position: absolute;
  will-change: transform, opacity;
}

#mobile-content { display: none; }
#turn-device { display: none; } 

@media (max-width: 900px) {
  
  /* 1. NETTOYAGE : On cache les éléments 3D et les triangles */
  #intro-triangles, 
  #zones, 
  #star-trails,
  #turn-device { 
    display: none !important; 
  }

  /* 2. CONTENEUR ACCUEIL : Plein écran et centré */
  html, body {
    overflow-y: auto !important; /* On autorise le scroll pour aller voir le menu plus bas */
    overflow-x: hidden !important;
    height: auto !important;
    position: relative !important;
  }

  #accueil {
    height: 100vh !important;      /* Prend toute la hauteur de l'écran */
    min-height: 100vh !important;
    padding: 0 !important;
    display: flex !important;      /* Active le mode Flexbox */
    flex-direction: column;
    justify-content: center;       /* Centre Verticalement */
    align-items: center;           /* Centre Horizontalement */
  }

  /* 3. LE LOGO : Centré et dimensionné */
  #logo {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;    /* On annule les positions absolues du desktop */
    
    width: 70vw;                   /* Largeur relative à l'écran */
    max-width: 320px;              /* Maximum raisonnable */
    height: auto;
    margin: 0;
    opacity: 1 !important; 
    
    /* On garde l'animation 3D du JS, mais on s'assure qu'elle est visible */
    transform-style: preserve-3d;
  }
  
  #logo .logo-part {
    position: absolute;
    inset: 0;
    margin: auto;
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
  }

  /* 4. LE CONTENU MOBILE (Menu) */
  /* Je le laisse affiché pour l'instant, il apparaîtra en scrollant vers le bas */
  #mobile-content {
    display: block !important;
    padding: 50px 20px;
    text-align: center;
    position: relative;
    z-index: 10;
    min-height: 50vh; /* Pour avoir de la place pour scroller */
  }

  .construction-note {
    font-family: "Orbitron", sans-serif;
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    letter-spacing: 1px;
    margin-bottom: 30px;
    margin-top: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
  }

  .mobile-name {
    font-family: "Orbitron", sans-serif;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 5px;
    color: #fff;
    text-shadow: 0 0 10px rgba(93, 244, 151, 0.5);
  }

  .mobile-link {
    display: block;
    font-family: Arial, sans-serif;
    font-size: 16px;
    color: #58B4FF; 
    text-decoration: none;
    margin-bottom: 5px;
    padding: 10px;
  }
  
  .mobile-link:last-child {
    color: #5DF497; 
  }

  /* Ajustement Paysage (Landscape) */
  @media (orientation: landscape) {
    #accueil { height: auto !important; padding: 50px 0 !important; }
    #logo { width: 25vw; max-width: 200px; } 
  }
}

.panel-content-frame {
  width: 100% !important;
  height: 100% !important;
  border: none;
  display: block;
  overflow: hidden;
  opacity: 0;
  animation: fadeInFrame 0.6s ease forwards 0.8s;
  -webkit-transform: translateZ(1px); 
  transform: translateZ(1px);
  background-color: transparent; 
}

@keyframes fadeInFrame {
  to { opacity: 1; }
}

.filter-btn, 
.back-btn, 
.submit-btn,
button[type="submit"] {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 5px;
  border-radius: 50px; 
  padding: 12px 30px;
  cursor: pointer;
  outline: none;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #00E5FF; 
  color: #00E5FF;
  text-shadow: 0 0 2px rgba(0, 229, 255, 0.3);
  box-shadow: 0 0 5px rgba(0, 229, 255, 0.1), inset 0 0 5px rgba(0, 229, 255, 0.1);
  transition: all 0.4s ease-out;
  transform: none !important;
}

.filter-btn:hover, 
.back-btn:hover, 
.submit-btn:hover,
button[type="submit"]:hover {
  background: rgba(0, 229, 255, 0.1); 
  color: #00E5FF;
  border-color: #00E5FF;
  animation: neon-elastic 0.3s linear forwards;
}

.filter-btn.active {
  background: #00E5FF; 
  border-color: #00E5FF;
  color: #000; 
  box-shadow: 0 0 0px rgba(0, 229, 255, 0.6);
  text-shadow: none;
  animation: none; 
}

.filter-btn i, .back-btn i, button[type="submit"] i {
  font-size: 14px;
}

@keyframes neon-elastic {
  0% { 
    box-shadow: 0 0 5px rgba(0, 229, 255, 0.5), inset 0 0 5px rgba(0, 229, 255, 0.5); 
  }
  30% { 
    box-shadow: 0 0 20px rgba(0, 229, 255, 1), inset 0 0 20px rgba(0, 229, 255, 0.8); 
  }
  50% { 
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.6), inset 0 0 10px rgba(0, 229, 255, 0.6); 
  }
  70% { 
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.7), inset 0 0 15px rgba(0, 229, 255, 0.7); 
  }
  100% { 
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.8), inset 0 0 10px rgba(0, 229, 255, 0.5); 
  }
}

@keyframes neon-thumb {
  0% {
    box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.5);
    border-color: transparent;
  }
  30% {
    box-shadow: 0 0 60px rgba(0, 229, 255, 0.8), inset 0 0 20px rgba(0, 229, 255, 0.5);
    border-color: #00E5FF;
  }
  50% {
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
  }
  100% {
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.6);
    border-color: #00E5FF;
  }
}

.project-item.clickable:hover {
  transform: translateY(-5px); 
  border-color: #00E5FF;
  animation: neon-elastic 0.3s linear forwards;
}