/* ==================================================
   BIOMETRIC — Face scan, fingerprint auth, feature tags
   Loaded LAST. Lóvi-inspired but cyber-styled.
   ================================================== */

/* ---------- Footer fix (no overlap with HUD) ---------- */
.footer { padding: 3rem 0 2rem !important; position: relative; z-index: 5; }
.footer-bottom {
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 1rem !important;
}
.footer-legal {
  display: flex; gap: 1.2rem; flex-wrap: wrap;
}
.footer-legal a {
  font-family: 'JetBrains Mono', monospace;
  font-size: .68rem; letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: .5rem .8rem;
  border: 1px solid var(--line);
  transition: all .25s;
}
.footer-legal a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(163,230,53,.04);
}

/* Move HUD higher so it doesn't sit on the footer */
.cyber-hud {
  bottom: 8rem !important;
  right: 1.2rem !important;
}
@media (max-width: 768px) { .cyber-hud { display: none !important; } }

/* ---------- Profile card frame — make image background subtle ---------- */
.profile-frame {
  background: linear-gradient(180deg, #0a0d0b, #060807) !important;
}
.profile-frame img {
  /* Cleaner blend with overlays */
  filter: contrast(1.05) brightness(.95) saturate(.95) !important;
}

/* ---------- FACE SCAN OVERLAY (drawn by JS into .face-scan) ---------- */
.face-scan {
  position: absolute; inset: 14px;
  z-index: 4; pointer-events: none;
}

/* Targeting reticle around face (animated) */
.face-scan .reticle {
  position: absolute;
  top: 18%; left: 22%;
  width: 56%; height: 50%;
  border: 1.5px solid var(--accent);
  box-shadow: 0 0 0 9999px rgba(0,0,0,.18) inset;
  opacity: 0;
  animation: reticleIn 1.2s .6s cubic-bezier(.25,1,.5,1) forwards;
}
.face-scan .reticle::before, .face-scan .reticle::after,
.face-scan .reticle .lt, .face-scan .reticle .rt,
.face-scan .reticle .lb, .face-scan .reticle .rb {
  content: ''; position: absolute; width: 14px; height: 14px;
  border-color: var(--accent); border-style: solid; border-width: 0;
}
.face-scan .reticle::before { top: -3px; left: -3px; border-top-width: 2.5px; border-left-width: 2.5px; }
.face-scan .reticle::after  { top: -3px; right: -3px; border-top-width: 2.5px; border-right-width: 2.5px; }
.face-scan .reticle .lb     { bottom: -3px; left: -3px; border-bottom-width: 2.5px; border-left-width: 2.5px; }
.face-scan .reticle .rb     { bottom: -3px; right: -3px; border-bottom-width: 2.5px; border-right-width: 2.5px; }

@keyframes reticleIn {
  0%   { opacity: 0; transform: scale(1.3); }
  100% { opacity: 1; transform: scale(1); }
}

/* Sweeping horizontal scan line (faster, more visible) */
.face-scan .sweep {
  position: absolute; left: 0; right: 0; height: 30px;
  background: linear-gradient(180deg, transparent, rgba(163,230,53,.55), transparent);
  filter: blur(.5px);
  top: -30px;
  animation: sweepDown 2.6s 1.4s cubic-bezier(.4,0,.6,1) forwards;
}
@keyframes sweepDown {
  0%   { top: -30px; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* Feature dots — anchor points on the face */
.face-scan .dot {
  position: absolute;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(163,230,53,.18), 0 0 12px var(--accent);
  opacity: 0;
  animation: dotIn .4s forwards, dotPulse 2s 4.4s infinite;
  transform: translate(-50%, -50%);
}
.face-scan .dot.d1 { top: 32%; left: 38%; animation-delay: 3.0s, 4.4s; }
.face-scan .dot.d2 { top: 32%; left: 62%; animation-delay: 3.2s, 4.6s; }
.face-scan .dot.d3 { top: 50%; left: 50%; animation-delay: 3.4s, 4.8s; }
.face-scan .dot.d4 { top: 70%; left: 50%; animation-delay: 3.6s, 5.0s; }
@keyframes dotIn { from { opacity: 0; transform: translate(-50%, -50%) scale(0); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes dotPulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(163,230,53,.18), 0 0 12px var(--accent); }
  50%     { box-shadow: 0 0 0 6px rgba(163,230,53,.06), 0 0 18px var(--accent); }
}

/* Connecting lines from dot to floating tag */
.face-scan .link {
  position: absolute;
  width: 1px;
  background: linear-gradient(0deg, transparent, var(--accent));
  transform-origin: top center;
  opacity: 0;
  animation: linkIn .5s forwards;
}
.face-scan .link.l1 { top: 32%; left: 38%; height: 0; transform: rotate(-130deg); animation-delay: 3.2s; --to-h: 60px; }
.face-scan .link.l2 { top: 32%; left: 62%; height: 0; transform: rotate(130deg);  animation-delay: 3.4s; --to-h: 60px; }
.face-scan .link.l3 { top: 50%; left: 50%; height: 0; transform: rotate(-90deg);  animation-delay: 3.6s; --to-h: 70px; }
.face-scan .link.l4 { top: 70%; left: 50%; height: 0; transform: rotate(90deg);   animation-delay: 3.8s; --to-h: 70px; }
@keyframes linkIn {
  0% { height: 0; opacity: 0; }
  100% { height: var(--to-h); opacity: .8; }
}

/* Floating feature tags (Lóvi style, cyber palette) */
.face-scan .tag {
  position: absolute;
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .65rem;
  background: rgba(4,6,5,.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: .58rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(8px);
  animation: tagIn .5s forwards;
  pointer-events: none;
}
.face-scan .tag .ok {
  display: inline-grid; place-items: center;
  width: 12px; height: 12px;
  background: var(--accent); color: #0a0d0b;
  border-radius: 50%; font-size: 7px;
}
.face-scan .tag .pct { color: var(--accent); }

.face-scan .tag.t1 { top: 8%;  left: -16%; animation-delay: 3.5s; }
.face-scan .tag.t2 { top: 8%;  right: -22%; animation-delay: 3.7s; }
.face-scan .tag.t3 { top: 30%; right: -28%; animation-delay: 3.9s; }
.face-scan .tag.t4 { bottom: 14%; right: -22%; animation-delay: 4.1s; }
.face-scan .tag.t5 { bottom: 4%; left: -18%; animation-delay: 4.3s; }
@keyframes tagIn {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1024px) {
  .face-scan .tag.t1, .face-scan .tag.t5 { left: 0; }
  .face-scan .tag.t2, .face-scan .tag.t3, .face-scan .tag.t4 { right: 0; }
}

/* Status text that updates during scan ("FACE SCAN IN PROGRESS..." → "VERIFIED") */
.face-scan .status-overlay {
  position: absolute;
  top: 12px; left: 12px; right: 12px;
  display: flex; justify-content: space-between; align-items: flex-start;
  font-family: 'JetBrains Mono', monospace;
  font-size: .55rem; letter-spacing: .25em;
  color: var(--accent);
  text-transform: uppercase;
  pointer-events: none;
}
.face-scan .status-overlay .left, .face-scan .status-overlay .right {
  display: grid; gap: .15rem;
}
.face-scan .status-overlay .right { text-align: right; }
.face-scan .status-overlay .label { color: var(--ink-faint); }
.face-scan .status-overlay .v { color: var(--accent); }

/* Big VERIFIED stamp (appears at end of scan) */
.face-scan .stamp {
  position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%) scale(.6) rotate(-8deg);
  border: 2px solid var(--accent);
  padding: .6rem 1.2rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem; font-weight: 700; letter-spacing: .15em;
  color: var(--accent);
  background: rgba(4,6,5,.5);
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  animation: stampIn .6s 4.6s cubic-bezier(.34,1.56,.64,1) forwards, stampSettle 1.5s 5.4s forwards;
  text-shadow: 0 0 20px var(--accent);
  box-shadow: 0 0 40px rgba(163,230,53,.3);
}
@keyframes stampIn {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.6) rotate(-8deg); }
  60%  { opacity: 1; transform: translate(-50%, -50%) scale(1.2) rotate(-8deg); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-8deg); }
}
@keyframes stampSettle {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-8deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1) rotate(-8deg); top: 18%; }
}

