/* ==========================================================
   APRIANI-SYS // HUD STYLESHEET
   Palette: void #000 · cyber #00f0ff · threat #ff003c · term #00ff41 · neon #a855f7
   ========================================================== */

:root {
  --void: #000000;
  --cyber: #00f0ff;
  --threat: #ff003c;
  --term: #00ff41;
  --neon: #a855f7;
  --term-h: 190px;
}

html { scroll-behavior: smooth; }
body { padding-bottom: var(--term-h); overflow-x: hidden; }
body.booting { overflow: hidden; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { background: rgba(0, 240, 255, 0.25); }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 240, 255, 0.5); }

/* ---------- Ambient layers ---------- */
.crt {
  background:
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
  animation: crt-flicker 6s infinite steps(1);
}
.crt::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent, rgba(0, 240, 255, 0.06) 50%, transparent);
  height: 18vh;
  animation: crt-roll 7s linear infinite;
}
@keyframes crt-roll { from { transform: translateY(-20vh); } to { transform: translateY(120vh); } }
@keyframes crt-flicker { 0%, 100% { opacity: 1; } 47% { opacity: 0.85; } 48% { opacity: 1; } 82% { opacity: 0.92; } }

.vignette { background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.85) 100%); }

.grid-floor {
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
}

/* ---------- Pulsing radar status light ---------- */
.radar-dot {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.radar-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  border: 1px solid currentColor;
  animation: ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes ping { 0% { transform: scale(1); opacity: 0.9; } 100% { transform: scale(3.2); opacity: 0; } }

.defcon { box-shadow: 0 0 14px rgba(255, 0, 60, 0.35), inset 0 0 10px rgba(255, 0, 60, 0.15); animation: defcon 1.6s ease-in-out infinite; }
@keyframes defcon { 50% { box-shadow: 0 0 22px rgba(255, 0, 60, 0.6), inset 0 0 14px rgba(255, 0, 60, 0.25); } }

/* ---------- Glitch heading ---------- */
.glitch {
  position: relative;
  text-shadow: 0 0 18px rgba(0, 240, 255, 0.35);
}
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.glitch::before {
  color: var(--threat);
  transform: translate(-2px, 0);
  mix-blend-mode: screen;
  animation: glitch-a 3.2s infinite linear alternate-reverse;
}
.glitch::after {
  color: var(--cyber);
  transform: translate(2px, 0);
  mix-blend-mode: screen;
  animation: glitch-b 2.6s infinite linear alternate-reverse;
}
@keyframes glitch-a {
  0%, 88% { clip-path: inset(0 0 100% 0); }
  89% { clip-path: inset(12% 0 70% 0); transform: translate(-4px, 0); }
  92% { clip-path: inset(55% 0 20% 0); transform: translate(3px, 0); }
  95% { clip-path: inset(80% 0 5% 0); transform: translate(-2px, 0); }
  100% { clip-path: inset(30% 0 50% 0); transform: translate(2px, 0); }
}
@keyframes glitch-b {
  0%, 85% { clip-path: inset(100% 0 0 0); }
  87% { clip-path: inset(65% 0 10% 0); transform: translate(4px, 0); }
  91% { clip-path: inset(5% 0 80% 0); transform: translate(-3px, 0); }
  96% { clip-path: inset(40% 0 40% 0); transform: translate(2px, 0); }
  100% { clip-path: inset(20% 0 60% 0); transform: translate(-1px, 0); }
}

/* ---------- HUD panels (glowing 1px border + corner brackets) ---------- */
.hud-panel {
  --c: var(--cyber);
  position: relative;
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 7%, transparent), rgba(0, 0, 0, 0.75) 45%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 24px -6px color-mix(in srgb, var(--c) 45%, transparent), inset 0 0 30px -18px var(--c);
}
.hud-panel::before,
.hud-panel::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--c);
  pointer-events: none;
}
.hud-panel::before { top: -1px; left: -1px; border-top: 2px solid; border-left: 2px solid; }
.hud-panel::after { bottom: -1px; right: -1px; border-bottom: 2px solid; border-right: 2px solid; }

