@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg: #070a0e;
  --bg2: #0b0f14;
  --panel: #10161d;
  --panel2: #141b24;
  --accent: #00e5a0;
  --accent2: #7c5cff;
  --accent3: #3dd6ff;
  --text: #e8eef5;
  --muted: #8b9bb0;
  --border: #1e2a36;
  --danger: #ff6b8a;
  --ok: #00e5a0;
  --font: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --radius: 16px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent3); text-decoration: none; }
a:hover { color: var(--accent); }

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.035;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem 5rem;
}

/* HERO */
.hero {
  position: relative;
  min-height: min(92vh, 860px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2rem 0 3rem;
  margin-bottom: 1rem;
}
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  border-radius: 0 0 28px 28px;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(124, 92, 255, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(0, 229, 160, 0.1), transparent 50%),
    linear-gradient(180deg, #05070a 0%, #0b0f14 100%);
}
.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 0 1.25rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: linear-gradient(135deg, #00e5a022, #7c5cff28);
  border: 1px solid #00e5a055;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.32rem 0.8rem;
  border-radius: 999px;
  margin-bottom: 1.1rem;
  backdrop-filter: blur(8px);
}
.badge .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.hero h1 {
  font-size: clamp(2.6rem, 8vw, 4.8rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.02;
  margin-bottom: 0.85rem;
}
.hero h1 .grad {
  background: linear-gradient(105deg, var(--accent) 0%, var(--accent3) 45%, var(--accent2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-lead {
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  color: var(--muted);
  max-width: 38rem;
  margin-bottom: 1.6rem;
}
.hero-lead strong { color: var(--text); font-weight: 500; }
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-bottom: 1.6rem;
}
.btn {
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.35rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #00b87f);
  color: #04140f;
  box-shadow: 0 8px 28px rgba(0, 229, 160, 0.25);
}
.btn-primary:hover { box-shadow: 0 10px 36px rgba(0, 229, 160, 0.4); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent2); color: #fff; }
.btn-sm {
  font-size: 0.82rem;
  padding: 0.5rem 0.95rem;
}
.law-pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: #b8f0d8;
  background: rgba(0, 229, 160, 0.08);
  border: 1px solid rgba(0, 229, 160, 0.28);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  max-width: 36rem;
}

/* X follow - hero chip */
.btn-x-follow {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1rem 0.55rem 0.85rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font);
  background:
    linear-gradient(135deg, rgba(10, 14, 20, 0.92), rgba(18, 12, 32, 0.88));
  border: 1px solid rgba(124, 92, 255, 0.45);
  box-shadow:
    0 0 0 1px rgba(0, 229, 160, 0.08) inset,
    0 8px 28px rgba(124, 92, 255, 0.18);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.btn-x-follow:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 229, 160, 0.55);
  box-shadow:
    0 0 0 1px rgba(0, 229, 160, 0.15) inset,
    0 12px 36px rgba(124, 92, 255, 0.28),
    0 0 24px rgba(0, 229, 160, 0.12);
  color: #fff;
}
.btn-x-follow:active { transform: scale(0.98); }
.x-follow-glow {
  position: absolute;
  inset: -40%;
  background: conic-gradient(from 120deg, transparent, rgba(0, 229, 160, 0.22), transparent 40%, rgba(124, 92, 255, 0.28), transparent 70%);
  animation: x-spin 6s linear infinite;
  opacity: 0.7;
  pointer-events: none;
}
@keyframes x-spin {
  to { transform: rotate(360deg); }
}
.btn-x-follow > *:not(.x-follow-glow) {
  position: relative;
  z-index: 1;
}
.btn-x-follow::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: linear-gradient(145deg, #0c1118 0%, #12101c 55%, #0a0e14 100%);
  z-index: 0;
}
.x-logo {
  flex-shrink: 0;
  color: #e8eef5;
  filter: drop-shadow(0 0 6px rgba(0, 229, 160, 0.35));
}
.x-follow-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  gap: 0.08rem;
}
.x-follow-kicker {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.x-follow-handle {
  font-family: var(--mono);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #f0f4fa;
}
.x-follow-chev {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--accent2);
  opacity: 0.85;
  margin-left: 0.15rem;
}

