/* unixb0y.de — zero JS, zero external requests. */

:root {
  --bg: #030803;
  --fg: #33ff66;
  --dim: #1f9940;
  --faint: #0d3a18;
  --hi: #b6ffc8;
  --amber: #ffb000;
  --glow: 0 0 2px rgba(51,255,102,.8), 0 0 10px rgba(51,255,102,.35);
  --mono: "IBM Plex Mono", "JetBrains Mono", "DejaVu Sans Mono", Menlo, Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  /* faint PCB traces, vias and a chip, tiled (inline SVG, no request) */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cg fill='none' stroke='%2333ff66' stroke-opacity='.09' stroke-width='2'%3E%3Cpath d='M0 40H70l30 30h60'/%3E%3Cpath d='M160 70h40l20-20h20'/%3E%3Cpath d='M40 240V180l30-30V110'/%3E%3Cpath d='M120 0v30l20 20'/%3E%3Cpath d='M0 200h90l20 20h60l30-30h40'/%3E%3Cpath d='M200 240v-30'/%3E%3Ccircle cx='160' cy='70' r='4'/%3E%3Ccircle cx='70' cy='110' r='4'/%3E%3Ccircle cx='140' cy='50' r='4'/%3E%3Ccircle cx='200' cy='210' r='4'/%3E%3Ccircle cx='170' cy='220' r='4'/%3E%3C/g%3E%3Cg fill='%2333ff66' fill-opacity='.05'%3E%3Crect x='150' y='130' width='40' height='26' rx='2'/%3E%3Crect x='146' y='134' width='4' height='3'/%3E%3Crect x='146' y='141' width='4' height='3'/%3E%3Crect x='146' y='148' width='4' height='3'/%3E%3Crect x='190' y='134' width='4' height='3'/%3E%3Crect x='190' y='141' width='4' height='3'/%3E%3Crect x='190' y='148' width='4' height='3'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 240px 240px,
    radial-gradient(ellipse at center, #0a1f0e 0%, var(--bg) 70%) fixed;
  color: var(--fg);
  font: 15px/1.6 var(--mono);
  text-shadow: var(--glow);
}

::selection { background: var(--fg); color: var(--bg); text-shadow: none; }

/* CRT: scanlines + vignette (static, so it stays readable) */
.crt { position: relative; padding: 32px 16px; }
.crt::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 10;
  background: repeating-linear-gradient(to bottom,
    rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,.28) 3px, rgba(0,0,0,0) 4px);
}
.crt::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 11;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.65) 100%);
}

/* Terminal window */
.term {
  max-width: 820px;
  margin: 0 auto;
  border: 1px solid var(--dim);
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--faint), 0 0 40px rgba(51,255,102,.12);
  padding: 0 24px 24px;
  background: rgba(2, 10, 4, .75);
}

.titlebar {
  display: flex; justify-content: space-between; gap: 8px;
  margin: 0 -24px 16px;
  padding: 4px 10px;
  background: var(--fg); color: var(--bg);
  text-shadow: none; font-weight: bold; font-size: 13px;
  white-space: nowrap; overflow: hidden;
}

