/* ==========================================================================
   components.css — hero, process list, boot, command bar, man page, thumbs
   ========================================================================== */

/* ---- hero ---------------------------------------------------------------- */
.hero { padding-block: var(--sp-8) var(--sp-7); }

.hero__name {
  font-family: var(--font-pixel);
  font-size: var(--step-name);
  line-height: 0.95;
  font-weight: 400;
  letter-spacing: 0.02em;
  margin: 0 0 var(--sp-5);
  color: var(--fg);
  text-transform: uppercase;
}

/* ---- glitch -------------------------------------------------------------
   Reusable. Minimum markup is just:

       <span class="glitch">Some text</span>

   js/glitch.js fills in data-text and the dither layer, then fires it on a
   random interval. Everything is tunable per element:

       data-glitch="hover"                hover/focus only, no ambient firing
       data-glitch-gap="3000,9000"        ms between ambient bursts
       data-glitch-burst="200,500"        ms each burst lasts
       style="--glitch-shift: 4px"        how far the colour layers split
       style="--glitch-dither: 3px"       checker size of the dither screen

   The offset scales with font-size by default, so it reads the same on a
   96px heading and a 14px button.
   ------------------------------------------------------------------------- */
.glitch {
  position: relative;
  display: inline-block;
  isolation: isolate;
  --glitch-shift: max(1px, 0.028em);
  --glitch-dither: 2px;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  padding: inherit;   /* keeps the ghost text aligned inside padded elements */
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}
.glitch::before {
  color: var(--glitch-a);
  transform: translate(calc(var(--glitch-shift) * -1), 0);
}
.glitch::after {
  color: var(--glitch-b);
  transform: translate(var(--glitch-shift), 0);
}

/* the dither screen: a checker that eats every other pixel */
.glitch .glitch__dither {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background-image:
    repeating-conic-gradient(var(--bg) 0% 25%, transparent 0% 50%);
  background-size: var(--glitch-dither) var(--glitch-dither);
  transition: opacity 160ms ease;
  z-index: 2;
}

/* Three ways in: hover, keyboard focus, and .is-glitching — which
   js/glitch.js flicks on by itself. All three share one look. */
.glitch:hover::before,
.glitch:hover::after,
.glitch:focus-visible::before,
.glitch:focus-visible::after,
.glitch.is-glitching::before,
.glitch.is-glitching::after { opacity: 1; }

.glitch:hover .glitch__dither,
.glitch:focus-visible .glitch__dither,
.glitch.is-glitching .glitch__dither { opacity: 0.7; }

@media (prefers-reduced-motion: no-preference) {
  .glitch:hover::before,
  .glitch:focus-visible::before,
  .glitch.is-glitching::before { animation: glitch-a 480ms steps(2, end) infinite; }
  .glitch:hover::after,
  .glitch:focus-visible::after,
  .glitch.is-glitching::after { animation: glitch-b 420ms steps(2, end) infinite; }
}

@keyframes glitch-a {
  0%   { transform: translate(calc(var(--glitch-shift) * -1), 0);    clip-path: inset(0 0 68% 0); }
  25%  { transform: translate(calc(var(--glitch-shift) * -1.5), 1px); clip-path: inset(42% 0 22% 0); }
  50%  { transform: translate(calc(var(--glitch-shift) * -0.5), -1px); clip-path: inset(72% 0 0 0); }
  75%  { transform: translate(calc(var(--glitch-shift) * -1.5), 0);  clip-path: inset(12% 0 56% 0); }
  100% { transform: translate(calc(var(--glitch-shift) * -1), 0);    clip-path: inset(0 0 68% 0); }
}
@keyframes glitch-b {
  0%   { transform: translate(var(--glitch-shift), 0);             clip-path: inset(58% 0 0 0); }
  25%  { transform: translate(calc(var(--glitch-shift) * 1.5), -1px); clip-path: inset(0 0 74% 0); }
  50%  { transform: translate(calc(var(--glitch-shift) * 0.5), 1px);  clip-path: inset(34% 0 38% 0); }
  75%  { transform: translate(calc(var(--glitch-shift) * 1.5), 0);  clip-path: inset(66% 0 8% 0); }
  100% { transform: translate(var(--glitch-shift), 0);             clip-path: inset(58% 0 0 0); }
}

.hero__roles {
  font-family: var(--font-mono);
  font-size: var(--step-1);
  color: var(--fg-dim);
  margin-bottom: var(--sp-2);
}
.hero__loc {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--fg-mute);
  margin-bottom: var(--sp-5);
}
.hero__blurb { max-width: var(--measure); color: var(--fg-dim); }

/* ---- process list ------------------------------------------------------- */
.ps {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  border-top: var(--rule) solid var(--border);
}

.ps__head,
.ps__row {
  display: grid;
  grid-template-columns: 3.25rem minmax(7rem, 1fr) 7.5rem minmax(0, 1.4fr) 6rem;
  gap: var(--sp-3);
  align-items: baseline;
  padding: var(--sp-3) var(--sp-2);
  border-bottom: var(--rule) solid var(--border);
}

