<template>
  <div class="proof-banner">
    <span class="dot"></span>
    <span class="label">Live</span>
    <span class="spacer"></span>
    <span class="hash-glyph">&#x29C9;</span>
    <span class="mono">0x{{ hash }}</span>
  </div>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import { useBlockBeacons } from '../composables/useBlockBeacons'

const { beacons } = useBlockBeacons()

// Format the live block hash for the bottom strip: 6 chars … 3 chars, no 0x —
// the template already prepends "0x".
const hash = computed(() => {
  const top = beacons.value[0]
  if (!top) return '------…---'
  const raw = top.hash.startsWith('0x') ? top.hash.slice(2) : top.hash
  return `${raw.slice(0, 6)}…${raw.slice(-3)}`
})
</script>

<style scoped>
.proof-banner {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.85rem;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: #000;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-family: 'Inter', system-ui, sans-serif;
  z-index: 50;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 7px rgba(255, 255, 255, 0.55);
  animation: pulse 1.6s ease-in-out infinite;
  flex: 0 0 auto;
}
.label {
  font-size: 0.55rem;
  font-weight: 500;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}
.spacer { flex: 1 1 auto; }
.hash-glyph {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.7rem;
  line-height: 1;
}
.mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.62);
  font-variant-numeric: tabular-nums;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}
</style>
