/* =========================================================
   REKTIOM — base: tokens, reset, type, primitives, FX
   ========================================================= */
:root {
  --bg: #050505;
  --bg-2: #08080a;
  --panel: #0a0a0c;
  --panel-2: #0f0f12;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.13);
  --line-3: rgba(255, 255, 255, 0.22);
  --text: #ececec;
  --text-2: #b9b9be;
  --muted: #7c7c84;
  --dim: #44444b;
  --green: #39ff65;
  --green-d: #1f9c3d;
  --green-a: rgba(57, 255, 101, 0.12);
  --purple: #8b35ff;
  --purple-a: rgba(139, 53, 255, 0.16);
  --red: #ff3b5c;
  --red-a: rgba(255, 59, 92, 0.12);

  --f-display: "Archivo", "Arial Narrow", Impact, system-ui, sans-serif;
  --f-sans: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --r: 2px;
  --nav-h: 64px;
  --tape-h: 26px;
  --pad: clamp(16px, 4vw, 48px);
  --max: 1440px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + var(--tape-h) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
body.is-booting { overflow: hidden; }
img, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, p, ul, dl, dd, figure { margin: 0; }
ul { padding: 0; list-style: none; }
::selection { background: var(--green); color: #000; }

:focus-visible { outline: 1px solid var(--green); outline-offset: 3px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 1000;
  background: var(--green); color: #000; padding: 8px 12px; font-family: var(--f-mono); font-size: 12px;
}
.skip-link:focus { top: 12px; }

/* ---------- type helpers ---------- */
.mono { font-family: var(--f-mono); letter-spacing: 0; }
.muted { color: var(--muted); }
.g { color: var(--green); }
.p { color: var(--purple); }
.r { color: var(--red); }
.caret { display: inline-block; animation: blink 1.05s steps(1) infinite; color: var(--green); }
@keyframes blink { 50% { opacity: 0; } }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }

/* ---------- dots / chips / badges ---------- */
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; vertical-align: middle; margin-right: 7px; }
.dot--green { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }
.dot--red { background: var(--red); box-shadow: 0 0 8px var(--red); animation: pulse 1.2s infinite; }
.dot--purple { background: var(--purple); box-shadow: 0 0 8px var(--purple); }
@keyframes pulse { 50% { opacity: 0.35; } }