/* ---------- Always-on-the-photo confirmation ribbon (after scan) ---------- */
.face-scan .ribbon {
  position: absolute;
  bottom: -32px; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem .8rem;
  background: var(--accent); color: #0a0d0b;
  font-family: 'JetBrains Mono', monospace;
  font-size: .65rem; letter-spacing: .2em;
  text-transform: uppercase; font-weight: 700;
  opacity: 0;
  animation: ribbonIn .5s 6s forwards;
}
@keyframes ribbonIn {
  0% { opacity: 0; transform: translateY(-8px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ---------- Fingerprint Auth Button (under photo) ---------- */
.fp-auth {
  position: absolute;
  bottom: -88px;  /* sits under ribbon */
  left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: .8rem;
  padding: .65rem 1.1rem .65rem .8rem;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  font-family: 'JetBrains Mono', monospace;
  font-size: .65rem; letter-spacing: .2em;
  text-transform: uppercase; color: var(--ink-soft);
  cursor: pointer;
  transition: all .3s var(--ease, cubic-bezier(.25,1,.5,1));
}
.fp-auth:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(163,230,53,.04);
}
.fp-auth .fp-icon {
  position: relative;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--line-2);
  color: var(--accent);
  font-size: 1.1rem;
  background: var(--surface);
  transition: all .3s;
}
.fp-auth:hover .fp-icon {
  border-color: var(--accent);
  background: rgba(163,230,53,.08);
}
.fp-auth .fp-icon::before {
  content: ''; position: absolute; inset: -3px;
  border: 1px solid var(--accent); opacity: 0;
  animation: ringPulse 2s infinite;
}
.fp-auth.scanning .fp-icon::before { opacity: 1; }
.fp-auth.scanning .fp-icon {
  background: var(--accent); color: #0a0d0b;
}

.fp-auth .fp-label { display: grid; gap: .1rem; line-height: 1; }
.fp-auth .fp-label .top { color: var(--accent); font-size: .58rem; letter-spacing: .25em; }
.fp-auth .fp-label .bot { color: var(--ink); font-weight: 500; }

/* When fingerprint is in scanning state, ribbon shows VERIFYING */
.fp-auth.scanning .fp-label .top { color: var(--accent); }
.fp-auth.verified .fp-icon { background: var(--accent); color: #0a0d0b; }
.fp-auth.verified .fp-label .top { color: var(--accent); }
.fp-auth.verified .fp-label .bot { color: var(--accent); }

/* Hide native HUD biometric box (it was redundant) */
.profile-card .biometric-data { display: none !important; }
.profile-card .photo-meta-top { display: none !important; }
.profile-frame::before { display: none !important; }  /* old corner brackets — replaced by reticle */

/* Adjust profile card so ribbon + fingerprint button have room */
.profile-card { margin-bottom: 7rem; }

/* On hover of fp-auth, re-trigger scan animation */
.face-scan.rescan .reticle,
.face-scan.rescan .sweep,
.face-scan.rescan .dot,
.face-scan.rescan .link,
.face-scan.rescan .tag,
.face-scan.rescan .stamp,
.face-scan.rescan .ribbon {
  animation: none;
}
.face-scan.rescan .reticle { animation: reticleIn 1.2s .2s cubic-bezier(.25,1,.5,1) forwards; }
.face-scan.rescan .sweep   { animation: sweepDown 2.6s 1.0s cubic-bezier(.4,0,.6,1) forwards; }
.face-scan.rescan .dot.d1  { animation: dotIn .4s 2.6s forwards, dotPulse 2s 4.0s infinite; }
.face-scan.rescan .dot.d2  { animation: dotIn .4s 2.8s forwards, dotPulse 2s 4.2s infinite; }
.face-scan.rescan .dot.d3  { animation: dotIn .4s 3.0s forwards, dotPulse 2s 4.4s infinite; }
.face-scan.rescan .dot.d4  { animation: dotIn .4s 3.2s forwards, dotPulse 2s 4.6s infinite; }
.face-scan.rescan .link.l1 { animation: linkIn .5s 2.8s forwards; }
.face-scan.rescan .link.l2 { animation: linkIn .5s 3.0s forwards; }
.face-scan.rescan .link.l3 { animation: linkIn .5s 3.2s forwards; }
.face-scan.rescan .link.l4 { animation: linkIn .5s 3.4s forwards; }
.face-scan.rescan .tag.t1  { animation: tagIn .5s 3.1s forwards; }
.face-scan.rescan .tag.t2  { animation: tagIn .5s 3.3s forwards; }
.face-scan.rescan .tag.t3  { animation: tagIn .5s 3.5s forwards; }
.face-scan.rescan .tag.t4  { animation: tagIn .5s 3.7s forwards; }
.face-scan.rescan .tag.t5  { animation: tagIn .5s 3.9s forwards; }
.face-scan.rescan .stamp   { animation: stampIn .6s 4.2s cubic-bezier(.34,1.56,.64,1) forwards, stampSettle 1.5s 5.0s forwards; }
.face-scan.rescan .ribbon  { animation: ribbonIn .5s 5.6s forwards; }

/* ---------- Hide old photo-plate (replaced by ribbon + fp-auth) ---------- */
.profile-card .photo-plate { display: none !important; }

/* ---------- Re-enable scanlines on photo subtle ---------- */
.profile-frame > .scan-line { display: none !important; } /* superseded by .sweep */

/* ---------- Status overlay text strings (filled by JS too) ---------- */
.face-scan .status-overlay .scanning-only { animation: blink2 1s infinite; }

/* ---------- Make sure mobile shows the photo nicely ---------- */
@media (max-width: 1024px) {
  .profile-card { max-width: 320px !important; margin: 0 auto 6rem !important; }
}