.boot { margin: 0 0 16px; color: var(--dim); font-size: 13px; }
.boot span { display: block; }
.boot b { color: var(--fg); }
.boot em { font-style: normal; color: #ff2a6d; text-shadow: 0 0 6px rgba(255,42,109,.6); }

/* VCC readout that dips in sync with the photo glitch (7s cycle) */
.vcc::after { content: "3.30V"; animation: vcc 7s infinite steps(1); }
@keyframes vcc {
  0%, 90%, 100% { content: "3.30V"; }
  91% { content: "1.07V"; }
  92.5% { content: "0.42V"; }
  94% { content: "2.91V"; }
}


/* PCB trace divider with vias at both ends */
.trace {
  height: 12px;
  margin: 20px 0;
  background:
    radial-gradient(circle at 6px 6px, var(--bg) 2px, var(--dim) 2px 5px, transparent 5px) left / 12px 12px no-repeat,
    radial-gradient(circle at 6px 6px, var(--bg) 2px, var(--dim) 2px 5px, transparent 5px) right / 12px 12px no-repeat,
    linear-gradient(var(--faint), var(--faint)) center / calc(100% - 20px) 2px no-repeat;
  filter: drop-shadow(0 0 3px rgba(51,255,102,.4));
}

.banner {
  margin: 0;
  /* 96 columns wide: scale to fit the window */
  font-size: min(12.5px, calc((100vw - 72px) / 58));
  line-height: 1.05;
  color: var(--fg);
  overflow: hidden;
}

/* Glitchy name */
h1 {
  position: relative;
  margin: 10px 0 0;
  font-size: 18px;
  font-weight: normal;
  letter-spacing: .35em;
  text-transform: uppercase;
  color: var(--hi);
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; left: 0; top: 0;
  width: 100%; overflow: hidden;
}
.glitch::before { color: #ff2a6d; text-shadow: none; animation: glitch 11s infinite steps(1); clip-path: inset(0 0 60% 0); opacity: 0; }
.glitch::after  { color: #05d9e8; text-shadow: none; animation: glitch 11s infinite steps(1) reverse; clip-path: inset(55% 0 0 0); opacity: 0; }
@keyframes glitch {
  0%, 92%, 100% { opacity: 0; transform: none; }
  93% { opacity: .8; transform: translate(-3px, 1px); }
  95% { opacity: .8; transform: translate(3px, -1px); }
  97% { opacity: .6; transform: translate(-1px, 0); }
}

/* Photo + about */
.who {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 8px;
}

.photo { margin: 0; }
.photo img {
  display: block;
  width: 100%; height: auto; aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--fg);
  padding: 3px;
  background: var(--bg);
  /* phosphor-tint the photo */
  filter: grayscale(1) sepia(1) hue-rotate(70deg) saturate(3) contrast(1.15) brightness(.9);
  image-rendering: pixelated;
}
.photo { position: relative; }
.photo::after {
  content: "";
  position: absolute; inset: 4px 4px 28px 4px;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 1px, rgba(0,0,0,.45) 2px 3px);
}
/* Photo glitch: displaced slices of the image + stuck/dead pixels.
   Only the photo moves; the text never does. */
.photo .px {
  position: absolute; left: 4px; top: 4px;
  width: calc(100% - 8px); aspect-ratio: 1;
  pointer-events: none;
  opacity: 0;
}
.photo .slice {
  background: url("assets/img/profile.jpg") 50% 50% / cover no-repeat;
  filter: grayscale(1) sepia(1) hue-rotate(70deg) saturate(3) contrast(1.15) brightness(.9);
}
.photo .slice.a { clip-path: inset(24% 0 64% 0); animation: slice-a 7s infinite steps(1); }
.photo .slice.b {
  clip-path: inset(57% 0 33% 0);
  filter: grayscale(1) sepia(1) hue-rotate(250deg) saturate(5) brightness(1.1);
  mix-blend-mode: screen;
  animation: slice-b 7s infinite steps(1);
}
@keyframes slice-a {
  0%, 90%, 100% { opacity: 0; }
  91%   { opacity: 1; background-position: calc(50% + 10px) 50%; }
  92.5% { opacity: 1; background-position: calc(50% - 6px) 50%; clip-path: inset(30% 0 60% 0); }
  94%   { opacity: 0; }
}
@keyframes slice-b {
  0%, 91%, 100% { opacity: 0; }
  91.8% { opacity: .9; background-position: calc(50% - 12px) 50%; }
  93.2% { opacity: .9; background-position: calc(50% + 5px) 50%; clip-path: inset(40% 0 52% 0); }
  94%   { opacity: 0; }
}
/* a few stuck pixels that blink on their own schedule */
.photo .dead {
  width: 6px; aspect-ratio: auto; height: 6px;
  background: var(--hi);
  box-shadow:
    48px 30px 0 #ff2a6d, 54px 30px 0 #ff2a6d,
    132px 62px 0 var(--fg),
    90px 118px 0 #05d9e8, 96px 118px 0 #05d9e8, 96px 124px 0 #05d9e8,
    150px 150px 0 var(--hi),
    24px 160px 0 var(--fg);
  animation: dead 4.3s infinite steps(1);
}
@keyframes dead {
  0%, 31%, 34%, 70%, 72%, 100% { opacity: 0; }
  32% { opacity: 1; }
  33% { opacity: .5; transform: translate(6px, 0); }
  71% { opacity: .8; transform: translate(0, 6px); }
}

.photo figcaption { font-size: 12px; color: var(--dim); margin-top: 4px; }

p { margin: 0 0 12px; }
.cmd { margin: 16px 0 6px; color: var(--hi); }
.about .cmd:first-child { margin-top: 0; }
.aka { color: var(--dim); font-size: 13px; }
.aka::before { content: "# "; }
.ps1 { color: var(--amber); text-shadow: 0 0 6px rgba(255,176,0,.5); }

.tree, .links { list-style: none; margin: 0 0 12px; padding: 0; }
.tree li { padding-left: 4ch; text-indent: -4ch; }
.tree li::before { content: "├── "; color: var(--dim); }
.tree li:last-child::before { content: "└── "; }
.ls { color: #5cf0ff; text-shadow: 0 0 6px rgba(92,240,255,.4); word-spacing: 1.2em; }

.links li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.perm { color: var(--dim); margin-right: 10px; }

a {
  color: var(--hi);
  text-decoration: none;
  border-bottom: 1px dashed var(--dim);
}
a:hover, a:focus-visible {
  background: var(--fg);
  color: var(--bg);
  text-shadow: none;
  border-bottom-color: var(--fg);
  outline: none;
}
a:visited { color: #8fe3a5; }
a:visited:hover { color: var(--bg); }

.cursor { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Footer + 88x31-style buttons */
footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px dashed var(--faint);
  font-size: 12px;
  color: var(--dim);
}
footer a { color: var(--dim); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 31px; min-width: 88px;
  padding-right: 6px;
  border: 2px outset #3a6b46;
  background: #071a0c; color: var(--fg);
  font-size: 10px; line-height: 1.1;
  text-shadow: none; text-transform: uppercase;
}
.badge b { align-self: stretch; display: flex; align-items: center; padding: 0 5px; background: var(--fg); color: var(--bg); }

/* Small screens */
@media (max-width: 640px) {
  body { font-size: 14px; }
  .crt { padding: 16px 8px; }
  .term { padding: 0 14px 18px; }
  .titlebar { margin: 0 -14px 14px; }
  .who { grid-template-columns: 1fr; }
  .photo { max-width: 200px; }
  .perm { display: none; }
  .links li { white-space: normal; }
  h1 { letter-spacing: .2em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}

@media print {
  body { background: #fff; color: #000; text-shadow: none; }
  .crt::before, .crt::after, .badges, .boot { display: none; }
  a { color: #000; }
}

/* ---------- howtos: file listing + rendered "markdown" pages ---------- */
.files a::after { content: ""; }
.files li:hover .perm { color: var(--fg); }

.crumb { margin: 0 0 16px; font-size: 13px; color: var(--dim); }
.crumb a { color: var(--dim); }

.md h1, .md h2 { font-weight: normal; letter-spacing: 0; text-transform: none; }
.md h1 { font-size: 20px; margin: 4px 0 6px; color: var(--hi); }
.md h1::before { content: "# "; color: var(--dim); }
.md h2 { font-size: 16px; margin: 26px 0 8px; color: var(--fg); }
.md h2::before { content: "## "; color: var(--dim); }
.md .lead { color: var(--dim); }
.md ul { list-style: none; margin: 0 0 8px; padding: 0; }
.md li { padding-left: 2ch; text-indent: -2ch; margin-bottom: 6px; }
.md li::before { content: "- "; color: var(--dim); }
.md li .note { color: var(--dim); }
.md li .note::before { content: " — "; }
.md li .tag {
  display: inline-block; margin-left: 6px; padding: 0 4px;
  font-size: 11px; text-indent: 0; line-height: 1.5;
  border: 1px solid var(--faint); color: var(--dim); text-shadow: none;
}
.md .eof { margin-top: 24px; color: var(--dim); }
