/* =========================================================
   1. RESET & BASE SETTINGS
   ========================================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

/* =========================================================
   2. BACKGROUNDS & ATMOSPHERE
   ========================================================= */
#galaxy-bg {
  position: fixed; 
  inset: 0; 
  width: 100%; 
  height: 120vh; 
  top: 0; 
  z-index: 0;
  background-color: #000005; 
  will-change: transform;
}

#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: 5px 5px; 
  opacity: 0.5; 
  pointer-events: none;
}

:root {
  --grid-rotate: 80deg; 
  --grid-persp: 1000px; 
  --grid-height: 50%;
}

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

#cyber-grid::before {
  content: ""; 
  position: absolute; 
  top: 0; 
  left: -50%; 
  width: 200%; 
  height: 200%;
  transform: rotateX(var(--grid-rotate)); 
  transform-origin: center top; 
  will-change: transform;
  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%);
}

#starfield {
  position: fixed !important; 
  inset: 0; 
  height: 100%; 
  z-index: 1; 
  pointer-events: none; 
  opacity: 0.7; 
}

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

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

/* =========================================================
   3. MAIN INTERFACE (LOGO & INTRO)
   ========================================================= */
#accueil {
  position: relative; 
  height: 100vh; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  z-index: 10;
}

#logo {
  position: absolute; 
  top: 50%; 
  left: 50%; 
  transform: translate(-50%, -50%);
  width: 40vw; 
  aspect-ratio: 1/1; 
  min-width: 300px; 
  max-width: 800px;
  height: auto; 
  min-height: 0; 
  transform-style: preserve-3d; 
  z-index: 5;
}

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

#logo-sphere-container {
  position: absolute; 
  width: 300%; 
  height: 300%; 
  top: 50%; 
  left: 50%;
  transform: translate(-50%, -50%); 
  z-index: 10; 
  pointer-events: none; 
  display: block;
}

canvas { 
  display: block; 
  outline: none; 
}

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

.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; 
}

/* =========================================================
   4. LAYOUT ZONES & CONTAINER
   ========================================================= */
#zones {
  min-height: 100vh; 
  display: flex; 
  align-items: center; 
  justify-content: center;
  position: relative; 
  margin-top: -20vh; 
  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; 
}

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

/* Panel Colors Configuration */
.panel:nth-child(1) { --c-top: #612ef3; --c-bottom: #2d0071; } 
.panel:nth-child(2) { --c-top: #43ff00; --c-bottom: #359500; } 
.panel:nth-child(3) { --c-top: #2fb1fc; --c-bottom: #002f54; } 


/* =========================================================
   5. PANELS ARCHITECTURE (THE DONUT TECHNIQUE)
   ========================================================= */
.panel {
  position: relative;
  display: flex; 
  flex-direction: column;
  flex: 1 1 180px; 
  min-width: 0; 
  height: 100%;
  cursor: pointer; 
  border: none; 
  background: transparent; 
  overflow: hidden;
  
  /* Global Shape */
  clip-path: polygon(
    20px 0, 
    100% 0, 
    100% 100%, 
    0 100%, 
    0 20px
  );

  transition: flex 1.5s cubic-bezier(0.76, 0, 0.24, 1);
  filter: drop-shadow(0 0 15px rgba(0,0,0,0.5));
}

/* Layer 1: Border (Gradient) - Uses Donut Mask */
.panel::before {
  content: ""; 
  position: absolute; 
  inset: 0; 
  z-index: 60; /* Above background */
  
  /* Opacité du Stroke (Validé) */
  opacity: 1; 
  
  background: linear-gradient(to bottom, var(--c-top), var(--c-bottom) 70%, transparent 98%);
  
  /* Cut out the center to create the border */
  clip-path: polygon(
    20px 0, 100% 0, 100% 100%, 0 100%, 0 20px, 20px 0,
    20px 3px, 3px 20px, 3px 102%, calc(100% - 3px) 102%, calc(100% - 3px) 3px, 20px 3px
  );
  
  pointer-events: none;
}

/* Layer 2: Background (Semi-Transparent Black FADING) */
.panel::after {
  content: ""; 
  position: absolute; 
  inset: 0;
  z-index: 1; /* Below border */
  
  /* --- MODIFICATION ICI : DÉGRADÉ DU FOND NOIR --- */
  /* Part du noir 0.2 (ton setting) et fade vers transparent vers la fin (80% à 100%) */
  background: linear-gradient(
      to bottom, 
      rgba(0, 0, 0, 0.2) 0%, 
      rgba(0, 0, 0, 0.2) 60%, 
      transparent 100%
  );
  
  /* Fits inside the border */
  clip-path: polygon(
    20px 3px, 
    calc(100% - 3px) 3px, 
    calc(100% - 3px) 100%, 
    3px 100%, 
    3px 20px
  );
  
  pointer-events: none;
  transition: background 0.4s ease; /* Changé background-color pour background */
}

/* Active State */
.panel.active-small::after,
.panel.active-full::after {
  /* On garde le même principe de gradient mais un peu plus sombre si actif */
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.3) 60%, transparent 100%) !important;
}

/* Hover State */
.panel:hover::after {
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.5) 60%, transparent 100%);
}

