/**
 * Tactical boot HUD — scoped to .boot-hud only (homepage overlay).
 * Palette: deep black, gold #D4A017, white.
 */

body.boot-hud-open {
  overflow: hidden;
}

.boot-hud {
  --hud-gold: #d4a017;
  --hud-gold-dim: rgba(212, 160, 23, 0.35);
  --hud-white: rgba(255, 255, 255, 0.92);
  --hud-black: #030304;
  --hud-font: ui-monospace, "Cascadia Mono", "Segoe UI Mono", monospace;

  position: fixed;
  inset: 0;
  z-index: 10050;
  display: grid;
  place-items: center;
  font-family: var(--hud-font);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hud-white);
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.boot-hud.is-active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.boot-hud__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 50%, rgba(212, 160, 23, 0.06) 0%, transparent 55%),
    linear-gradient(180deg, #050506 0%, var(--hud-black) 50%, #020203 100%);
}

.boot-hud__grid {
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-size: 48px 48px;
  background-image:
    linear-gradient(rgba(212, 160, 23, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
}

.boot-hud.is-active .boot-hud__grid {
  animation: boot-hud-grid-flicker 2.8s ease-in-out infinite;
}

@keyframes boot-hud-grid-flicker {
  0%,
  100% {
    opacity: 0.08;
  }
  12% {
    opacity: 0.18;
  }
  13% {
    opacity: 0.05;
  }
  25% {
    opacity: 0.15;
  }
  40% {
    opacity: 0.06;
  }
  55% {
    opacity: 0.16;
  }
  70% {
    opacity: 0.09;
  }
  88% {
    opacity: 0.2;
  }
}

.boot-hud__scan {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.boot-hud__scan::after {
  content: "";
  position: absolute;
  left: -10%;
  width: 120%;
  height: 14%;
  top: -20%;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(212, 160, 23, 0.04) 40%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(212, 160, 23, 0.06) 60%,
    transparent 100%
  );
  box-shadow: 0 0 40px rgba(212, 160, 23, 0.15);
}

.boot-hud.is-active .boot-hud__scan::after {
  animation: boot-hud-scan 2.6s ease-in-out infinite;
}

@keyframes boot-hud-scan {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  92% {
    opacity: 1;
  }
  100% {
    transform: translateY(520%);
    opacity: 0;
  }
}

.boot-hud__corners {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.boot-hud__corner {
  position: absolute;
  width: min(22vw, 140px);
  height: min(22vw, 140px);
  border-color: var(--hud-gold);
  border-style: solid;
  opacity: 0.95;
}

.boot-hud.is-active .boot-hud__corner {
  animation: boot-hud-corner-in 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.boot-hud__corner--tl {
  top: 1.25rem;
  left: 1.25rem;
  border-width: 3px 0 0 3px;
  transform: translate(-80%, -80%) scale(1.4);
  animation-delay: 0.05s;
}

.boot-hud__corner--tr {
  top: 1.25rem;
  right: 1.25rem;
  border-width: 3px 3px 0 0;
  transform: translate(80%, -80%) scale(1.4);
  animation-delay: 0.1s;
}

.boot-hud__corner--bl {
  bottom: 1.25rem;
  left: 1.25rem;
  border-width: 0 0 3px 3px;
  transform: translate(-80%, 80%) scale(1.4);
  animation-delay: 0.15s;
}

.boot-hud__corner--br {
  bottom: 1.25rem;
  right: 1.25rem;
  border-width: 0 3px 3px 0;
  transform: translate(80%, 80%) scale(1.4);
  animation-delay: 0.2s;
}

@keyframes boot-hud-corner-in {
  to {
    transform: translate(0, 0) scale(1);
  }
}

.boot-hud__radar {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  width: min(55vmin, 420px);
  height: min(55vmin, 420px);
  pointer-events: none;
}

.boot-hud__radar span {
  position: absolute;
  inset: 0;
  border: 1px solid var(--hud-gold-dim);
  border-radius: 50%;
}

.boot-hud.is-active .boot-hud__radar span {
  animation: boot-hud-radar-pulse 2.4s ease-out infinite;
}

.boot-hud.is-active .boot-hud__radar span:nth-child(1) {
  animation-delay: 0s;
}

.boot-hud.is-active .boot-hud__radar span:nth-child(2) {
  animation-delay: 0.55s;
}

.boot-hud.is-active .boot-hud__radar span:nth-child(3) {
  animation-delay: 1.1s;
}

@keyframes boot-hud-radar-pulse {
  0% {
    transform: scale(0.35);
    opacity: 0.9;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

.boot-hud__readouts {
  position: absolute;
  left: clamp(1rem, 4vw, 2rem);
  top: calc(var(--nav-h, 4rem) + 0.75rem);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 0 12px rgba(212, 160, 23, 0.35);
}

.boot-hud__readouts--right {
  left: auto;
  right: clamp(1rem, 4vw, 2rem);
  align-items: flex-end;
  text-align: right;
}

.boot-hud__line {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.boot-hud__readouts--right .boot-hud__line {
  flex-direction: row-reverse;
}

.boot-hud__lbl {
  color: var(--hud-gold);
  font-size: 9px;
  opacity: 0.85;
}

.boot-hud__val {
  color: var(--hud-white);
  font-variant-numeric: tabular-nums;
  min-width: 4.5ch;
}

.boot-hud__center {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-top: 6vh;
}

.boot-hud__ring-wrap {
  position: relative;
  width: 120px;
  height: 120px;
}

.boot-hud__ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.boot-hud__ring-bg {
  fill: none;
  stroke: rgba(212, 160, 23, 0.12);
  stroke-width: 4;
}

.boot-hud__ring-fill {
  fill: none;
  stroke: #d4a017;
  stroke: url(#boot-hud-ring-grad);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 251.33;
  stroke-dashoffset: 251.33;
  filter: drop-shadow(0 0 6px rgba(212, 160, 23, 0.6));
}

.boot-hud.is-active .boot-hud__ring-fill {
  animation: boot-hud-ring-fill 2.85s cubic-bezier(0.45, 0, 0.15, 1) forwards;
}

@keyframes boot-hud-ring-fill {
  to {
    stroke-dashoffset: 0;
  }
}

.boot-hud__pct {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--hud-white);
  text-shadow: 0 0 20px rgba(212, 160, 23, 0.5);
}

.boot-hud__bar-track {
  width: min(240px, 70vw);
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(212, 160, 23, 0.2);
}

.boot-hud__bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.5), var(--hud-gold));
  box-shadow: 0 0 16px rgba(212, 160, 23, 0.55);
}

.boot-hud.is-active .boot-hud__bar-fill {
  animation: boot-hud-bar-fill 2.85s cubic-bezier(0.45, 0, 0.15, 1) forwards;
}

@keyframes boot-hud-bar-fill {
  to {
    width: 100%;
  }
}

.boot-hud__status {
  margin: 0;
  max-width: 18rem;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.5;
}

.boot-hud__ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent calc(100% / 24 - 1px),
      rgba(212, 160, 23, 0.25) calc(100% / 24 - 1px),
      rgba(212, 160, 23, 0.25) calc(100% / 24)
    );
  mask-image: linear-gradient(180deg, black 0%, transparent 12%, transparent 88%, black 100%);
  -webkit-mask-image: linear-gradient(180deg, black 0%, transparent 12%, transparent 88%, black 100%);
}

.boot-hud.is-exit .boot-hud__grid,
.boot-hud.is-exit .boot-hud__scan::after,
.boot-hud.is-exit .boot-hud__radar span {
  animation: none;
  opacity: 0.06;
}

.boot-hud.is-exit {
  animation: boot-hud-glitch-out 0.55s ease forwards;
}

@keyframes boot-hud-glitch-out {
  0% {
    opacity: 1;
    filter: none;
    transform: translate(0, 0);
  }
  10% {
    opacity: 1;
    transform: translate(-4px, 2px);
    filter: hue-rotate(0deg) contrast(1.2);
  }
  20% {
    transform: translate(5px, -3px);
    clip-path: inset(0 0 0 0);
  }
  30% {
    clip-path: inset(12% 0 55% 0);
    transform: translate(-3px, 0);
  }
  45% {
    clip-path: inset(40% 0 20% 0);
    transform: translate(4px, 2px);
    opacity: 0.85;
  }
  60% {
    clip-path: inset(5% 10% 60% 8%);
    filter: contrast(1.4) brightness(1.15);
  }
  100% {
    opacity: 0;
    transform: translate(0, 0) scale(1.02);
    clip-path: inset(50% 50% 50% 50%);
    filter: brightness(1.5) blur(2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .boot-hud.is-active .boot-hud__grid,
  .boot-hud.is-active .boot-hud__scan::after,
  .boot-hud.is-active .boot-hud__radar span {
    animation: none !important;
    opacity: 0.1;
  }

  .boot-hud.is-active .boot-hud__corner {
    animation: none !important;
    transform: translate(0, 0) scale(1);
  }

  .boot-hud.is-active .boot-hud__ring-fill {
    animation: boot-hud-ring-fill-reduced 0.45s linear forwards;
  }

  .boot-hud.is-active .boot-hud__bar-fill {
    animation: boot-hud-bar-fill-reduced 0.45s linear forwards;
  }

  @keyframes boot-hud-ring-fill-reduced {
    to {
      stroke-dashoffset: 0;
    }
  }

  @keyframes boot-hud-bar-fill-reduced {
    to {
      width: 100%;
    }
  }

  .boot-hud.is-exit {
    animation: boot-hud-fade-out 0.35s ease forwards;
  }

  @keyframes boot-hud-fade-out {
    to {
      opacity: 0;
    }
  }
}