/* ---------- Radar ---------- */
.radar {
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 9999px;
  border: 1px solid rgba(0, 240, 255, 0.45);
  background:
    radial-gradient(circle, transparent 0 22%, rgba(0, 240, 255, 0.25) 22.5% 23%, transparent 23.5% 45%, rgba(0, 240, 255, 0.2) 45.5% 46%, transparent 46.5% 68%, rgba(0, 240, 255, 0.15) 68.5% 69%, transparent 69.5%),
    linear-gradient(transparent 49.6%, rgba(0, 240, 255, 0.2) 49.6% 50.4%, transparent 50.4%),
    linear-gradient(90deg, transparent 49.6%, rgba(0, 240, 255, 0.2) 49.6% 50.4%, transparent 50.4%),
    radial-gradient(circle, rgba(0, 240, 255, 0.08), transparent 70%);
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.2), inset 0 0 24px rgba(0, 240, 255, 0.1);
  overflow: hidden;
}
@media (min-width: 640px) { .radar { width: 150px; height: 150px; } }
.radar-sweep {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: conic-gradient(from 0deg, rgba(0, 240, 255, 0.55), rgba(0, 240, 255, 0.05) 60deg, transparent 90deg);
  animation: sweep 3.5s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }
.blip {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: var(--cyber);
  box-shadow: 0 0 10px var(--cyber);
  animation: blip 3.5s ease-out infinite;
  animation-delay: var(--d);
}
.blip-red { background: var(--threat); box-shadow: 0 0 10px var(--threat); }
.blip-purple { background: var(--neon); box-shadow: 0 0 10px var(--neon); }
@keyframes blip { 0% { opacity: 1; transform: scale(1.4); } 70%, 100% { opacity: 0.1; transform: scale(1); } }

/* ---------- Section headings ---------- */
.section-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.75rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
}
.section-head h2 {
  color: #fff;
  font-size: clamp(1.25rem, 3.6vw, 2rem);
  letter-spacing: 0.12em;
  white-space: nowrap;
}
.section-head .line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.5), transparent);
}
@media (max-width: 420px) { .section-head h2 { white-space: normal; } }

/* ---------- Bento cards ---------- */
.bento {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  min-height: 360px;
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
  isolation: isolate;
}
.bento > * { position: relative; z-index: 1; }
.bento .spot {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--rgb), 0.16), transparent 60%);
}
.bento:hover { transform: translateY(-4px); border-color: var(--c); box-shadow: 0 0 40px -6px rgba(var(--rgb), 0.55), inset 0 0 40px -20px var(--c); }
.bento:hover .spot { opacity: 1; }