.ps__head {
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

.ps__row {
  color: var(--fg-dim);
  text-decoration: none;
  transition: background-color 120ms ease, color 120ms ease;
}
.ps__row:hover,
.ps__row:focus-visible {
  background: var(--bg-raise);
  color: var(--fg);
  text-decoration: none;
}
.ps__row:hover .ps__name { color: var(--accent); }

.ps__pid { color: var(--fg-mute); }
.ps__name { color: var(--fg); }
.ps__tags { color: var(--fg-mute); }
.ps__date { color: var(--fg-mute); white-space: nowrap; }

.status { white-space: nowrap; }
.status::before { content: "● "; }
.status--running { color: var(--ok); }
.status--shipped { color: var(--info); }
.status--shipped::before { content: "◆ "; }
.status--experiment { color: var(--warn); }
.status--experiment::before { content: "▲ "; }
.status--archived { color: var(--fg-mute); }
.status--archived::before { content: "□ "; }

@media (max-width: 46rem) {
  .ps__head { display: none; }
  .ps__row {
    grid-template-columns: 1fr auto;
    row-gap: var(--sp-1);
    padding-block: var(--sp-4);
  }
  .ps__pid { display: none; }
  .ps__name { grid-column: 1; font-size: var(--step-0); }
  .ps__status { grid-column: 2; text-align: right; }
  .ps__tags { grid-column: 1 / -1; }
  .ps__date { grid-column: 1 / -1; }
}

/* ---- boot overlay ------------------------------------------------------- */
/* The overlay is display:none until js/head.js (a blocking script, so this
   happens before first paint) decides the boot should play and sets
   data-boot="pending" on <html>. With JS off it is never shown at all. */
.boot { display: none; }
[data-boot="pending"] { overflow: hidden; }
[data-boot="pending"] .boot {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--bg-sunk);
  color: var(--fg-dim);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.boot--out {
  opacity: 0;
  transition: opacity 260ms ease;
}

.boot__log { margin: auto 0; max-width: 72ch; width: 100%; }
.boot__line { display: block; white-space: pre-wrap; }
.boot__ok { color: var(--ok); }
.boot__mod { color: var(--fg); }
.boot__dots { color: var(--fg-mute); }
.boot__ready { color: var(--accent); }

.boot__skip {
  margin-top: var(--sp-5);
  color: var(--fg-mute);
  background: none;
  border: var(--rule) solid var(--border);
  font: inherit;
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
  align-self: flex-start;
}
.boot__skip:hover { color: var(--fg); border-color: var(--border-hi); }

.boot__cursor {
  display: inline-block;
  width: 0.6em;
  background: var(--accent);
  color: transparent;
}
@media (prefers-reduced-motion: no-preference) {
  .boot__cursor { animation: blink 1s steps(1, end) infinite; }
}
@keyframes blink { 50% { opacity: 0; } }

/* ---- command bar -------------------------------------------------------- */
.cmd {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: color-mix(in srgb, var(--bg-sunk) 72%, transparent);
  padding: 12vh var(--sp-4) var(--sp-4);
  display: flex;
  justify-content: center;
}
.cmd[hidden] { display: none; }

.cmd__panel {
  width: min(36rem, 100%);
  background: var(--bg);
  border: var(--rule) solid var(--border-hi);
  font-family: var(--font-mono);
  font-size: var(--step-0);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}

.cmd__field {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: var(--rule) solid var(--border);
}
.cmd__sigil { color: var(--accent); }
.cmd__input {
  all: unset;
  flex: 1;
  color: var(--fg);
  font: inherit;
  caret-color: var(--accent);
}
.cmd__input::placeholder { color: var(--fg-mute); }

.cmd__list {
  list-style: none;
  margin: 0;
  padding: var(--sp-2) 0;
  overflow-y: auto;
}
.cmd__item {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  cursor: pointer;
  color: var(--fg-dim);
  font-size: var(--step--1);
}
.cmd__item[aria-selected="true"] {
  background: var(--bg-raise);
  color: var(--fg);
}
.cmd__item[aria-selected="true"] .cmd__label { color: var(--accent); }
.cmd__kind {
  color: var(--fg-mute);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-left: auto;
}
.cmd__empty {
  padding: var(--sp-3) var(--sp-4);
  color: var(--fg-mute);
  font-size: var(--step--1);
}

/* ---- man page ----------------------------------------------------------- */
.man { padding-block: var(--sp-5) var(--sp-7); }

.man__rule {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--sp-4);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-block: var(--sp-3);
  border-block: var(--rule) solid var(--border);
}
.man__rule > :nth-child(2) { text-align: center; }
.man__rule > :nth-child(3) { text-align: right; }
@media (max-width: 34rem) {
  .man__rule { grid-template-columns: 1fr auto; }
  .man__rule > :nth-child(2) { display: none; }
  .man__rule > :nth-child(3) { text-align: right; }
}

