/* ============================================================
   TERMINAL PRELOADER
============================================================ */

#preloader,
.wanheda-preloader {
  --boot-red: #ff003c;
  --boot-red-soft: rgba(255, 0, 60, 0.55);
  --boot-red-dim: rgba(255, 0, 60, 0.12);

  --boot-white: #ffffff;
  --boot-text: rgba(255, 255, 255, 0.72);
  --boot-muted: rgba(255, 255, 255, 0.30);

  --boot-bg: #020202;

  position: fixed;
  inset: 0;

  width: 100%;
  height: 100dvh;

  display: flex;
  align-items: center;
  justify-content: center;

  background:
    radial-gradient(circle at center,
      rgba(255, 0, 60, 0.035),
      transparent 45%),
    #020202;

  overflow: hidden;

  z-index: 99997;

  color: var(--boot-text);

  font-family:
    var(--font-mono),
    "JetBrains Mono",
    "Fira Code",
    "Courier New",
    monospace;

  opacity: 1;
  visibility: visible;

  isolation: isolate;

  transition:
    opacity 0.7s cubic-bezier(.77, 0, .18, 1),
    visibility 0.7s;
}


/* ============================================================
   EXIT
   ============================================================ */

#preloader.fade-out,
.wanheda-preloader.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}


/* ============================================================
   CRT NOISE
   ============================================================ */

.hacker-noise {
  position: absolute;
  inset: -100%;

  z-index: 50;

  pointer-events: none;

  opacity: 0.045;

  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  animation:
    hackerNoise 0.11s steps(2) infinite;
}

@keyframes hackerNoise {

  0% {
    transform: translate(0, 0);
  }

  25% {
    transform: translate(2%, -1%);
  }

  50% {
    transform: translate(-1%, 2%);
  }

  75% {
    transform: translate(1%, 1%);
  }

  100% {
    transform: translate(-2%, -1%);
  }
}


/* ============================================================
   SCANLINES
   ============================================================ */

.hacker-scanlines {
  position: absolute;
  inset: 0;

  z-index: 40;

  pointer-events: none;

  background:
    repeating-linear-gradient(0deg,
      rgba(255, 255, 255, 0.025) 0,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px,
      transparent 4px);

  mix-blend-mode: screen;

  opacity: 0.8;
}


/* Moving scan beam */

.hacker-scanlines::after {
  content: "";

  position: absolute;

  left: 0;
  right: 0;

  top: -15%;

  height: 20%;

  background:
    linear-gradient(to bottom,
      transparent,
      rgba(255, 0, 60, 0.04),
      transparent);

  animation:
    scanBeam 5s linear infinite;
}

@keyframes scanBeam {

  from {
    transform: translateY(-120%);
  }

  to {
    transform: translateY(650%);
  }

}


/* ============================================================
   VIGNETTE
   ============================================================ */

.hacker-vignette {
  position: absolute;
  inset: 0;

  z-index: 45;

  pointer-events: none;

  background:
    radial-gradient(ellipse at center,
      transparent 35%,
      rgba(0, 0, 0, 0.45) 65%,
      rgba(0, 0, 0, 0.95) 100%);
}


/* ============================================================
   AMBIENT GRID
   ============================================================ */

.ambient-grid {
  position: absolute;
  inset: 0;

  z-index: 1;

  opacity: 0.13;

  pointer-events: none;

  background-image:
    linear-gradient(rgba(255, 0, 60, 0.045) 1px,
      transparent 1px),
    linear-gradient(90deg,
      rgba(255, 0, 60, 0.045) 1px,
      transparent 1px);

  background-size:
    45px 45px;

  mask-image:
    radial-gradient(circle at center,
      black 0%,
      transparent 75%);

  animation:
    gridDrift 12s linear infinite;
}

@keyframes gridDrift {

  from {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(45px, 45px, 0);
  }

}


