/* =================================================================
   PIXEL PROS — Loader d'entrée façon boot rétro
   Animation pixel-art au chargement des pages démo + configurer
   ================================================================= */

.pixel-boot {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0b0d1a;
  color: #facc15;
  font-family: 'Press Start 2P', monospace;
  overflow: hidden;
  pointer-events: all;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.pixel-boot-active { overflow: hidden; }

/* ====== SCANLINES + GRAIN ====== */
.pixel-boot::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,.02) 0px,
      rgba(255,255,255,.02) 1px,
      transparent 1px,
      transparent 4px
    );
  z-index: 3;
  animation: pb-scanlines 8s linear infinite;
}
@keyframes pb-scanlines {
  0% { background-position: 0 0; }
  100% { background-position: 0 100px; }
}
.pixel-boot::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,.55) 100%);
  z-index: 4;
}

/* ====== TERMINAL CENTRAL ====== */
.pixel-boot-terminal {
  position: relative;
  z-index: 5;
  width: min(640px, 90vw);
  padding: 32px 36px;
  background: rgba(11, 13, 26, 0.92);
  border: 3px solid #facc15;
  border-radius: 10px;
  box-shadow:
    0 0 0 1px rgba(250,204,21,.4),
    8px 8px 0 #0ea5ff,
    0 0 60px rgba(250,204,21,.25);
}

.pixel-boot-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 2px dashed #facc15;
  margin-bottom: 18px;
}
.pixel-boot-titlebar span {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #facc15;
}
.pixel-boot-titlebar span:nth-child(1) { background: #ef4444; }
.pixel-boot-titlebar span:nth-child(2) { background: #facc15; animation: pb-blink 1.5s infinite; }
.pixel-boot-titlebar span:nth-child(3) { background: #22c55e; }
.pixel-boot-titlebar em {
  margin-left: auto;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: rgba(255,255,255,.4);
  font-style: normal;
  letter-spacing: .08em;
}
@keyframes pb-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; }
}

.pixel-boot-logo {
  font-size: clamp(22px, 4vw, 32px);
  color: #facc15;
  text-shadow:
    3px 3px 0 #0ea5ff,
    6px 6px 0 rgba(34, 197, 94, 0.4);
  margin-bottom: 22px;
  letter-spacing: .04em;
  text-align: center;
  animation: pb-logo-in .4s steps(4) both;
}
@keyframes pb-logo-in {
  0% { opacity: 0; transform: translateY(-8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.pixel-boot-lines {
  font-size: 10px;
  line-height: 1.9;
  color: #22c55e;
  min-height: 110px;
  letter-spacing: .04em;
}
.pixel-boot-line {
  display: flex;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
}
.pixel-boot-line.is-error { color: #ef4444; }
.pixel-boot-line .pb-prompt { color: #facc15; }
.pixel-boot-line .pb-ok { color: #0ea5ff; margin-left: auto; }
.pixel-boot-line .pb-text { overflow: hidden; }

/* curseur clignotant après dernière ligne */
.pixel-boot-cursor {
  display: inline-block;
  width: 9px; height: 12px;
  background: #facc15;
  vertical-align: -2px;
  margin-left: 4px;
  animation: pb-blink .6s infinite;
}

/* ====== BARRE DE PROGRESSION ====== */
.pixel-boot-bar {
  margin-top: 20px;
  height: 14px;
  background: rgba(255,255,255,.06);
  border: 2px solid #facc15;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.pixel-boot-bar-fill {
  height: 100%;
  width: 0;
  background:
    repeating-linear-gradient(90deg, #22c55e 0 12px, #facc15 12px 24px, #0ea5ff 24px 36px);
  background-size: 36px 100%;
  transition: width .15s linear;
  animation: pb-bar-anim .6s linear infinite;
}
@keyframes pb-bar-anim {
  0% { background-position: 0 0; }
  100% { background-position: 36px 0; }
}
.pixel-boot-bar-label {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  color: rgba(255,255,255,.5);
}
.pixel-boot-bar-label strong { color: #facc15; }

/* ====== GLITCH FINAL ====== */
.pixel-boot-glitch {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(0deg, transparent 30%, rgba(14,165,255,.6) 31%, rgba(14,165,255,.6) 33%, transparent 34%),
    linear-gradient(0deg, transparent 55%, rgba(239,68,68,.55) 56%, rgba(239,68,68,.55) 57%, transparent 58%),
    linear-gradient(0deg, transparent 70%, rgba(250,204,21,.6) 71%, rgba(250,204,21,.6) 73%, transparent 74%);
}
.pixel-boot.is-glitching .pixel-boot-glitch {
  opacity: 1;
  animation: pb-glitch .3s steps(6);
}
@keyframes pb-glitch {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-8px, 4px); }
  40%  { transform: translate(6px, -3px); }
  60%  { transform: translate(-4px, 6px); }
  80%  { transform: translate(8px, -5px); }
  100% { transform: translate(0, 0); }
}
.pixel-boot.is-glitching .pixel-boot-terminal {
  animation: pb-shake .3s steps(6);
}
@keyframes pb-shake {
  0%, 100% { transform: translate(0, 0) skewX(0); }
  20% { transform: translate(-6px, 2px) skewX(-2deg); filter: hue-rotate(20deg); }
  40% { transform: translate(8px, -3px) skewX(2deg); filter: hue-rotate(-30deg); }
  60% { transform: translate(-4px, 5px) skewX(-1deg); filter: hue-rotate(15deg); }
  80% { transform: translate(6px, -2px) skewX(1deg); filter: hue-rotate(-15deg); }
}

/* ====== FLASH BLANC ====== */
.pixel-boot-flash {
  position: absolute;
  inset: 0;
  z-index: 7;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
}
.pixel-boot.is-flashing .pixel-boot-flash {
  animation: pb-flash .25s ease-out forwards;
}
@keyframes pb-flash {
  0%   { opacity: 0; }
  40%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ====== MOSAÏQUE DE RÉVÉLATION ====== */
.pixel-boot-mosaic {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  grid-template-rows: repeat(12, 1fr);
  gap: 0;
  pointer-events: none;
  opacity: 0;
}
.pixel-boot.is-revealing .pixel-boot-mosaic { opacity: 1; }
.pixel-boot-mosaic span {
  background: #0b0d1a;
  transform: scale(1);
  transition: transform .35s cubic-bezier(.6,-.4,.5,1.4);
}
.pixel-boot.is-revealing .pixel-boot-mosaic span { transform: scale(0); }

/* ====== SORTIE ====== */
.pixel-boot.is-leaving {
  pointer-events: none;
  animation: pb-leave .4s ease-out forwards;
}
@keyframes pb-leave {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* ====== BOUTON SKIP ====== */
.pixel-boot-skip {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 9;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: rgba(255,255,255,.5);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.2);
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: .08em;
  transition: color .15s, border-color .15s;
}
.pixel-boot-skip:hover {
  color: #facc15;
  border-color: #facc15;
}

/* ====== RÉDUCTION DE MOUVEMENT ====== */
@media (prefers-reduced-motion: reduce) {
  .pixel-boot {
    animation: pb-quick-fade 0.2s ease-out forwards;
    animation-delay: 0.3s;
  }
  @keyframes pb-quick-fade {
    to { opacity: 0; pointer-events: none; }
  }
  .pixel-boot-bar-fill { animation: none; }
  .pixel-boot::before { animation: none; }
}
