/* Gaffo AI: the pixel kit. Everything here shares the 16x16 bolt's grid: sparkles, HUD labels, the coin,
   the XP bar, the bolt build and the 3D voxel bolt. Motion uses steps() so pixels stay hard; all of it stops under
   prefers-reduced-motion. */

/* pixel divider: a row of 4px squares, two tones */
.px-rule { height: 8px; background:
  linear-gradient(90deg, var(--green) 0 4px, transparent 4px 8px) 0 0 / 8px 4px repeat-x,
  linear-gradient(90deg, transparent 0 4px, var(--green-lo) 4px 8px) 0 4px / 8px 4px repeat-x;
  image-rendering: pixelated; }
.px-rule.dim { opacity: .35; }

/* a blinking status square (recording / running) and a steady one */
.rec::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px; vertical-align: 1px; background: var(--pink); animation: rec 1.6s steps(1) infinite; }
@keyframes rec { 50% { opacity: 0; } }
.dot-on::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px; vertical-align: 1px; background: var(--green); }

/* HUD labels pinned to the corners of a surface */
.hud { position: absolute; display: flex; gap: 6px; align-items: center; pointer-events: none; z-index: 4; }
.hud .px-label { padding: 5px 6px 4px; background: rgb(3 18 12 / .78); color: var(--green-hi); }
.hud .px-label.on { color: var(--green); }
.hud .px-label.y { color: var(--yellow); }
.hud.h-tl { left: 14px; top: 14px; } .hud.h-tr { right: 14px; top: 14px; } .hud.h-bl { left: 14px; bottom: 14px; } .hud.h-br { right: 14px; bottom: 14px; }

/* pixel sparkle: a 5x5 plus that pops and steps away; colour from --sc */
.spark { position: absolute; width: 10px; height: 10px; pointer-events: none; --sc: var(--green-hi);
  background: linear-gradient(var(--sc), var(--sc)) 4px 0 / 2px 10px no-repeat, linear-gradient(var(--sc), var(--sc)) 0 4px / 10px 2px no-repeat;
  opacity: 0; animation: spark 2.6s steps(4) infinite; animation-delay: var(--sd, 0s); }
.spark.big { width: 15px; height: 15px; background-size: 3px 15px, 15px 3px; background-position: 6px 0, 0 6px; }
@keyframes spark { 0% { opacity: 0; transform: scale(.5); } 18% { opacity: 1; transform: scale(1); } 40% { opacity: .55; transform: scale(.75); } 60%, 100% { opacity: 0; transform: scale(.5); } }

/* the coin: credits */
.coin { display: inline-block; width: 16px; height: 16px; flex: none; vertical-align: -2px; image-rendering: pixelated;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cpath fill='%23c99a12' d='M2 0h4v1h1v1h1v4H7v1H6v1H2V7H1V6H0V2h1V1h1z'/%3E%3Cpath fill='%23ffd447' d='M2 1h4v1h1v4H6v1H2V6H1V2h1z'/%3E%3Cpath fill='%23fff3c4' d='M2 2h1v3H2z'/%3E%3Cpath fill='%23c99a12' d='M4 2h1v4H4z'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }

.coin.spin { animation: coin-spin 1.6s steps(1) infinite; }
@keyframes coin-spin { 0%, 55% { transform: none; } 62% { transform: scaleX(.6); } 70% { transform: scaleX(.2); } 78% { transform: scaleX(-.6); } 86% { transform: scaleX(-1); } 94% { transform: scaleX(-.4); } 100% { transform: none; } }

/* pixel sprites floating in a field: bob in two steps, drift against the pointer (--mx/--my from home.js) */
.sprite { position: absolute; left: var(--x); top: var(--y); width: var(--w, 44px); height: auto; image-rendering: pixelated; pointer-events: none;
  translate: calc(var(--mx, 0) * var(--d, 8) * -1px) calc(var(--my, 0) * var(--d, 8) * -1px);
  animation: bob 2.4s steps(2) infinite alternate; animation-delay: var(--b, 0s); }
@keyframes bob { to { transform: translateY(-8px); } }

/* XP bar: a segmented progress bar */
.xp { position: relative; height: 16px; background: var(--well); box-shadow: 0 0 0 3px var(--edge-hi); overflow: hidden; }
.xp i { position: absolute; inset: 3px; background: repeating-linear-gradient(90deg, var(--xc, var(--green)) 0 10px, transparent 10px 13px); transform-origin: left center; transform: scaleX(var(--xv, 1)); }

/* ---------- the bolt: built pixel by pixel (bolt.js), then one white flash ---------- */
.bolt { display: block; shape-rendering: crispEdges; overflow: visible; }
.bolt .p { opacity: 1; }
.js .bolt.building .p { opacity: 0; animation: px-in 1ms steps(1) forwards; animation-delay: calc(var(--i) * var(--bolt-step, 14ms)); }
@keyframes px-in { to { opacity: 1; } }
.bolt .flash { opacity: 0; pointer-events: none; }
.js .bolt.building .flash { animation: bolt-flash 420ms steps(6) forwards; animation-delay: var(--bolt-flash-at, 900ms); }
@keyframes bolt-flash { 0% { opacity: 1; } 34% { opacity: .55; } 100% { opacity: 0; } }
/* its 16x16 construction grid: visible while it builds, gone once the flash lands */
.bolt-grid { position: relative; }
.bolt-grid::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background-image: linear-gradient(rgb(0 255 133 / .18) 1px, transparent 1px), linear-gradient(90deg, rgb(0 255 133 / .18) 1px, transparent 1px);
  background-size: 6.25% 6.25%; }
