/* I MADE A BUG: the Glitch Bug's page gags (gb-headline.js on Home, gb-cards.js on Work). Everything here is decoration on top of the real page: nothing changes the
   layout (letters are inline-block spans of the same size, chips / tiles / pings are absolutely positioned in a click-through layer), pointer-events stay off,
   and the real text is untouched. Flash safety: no element changes luminance more than ~1 time a second; the RGB split and the jitter are small, stepped shifts.
   Reduced motion (html.gag-calm, set by the scripts): a static faint split, soft fades, no jitter, no dip, no squash, no sweep. */

/* ---------------- HOME: the glitching headline letter ---------------- */
/* At rest the letters are plain inline spans (shaping, kerning and the accessible text are exactly those of an unwrapped word); only the letter that is glitching becomes
   an inline-block so it can be transformed. */
.gl-bad, .gl-fix { display: inline-block; }
.gl-bad { animation: gl-bad 1.3s steps(1, end) infinite; will-change: transform; }
@keyframes gl-bad {
  0%   { transform: translate(0, 0) skewX(0); text-shadow: -3px 0 #FF2BD6, 3px 0 #35D6FF; opacity: 1; }
  7%   { transform: translate(2px, -1px) skewX(-9deg); text-shadow: -6px 0 #FF2BD6, 4px 0 #35D6FF; }
  13%  { transform: translate(-3px, 1px) skewX(7deg); text-shadow: 5px 0 #FF2BD6, -4px 0 #35D6FF; }
  19%  { transform: translate(0, 0) skewX(0); text-shadow: -2px 0 #FF2BD6, 2px 0 #35D6FF; }
  27%  { transform: translate(3px, 0) scaleY(1.08); text-shadow: -4px 1px #FF2BD6, 4px -1px #35D6FF; }
  34%  { transform: translate(-1px, -2px) skewX(5deg); text-shadow: 3px 0 #FF2BD6, -6px 0 #35D6FF; }
  41%  { transform: translate(0, 0) skewX(0); text-shadow: -3px 0 #FF2BD6, 3px 0 #35D6FF; }
  52%  { transform: translate(-2px, 1px) skewX(-6deg); text-shadow: 6px 0 #FF2BD6, -3px 0 #35D6FF; }
  58%  { transform: translate(1px, 0) scaleY(.94); text-shadow: -3px 0 #FF2BD6, 3px 0 #35D6FF; opacity: .42; }   /* the one dip, ~0.1 s a loop (~0.8 / s) */
  66%  { opacity: 1; transform: translate(2px, -1px) skewX(8deg); text-shadow: -5px 0 #FF2BD6, 5px 0 #35D6FF; }
  74%  { transform: translate(0, 0) skewX(0); text-shadow: -2px 0 #FF2BD6, 2px 0 #35D6FF; }
  86%  { transform: translate(-2px, 0) scaleY(1.05); text-shadow: 4px 0 #FF2BD6, -4px 0 #35D6FF; }
  93%  { transform: translate(0, 1px) skewX(-4deg); text-shadow: -3px 0 #FF2BD6, 3px 0 #35D6FF; }
}
/* the fix: squashed flat by the bonk, springs up past its height, settles; a lime flash that fades */
.gl-fix { transform-origin: 50% 100%; animation: gl-fix .62s cubic-bezier(.25, .7, .3, 1) both; }
@keyframes gl-fix {
  0%   { transform: scale(1.3, .5) translateY(3px); text-shadow: 0 0 16px rgba(187, 255, 0, .95); }
  34%  { transform: scale(.86, 1.26); text-shadow: 0 0 12px rgba(187, 255, 0, .7); }
  62%  { transform: scale(1.06, .95); text-shadow: 0 0 6px rgba(187, 255, 0, .35); }
  82%  { transform: scale(.99, 1.02); text-shadow: 0 0 2px rgba(187, 255, 0, .15); }
  100% { transform: none; text-shadow: none; }
}
html.gag-calm .gl-bad { animation: none; opacity: .78; text-shadow: -2px 0 rgba(255, 43, 214, .65), 2px 0 rgba(53, 214, 255, .65); transition: opacity .6s ease, text-shadow .6s ease; }
html.gag-calm .gl-fix { animation: gl-fix-calm .9s ease-out both; }
@keyframes gl-fix-calm { 0% { opacity: .78; text-shadow: -2px 0 rgba(255, 43, 214, .5), 2px 0 rgba(53, 214, 255, .5); } 100% { opacity: 1; text-shadow: none; } }

/* ---------------- WORK: the inspector who plays the projects ---------------- */
/* one click-through layer in DOCUMENT coordinates (the chips, tiles, pings and discs the Bug uses), above the Bug's canvas (z 50), below the nav (60) */
#gag-layer { position: absolute; left: 0; top: 0; width: 100%; height: 0; overflow-x: clip; z-index: 52; pointer-events: none; }
#gag-layer > i { position: absolute; display: block; left: 0; top: 0; visibility: hidden; pointer-events: none; font-style: normal; will-change: transform, opacity; }
#gag-layer > i.go { visibility: visible; }
/* the "+1" (and "PDF ✓") chip: the lime chip of the Services page, popping up and fading */
.gag-chip { font: 700 15px/1 var(--display, "Martian Mono", sans-serif); color: var(--charcoal, #0B0E0C); background: var(--lime, #BBFF00); border-radius: 999px; padding: 7px 10px 6px; white-space: nowrap; box-shadow: 0 0 0 4px rgba(165, 255, 61, .14); }
.gag-chip.go { visibility: visible; animation: gag-chip 1.5s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes gag-chip {
  0%   { opacity: 0; transform: translate(-50%, 6px) scale(.3) rotate(8deg); }
  16%  { opacity: 1; transform: translate(-50%, -8px) scale(1.28) rotate(8deg); }
  30%  { transform: translate(-50%, -12px) scale(.96) rotate(8deg); }
  70%  { opacity: 1; transform: translate(-50%, -26px) scale(1) rotate(8deg); }
  100% { opacity: 0; transform: translate(-50%, -40px) scale(1) rotate(8deg); }
}
/* a tap / knock ring where a fist lands */
.gag-ping { width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 2px solid var(--lime, #BBFF00); box-shadow: 0 0 8px rgba(187, 255, 0, .55); }
.gag-ping.go { visibility: visible; animation: gag-ping .42s ease-out both; }
@keyframes gag-ping { 0% { opacity: .95; transform: scale(.25); } 100% { opacity: 0; transform: scale(1.35); } }
/* Word Sort tiles */
.gag-tile { width: 30px; height: 34px; margin: -17px 0 0 -15px; border-radius: 5px; background: var(--lime, #BBFF00); color: var(--charcoal, #0B0E0C); font: 700 18px/34px var(--display, sans-serif); text-align: center;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .35); transition: transform .28s cubic-bezier(.3, 1.4, .5, 1); }
.gag-tile.go { visibility: visible; animation: gag-tile-in .3s cubic-bezier(.3, 1.5, .5, 1) both; }
.gag-tile.ok { box-shadow: 0 3px 0 rgba(0, 0, 0, .35), 0 0 0 3px rgba(255, 255, 255, .85); }
.gag-tile.out { animation: gag-tile-out .4s ease-in both; }
@keyframes gag-tile-in { 0% { opacity: 0; scale: .3; translate: 0 8px; } 100% { opacity: 1; scale: 1; translate: 0 0; } }
@keyframes gag-tile-out { to { opacity: 0; scale: .6; translate: 0 -10px; } }
/* Ataxx pieces: a disc that flips in (the captured pieces) */
.gag-disc { width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff8a8a, #E5484D 60%, #a3262b); box-shadow: 0 0 0 2px rgba(255, 255, 255, .85), 0 2px 6px rgba(0, 0, 0, .4); }
.gag-disc.go { visibility: visible; animation: gag-disc 1.25s ease both; }
@keyframes gag-disc { 0% { opacity: 0; transform: rotateY(90deg) scale(.5); } 18% { opacity: 1; transform: rotateY(0) scale(1.18); } 30% { transform: rotateY(0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(.8); } }
/* Scan Easier: a scanner line sweeping down the project art (the Bug's head sweeps on the same clock) */
.art.gag-scan::after { content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none; transform: translateY(-100%); animation: gag-scan 1.4s cubic-bezier(.45, 0, .55, 1) both;
  background: linear-gradient(#BBFF00, #BBFF00) 0 100% / 100% 3px no-repeat, linear-gradient(to top, rgba(187, 255, 0, .24), rgba(187, 255, 0, 0)) 0 calc(100% - 3px) / 100% 50px no-repeat; }   /* a full-size layer whose bottom edge is the line: it slides with transform only (no layout) */
@keyframes gag-scan { 0% { transform: translateY(-100%); opacity: 0; } 8% { opacity: 1; } 92% { opacity: 1; } 100% { transform: translateY(0); opacity: 0; } }
html.gag-calm .gag-chip.go { animation: gag-chip-calm 1.8s ease both; }
@keyframes gag-chip-calm { 0% { opacity: 0; transform: translate(-50%, -14px); } 25%, 70% { opacity: 1; transform: translate(-50%, -20px); } 100% { opacity: 0; transform: translate(-50%, -26px); } }
html.gag-calm .gag-ping.go { animation: gag-ping-calm .8s ease-out both; }
@keyframes gag-ping-calm { 0% { opacity: .6; } 100% { opacity: 0; } }
html.gag-calm .gag-tile.go { animation: gag-fade-calm 2.8s ease both; }
html.gag-calm .gag-disc.go { animation: gag-fade-calm 1.6s ease both; }
html.gag-calm .gag-tile { transition: transform .7s ease; }
html.gag-calm .gag-tile.out { animation: gag-fade-calm-out .5s ease both; }
@keyframes gag-fade-calm { 0% { opacity: 0; } 25%, 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes gag-fade-calm-out { to { opacity: 0; } }
html.gag-calm .art.gag-scan::after { transform: none; background: rgba(187, 255, 0, .16); animation: gag-scan-calm 1.4s ease both; }
@keyframes gag-scan-calm { 0%, 100% { opacity: 0; } 35%, 65% { opacity: 1; } }