/* ============================================================
   TERMINAL
   ============================================================ */

.hacker-terminal {

  position: relative;

  width: min(900px, 88vw);

  height: min(500px, 64vh);

  min-height: 320px;

  display: flex;

  flex-direction: column;

  background:
    linear-gradient(135deg,
      rgba(12, 12, 12, 0.98),
      rgba(2, 2, 2, 0.99));

  border:
    1px solid rgba(255, 0, 60, 0.22);

  border-radius: 3px;

  box-shadow:
    0 0 0 1px rgba(255, 0, 60, 0.025),
    0 0 35px rgba(255, 0, 60, 0.045),
    0 0 120px rgba(255, 0, 60, 0.025),
    inset 0 0 80px rgba(255, 0, 60, 0.018);

  overflow: hidden;

  z-index: 10;

  animation:
    terminalBoot 0.8s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes terminalBoot {

  0% {
    opacity: 0;
    transform:
      scaleY(0.02) scaleX(0.72);
    filter: brightness(3);
  }

  35% {
    opacity: 1;
    transform:
      scaleY(0.02) scaleX(1);
  }

  60% {
    transform:
      scaleY(1.04) scaleX(1);
  }

  100% {
    transform:
      scaleY(1) scaleX(1);

    filter: brightness(1);
  }

}

/* ============================================================
   TERMINAL HEADER
   ============================================================ */

.terminal-header {

  flex: 0 0 36px;

  display: flex;

  align-items: center;

  justify-content: space-between;

  padding:
    0 14px;

  border-bottom:
    1px solid rgba(255, 0, 60, 0.14);

  background:
    linear-gradient(90deg,
      rgba(255, 0, 60, 0.045),
      rgba(255, 255, 255, 0.012),
      rgba(255, 0, 60, 0.045));

  font-size: 9px;

  user-select: none;

  position: relative;
}


/* header shine */

.terminal-header::after {

  content: "";

  position: absolute;

  left: 0;
  right: 0;

  bottom: -1px;

  height: 1px;

  background:
    linear-gradient(90deg,
      transparent,
      var(--boot-red),
      transparent);

  opacity: 0.45;
}

/* ============================================================
   TERMINAL DOTS
   ============================================================ */

.terminal-dots {

  display: flex;

  align-items: center;

  gap: 6px;

  width: 100px;

  flex: 0 0 auto;
}

.terminal-dots span {

  width: 7px;
  height: 7px;

  border-radius: 50%;

  background:
    rgba(255, 0, 60, 0.45);

  box-shadow:
    0 0 6px rgba(255, 0, 60, 0.25);
}

.terminal-dots span:nth-child(2),
.terminal-dots span:nth-child(3) {

  background:
    rgba(255, 255, 255, 0.14);

  box-shadow: none;
}

/* ============================================================
   TITLE
   ============================================================ */

.terminal-title {

  flex: 1 1 auto;

  min-width: 0;

  text-align: center;

  color:
    rgba(255, 255, 255, 0.38);

  letter-spacing:
    0.14em;

  font-size: 9px;
}

/* ============================================================
   STATUS
   ============================================================ */

.terminal-status {

  width: 100px;

  flex: 0 0 auto;

  margin-left: auto;

  text-align: right;

  color:
    var(--boot-red-soft);

  font-size: 7px;

  letter-spacing:
    0.2em;

  transition:
    color 0.25s ease,
    text-shadow 0.25s ease;
}

.terminal-status.ready {

  color:
    #fff;

  text-shadow:
    0 0 10px var(--boot-red);
}

/* ============================================================
   TERMINAL BODY
   ============================================================ */

.terminal-body {

  position: relative;

  flex: 1;

  min-height: 0;

  display: flex;

  flex-direction: column;

  padding:
    20px 24px 18px;

  overflow: hidden;

  font-size: 11px;

  line-height: 1.7;

  color:
    var(--boot-text);
}

/* ============================================================
   OUTPUT
   ============================================================ */

.terminal-output {

  flex: 1;

  min-height: 0;

  overflow: hidden;

  white-space: pre-wrap;

  word-break: break-word;

  mask-image:
    linear-gradient(to bottom,
      transparent 0,
      black 8%,
      black 100%);
}

/* ============================================================
   TERMINAL LINES
   ============================================================ */

.terminal-line {

  min-height: 18px;

  animation:
    terminalLineAppear 0.16s ease both;
}

@keyframes terminalLineAppear {

  from {
    opacity: 0;
    transform:
      translateX(-5px);
  }

  to {
    opacity: 1;
    transform:
      translateX(0);
  }

}

.terminal-line.success {

  color:
    rgba(255, 0, 60, 0.9);

  text-shadow:
    0 0 8px rgba(255, 0, 60, 0.14);
}

.terminal-line.dim {

  color:
    rgba(255, 255, 255, 0.25);
}

.terminal-line.warning {

  color:
    rgba(255, 0, 60, 0.6);
}

.terminal-line.info {

  color:
    rgba(255, 255, 255, 0.48);
}

.terminal-line.highlight {

  color:
    #fff;

  text-shadow:
    0 0 12px rgba(255, 0, 60, 0.5);
}

/* ============================================================
   COMMAND
   ============================================================ */

.terminal-command {

  display: flex;

  align-items: center;

  flex: 0 0 auto;

  min-height: 22px;

  margin-top: 10px;

  color:
    rgba(255, 255, 255, 0.65);
}

.terminal-prompt {

  color:
    var(--boot-red);

  margin-right: 8px;

  text-shadow:
    0 0 8px rgba(255, 0, 60, 0.35);
}

.terminal-command-text {

  color:
    rgba(255, 255, 255, 0.82);

  min-width: 0;

  overflow: hidden;

  white-space: nowrap;

  text-overflow: clip;
}

/* ============================================================
   CURSOR
   ============================================================ */

.terminal-cursor {

  width: 7px;
  height: 14px;

  margin-left: 4px;

  flex: 0 0 auto;

  background:
    var(--boot-red);

  box-shadow:
    0 0 8px rgba(255, 0, 60, 0.8);

  animation:
    terminalCursor 0.7s steps(1) infinite;
}

@keyframes terminalCursor {

  50% {
    opacity: 0;
  }

}

/* ============================================================
   PROGRESS
   ============================================================ */

.boot-progress {

  flex: 0 0 auto;

  margin-top: 15px;
}

.progress-meta {

  display: flex;

  justify-content: space-between;

  margin-bottom: 6px;

  font-size: 7px;

  letter-spacing: 0.16em;

  color:
    rgba(255, 255, 255, 0.27);
}

.progress-track {

  position: relative;

  width: 100%;

  height: 2px;

  background:
    rgba(255, 255, 255, 0.07);

  overflow: hidden;
}

.progress-bar {

  width: 0%;

  height: 100%;

  background:
    linear-gradient(90deg,
      transparent,
      var(--boot-red),
      #fff);

  box-shadow:
    0 0 10px rgba(255, 0, 60, 0.7);

  transition:
    width 0.35s cubic-bezier(.16, 1, .3, 1);

  position: relative;
}

.progress-bar::after {

  content: "";

  position: absolute;

  right: 0;
  top: -3px;

  width: 18px;
  height: 8px;

  background:
    var(--boot-red);

  filter:
    blur(4px);

  opacity: 0.75;
}

/* ============================================================
   BINARY RAIN
   ============================================================ */

.binary-rain {

  position: absolute;

  inset: 0;

  z-index: 2;

  pointer-events: none;

  overflow: hidden;

  opacity: 0;

  transition:
    opacity 0.7s ease;
}

.binary-column {

  position: absolute;

  top: -120%;

  writing-mode: vertical-rl;

  color:
    rgba(255, 0, 60, 0.13);

  font-size:
    clamp(7px, 0.65vw, 10px);

  line-height: 1.5;

  letter-spacing: 0.08em;

  text-shadow:
    0 0 5px rgba(255, 0, 60, 0.2);

  animation:
    binaryFall linear infinite;
}

@keyframes binaryFall {

  from {
    transform:
      translateY(-10vh);
  }

  to {
    transform:
      translateY(230vh);
  }

}

/* ============================================================
   SYSTEM DATA
   ============================================================ */

.system-data {

  position: absolute;

  z-index: 5;

  display: flex;

  flex-direction: column;

  gap: 5px;

  font-size: 7px;

  letter-spacing: 0.14em;

  color:
    rgba(255, 255, 255, 0.18);

  pointer-events: none;

  user-select: none;
}

.system-data-left {

  left: 24px;

  bottom: 30px;

  text-align: left;
}

.system-data-right {

  right: 24px;

  bottom: 30px;

  text-align: right;
}

/* ============================================================
   HUD
   ============================================================ */

.boot-hud {

  position: absolute;

  z-index: 75;

  top: 20px;

  left: 25px;
  right: 25px;

  display: flex;

  align-items: center;

  justify-content: space-between;

  font-size: 7px;

  letter-spacing: 0.18em;

  color:
    rgba(255, 255, 255, 0.25);

  pointer-events: none;

  user-select: none;
}

.hud-left,
.hud-right,
.hud-center {

  display: flex;

  align-items: center;

  gap: 7px;
}

.hud-indicator {

  width: 5px;
  height: 5px;

  border-radius: 50%;

  background:
    var(--boot-red);

  box-shadow:
    0 0 9px var(--boot-red);

  animation:
    hudPulse 1.2s ease-in-out infinite;
}

@keyframes hudPulse {

  50% {
    opacity: 0.3;
  }

}

/* ============================================================
   IDENTITY
   ============================================================ */

.hacker-identity {

  position: absolute;

  left: 50%;
  top: 50%;

  transform:
    translate(-50%, -50%) scale(0.75);

  display: flex;

  flex-direction: column;

  align-items: center;

  opacity: 0;

  z-index: 60;

  pointer-events: none;

  width: min(900px, 92vw);
}

.identity-tag {

  margin-bottom: 16px;

  color:
    rgba(255, 0, 60, 0.6);

  font-size: 7px;

  letter-spacing:
    0.45em;

  text-transform:
    uppercase;
}

.identity-logo-wrap {

  position: relative;

  display: flex;

  align-items: center;

  justify-content: center;
}

.ascii-logo {

  position: relative;

  z-index: 3;

  margin: 0;

  font-family:
    "Courier New",
    monospace;

  font-size:
    clamp(7px, 1.15vw, 14px);

  line-height: 1.1;

  letter-spacing: 0;

  color:
    #fff;

  text-shadow:
    0 0 8px rgba(255, 0, 60, 0.85),
    0 0 25px rgba(255, 0, 60, 0.25);

  white-space: pre;

  user-select: none;
}


/* secondary text logo */

.identity-name {

  margin-top: 17px;

  color:
    #fff;

  font-size:
    clamp(15px, 2vw, 25px);

  font-weight: 700;

  letter-spacing:
    0.65em;

  padding-left:
    0.65em;

  text-shadow:
    0 0 10px rgba(255, 0, 60, 0.65),
    0 0 30px rgba(255, 0, 60, 0.25);
}

.identity-subtitle {

  margin-top: 14px;

  color:
    var(--boot-red);

  font-size: 8px;

  letter-spacing:
    0.32em;

  text-shadow:
    0 0 12px rgba(255, 0, 60, 0.6);
}

.identity-line {

  width: 180px;

  height: 1px;

  margin-top: 17px;

  background:
    linear-gradient(90deg,
      transparent,
      var(--boot-red),
      transparent);

  box-shadow:
    0 0 10px rgba(255, 0, 60, 0.5);
}

/* ============================================================
   GLITCH LAYERS
   ============================================================ */

.identity-glitch {

  position: absolute;

  left: 0;
  top: 0;

  font-family:
    "Courier New",
    monospace;

  font-size:
    clamp(7px, 1.15vw, 14px);

  line-height: 1.1;

  white-space: pre;

  opacity: 0;

  pointer-events: none;

  z-index: 5;
}

.identity-glitch-red {

  color:
    var(--boot-red);

  animation:
    identityGlitchRed 0.32s steps(2) infinite;
}

.identity-glitch-white {

  color:
    #fff;

  animation:
    identityGlitchWhite 0.24s steps(2) infinite;
}

@keyframes identityGlitchRed {

  0% {
    opacity: 0;
  }

  25% {
    opacity: 0.8;
    transform:
      translate(-8px, 0);
    clip-path:
      inset(15% 0 65% 0);
  }

  50% {
    opacity: 0;
  }

  70% {
    opacity: 0.55;
    transform:
      translate(6px, 0);
    clip-path:
      inset(55% 0 20% 0);
  }

  100% {
    opacity: 0;
  }

}

@keyframes identityGlitchWhite {

  0% {
    opacity: 0;
  }

  35% {
    opacity: 0.6;
    transform:
      translate(7px, 0);
    clip-path:
      inset(60% 0 10% 0);
  }

  65% {
    opacity: 0;
  }

  80% {
    opacity: 0.4;
    transform:
      translate(-5px, 0);
  }

  100% {
    opacity: 0;
  }

}

/* ============================================================
   FINAL MESSAGE
   ============================================================ */

.hacker-final {

  position: absolute;

  left: 50%;
  bottom: 9%;

  transform:
    translateX(-50%);

  display: flex;

  align-items: center;

  gap: 8px;

  z-index: 70;

  font-size: 9px;

  letter-spacing:
    0.24em;

  color:
    rgba(255, 0, 60, 0.85);

  opacity: 0;

  white-space: nowrap;

  text-shadow:
    0 0 10px rgba(255, 0, 60, 0.35);
}

.final-symbol {

  color:
    var(--boot-red);

  font-weight: 700;
}

.final-cursor {

  animation:
    finalCursor 0.6s steps(1) infinite;
}

@keyframes finalCursor {

  50% {
    opacity: 0;
  }

}

/* ============================================================
   FULLSCREEN GLITCH
   ============================================================ */

.hacker-glitch-overlay {

  position: absolute;

  inset: 0;

  z-index: 100;

  pointer-events: none;

  opacity: 0;

  background:
    repeating-linear-gradient(0deg,
      transparent 0,
      transparent 3px,
      rgba(255, 0, 60, 0.18) 3px,
      rgba(255, 0, 60, 0.18) 4px);
}

#preloader.glitch-active {

  animation:
    screenGlitch 0.5s steps(2) both;
}

#preloader.glitch-active .hacker-glitch-overlay {

  animation:
    glitchOverlay 0.5s steps(3) both;
}