.man__section { margin-top: var(--sp-6); }
.man__h {
  font-family: var(--font-mono);
  font-size: var(--step-0);
  letter-spacing: 0.12em;
  color: var(--accent-2);
  text-transform: uppercase;
  margin-bottom: var(--sp-3);
}
.man__body { padding-left: var(--sp-5); max-width: var(--measure); }
@media (max-width: 34rem) {
  .man__body { padding-left: var(--sp-3); }
}

/* key/value block for SYNOPSIS */
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--sp-2) var(--sp-5);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  margin: 0;
}
.kv dt { color: var(--fg-mute); text-transform: uppercase; letter-spacing: 0.06em; }
.kv dd { margin: 0; color: var(--fg); }

.seealso {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  font-family: var(--font-mono);
  font-size: var(--step--1);
}
.seealso a::after { content: "(1)"; color: var(--fg-mute); }

.man__nav {
  display: flex;
  gap: var(--sp-4);
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  border-top: var(--rule) solid var(--border);
  margin-top: var(--sp-7);
  padding-top: var(--sp-4);
}
.man__nav > :nth-child(2) { margin-inline: auto; }

/* ---- thumbnails: dithered until hover ---------------------------------- */
.thumb {
  position: relative;
  display: block;
  border: var(--rule) solid var(--border);
  background: var(--bg-sunk);
  overflow: hidden;
}
.thumb img {
  width: 100%;
  filter: grayscale(0.65) contrast(1.25) brightness(0.9);
  transition: filter 220ms ease, transform 220ms ease;
}
.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-conic-gradient(
    var(--bg-sunk) 0% 25%, transparent 0% 50%
  );
  background-size: 3px 3px;
  opacity: 0.75;
  transition: opacity 220ms ease;
}
.thumb:hover img,
.thumb:focus-visible img { filter: none; }
.thumb:hover::after,
.thumb:focus-visible::after { opacity: 0; }

/* drop a tiny source image in and it reads as real pixel art */
.thumb--pixelated img { image-rendering: pixelated; }

.thumb__cap {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-mute);
  padding: var(--sp-2) var(--sp-3);
  border-top: var(--rule) solid var(--border);
}

.figure-grid {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

/* ---- resume ------------------------------------------------------------- */
.resume { padding-block: var(--sp-6) var(--sp-7); }

.resume__head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-5);
  align-items: baseline;
  border-bottom: var(--rule) solid var(--border-hi);
  padding-bottom: var(--sp-4);
}
.resume__name {
  font-family: var(--font-pixel);
  font-size: var(--step-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.resume__contact {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--fg-dim);
  text-align: right;
}
.resume__contact span { display: block; }

.resume__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
  font-family: var(--font-mono);
  font-size: var(--step--1);
}
.btn {
  border: var(--rule) solid var(--border-hi);
  color: var(--fg-dim);
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-raise);
}
.btn:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

.rsection { margin-top: var(--sp-6); }
.rsection__h {
  font-family: var(--font-mono);
  font-size: var(--step-0);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
  border-bottom: var(--rule) solid var(--border);
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.entry { margin-bottom: var(--sp-5); break-inside: avoid; }
.entry:last-child { margin-bottom: 0; }
.entry__top {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-4);
  align-items: baseline;
}
.entry__role { font-family: var(--font-mono); font-weight: 700; color: var(--fg); }
.entry__org { color: var(--fg-dim); }
.entry__when {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--fg-mute);
  white-space: nowrap;
}
.entry__list { margin: var(--sp-2) 0 0; padding-left: 1.1rem; color: var(--fg-dim); }
.entry__list li { margin-bottom: var(--sp-1); }

.skills {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--sp-2) var(--sp-5);
  margin: 0;
  font-size: var(--step--1);
}
.skills dt {
  font-family: var(--font-mono);
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.skills dd { margin: 0; color: var(--fg-dim); }
@media (max-width: 34rem) {
  .skills { grid-template-columns: 1fr; gap: var(--sp-1); }
  .skills dd { margin-bottom: var(--sp-3); }
}

/* ---- 404 ---------------------------------------------------------------- */
.halt {
  padding-block: var(--sp-8);
  font-family: var(--font-mono);
}
.halt__code {
  font-family: var(--font-pixel);
  font-size: var(--step-3);
  color: var(--danger);
  text-transform: uppercase;
}
.halt pre { color: var(--fg-dim); }

/* ---- misc --------------------------------------------------------------- */
.todo {
  color: var(--warn);
  font-family: var(--font-mono);
  font-size: 0.85em;
  letter-spacing: 0.04em;
}
.tagline { color: var(--fg-mute); font-family: var(--font-mono); font-size: var(--step--1); }

.card {
  border: var(--rule) solid var(--border);
  background: var(--bg-raise);
  padding: var(--sp-4);
}

.cmd__hint { color: var(--fg-mute); font-size: 0.75rem; }

.man__name {
  font-size: var(--step-1);
  font-weight: 400;
  color: var(--fg-dim);
}
.man__name .mono { color: var(--fg); font-weight: 700; }