/* Flex Sizing Animation */
.panel.active-small, .panel.active-full { flex: 5 1 180px; } 
.panel.collapsed-small, .panel.collapsed-full { flex: 0.001 1 180px; }


/* =========================================================
   NOUVEAU : GESTION DU FADE DU CONTENU
   ========================================================= */
/* Applique cette classe à la DIV qui contient ton texte/images dans le panel */
.panel-content {
    position: relative;
    z-index: 3; /* Au dessus du background */
    height: 100%;
    
    /* C'est ici que la magie du fade opère sur le contenu */
    /* Le texte sera visible à 100% jusqu'à 70%, puis deviendra transparent */
    mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

/* =========================================================
   6. PANEL CONTENT & HEADER
   ========================================================= */
.panel-header {
  position: relative; 
  z-index: 50; 
  width: 100%; 
  height: 45px; 
  padding: 0 10px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  flex-shrink: 0; 
  
  /* Fond transparent (géré par le ::before) */
  background: transparent; 
  
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
  clip-path: polygon(20px 0, 100% 0, 100% 100%, 0 100%, 0 20px);
  isolation: isolate; 
}

/* GESTION DE LA COULEUR ET TRANSPARENCE DU HEADER */
.panel-header::before {
  content: "";
  position: absolute;
  inset: 0; 
  z-index: -1; 
  
  background: linear-gradient(90deg, var(--c-top), var(--c-bottom));
  
  /* --- REGLAGE TRANSPARENCE (ALPHA) --- */
  opacity: 0.6; 
}

.panel-title {
  font-family: "Orbitron", sans-serif; 
  text-transform: uppercase;
  font-weight: 900 !important; 
  font-size: 14px !important; 
  letter-spacing: 2px !important; 
  text-shadow: none; 
  white-space: nowrap; 
  color: #fff;
  margin: 0; 
  padding-top: 2px; 
  padding-bottom: 0;
  padding-left: 0;
  padding-right: 0;
  
  z-index: 2; 
  /*text-shadow: 2px 2px 1px rgba(0, 0, 0, 1);*/
}

.close-btn {
  position: absolute; 
  right: 15px; 
  top: 50%; 
  transform: translateY(-50%); 
  border: 2px solid #000; 
  background: rgba(255,255,255,0.3); 
  color: #000;
  border-radius: 50%; 
  width: 26px; 
  height: 26px;
  font-size: 14px; 
  line-height: 22px; 
  text-align: center;
  cursor: pointer; 
  opacity: 0; 
  pointer-events: none; 
  transition: all .3s ease;
  z-index: 5; 
}

.close-btn:hover { 
  background: #000; 
  color: #fff; 
  transform: translateY(-50%) rotate(90deg); 
}

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

.panel-body {
  position: absolute; 
  inset: 0; 
  top: 45px; 
  width: 100%; 
  height: calc(100% - 45px); 
  padding: 0; 
  display: none; 
  opacity: 0; 
  z-index: 10; 
  overflow: hidden; 
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

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

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

.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; 
  background-color: transparent; 
}

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


/* =========================================================
   7. INTERACTIVE ELEMENTS (BUTTONS & TILES)
   ========================================================= */
.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: 5px; 
  padding: 12px 30px;
  cursor: pointer; 
  outline: none;
  
  background: #000 !important;
  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) !important; 
  color: #00E5FF;
  border-color: #00E5FF;
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.6);
}

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

.cyber-tile {
  position: relative;
  display: flex; 
  align-items: center; 
  justify-content: center;
  width: 100%; 
  aspect-ratio: 16/9; 
  margin-bottom: 20px;
  cursor: pointer;
  color: #fff; 
  font-family: "Orbitron", sans-serif; 
  font-size: 14px; 
  letter-spacing: 1px;
  text-decoration: none;
  
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 8px;
  clip-path: none;
  transition: all 0.3s ease;
}

.cyber-tile:hover {
  border-color: #00E5FF;
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.2);
  transform: translateY(-2px);
  color: #00E5FF;
  background: rgba(0,0,0,0.8);
}

/* =========================================================
   8. MOBILE INTERFACE
   ========================================================= */
#mobile-content { display: none; }