@keyframes screenGlitch {

  0% {
    transform: translate(0);
  }

  15% {
    transform: translate(-7px, 1px);
  }

  30% {
    transform: translate(5px, -3px);
  }

  45% {
    transform: translate(-4px, 2px);
  }

  60% {
    transform: translate(7px, 0);
  }

  75% {
    transform: translate(-3px, -1px);
  }

  100% {
    transform: translate(0);
  }

}

@keyframes glitchOverlay {

  0% {
    opacity: 0;
  }

  15% {
    opacity: 0.9;
    transform: translateX(-12px);
  }

  30% {
    opacity: 0;
    transform: translateX(12px);
  }

  50% {
    opacity: 0.7;
    transform: translateX(-7px);
  }

  70% {
    opacity: 0.2;
  }

  100% {
    opacity: 0;
  }

}

/* ============================================================
   IDENTITY REVEAL
   ============================================================ */

#preloader.identity-active .hacker-terminal {

  animation:
    terminalDisappear 0.55s cubic-bezier(.77, 0, .18, 1) forwards;
}

#preloader.identity-active .hacker-identity {

  animation:
    identityReveal 0.8s cubic-bezier(.16, 1, .3, 1) forwards;
}

#preloader.identity-active .hacker-final {

  animation:
    finalMessageReveal 0.45s ease forwards;

  animation-delay:
    0.5s;
}

