/* sudo.vin: a terminal floating over halftone lava.
   One bold thing (the background); the terminal itself stays quiet. */

:root {
  color-scheme: dark;
  --ink: #000;
  --night: #0d0313;
  --panel: rgba(13, 4, 20, 0.9);
  --lav: #f1dcff;
  --lav-2: #b79bcb;
  --pink: #ff5bdc;
  --gold: #ffb23f;
  --orange: #ff7a2e;
  --teal: #3fd8c4;
  --cobalt: #7465ff;
  --root: #ff3d5e;
  --mono: "Martian Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs: 13.5px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--night);
  color: var(--lav);
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: var(--fs);
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--pink); color: var(--ink); }

/* ---------- background ---------- */
#lava { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
html.no-webgl #lava { display: none; }
html.no-webgl body {
  background:
    radial-gradient(circle at 80% 50%, rgba(255, 140, 240, 0.35), transparent 22%),
    radial-gradient(circle, #c21cb3 38%, transparent 40%) 0 0 / 8px 8px,
    radial-gradient(ellipse at 80% 50%, #8a1580 0, #2a0631 40%, var(--night) 70%);
}

.art {
  position: fixed;
  right: 0;
  bottom: 0;
  height: min(96vh, 1100px);
  max-width: 46vw;
  object-fit: contain;
  object-position: right bottom;
  pointer-events: none;
  user-select: none;
}

/* ---------- the terminal ---------- */
.term {
  position: fixed;
  left: clamp(16px, 6vw, 112px);
  top: 50%;
  transform: translateY(-50%);
  width: min(800px, 62vw);
  height: min(86vh, 820px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 10px 10px 0 var(--ink), 0 0 90px rgba(255, 91, 220, 0.22);
  overflow: hidden;
  transition: box-shadow 1.2s;
}
[data-user="root"] .term { box-shadow: 10px 10px 0 var(--ink), 0 0 110px rgba(255, 61, 94, 0.34); }

.bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 14px 8px;
  background: var(--ink);
  color: var(--lav-2);
  font-size: 12px;
}
[data-user="root"] .bar-title { color: var(--root); }
.bar-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-incidents {
  all: unset;
  flex: none;
  cursor: pointer;
  color: var(--gold);
  font-size: 12px;
}
.bar-incidents:hover { color: var(--ink); background: var(--gold); }

.screen {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 12px;
  scrollbar-width: thin;
  scrollbar-color: #4a2a5c transparent;
  overscroll-behavior: contain;
}

.ln { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.6em; }
.cmdline { margin-top: 12px; }
.dim, .k { color: var(--lav-2); }
.err { color: var(--orange); }
.ok { color: var(--teal); font-weight: 700; }
.hint { color: var(--gold); }
.hi { color: var(--gold); font-weight: 700; }
.code { color: var(--gold); }
.garble { color: var(--lav-2); }
.match { background: var(--pink); color: var(--ink); }

.p-user { color: var(--pink); font-weight: 700; }
.p-root { color: var(--root); font-weight: 800; text-shadow: 0 0 14px rgba(255, 61, 94, 0.55); }
.p-host { color: var(--gold); }
.p-path { color: var(--teal); }

button.run {
  all: unset;
  cursor: pointer;
  color: var(--teal);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(63, 216, 196, 0.45);
}
button.run.dir { font-weight: 700; }
button.run.exe { color: var(--gold); text-decoration-color: rgba(255, 178, 63, 0.45); }
button.run.hidden { color: var(--lav-2); text-decoration-color: rgba(183, 155, 203, 0.4); }
button.run:hover { color: var(--ink); background: var(--teal); text-decoration: none; }
button.run.exe:hover { background: var(--gold); }
button.run.hidden:hover { background: var(--lav-2); }
a.link { color: var(--pink); text-underline-offset: 3px; }
a.link:hover { color: var(--ink); background: var(--pink); text-decoration: none; }
button.run:focus-visible, a:focus-visible, .chips button:focus-visible, .bar-incidents:focus-visible {
  outline: 2px dashed var(--teal);
  outline-offset: 2px;
}

/* the name, set as a figlet banner in the blob colours */
.banner {
  width: max-content;
  max-width: 100%;
  margin: 0 0 8px;
  font: inherit;
  font-stretch: 75%;
  font-size: min(14px, calc((100vw - 80px) / 36));
  line-height: 1;
  white-space: pre;
  background: linear-gradient(90deg, var(--gold), var(--pink) 50%, var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(2px 2px 0 var(--ink));
}

/* tabular output */
.grid { display: grid; column-gap: 18px; row-gap: 1px; margin: 2px 0 6px; }
.grid > div { white-space: pre-wrap; min-width: 0; }
.grid.help, .grid.contact, .grid.cv, .finger { grid-template-columns: max-content minmax(0, 1fr); }
.grid.projects, .grid.ls-l { grid-template-columns: max-content max-content minmax(0, 1fr); }
.finger { display: grid; column-gap: 14px; margin: 2px 0 6px; }
.grid .k, .finger .k { color: var(--lav-2); }
.grid .grp { grid-column: 1 / -1; margin-top: 8px; }
.grid .grp:first-child { margin-top: 0; }
.ls { display: flex; flex-wrap: wrap; column-gap: 24px; }

/* one project, opened */
.proj {
  margin: 8px 0 12px;
  padding: 14px 18px 12px;
  max-width: 72ch;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: rgba(40, 10, 52, 0.7);
  box-shadow: 4px 4px 0 var(--ink);
}
.proj-name {
  margin: 0 0 6px;
  font-size: 23px;
  font-weight: 800;
  font-stretch: 112.5%;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--gold);
  text-shadow: 2px 2px 0 var(--ink);
}
.proj-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 12px; }
.proj-meta .status { color: var(--teal); margin-right: 6px; }
.proj-meta .tag {
  padding: 0 8px 1px;
  border: 1px solid #573070;
  border-radius: 999px;
  background: #22092f;
}
.proj p { margin: 0 0 8px; }
.proj-links { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 4px; }

.neofetch { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: flex-start; margin: 4px 0 8px; }
.duck { margin: 0; font: inherit; color: var(--gold); line-height: 1.3; text-shadow: 2px 2px 0 var(--ink); }
.neofetch .info > div { white-space: pre-wrap; }
.neofetch .info .k { color: var(--pink); font-weight: 700; }
.swatches { display: flex; margin-top: 8px; }
.sw { width: 24px; height: 14px; border: 2px solid var(--ink); margin-right: -2px; }
.sw-night { background: #1a0626; } .sw-dot { background: #c21cb3; } .sw-orange { background: var(--orange); }
.sw-gold { background: var(--gold); } .sw-mag { background: #c729c2; } .sw-cobalt { background: #4a38db; }
.sw-teal { background: var(--teal); } .sw-lav { background: var(--lav); }

.lockbox { margin: 6px 0 8px; padding: 12px 16px; max-width: 64ch; border: 2px dashed var(--gold); border-radius: 8px; }
.lock-title { color: var(--gold); font-weight: 800; font-stretch: 112.5%; margin-bottom: 6px; }
.glass { margin: 4px 0; font: inherit; color: var(--root); line-height: 1.25; }

/* the input line */
.input-line { display: flex; align-items: baseline; margin-top: 12px; }
.input-line.busy { visibility: hidden; }
.prompt { flex: none; white-space: pre; }
#cmd {
  flex: 1;
  min-width: 4ch;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--lav);
  font: inherit;
  caret-color: var(--pink);
}

/* quick commands for people who'd rather not type */
.chips {
  flex: none;
  display: flex;
  gap: 10px;
  padding: 10px 14px 12px;
  border-top: 2px solid var(--ink);
  background: rgba(0, 0, 0, 0.45);
  overflow-x: auto;
  scrollbar-width: none;
}
.chips button {
  flex: none;
  padding: 5px 13px 6px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  font-stretch: 100%;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
}
.chips button:nth-child(2) { background: var(--teal); }
.chips button:nth-child(3) { background: var(--pink); }
.chips button:nth-child(4) { background: var(--lav); }
.chips button:nth-child(5) { background: var(--cobalt); color: var(--lav); }
.chips button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

/* ---------- narrow screens: the terminal takes the whole window ---------- */
@media (max-width: 760px) {
  :root { --fs: 12.5px; }
  .term {
    left: 8px;
    right: 8px;
    top: max(8px, env(safe-area-inset-top));
    bottom: max(8px, env(safe-area-inset-bottom));
    width: auto;
    height: auto;
    transform: none;
    border-radius: 10px;
    box-shadow: 5px 5px 0 var(--ink), 0 0 60px rgba(255, 91, 220, 0.2);
  }
  .screen { padding: 14px 14px 10px; }
  .art { display: none; }
  .grid.projects { grid-template-columns: minmax(0, 1fr); }
  .grid.projects .perm { display: none; }
  .grid.projects .blurb { padding-left: 2ch; margin-bottom: 4px; color: var(--lav-2); }
  .chips { gap: 8px; padding: 9px 10px 11px; }
  .chips button { padding: 4px 10px 5px; font-size: 11.5px; }
  .grid.ls-l { grid-template-columns: max-content minmax(0, 1fr); }
  .grid.help { grid-template-columns: minmax(0, 1fr); }
  .grid.help > .dim { padding-left: 2ch; margin-bottom: 3px; }
  .grid.ls-l > div:nth-child(3n + 2) { display: none; }
  .proj { padding: 12px 14px 10px; }
  .proj-name { font-size: 19px; }
}
/* iOS zooms into inputs under 16px */
@media (pointer: coarse) { #cmd { font-size: 16px; } }

@media (prefers-reduced-motion: reduce) {
  .term { transition: none; }
  .spark i { transition: none; }
}

/* 404 */
.term.lost-term { height: auto; min-height: 0; }
.noscript { position: fixed; inset: auto 16px 16px; padding: 16px; background: var(--ink); color: var(--lav); }
.noscript a { color: var(--pink); }

/* ---------- root toys ---------- */
.duck3d {
  margin: 6px 0 4px;
  font: inherit;
  font-stretch: 75%;
  line-height: 1.05;
  white-space: pre;
  overflow: hidden;
}
.d-body { color: var(--gold); }
.d-beak { color: var(--orange); }
.d-eye { color: var(--lav); font-weight: 800; }
.d-water { color: var(--teal); opacity: 0.75; }

.tier-1 { color: var(--lav-2); }
.tier-2 { color: var(--lav); }
.tier-3 { color: var(--teal); }
.tier-4 { color: var(--pink); }
.tier-5 { color: var(--gold); text-shadow: 0 0 12px rgba(255, 178, 63, 0.6); }
.pull-n { font-size: 1.3em; font-weight: 800; font-stretch: 112.5%; }
.pull-spin { color: var(--lav-2); }

/* sudo shutdown: the whole stage collapses like an old CRT */
#stage { position: fixed; inset: 0; }
#power {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: #000;
  color: #4a3a55;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
html.off #power { display: grid; }
html.off #stage { visibility: hidden; }
html.crt-off body, html.off body { background: #000; }
html.crt-off #stage { animation: crt-off 0.9s cubic-bezier(0.7, 0, 0.3, 1) forwards; }
html.crt-on #stage { animation: crt-on 0.6s cubic-bezier(0.2, 0.7, 0.3, 1); }
@keyframes crt-off {
  0% { transform: none; filter: none; }
  45% { transform: scale(1, 0.004); filter: brightness(2.5); }
  75% { transform: scale(0.003, 0.004); filter: brightness(4); }
  100% { transform: scale(0, 0); filter: brightness(4); }
}
@keyframes crt-on {
  0% { transform: scale(0.003, 0.004); filter: brightness(4); }
  40% { transform: scale(1, 0.004); filter: brightness(2.5); }
  100% { transform: none; filter: none; }
}

/* ---------- the htop window on the right ---------- */
.side {
  position: fixed;
  right: clamp(16px, 4vw, 72px);
  top: calc(50% - min(43vh, 410px));
  width: clamp(290px, 25vw, 360px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 8px 8px 0 var(--ink), 0 0 70px rgba(255, 91, 220, 0.18);
  font-size: 12px;
  line-height: 1.55;
  overflow: hidden;
}
[data-user="root"] .side { box-shadow: 8px 8px 0 var(--ink), 0 0 80px rgba(255, 61, 94, 0.28); }
[data-user="root"] .side-title { color: var(--root); }
.side .bar { font-size: 11.5px; }
.side-tty { color: var(--lav-2); }
.side-body { padding: 12px 14px 10px; }
.meter { white-space: pre; }
.meter .k { display: inline-block; width: 5ch; color: var(--teal); font-weight: 700; }
.bars.cool { color: var(--teal); }
.bars.warm { color: var(--gold); }
.bars.hot { color: var(--pink); }
.m-val { color: var(--lav-2); }
.spark-row { display: flex; gap: 10px; align-items: flex-end; margin: 8px 0 10px; white-space: nowrap; }
.spark-row .k { color: var(--lav-2); line-height: 1; }
.spark { flex: 1; display: flex; align-items: flex-end; gap: 2px; height: 22px; }
.spark i { flex: 1; min-width: 2px; background: var(--pink); border-radius: 1px 1px 0 0; transition: height 0.4s; }
[data-user="root"] .spark i { background: var(--root); }
.side-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; margin-bottom: 10px; }
.side-kv .k { color: var(--lav-2); }
.procs { border-top: 1px solid #3a1850; padding-top: 6px; }
.proc {
  display: grid;
  grid-template-columns: 4.5ch 5.5ch 4.5ch minmax(0, 1fr);
  gap: 0 8px;
  padding: 0 4px;
  white-space: nowrap;
}
.proc > span:nth-child(-n + 3) { text-align: right; }
.proc .cmd { overflow: hidden; text-overflow: ellipsis; }
.proc.head { color: var(--ink); background: var(--teal); font-weight: 700; }
.proc.hl { color: var(--ink); background: var(--gold); }
.proc.clickable { cursor: pointer; }
.proc.clickable:not(.hl):hover { background: rgba(63, 216, 196, 0.16); }
.fkeys { display: flex; gap: 2px; padding: 6px 10px 8px; border-top: 2px solid var(--ink); background: rgba(0, 0, 0, 0.45); }
.fkeys button {
  all: unset;
  cursor: pointer;
  padding-right: 8px;
  color: var(--lav);
  font-size: 11.5px;
}
.fkeys .fk { margin-right: 3px; padding: 0 3px; color: var(--ink); background: var(--teal); font-weight: 700; }
.fkeys button:hover .fk { background: var(--gold); }
.fkeys button:focus-visible { outline: 2px dashed var(--teal); outline-offset: 2px; }
/* only when there's room beside the terminal */
@media (max-width: 1180px), (max-height: 560px) { .side { display: none; } }
