/* ═══════════════════════════════════════════════════
   BR. — Premium Digital Line Tracing Loader
   ═══════════════════════════════════════════════════ */

:root {
  --loader-bg: #020203;
  --loader-grid: rgba(255, 255, 255, 0.03);
  --loader-line: #ffffff;
  --loader-accent: #00f0ff;
}

/* --- 1. GRILLE ARCHITECTURALE --- */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background-image:
    linear-gradient(var(--loader-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--loader-grid) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center center;
  opacity: 0;
  animation: fadeInGrid 1.5s ease 0.2s forwards;
  pointer-events: none;
}

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

/* --- 2. CONTENEUR PRINCIPAL --- */
#global-preloader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--loader-bg);
  transition: transform 0.8s cubic-bezier(0.76, 0, 0.24, 1);
}

/* Effet de zoom lors de la transition */
#global-preloader.zoom-out {
  transform: scale(1.1);
  opacity: 0;
  pointer-events: none;
}

/* --- 3. LIGNE D'IMPULSION INITIALE --- */
.impulse-line {
  position: absolute;
  height: 1px;
  background-color: var(--loader-line);
  width: 0;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  animation: strikeThrough 0.6s cubic-bezier(0.86, 0, 0.07, 1) forwards;
}

@keyframes strikeThrough {
  0%  { width: 0;     opacity: 0; }
  50% { width: 150px; opacity: 1; }
  90% { width: 0;     opacity: 1; }
  100%{ width: 0;     opacity: 0; }
}

/* --- 4. TRACÉ SVG "BR." --- */
.svg-container {
  position: absolute;
  opacity: 0;
  animation: revealSvgContainer 0s 0.6s forwards;
  filter: drop-shadow(0px 0px 8px rgba(255, 255, 255, 0.2));
}

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

.svg-container text {
  font-family: 'Syncopate', sans-serif;
  font-size: 7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  fill: transparent;
  stroke: var(--loader-line);
  stroke-width: 1.5px;
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation:
    drawStroke 1.2s cubic-bezier(0.25, 1, 0.5, 1) 0.6s forwards,
    fillText   0.5s ease 1.8s forwards;
}

.svg-container text .dot {
  stroke: var(--loader-accent);
  transition: fill 0.3s ease;
}

@keyframes drawStroke {
  to { stroke-dashoffset: 0; }
}

@keyframes fillText {
  to {
    fill: var(--loader-line);
    stroke-width: 0;
  }
}

.svg-container text.fill-dot .dot {
  fill: var(--loader-accent);
  animation: dotPulse 0.6s ease-in-out 3 forwards;
}

@keyframes dotPulse {
  0%, 100% { 
    opacity: 1; 
    filter: drop-shadow(0 0 15px var(--loader-accent)); 
  }
  50% { 
    opacity: 0; 
    filter: drop-shadow(0 0 0px var(--loader-accent)); 
  }
}


/* --- 6. ÉTATS DE TRANSITION --- */
body.is-loading {
  overflow: hidden;
}

body.loaded #global-preloader {
  opacity: 0;
  pointer-events: none;
}

body.loaded .bg-grid {
  opacity: 0;
  pointer-events: none;
}

body.loaded {
  overflow: visible !important;
}

