/* Noxpager — Cinématique d'entrée (première visite) */

html.nxp-entry-active {
  overflow: hidden;
  height: 100%;
}

html.nxp-entry-active body {
  overflow: hidden;
  touch-action: none;
}

.nxp-entry {
  --nxp-entry-duration: 5.2s;
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #010204;
  isolation: isolate;
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.nxp-entry.is-exiting {
  pointer-events: none;
  animation: nxpEntryExit 1.15s cubic-bezier(0.76, 0, 0.22, 1) forwards;
}

@keyframes nxpEntryExit {
  0% {
    opacity: 1;
    clip-path: circle(120% at 50% 50%);
    filter: blur(0);
  }
  45% {
    opacity: 1;
    clip-path: circle(8% at 50% 48%);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    clip-path: circle(0% at 50% 48%);
    filter: blur(6px);
  }
}

.nxp-entry__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.nxp-entry__grid {
  position: absolute;
  inset: -50%;
  z-index: 0;
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  transform: perspective(800px) rotateX(58deg) translateY(-12%);
  animation: nxpGridDrift 18s linear infinite;
  opacity: 0.5;
  mask-image: radial-gradient(ellipse 70% 55% at 50% 45%, #000 0%, transparent 72%);
}

@keyframes nxpGridDrift {
  0% { transform: perspective(800px) rotateX(58deg) translateY(-12%) translateZ(0); }
  100% { transform: perspective(800px) rotateX(58deg) translateY(-12%) translateZ(80px); }
}

.nxp-entry__vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: radial-gradient(ellipse 55% 50% at 50% 42%, transparent 0%, #010204 78%);
  pointer-events: none;
}

.nxp-entry__scan {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 4px
  );
  opacity: 0.35;
  mix-blend-mode: overlay;
}

.nxp-entry__flash {
  position: absolute;
  inset: 0;
  z-index: 8;
  background: radial-gradient(circle at 50% 45%, rgba(0, 229, 255, 0.35) 0%, transparent 55%);
  opacity: 0;
  pointer-events: none;
}

.nxp-entry[data-phase="2"] .nxp-entry__flash,
.nxp-entry[data-phase="3"] .nxp-entry__flash {
  animation: nxpFlash 0.55s ease-out forwards;
}

@keyframes nxpFlash {
  0% { opacity: 0; }
  15% { opacity: 0.9; }
  100% { opacity: 0; }
}

.nxp-entry__core {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem;
  max-width: min(92vw, 520px);
}

.nxp-entry__rings {
  position: absolute;
  left: 50%;
  top: 38%;
  width: clamp(200px, 52vw, 320px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.nxp-entry__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid transparent;
  opacity: 0;
}

.nxp-entry[data-phase="2"] .nxp-entry__ring,
.nxp-entry[data-phase="3"] .nxp-entry__ring {
  animation: nxpRingPulse 1.8s ease-out forwards;
}

.nxp-entry__ring:nth-child(1) {
  border-color: rgba(0, 229, 255, 0.5);
  animation-delay: 0s;
}

.nxp-entry__ring:nth-child(2) {
  inset: -18%;
  border-color: rgba(123, 97, 255, 0.35);
  animation-delay: 0.12s;
}

.nxp-entry__ring:nth-child(3) {
  inset: -36%;
  border-color: rgba(0, 229, 255, 0.2);
  animation-delay: 0.24s;
}

@keyframes nxpRingPulse {
  0% {
    opacity: 0;
    transform: scale(0.35);
  }
  25% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

.nxp-entry__logo-wrap {
  position: relative;
  width: clamp(100px, 28vw, 160px);
  aspect-ratio: 1;
  margin-bottom: 1.25rem;
  opacity: 0;
  transform: scale(0.4) rotate(-8deg);
  filter: blur(12px);
}

.nxp-entry[data-phase="1"] .nxp-entry__logo-wrap,
.nxp-entry[data-phase="2"] .nxp-entry__logo-wrap,
.nxp-entry[data-phase="3"] .nxp-entry__logo-wrap {
  animation: nxpLogoReveal 1.1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes nxpLogoReveal {
  0% {
    opacity: 0;
    transform: scale(0.4) rotate(-8deg);
    filter: blur(12px);
  }
  60% {
    opacity: 1;
    transform: scale(1.06) rotate(2deg);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
    filter: blur(0);
  }
}

.nxp-entry__logo-glow {
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.55) 0%, transparent 68%);
  animation: nxpGlowPulse 2.4s ease-in-out infinite;
}

@keyframes nxpGlowPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}

.nxp-entry__logo {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 28px rgba(0, 229, 255, 0.5));
}

.nxp-entry[data-phase="2"] .nxp-entry__logo {
  animation: nxpLogoGlitch 0.45s steps(2) 0.15s;
}