/* Fixed corner float */
.x-follow-float {
  position: fixed;
  z-index: 40;
  right: 1.1rem;
  bottom: 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem 0.55rem 0.75rem;
  border-radius: 999px;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: #e8eef5;
  background: rgba(10, 14, 20, 0.82);
  border: 1px solid rgba(0, 229, 160, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.45),
    0 0 20px rgba(124, 92, 255, 0.15);
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.x-follow-float:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 229, 160, 0.7);
  box-shadow:
    0 14px 44px rgba(0, 0, 0, 0.5),
    0 0 28px rgba(0, 229, 160, 0.18);
  color: #fff;
}
.x-follow-float-ring {
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 1px solid transparent;
  background:
    linear-gradient(rgba(10, 14, 20, 0.01), rgba(10, 14, 20, 0.01)) padding-box,
    linear-gradient(120deg, var(--accent), var(--accent2), var(--accent3)) border-box;
  opacity: 0.55;
  animation: x-pulse-ring 2.8s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}
@keyframes x-pulse-ring {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(1.02); }
}

@media (max-width: 520px) {
  .x-follow-float span:last-child { display: none; }
  .x-follow-float { padding: 0.7rem; }
  .x-follow-kicker { display: none; }
}

/* SECTIONS */
section {
  margin: 3.2rem 0;
}
.sec-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.55rem;
}
section h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 0.7rem;
}
.lede { color: var(--muted); max-width: 40rem; margin-bottom: 1.4rem; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.45rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.panel-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 820px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* BYTE GRID */
.byte-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.4rem, 1fr));
  gap: 0.28rem;
  max-height: 280px;
  overflow: auto;
  padding: 0.2rem;
}
.byte-cell {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.35rem 0;
  background: #0a1016;
  color: #7a8a9c;
  cursor: pointer;
}
.byte-cell.p0 {
  color: #9ff0d0;
  background: rgba(0, 229, 160, 0.08);
  border-color: rgba(0, 229, 160, 0.15);
}
.byte-cell.agent, .byte-cell.ev-agent {
  color: #d4c4ff;
  background: rgba(124, 92, 255, 0.18);
  border-color: rgba(124, 92, 255, 0.35);
}
.byte-cell.mm, .byte-cell.ev-multimodal {
  color: #9de8ff;
  background: rgba(61, 214, 255, 0.12);
  border-color: rgba(61, 214, 255, 0.3);
}
.byte-cell.p2, .byte-cell.p1, .byte-cell.ext {
  color: #f0c9a0;
  background: rgba(240, 160, 80, 0.1);
}
.byte-cell.active {
  outline: 2px solid var(--accent);
  transform: scale(1.06);
}
.byte-inspect {
  margin-top: 0.85rem;
  font-size: 0.88rem;
  color: var(--muted);
  min-height: 1.4rem;
}
.byte-inspect .ok { color: var(--ok); font-weight: 600; }

.hex-dump {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre;
  overflow: auto;
  max-height: 280px;
  color: #c5d4e4;
  background: #080c11;
  border: 1px solid #1a2530;
  border-radius: 10px;
  padding: 1rem;
}

.wire-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.4rem;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.9rem;
}
.wire-stats .ok { color: var(--ok); }

.event-stream {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 360px;
  overflow: auto;
}
.event-card {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--muted);
}
.event-card.kind-text { border-left-color: var(--accent); }
.event-card.kind-agent { border-left-color: var(--accent2); }
.event-card.kind-multimodal { border-left-color: var(--accent3); }
.ev-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.event-card pre, .event-card p {
  font-size: 0.9rem;
  color: var(--text);
}
.event-card pre {
  font-family: var(--mono);
  white-space: pre-wrap;
  color: #d4e0ec;
}
.mono-sm {
  font-family: var(--mono);
  font-size: 0.75rem;
  word-break: break-all;
  color: var(--muted);
}