.chip {
  font-size: 11px;
  padding: 0.3rem 0.6rem;
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  color: color-mix(in srgb, var(--c) 70%, #fff);
  background: color-mix(in srgb, var(--c) 6%, transparent);
  transition: all 0.2s ease;
}
.chip:hover { background: color-mix(in srgb, var(--c) 18%, transparent); border-color: var(--c); color: #fff; box-shadow: 0 0 12px -2px var(--c); }

.meter {
  --c: inherit;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(90deg, var(--c, var(--cyber)) 0 6px, transparent 6px 8px);
  box-shadow: 0 0 10px var(--c, var(--cyber));
  transition: width 1.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.meter.on > span { width: var(--w); }

/* ---------- Missions: hover-to-unredact ---------- */
.mission { padding: 1.25rem 1.25rem 1.4rem; cursor: crosshair; outline: none; transition: box-shadow 0.35s, border-color 0.35s; }
@media (min-width: 640px) { .mission { padding: 1.5rem 1.75rem 1.75rem; } }
.mission:hover, .mission:focus-visible, .mission.revealed { border-color: var(--c); box-shadow: 0 0 36px -8px var(--c), inset 0 0 40px -24px var(--c); }

.mission-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.75rem 1.25rem; }
.mission-head .op {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: #000;
  background: var(--c);
  padding: 0.2rem 0.55rem;
  box-shadow: 0 0 14px -2px var(--c);
}
.mission-head h3 { font-family: 'Share Tech Mono', monospace; color: #fff; font-size: clamp(1rem, 2.4vw, 1.35rem); letter-spacing: 0.08em; line-height: 1.25; }
.mission-head .org { margin-top: 0.2rem; font-size: 13px; color: #94a3b8; }
.mission-head .meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; font-family: 'Share Tech Mono', monospace; font-size: 11px; letter-spacing: 0.2em; }
@media (max-width: 767px) { .mission-head .meta { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; } }
.mission-head .date { color: var(--c); }
.mission-head .status { color: #64748b; border: 1px solid rgba(100, 116, 139, 0.4); padding: 0.1rem 0.45rem; transition: all 0.3s; }
.mission:hover .status, .mission:focus-visible .status, .mission.revealed .status { color: var(--term); border-color: rgba(0, 255, 65, 0.5); }

.mission-body { margin-top: 1.1rem; font-size: 14px; line-height: 2; color: #e2e8f0; }
.redact {
  color: transparent;
  background-image: repeating-linear-gradient(90deg, #15171c 0 14px, #1b1e24 14px 15px);
  background-repeat: no-repeat;
  background-size: 100% 78%;
  background-position: right center;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: background-size 0.55s cubic-bezier(0.7, 0, 0.2, 1), color 0.3s ease 0.2s;
  user-select: none;
}
.mission:hover .redact,
.mission:focus-visible .redact,
.mission.revealed .redact { background-size: 0% 78%; color: inherit; user-select: text; }
.mission .redact:nth-child(2) { transition-delay: 0.12s, 0.32s; }
.mission .redact:nth-child(3) { transition-delay: 0.24s, 0.44s; }
.mission .redact:nth-child(4) { transition-delay: 0.36s, 0.56s; }

@media (hover: none) { .hover-hint { font-size: 0; } .hover-hint::after { content: 'TAP'; font-size: 11px; } }

/* ---------- Clearance badges ---------- */
.badge {
  --c: var(--cyber);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.1rem 1.1rem 1.2rem;
  border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 8%, transparent), rgba(0, 0, 0, 0.8));
  transition: all 0.3s ease;
  overflow: hidden;
}
.badge::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--c);
  box-shadow: 0 0 12px var(--c);
}
.badge:hover { border-color: var(--c); box-shadow: 0 0 28px -6px var(--c); transform: translateY(-3px); }
.badge-code { font-family: 'Share Tech Mono', monospace; font-size: 1.75rem; color: var(--c); letter-spacing: 0.08em; text-shadow: 0 0 14px color-mix(in srgb, var(--c) 60%, transparent); }
.badge-name { font-size: 13px; color: #f1f5f9; line-height: 1.4; }
.badge-issuer { font-family: 'Share Tech Mono', monospace; font-size: 10px; letter-spacing: 0.2em; color: #64748b; text-transform: uppercase; }

.academic { padding: 1.5rem; }

/* ---------- Terminal ---------- */
.term-output { height: 118px; scrollbar-width: thin; }
@media (min-width: 640px) { .term-output { height: 140px; } }
#terminal.collapsed .term-output { height: 0; padding: 0; }
.term-line { white-space: pre-wrap; word-break: break-word; }
.term-line .p { color: var(--term); }
.t-cyber { color: var(--cyber); }
.t-red { color: var(--threat); }
.t-green { color: var(--term); }
.t-purple { color: var(--neon); }
.t-dim { color: #64748b; }
#term-input { caret-color: var(--term); }

/* ---------- Boot ---------- */
#boot .cursor::after { content: '█'; animation: blink 0.8s steps(1) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.boot-noise { color: rgba(0, 255, 65, 0.35); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .glitch::before, .glitch::after { display: none; }
}