@media (max-width: 900px) {
  #intro-triangles, #zones, #star-trails { display: none !important; }
  
  html, body { 
    overflow: hidden !important; 
    height: 100% !important; 
    position: fixed; 
    width: 100%; 
    background-color: #000; 
  }
  
  #accueil { 
    height: 100vh !important; 
    display: flex !important; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    padding-bottom: 80px; 
  }
  
  #logo {
    position: relative !important; 
    top: auto !important; 
    left: auto !important; 
    transform: none !important;
    width: 70vw; 
    max-width: 300px; 
    height: 200px !important; 
    margin: 0 auto; 
    opacity: 1 !important; 
    visibility: visible !important;
    transition: opacity 0.5s ease 0.5s !important; 
  }
  
  #accueil.faded #logo { 
    opacity: 0 !important; 
    transition-delay: 0s !important; 
  }
  
  #logo .logo-part { 
    position: absolute; 
    inset: 0; 
    margin: auto; 
    max-height: 100%; 
    max-width: 100%; 
    object-fit: contain; 
  }

  #mobile-content { display: block !important; }

  .mobile-dock {
    position: fixed; 
    bottom: 35px; 
    left: 20px; 
    right: 20px; 
    height: 70px;
    background: rgba(0, 0, 0, 0.9); 
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 229, 255, 0.3); 
    border-radius: 20px;
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 0 10px; 
    z-index: 300; 
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.1);
    transition: bottom 1.2s cubic-bezier(0.22, 1, 0.36, 1);
  }
  
  .mobile-dock.dock-top { bottom: calc(100% - 90px); }

  .dock-btn {
    -webkit-appearance: none; 
    appearance: none; 
    background: transparent; 
    border: none; 
    padding: 0; 
    margin: 0; 
    height: 100%; 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    cursor: pointer; 
    opacity: 0.7; 
    transition: all 0.3s ease; 
    gap: 0; 
  }
  
  .dock-btn span {
    color: #fff !important; 
    text-shadow: none !important; 
    font-family: "Orbitron", sans-serif; 
    font-size: 10px; 
    letter-spacing: 1px; 
    line-height: 1; 
    display: block; 
    font-weight: normal;
    transition: color 0.3s ease;
  }
  
  .dock-btn.active span { 
    color: #00E5FF !important; 
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.8); 
    font-weight: 700; 
  }
  
  .dock-btn.active { 
    transform: none !important; 
    opacity: 1 !important; 
  }

  .btn-logo { 
    flex: 0 0 60px; 
    margin-right: 5px; 
    border: none !important; 
    box-shadow: none !important; 
    background: none !important; 
    opacity: 1 !important; 
  }
  
  .btn-logo img { 
    display: block; 
    filter: none !important; 
  }

  #mobile-panel-viewer {
    position: fixed; 
    inset: 0; 
    z-index: 200; 
    background: transparent; 
    transform: translateY(100%); 
    transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex; 
    flex-direction: column; 
    padding-top: 50px !important; 
  }
  
  #mobile-panel-viewer.open { transform: translateY(0); }

  #mobile-frame-container { 
    flex: 1; 
    width: 100%; 
    height: 100%; 
    -webkit-overflow-scrolling: touch; 
    overflow-y: auto; 
  }
  
  #mobile-frame-container iframe { 
    width: 100%; 
    height: 100%; 
    border: none; 
    display: block; 
    background: transparent; 
  }
}

/* =========================================================
   9. AUDIO & INTRO OVERLAY
   ========================================================= */

/* Le Rideau Noir (Transition accélérée à 0.2s) */
#entry-overlay {
  position: fixed;
  inset: 0;
  background-color: #000;
  z-index: 9999; 
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease; /* RAPIDE */
}

/* Le Loader Cyberpunk */
.loader-container {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 40px;
}

.cyber-loader {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(0, 229, 255, 0.3);
  border-top: 2px solid #00E5FF;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.cyber-loader-inner {
  position: absolute;
  inset: 15px;
  border: 2px solid rgba(0, 255, 153, 0.3);
  border-bottom: 2px solid #00FF99;
  border-radius: 50%;
  animation: spin 2s linear infinite reverse;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Le Bouton GO (STYLE UNIFIÉ) */
#enter-btn {
  display: none; 
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 16px; /* Un peu plus gros que les boutons standards */
  letter-spacing: 2px;
  
  /* --- AJUSTEMENT : Encore plus haut (-15px total) --- */
  margin-top: -30px; 
  
  /* Style standard du site */
  border-radius: 5px;
  padding: 15px 60px;
  cursor: pointer;
  outline: none;
  background: #000;
  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.2s ease-out;
}

#enter-btn:hover {
  background: rgba(0, 229, 255, 0.1); 
  color: #00E5FF;
  border-color: #00E5FF;
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.6);
  transform: scale(1.05);
}

/* Le Bouton Son */
#sound-control {
  position: fixed;
  top: 30px;
  right: 30px;
  z-index: 10000; 
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  opacity: 1; 
  visibility: visible;
}

#sound-control:hover {
  border-color: #00E5FF;
  color: #00E5FF;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

@media (max-width: 900px) {
  .hidden-mobile { display: none !important; }
  #entry-overlay { display: none !important; } 
}