textarea.hex-input {
  width: 100%;
  min-height: 140px;
  font-family: var(--mono);
  font-size: 0.82rem;
  background: #080c11;
  color: #d4e0ec;
  border: 1px solid #1a2530;
  border-radius: 10px;
  padding: 0.9rem;
  resize: vertical;
  margin-bottom: 0.75rem;
}
textarea.text-input {
  font-family: var(--font);
  font-size: 0.95rem;
  min-height: 140px;
}
.encode-opts {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}
.encode-opts .chk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
}
.encode-opts input[type="checkbox"] {
  accent-color: var(--accent);
  width: 1rem;
  height: 1rem;
}
.role-name {
  font-family: var(--mono);
  font-size: 0.82rem;
  background: #080c11;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.45rem;
  width: 7rem;
  max-width: 40vw;
}
.encode-opts select {
  font-family: var(--mono);
  font-size: 0.82rem;
  background: #080c11;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.45rem;
  max-width: min(100%, 22rem);
}
.lab-io .panel { min-height: 100%; }

/* SACRED METER */
.sacred-input {
  width: 100%;
  font-family: var(--mono);
  font-size: 1rem;
  background: #080c11;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
}
.meter-track {
  height: 8px;
  background: #1a2530;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.55rem;
}
.meter-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent3));
  transition: width 0.25s ease;
}
#sacred-meter {
  font-size: 0.9rem;
  color: var(--muted);
}
#sacred-meter.warn { color: #f0c9a0; }

/* MANIFESTO / PLANES */
.planes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.55rem;
}
.plane {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.8rem;
}
.plane .pid {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.plane .pname { font-weight: 600; font-size: 0.92rem; }
.plane .prole { font-size: 0.8rem; color: var(--muted); margin-top: 0.2rem; }

.quote {
  font-size: 1.15rem;
  color: var(--text);
  border-left: 3px solid var(--accent);
  padding: 0.2rem 0 0.2rem 1.1rem;
  margin: 1.2rem 0;
  max-width: 36rem;
}

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem; }
.tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  background: #1a2530;
  color: #9fb3c9;
  padding: 0.18rem 0.55rem;
  border-radius: 5px;
}

table.simple {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.simple th {
  text-align: left;
  color: var(--accent);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
table.simple td {
  padding: 0.5rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.simple code {
  font-family: var(--mono);
  font-size: 0.82em;
  color: #b8f0d8;
  background: #1a2530;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.footer {
  margin-top: 4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  justify-content: space-between;
  align-items: flex-start;
}

/* Infographic feature */
.info-panel { padding-bottom: 1.2rem; }
.info-link {
  display: block;
  margin-top: 0.35rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #080c11;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.info-link:hover {
  border-color: rgba(0, 229, 160, 0.45);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), 0 0 24px rgba(124, 92, 255, 0.12);
}
.infographic {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}
.info-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}

.decode-status {
  margin-top: 0.65rem;
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.3em;
}
.decode-status.ok { color: var(--ok); }
.decode-status.err { color: var(--danger); }

/* flash wire lab when decode runs */
#lab.lab-flash,
#lab-results.lab-flash,
#lab-units.lab-flash {
  outline: 2px solid rgba(0, 229, 160, 0.55);
  outline-offset: 8px;
  border-radius: 12px;
  transition: outline-color 0.9s ease;
}

@media (prefers-reduced-motion: reduce) {
  .badge .dot { animation: none; }
  .x-follow-glow,
  .x-follow-float-ring { animation: none; }
  * { transition: none !important; }
  #lab.lab-flash,
  #lab-results.lab-flash,
  #lab-units.lab-flash { outline: none; }
}