@keyframes nxpLogoGlitch {
  0%, 100% { transform: translate(0); filter: drop-shadow(0 0 28px rgba(0, 229, 255, 0.5)); }
  25% { transform: translate(-3px, 1px); filter: drop-shadow(4px 0 #7b61ff); }
  50% { transform: translate(3px, -1px); filter: drop-shadow(-4px 0 #00e5ff); }
  75% { transform: translate(-1px, 2px); }
}

.nxp-entry__wordmark {
  display: flex;
  gap: 0.02em;
  font-family: var(--font-display);
  font-size: clamp(2rem, 9vw, 3.25rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  line-height: 1;
  margin-bottom: 0.65rem;
}

.nxp-entry__letter {
  display: inline-block;
  color: var(--nox-text, #eef2f8);
  opacity: 0;
  transform: translateY(24px) skewX(12deg);
  text-shadow: 0 0 24px rgba(0, 229, 255, 0.4);
}

.nxp-entry[data-phase="2"] .nxp-entry__letter,
.nxp-entry[data-phase="3"] .nxp-entry__letter {
  animation: nxpLetterIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.nxp-entry__letter:nth-child(1) { animation-delay: 0.05s; color: #00e5ff; }
.nxp-entry__letter:nth-child(2) { animation-delay: 0.1s; }
.nxp-entry__letter:nth-child(3) { animation-delay: 0.15s; color: #7b61ff; }
.nxp-entry__letter:nth-child(4) { animation-delay: 0.2s; }
.nxp-entry__letter:nth-child(5) { animation-delay: 0.25s; }
.nxp-entry__letter:nth-child(6) { animation-delay: 0.3s; }
.nxp-entry__letter:nth-child(7) { animation-delay: 0.35s; color: #00e5ff; }
.nxp-entry__letter:nth-child(8) { animation-delay: 0.4s; }
.nxp-entry__letter:nth-child(9) { animation-delay: 0.45s; }

@keyframes nxpLetterIn {
  to {
    opacity: 1;
    transform: translateY(0) skewX(0);
  }
}

.nxp-entry__tagline {
  font-size: clamp(0.75rem, 2.8vw, 0.9rem);
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(238, 242, 248, 0.55);
  opacity: 0;
  transform: translateY(10px);
}

.nxp-entry[data-phase="2"] .nxp-entry__tagline,
.nxp-entry[data-phase="3"] .nxp-entry__tagline {
  animation: nxpTaglineIn 0.7s ease 0.5s forwards;
}

@keyframes nxpTaglineIn {
  to { opacity: 1; transform: translateY(0); }
}

.nxp-entry__cipher {
  position: absolute;
  bottom: 18%;
  left: 0;
  right: 0;
  overflow: hidden;
  height: 1.25rem;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: rgba(0, 229, 255, 0.45);
  opacity: 0;
  z-index: 4;
  pointer-events: none;
}

.nxp-entry[data-phase="1"] .nxp-entry__cipher,
.nxp-entry[data-phase="2"] .nxp-entry__cipher,
.nxp-entry[data-phase="3"] .nxp-entry__cipher {
  opacity: 1;
}

.nxp-entry__cipher-track {
  display: flex;
  width: max-content;
  animation: nxpCipherScroll 12s linear infinite;
  white-space: nowrap;
}

.nxp-entry__cipher span {
  padding: 0 1.5rem;
}

@keyframes nxpCipherScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.nxp-entry__tunnel {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  background: repeating-conic-gradient(
    from 0deg at 50% 48%,
    transparent 0deg 8deg,
    rgba(0, 229, 255, 0.03) 8deg 9deg
  );
  mask-image: radial-gradient(circle at 50% 48%, transparent 0%, #000 42%, transparent 70%);
}

.nxp-entry.is-exiting .nxp-entry__tunnel {
  animation: nxpTunnelSpin 1.1s cubic-bezier(0.76, 0, 0.22, 1) forwards;
}

@keyframes nxpTunnelSpin {
  0% { opacity: 0; transform: scale(0.5) rotate(0deg); }
  30% { opacity: 0.85; }
  100% { opacity: 0; transform: scale(2.5) rotate(120deg); }
}

.nxp-entry__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 9;
  background: linear-gradient(90deg, #00e5ff, #7b61ff, #00e5ff);
  background-size: 200% 100%;
  animation: nxpProgressShine 1.2s linear infinite;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.6);
}

.nxp-entry.is-running .nxp-entry__progress {
  animation: nxpProgressShine 1.2s linear infinite, nxpProgressFill var(--nxp-entry-duration) linear forwards;
}

@keyframes nxpProgressFill {
  to { width: 100%; }
}

@keyframes nxpProgressShine {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.nxp-entry__skip {
  position: absolute;
  bottom: 2.5rem;
  right: clamp(1rem, 4vw, 2rem);
  z-index: 10;
  padding: 0.5rem 1rem;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(238, 242, 248, 0.7);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 999px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s;
}

.nxp-entry.is-running .nxp-entry__skip {
  animation: nxpSkipIn 0.5s ease 0.8s forwards;
}

@keyframes nxpSkipIn {
  to { opacity: 1; transform: translateY(0); }
}

.nxp-entry__skip:hover,
.nxp-entry__skip:focus-visible {
  color: #00e5ff;
  border-color: rgba(0, 229, 255, 0.55);
  background: rgba(0, 229, 255, 0.08);
  outline: none;
}

html.nxp-entry-done #nxp-entry {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .nxp-entry { display: none !important; }
}

@media (max-width: 480px) {
  .nxp-entry__wordmark { letter-spacing: 0.08em; text-indent: 0.08em; }
}