.js .bolt-grid.building::after { animation: grid-show calc(var(--bolt-flash-at, 900ms) + 700ms) var(--ease-out) forwards; }
@keyframes grid-show { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- the voxel bolt: the 2D bolt extruded into 3D (stacked silhouette layers behind the face) ----------
   markup (bolt.js mountVoxels): .vox > .vox-tilt > .vox-sway > (.vox-l x N) + .vox-face[data-bolt]
   --ext goes 0 -> 1 after the build: the flat bolt pushes out into depth. */
@property --ext { syntax: "<number>"; inherits: true; initial-value: 1; }
.vox { --vs: 320px; --depth: calc(var(--vs) * .19); position: relative; width: var(--vs); aspect-ratio: 1; perspective: calc(var(--vs) * 3.6); transition: --ext 900ms var(--ease-out); }
.vox.flat { --ext: 0; }
.vox-tilt, .vox-sway { position: absolute; inset: 0; transform-style: preserve-3d; }
.vox-tilt { transform: rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg)); }
.vox-sway { transform: rotateX(10deg) rotateY(-24deg); animation: vox-sway 7s var(--ease-in-out) infinite alternate; }
.vox.flat .vox-sway { animation-play-state: paused; }
@keyframes vox-sway { 0% { transform: rotateX(10deg) rotateY(-26deg); } 100% { transform: rotateX(4deg) rotateY(22deg); } }
.vox-l { position: absolute; inset: 0; background: var(--lc);
  -webkit-mask: url("/assets/img/bolt-mask.svg") center / 100% 100% no-repeat; mask: url("/assets/img/bolt-mask.svg") center / 100% 100% no-repeat;
  transform: translateZ(calc(var(--z) * var(--depth) * var(--ext) * -1)); }
.vox-face { position: absolute; inset: 0; transform: translateZ(1px); }
.vox-face svg, .vox-face img { width: 100%; height: 100%; image-rendering: pixelated; }
.vox-shadow { position: absolute; left: 14%; right: 14%; bottom: -10%; height: 10%; pointer-events: none; opacity: .55;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' shape-rendering='crispEdges'%3E%3Crect width='2' height='2' fill='%23000'/%3E%3Crect x='2' y='2' width='2' height='2' fill='%23000'/%3E%3C/svg%3E") 0 0 / 4px 4px;
  -webkit-mask-image: radial-gradient(closest-side, #000 60%, transparent 61%); mask-image: radial-gradient(closest-side, #000 60%, transparent 61%); }

/* ---------- round 3 (2026-11-06): the arcade pieces on sub-page heads ---------- */
/* Sparkles across the green field, two pixel sprites in the strip between the nav and the headline, and a HUD tag at
   the top right. All decoration: aria-hidden, no pointer events, still under reduced motion. */
.page-head > .ph-deco.ph-deco, .nf > .ph-deco.ph-deco { position: absolute; top: 0; bottom: 0; left: 50%; width: 100vw; max-width: none; transform: translateX(-50%); pointer-events: none; overflow: hidden; }
.nf { position: relative; }
.ph-deco .hud { top: calc(var(--nav-h) + 22px); right: max(var(--gutter), calc((100vw - var(--max)) / 2)); }
.nf > .ph-deco .hud { top: 22px; }
.ph-deco .sprite { top: calc(var(--nav-h) + var(--y)); }
.nf > .ph-deco .sprite { top: var(--y); }
@media (max-width: 860px) { .ph-deco .sprite { display: none; } }
@media (max-width: 700px) { .ph-deco .hud { display: none; } }

/* ---------- the prompt band: what people type, scrolling past on bright green (home and /skills) ---------- */
.mq { position: relative; padding: 24px 0; display: grid; gap: 14px; background: var(--green); overflow: hidden; }
.mq::before, .mq::after { content: ""; position: absolute; left: 0; right: 0; height: 8px; background: repeating-conic-gradient(var(--bg) 0 25%, transparent 0 50%) 0 0 / 8px 8px; }
.mq::before { top: 0; } .mq::after { bottom: 0; }
.mq-row { display: flex; width: max-content; list-style: none; padding-left: 14px; }
.mq-row li { --c: var(--ink-dark); margin-right: 14px; padding: 14px 18px 13px; background: var(--c); color: var(--ink-dark); white-space: nowrap;
  font: 600 1rem/1 var(--f-mono); box-shadow: inset -3px -3px 0 0 rgb(0 0 0 / .28), inset 3px 3px 0 0 rgb(255 255 255 / .3); }
.mq-row li[style*="ink-dark"] { color: var(--green); box-shadow: inset -3px -3px 0 0 #000, inset 3px 3px 0 0 rgb(255 255 255 / .1); }
.mq-row li::before { content: "> "; opacity: .55; }
.js .mq.dup .mq-row { animation: mq 52s linear infinite; }
.js .mq.dup .mq-row.rev { animation-duration: 60s; animation-direction: reverse; }
@media (hover: hover) and (pointer: fine) { .js .mq.dup:hover .mq-row { animation-play-state: paused; } }
@keyframes mq { to { transform: translateX(-50%); } }

@media (prefers-reduced-motion: reduce) {
  .rec::before, .spark { animation: none; }
  .spark { opacity: .8; }
  .js .bolt.building .p, .js .bolt.building .flash, .js .bolt-grid.building::after { animation: none; }
  .js .bolt.building .p { opacity: 1; }
  .vox-sway, .sprite, .coin.spin { animation: none; }
  .vox { transition: none; }
}
