/* 2BREGO — terminal print reveal (pairs with terminal-print.js) */
:root { --tp-accent:#30ffce; --tp-red:#ff2b5e; --tp-rgb-a:rgba(255,43,94,.85); --tp-rgb-b:rgba(48,255,206,.85); }

/* Before the script has marked units: hide content regions (not backgrounds)
   so nothing flashes fully printed. Removed by the script, or by the 3 s
   failsafe in the head snippet if the script never loads. */
html.tp-armed:not(.tp-ready) :is(.started-content, .started .mouse_btn, .section .content, footer, .header .logo, .header .top-menu-nav) { visibility:hidden !important; }

/* Waiting for its turn: keeps its space, prints later. */
/* Offscreen content remains readable without scrolling. Conceal only a queued entrance. */
html.tp-armed [data-tp-unit][data-tp-state="queued"] { visibility:hidden !important; }

/* Text printing parts */
tp-r { visibility:hidden; }
tp-r.tp-ghost { visibility:visible; color:var(--tp-accent); opacity:.36; }
tp-n { color:var(--tp-accent); }
tp-c { position:relative; }
tp-c::after { content:""; position:absolute; left:.06em; top:50%; width:.55em; height:1.02em; transform:translateY(-50%); background:var(--tp-accent); box-shadow:0 0 12px rgba(48,255,206,.55); pointer-events:none; }
tp-c.tp-blink::after { animation:tp-blink .3s steps(1) infinite; }
@keyframes tp-blink { 50% { opacity:0; } }

/* ---------- 1. TTY: block cursor, char by char ---------- */
html[data-tp="tty"] .tp-jolt { text-shadow:-2px 0 var(--tp-rgb-a), 2px 0 var(--tp-rgb-b); }
html[data-tp="tty"] .tp-run-block { animation:tp-rows .46s steps(8,end) both; }
@keyframes tp-rows {
  from { clip-path:inset(0 0 100% 0); filter:brightness(1.9); }
  85%  { filter:brightness(1.2); }
  to   { clip-path:inset(0 0 0 0); filter:none; }
}

/* ---------- 2. DECRYPT: ciphertext resolves left to right ---------- */
html[data-tp="decrypt"] tp-n { color:#eafff9; text-shadow:0 0 8px var(--tp-accent), 0 0 2px var(--tp-accent); }
html[data-tp="decrypt"] .tp-run-block { animation:tp-decode-block .56s steps(1,end) both; }
@keyframes tp-decode-block {
  0%   { opacity:0; }
  8%   { opacity:.55; filter:grayscale(1) contrast(3) brightness(1.5); clip-path:inset(0 0 62% 0); }
  18%  { opacity:.12; }
  30%  { opacity:.75; filter:grayscale(1) contrast(2.2) brightness(1.3); clip-path:inset(0 0 28% 0); }
  44%  { opacity:.3; clip-path:inset(0); }
  60%  { opacity:.9; filter:saturate(.35) brightness(1.25); }
  78%  { opacity:.7; }
  100% { opacity:1; filter:none; clip-path:none; }
}

/* ---------- 3. BOOT LOG: word bursts, CRT phosphor, scanlines ---------- */
html[data-tp="bootlog"] tp-c::after { top:auto; bottom:.02em; transform:none; width:.6em; height:.11em; }
html[data-tp="bootlog"] .tp-glow {
  text-shadow:0 0 6px rgba(48,255,206,.9), 0 0 22px rgba(48,255,206,.45);
  -webkit-mask-image:repeating-linear-gradient(180deg,#000 0 2px,rgba(0,0,0,.5) 2px 3px);
          mask-image:repeating-linear-gradient(180deg,#000 0 2px,rgba(0,0,0,.5) 2px 3px);
  animation:tp-flicker .45s steps(1,end) both;
}
html[data-tp="bootlog"] .tp-decay { animation:tp-phosphor .9s ease-out both; }
@keyframes tp-flicker { 0% { opacity:.2; } 15% { opacity:1; } 25% { opacity:.45; } 40% { opacity:1; } 55% { opacity:.75; } 70%,100% { opacity:1; } }
@keyframes tp-phosphor { from { text-shadow:0 0 6px rgba(48,255,206,.9), 0 0 22px rgba(48,255,206,.45); } to { text-shadow:0 0 0 rgba(48,255,206,0), 0 0 0 rgba(48,255,206,0); } }
html[data-tp="bootlog"] .tp-run-block {
  transform-origin:50% 50%;
  animation:tp-crt .62s cubic-bezier(.2,.7,.2,1) both;
  -webkit-mask-image:repeating-linear-gradient(180deg,#000 0 2px,rgba(0,0,0,.45) 2px 3px);
          mask-image:repeating-linear-gradient(180deg,#000 0 2px,rgba(0,0,0,.45) 2px 3px);
}
@keyframes tp-crt {
  0%   { transform:scale(.35,.008); filter:brightness(5) saturate(0); }
  30%  { transform:scale(1,.008); filter:brightness(4) saturate(0); }
  55%  { transform:scale(1,1.03); filter:brightness(1.7); }
  70%  { transform:none; filter:brightness(1.2); opacity:1; }
  80%  { opacity:.7; }
  88%  { opacity:1; }
  100% { transform:none; filter:none; }
}

/* ---------- 4. CORRUPT: bursts, backspaces, RGB split, slices ---------- */
html[data-tp="corrupt"] tp-n { color:var(--tp-accent); text-shadow:-2px 0 var(--tp-rgb-a); }
html[data-tp="corrupt"] [data-tp-unit="text"][data-tp-state="run"] { animation:tp-shake .13s steps(1,end) infinite; }
@keyframes tp-shake {
  0%  { text-shadow:-2px 0 var(--tp-rgb-a), 2px 0 var(--tp-rgb-b); clip-path:none; }
  20% { text-shadow:3px 0 var(--tp-rgb-a), -3px 0 var(--tp-rgb-b); clip-path:inset(0 0 45% 0); }
  35% { text-shadow:-1px 0 var(--tp-rgb-a), 1px 0 var(--tp-rgb-b); clip-path:none; }
  60% { text-shadow:-4px 0 rgba(255,43,94,.7), 4px 0 rgba(48,255,206,.7); clip-path:inset(38% 0 0 0); }
  75% { text-shadow:none; clip-path:none; }
}
html[data-tp="corrupt"] .tp-flash { color:#fff; text-shadow:0 0 14px var(--tp-accent); }
html[data-tp="corrupt"] .tp-run-block { animation:tp-slices .25s steps(1,end) both; }
@keyframes tp-slices {
  0%   { clip-path:inset(0 0 100% 0); }
  10%  { clip-path:inset(12% 0 58% 0); transform:translateX(-14px); filter:drop-shadow(4px 0 var(--tp-red)) drop-shadow(-4px 0 var(--tp-accent)); }
  20%  { clip-path:inset(52% 0 18% 0); transform:translateX(11px); }
  30%  { clip-path:inset(0 0 72% 0); transform:translateX(-5px); filter:drop-shadow(-3px 0 var(--tp-red)) drop-shadow(3px 0 var(--tp-accent)); }
  44%  { clip-path:inset(28% 0 0 0); transform:translateX(7px); }
  58%  { clip-path:inset(0 0 14% 0); transform:translateX(-3px); }
  74%  { clip-path:inset(0); transform:translateX(2px); filter:drop-shadow(2px 0 var(--tp-red)) drop-shadow(-2px 0 var(--tp-accent)); }
  86%  { clip-path:inset(0); transform:none; filter:brightness(1.8); }
  100% { clip-path:none; transform:none; filter:none; }
}

/* Runtime guards only. Original CORRUPT keyframes are unchanged. */
:root{--brego-glitch-enabled:1}
@media(prefers-reduced-motion:reduce){html.tp-armed [data-tp-unit]{visibility:visible!important;animation:none!important}tp-r{visibility:visible!important}tp-c{display:none!important}}

/* Small-square loading retained at the user's request, with CORRUPT slices. */
.tp-packet-position{position:relative!important}
.tp-packet-cover{position:absolute;inset:0;z-index:0;overflow:hidden;pointer-events:none!important;border:0!important;border-radius:inherit}
.tp-packet-tile{position:absolute;display:block;pointer-events:none;border:0;margin:0;padding:0}
html[data-tp="corrupt"] .tp-run-block.tp-packet-active{animation-duration:.35s}
html.tp-armed [data-tp-unit="block"][data-tp-state="loading"]{visibility:hidden!important}
@media(prefers-reduced-motion:reduce){.tp-packet-cover{display:none!important}html.tp-armed [data-tp-state="loading"]{visibility:visible!important}}