@keyframes terminalDisappear {

  0% {
    opacity: 1;
    transform: scale(1);
  }

  45% {
    opacity: 1;
    transform:
      scaleX(1.03) scaleY(0.025);
    filter:
      brightness(2);
  }

  100% {
    opacity: 0;
    transform:
      scaleX(1.35) scaleY(0.004);
    filter:
      brightness(4);
  }

}

@keyframes identityReveal {

  0% {
    opacity: 0;

    transform:
      translate(-50%, -50%) scale(1.5);

    filter:
      blur(18px) brightness(2);
  }

  35% {
    opacity: 1;

    transform:
      translate(-50%, -50%) scale(0.96);

    filter:
      blur(0) brightness(1.5);
  }

  65% {
    transform:
      translate(-50%, -50%) scale(1.02);
  }

  100% {
    opacity: 1;

    transform:
      translate(-50%, -50%) scale(1);

    filter:
      blur(0) brightness(1);
  }

}

@keyframes finalMessageReveal {

  from {
    opacity: 0;

    transform:
      translate(-50%, 10px);
  }

  to {
    opacity: 1;

    transform:
      translate(-50%, 0);
  }

}

/* ============================================================
   SKIP BUTTON
   ============================================================ */

.skip-boot {

  position: absolute;

  right: 25px;
  bottom: 22px;

  z-index: 90;

  border: 1px solid rgba(255, 0, 60, 0.2);

  background:
    rgba(0, 0, 0, 0.45);

  color:
    rgba(255, 255, 255, 0.3);

  padding:
    7px 10px;

  font-family:
    inherit;

  font-size: 7px;

  letter-spacing:
    0.14em;

  cursor: pointer;

  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.skip-boot span {

  color:
    rgba(255, 0, 60, 0.55);
}

.skip-boot:hover {

  color:
    #fff;

  border-color:
    rgba(255, 0, 60, 0.65);

  background:
    rgba(255, 0, 60, 0.06);
}

/* ============================================================
   CORNER MARKERS
   ============================================================ */

.corner-marker {

  position: absolute;

  width: 24px;
  height: 24px;

  z-index: 80;

  pointer-events: none;

  opacity: 0.4;
}

.corner-tl {
  top: 20px;
  left: 20px;

  border-top:
    1px solid var(--boot-red);

  border-left:
    1px solid var(--boot-red);
}

.corner-tr {
  top: 20px;
  right: 20px;

  border-top:
    1px solid var(--boot-red);

  border-right:
    1px solid var(--boot-red);
}

.corner-bl {
  bottom: 20px;
  left: 20px;

  border-bottom:
    1px solid var(--boot-red);

  border-left:
    1px solid var(--boot-red);
}

.corner-br {
  bottom: 20px;
  right: 20px;

  border-bottom:
    1px solid var(--boot-red);

  border-right:
    1px solid var(--boot-red);
}

/* ============================================================
   HIGH CONTRAST / FALLBACK
   ============================================================ */

@media (forced-colors: active) {

  #preloader {

    forced-color-adjust: none;
  }

}

/* ============================================================
   BODY LOCK
   ============================================================ */

body.loading {

  overflow: hidden;

  height: 100vh;
}

body.loading>*:not(#preloader) {

  pointer-events: none;
}