.chip {
  display: inline-flex; align-items: center; height: 30px; padding: 0 10px;
  border: 1px solid var(--line-2); font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em;
  color: var(--text-2); white-space: nowrap;
}
.badge {
  display: inline-flex; align-items: center; height: 18px; padding: 0 6px;
  font-family: var(--f-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  border: 1px solid currentColor; line-height: 1; white-space: nowrap;
}
.badge--demo { color: #ffb020; background: rgba(255, 176, 32, 0.08); }
.badge--live { color: var(--green); background: var(--green-a); }
.demo-note { color: #ffb020; font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
  --h: 44px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--h); padding: 0 20px; border: 1px solid var(--line-3); border-radius: var(--r);
  font-family: var(--f-mono); font-size: 13px; font-weight: 700; letter-spacing: 0.06em;
  white-space: nowrap; overflow: hidden; isolation: isolate;
  transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--green); transform: translateX(-101%); transition: transform .35s var(--ease);
}
.btn:hover::before, .btn:focus-visible::before { transform: translateX(0); }
.btn:hover, .btn:focus-visible { color: #000; border-color: var(--green); }
.btn:active { transform: translateY(1px); }
.btn--green { background: var(--green); color: #000; border-color: var(--green); }
.btn--green::before { background: #fff; }
.btn--green:hover { border-color: #fff; }
.btn--ghost { background: transparent; }
.btn--sm { --h: 34px; padding: 0 14px; font-size: 11.5px; }
.btn--lg { --h: 54px; padding: 0 26px; font-size: 14px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.is-pending { opacity: .62; }
.btn[disabled]::before { display: none; }
.btn[disabled]:hover { color: inherit; border-color: var(--line-3); }

/* pending (link not announced yet) */
[data-link].is-pending { cursor: not-allowed; }


/* ---------- glitch text ---------- */
.glitch { position: relative; display: inline-block; }
.glitch::before, .glitch::after {
  content: attr(data-text); position: absolute; inset: 0; pointer-events: none; opacity: 0;
}
.glitch::before { color: var(--purple); transform: translate(-2px, 0); }
.glitch::after { color: var(--green); transform: translate(2px, 0); mix-blend-mode: screen; }
.glitch.is-glitching::before, .glitch--hover:hover::before, .glitch--loop::before { opacity: .9; animation: glitchA .38s steps(2) infinite; }
.glitch.is-glitching::after, .glitch--hover:hover::after, .glitch--loop::after { opacity: .8; animation: glitchB .32s steps(2) infinite; }
.glitch--loop::before { animation: glitchA 3.2s steps(1) infinite; }
.glitch--loop::after { animation: glitchB 2.7s steps(1) infinite; }
@keyframes glitchA {
  0% { clip-path: inset(10% 0 70% 0); transform: translate(-4px, 0); }
  20% { clip-path: inset(60% 0 12% 0); transform: translate(3px, 0); }
  40% { clip-path: inset(35% 0 45% 0); transform: translate(-2px, 0); }
  60% { clip-path: inset(80% 0 4% 0); transform: translate(4px, 0); }
  80% { clip-path: inset(0 0 88% 0); transform: translate(-3px, 0); }
  92%, 100% { clip-path: inset(50% 0 50% 0); transform: none; }
}
@keyframes glitchB {
  0% { clip-path: inset(70% 0 8% 0); transform: translate(3px, 0); }
  25% { clip-path: inset(5% 0 80% 0); transform: translate(-4px, 0); }
  50% { clip-path: inset(44% 0 30% 0); transform: translate(2px, 0); }
  75% { clip-path: inset(88% 0 2% 0); transform: translate(-2px, 0); }
  90%, 100% { clip-path: inset(50% 0 50% 0); transform: none; }
}

/* ---------- CRT treatment for images ---------- */
.crt { position: relative; overflow: hidden; background: #000; }
.crt::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.28) 0 1px, transparent 1px 3px),
    radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0,0,0,.65) 100%);
  mix-blend-mode: multiply;
}
.crt img { width: 100%; height: 100%; object-fit: cover; filter: contrast(1.08) saturate(1.05); }

/* ---------- global FX ---------- */
.fx-scan {
  position: fixed; inset: 0; z-index: 90; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0 1px, transparent 1px 3px);
}
.fx-scan::after {
  content: ""; position: absolute; left: 0; right: 0; height: 22vh; top: -22vh;
  background: linear-gradient(180deg, transparent, rgba(57,255,101,.025), transparent);
  animation: sweep 9s linear infinite;
}
@keyframes sweep { to { transform: translateY(130vh); } }
.fx-noise {
  position: fixed; inset: -50%; z-index: 89; pointer-events: none; opacity: .055;
  background-size: 160px 160px; animation: noise .9s steps(4) infinite;
}
@keyframes noise {
  0% { transform: translate(0, 0); } 25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -3%); } 75% { transform: translate(-1%, 3%); } 100% { transform: translate(0, 0); }
}

/* ---------- custom cursor (fine pointers only) ---------- */
.cursor { display: none; }
@media (pointer: fine) {
  .has-cursor .cursor {
    display: block; position: fixed; left: 0; top: 0; z-index: 200; pointer-events: none;
    width: 0; height: 0; mix-blend-mode: difference;
  }
  .has-cursor .cursor span {
    position: absolute; left: -5px; top: -5px; width: 10px; height: 10px;
    border: 1px solid var(--green); transition: transform .2s var(--ease), background .2s var(--ease), width .2s, height .2s, left .2s, top .2s;
  }
  .has-cursor .cursor.is-hover span { left: -14px; top: -14px; width: 28px; height: 28px; background: rgba(57,255,101,.15); }
  .has-cursor .cursor.is-text span { left: -1px; top: -10px; width: 2px; height: 20px; background: var(--green); border: 0; }
  .has-cursor .cursor.is-down span { transform: scale(.7); }
}

/* ---------- form fields ---------- */
.field { display: grid; gap: 6px; }
.field > span:first-child { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .12em; color: var(--muted); }
.field input, .field textarea, .field select {
  width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r);
  padding: 11px 12px; font-family: var(--f-mono); font-size: 13px; color: var(--text);
  transition: border-color .2s;
}
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-a); }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 300; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  font-family: var(--f-mono); font-size: 12px; padding: 12px 14px; background: #0b0b0d;
  border: 1px solid var(--line-2); border-left: 2px solid var(--green);
  box-shadow: 0 10px 40px rgba(0,0,0,.6); animation: toastIn .3s var(--ease);
}
.toast--warn { border-left-color: #ffb020; }
.toast.is-out { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(8px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
  .fx-noise, .fx-scan::after { display: none; }
}
