@font-face {
  font-family: "Orbit";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/Orbit-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #0e0e0e;
  --fg: #ffffff;
  --dim: #7d7d7d;
  --line: rgba(255, 255, 255, 0.16);
  --accent: #ff7130; /* fox orange */
  --ca-orange: var(--accent);
  --ca-cyan: rgba(0, 200, 255, 0.5);
  --font: "Orbit", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: clamp(16px, 3vw, 40px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font: 400 14px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  height: 100svh;
  overflow: hidden; /* sidebar and pane scroll on their own, the bars stay put */
}

/* film grain + soft vignette, like the thumbnail */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
body::before {
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.5) 100%);
}
body::after {
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
.dim { color: var(--dim); }
.spacer { flex: 1; }

/* layout: the screen is split like a tmux pane — narrow sidebar session on the left,
   main pane on the right with the headline centered inside it */
.screen {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
}

.session {
  font-size: 12px;
  padding: 24px clamp(20px, 2vw, 32px) 40px var(--gutter);
  border-right: 1px solid rgba(255, 255, 255, 0.035);
  overflow-y: auto;
}

/* right pane: scrolls on its own; holds the home hero or a routed page */
.pane {
  position: relative;
  min-width: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2a2a2a transparent;
}
/* the tree sets the sidebar width; `.fit` blocks take that width instead of pushing it */
.session > .fit { width: 0; min-width: 100%; }
.session > .block:first-child { margin-top: 0; min-width: 31ch; }

.hero {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 var(--gutter);
  text-align: center;
  container-type: size; /* the logo is sized by the pane's height too, so the fox fits without scrolling */
  overflow: hidden;
  background: var(--bg); /* backdrop for the logo noise blend */
}
.sub {
  position: relative; /* paints above the fox */
  width: fit-content;
  margin-inline: auto;
  padding: 0 8px;
  background: var(--bg); /* stays readable over the fox's snout */
}
.sub:first-of-type { margin-top: clamp(20px, 3vw, 36px); }

.block { margin-top: clamp(20px, 3vh, 32px); }
.cmd { color: var(--dim); }
.ps1 { color: var(--accent); }

/* headline */
.logo {
  font-weight: 400;
  font-size: var(--logo-size);
  line-height: 0.9;
  -webkit-text-stroke: 0.035em var(--fg);
  position: relative;
  user-select: none;
  cursor: default;
}
/* stage: headline + the ASCII fox peeking from behind it */
.stage {
  position: relative;
  /* the fox spans -1.07..2.63 logo sizes around the stage; the two cqb terms keep both ends inside the pane
     (45px = the two lines under the headline, centred together with it) */
  --logo-size: min(260px, 19.5cqi, calc((50cqb - 45px) / 1.52), calc((50cqb + 45px) / 2.25));
}

/* halftone fox, drawn by fox.js on this canvas. Size and offsets come from FOX_CONFIG
   (--fox-y / --fox-x, in headline font sizes). It comes first in the DOM, so the word paints over it. */
.fox {
  position: absolute;
  left: 50%;
  top: calc(var(--logo-size) * var(--fox-y, -1.07));
  transform: translateX(calc(-50% + var(--logo-size) * var(--fox-x, 0)));
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 75%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 75%, transparent 100%);
}

/* animated pixel noise over the letters (driven by glitch.js); multiply keeps the dark background untouched */
.logo::after {
  content: "";
  position: absolute;
  inset: -10% -5%;
  background: var(--noise-img, none) var(--noise-x, 0) var(--noise-y, 0) / var(--noise-size, 384px);
  image-rendering: pixelated;
  mix-blend-mode: multiply;
  opacity: var(--noise-o, 0);
  pointer-events: none;
}

/* optical kerning — Orbit is monospaced, so narrow t/f and the open x leave holes */
.logo .k-tf { margin-left: -0.05em; }
.logo .k-fo { margin-left: -0.035em; }
.logo .k-ox { margin-left: -0.03em; }
/* once sliced, the original text only holds the layout; slices draw it */
.logo.is-glitched { color: transparent; -webkit-text-stroke-color: transparent; }
.logo .slice {
  position: absolute;
  inset: 0;
  color: var(--fg);
  -webkit-text-stroke: 0.035em var(--fg);
  text-shadow:
    calc(var(--ca, 0.021em) * -1) 0 var(--ca-orange),
    var(--ca, 0.021em) 0 var(--ca-cyan);
  pointer-events: none;
}

/* `tree` output: glyph prefixes are literal text, so they line up in the monospace grid */
.tree li { display: flex; align-items: center; white-space: pre; line-height: 1.45; min-height: 24px; }
.tree .g { color: var(--dim); }

/* `ls` output as columns; long names are cut with an ellipsis (full name in the title tooltip) */
.ls a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4ch 4ch;
  gap: 1ch;
}
.ls .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree a,
.ls a {
  padding: 0 4px;
  margin-left: -4px;
}
.tree a { display: inline-flex; align-items: center; gap: 10px; min-height: 24px; }
.ls a { min-height: 24px; align-items: center; }

/* selection-style hover, like a highlighted line in a TUI */
.tree a:hover,
.tree a:focus-visible,
.ls a:hover,
.ls a:focus-visible,
.badge:hover {
  background: var(--fg);
  color: var(--bg);
  outline: none;
}
.ls a:hover .dim,
.ls a:focus-visible .dim { color: var(--bg); }

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  vertical-align: -0.2em;
  background: var(--fg);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* pixel icons */
.px { display: inline-flex; width: 12px; height: 12px; }
.px svg { width: 100%; height: 100%; shape-rendering: crispEdges; }

/* private services: a lock in the hero's corner (like the old page), opens `ls -l services/` */
.lock {
  position: absolute;
  top: 24px;
  right: var(--gutter);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--fg);
  opacity: 0.32;
  transition: opacity 0.2s ease;
}
.lock:hover, .lock:focus-visible { opacity: 0.7; }
.lock .px { width: 12px; height: 12px; }
.ls--svc a { grid-template-columns: 10ch minmax(0, 1fr) 2ch; }

/* tmux-style status bar, pinned to the top of the viewport */
.status {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 4px var(--gutter);
  background: #1c1c1c;
  color: var(--dim);
  font-size: 12px;
}
.status .tag { background: var(--fg); color: var(--bg); padding: 0 6px; }
.status .win { color: var(--fg); }
.status .old { color: var(--fg); }
.status .old:hover, .status .old:focus-visible { color: var(--accent); }
.status > * { white-space: nowrap; }

.badge {
  display: inline-flex;
  align-items: baseline; /* the 6px dot sits on the baseline = same height as lowercase letters */
  gap: 8px;
  padding: 0 4px;
  color: var(--accent);
}
.dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}
/* "online" indicator: the glow breathes so the eye finds it */
@keyframes pulse {
  50% { box-shadow: 0 0 2px var(--accent); opacity: 0.55; }
}

/* bottom line: last login on the left, live process readout on the right */
.foot {
  display: flex;
  gap: 16px;
  padding: 4px var(--gutter);
  border-top: 1px solid rgba(255, 255, 255, 0.035);
  color: var(--dim);
  font-size: 12px;
  white-space: nowrap;
}
.live { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.live .spin { color: var(--accent); }

/* ── routed pages (router.js / pages.js) ─────────────────────────── */
.page {
  max-width: 900px;
  padding: 32px clamp(24px, 4vw, 64px) 64px;
  font-size: 13px;
}
.page .block:first-child { margin-top: 0; }
.page .block { margin-top: 36px; }
.page .out { margin-top: 12px; }
.out.reveal { animation: reveal 0.24s steps(4); } /* stepped, like a screen redraw; no fill-mode, so output stays visible if animations never run */
@keyframes reveal { from { opacity: 0; clip-path: inset(0 0 100% 0); } to { opacity: 1; clip-path: inset(0); } }

/* cat about.md */
.about-head {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: center;
}
.portrait { display: block; width: 240px; }
.about-name { font-weight: 400; font-size: 28px; line-height: 1.1; }
.role { color: var(--accent); margin: 6px 0 18px; }
.prose { color: #cfcfcf; max-width: 62ch; line-height: 1.75; }
.prose + .prose { margin-top: 12px; }

/* principles as cli flags */
.flags { display: flex; flex-wrap: wrap; gap: 8px; }
.flags li {
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #d6d6d6;
}
.flags button, .flags a { display: inline-flex; align-items: center; font: inherit; color: inherit; background: none; border: 0; padding: 2px 8px; min-height: 24px; cursor: pointer; }
.flags li:hover, .flags li.is-open, .flags li:has(:focus-visible) { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* cat <id>.txt under the principles list */
.cat { margin-top: 12px; }
.pr-title { font-size: 20px; line-height: 1.2; margin: 4px 0 8px; }
.cat .prose + .pr-list-title, .cat .prose + p { margin-top: 12px; }
.pr-list-title { margin-top: 12px; }
.pr-list { list-style: none; color: #cfcfcf; max-width: 62ch; line-height: 1.7; }
.pr-list li + li { margin-top: 6px; }
.pr-list b { font-weight: 400; color: var(--fg); }
.cat .btn { margin-top: 4px; display: inline-block; }

/* tree output with a value column */
.trow {
  display: grid;
  grid-template-columns: max-content 24ch minmax(0, 1fr);
  white-space: pre;
  line-height: 1.7;
}
.trow { position: relative; }
.trow .g { color: var(--dim); }
/* the branch lines (data-guide, see treeRows) repeated on every wrapped line after the first, as text,
   so they match the row's line height whatever the width */
.trow--bar::before {
  content: attr(data-guide);
  position: absolute;
  inset: 1lh auto 0 0; /* the first line is drawn by .g itself */
  overflow: hidden;
  white-space: pre;
  color: var(--dim);
}
.trow .tv { color: var(--dim); white-space: normal; }
.trow:hover .tl, .trow:hover .tv { color: var(--fg); }

/* git log */
.log {
  list-style: none;
  columns: 2 220px;
  column-gap: 32px;
  line-height: 1.8;
}
.log li { break-inside: avoid; }
.log .hash { color: var(--accent); opacity: 0.7; margin-right: 1.5ch; }

/* whois: switch + key/value */
.switch { display: flex; gap: 8px; margin-bottom: 12px; }
.switch button {
  font: inherit;
  color: var(--dim);
  background: none;
  border: 0;
  padding: 0 4px;
  cursor: pointer;
}
.switch button[aria-selected="true"] { background: var(--fg); color: var(--bg); }
.switch button:hover:not([aria-selected="true"]) { color: var(--fg); }
.kv {
  display: grid;
  grid-template-columns: 16ch minmax(0, 1fr);
  row-gap: 4px;
  line-height: 1.6;
}
.kv dt { color: var(--dim); }
.kv dd a { color: var(--accent); }
.kv dd a:hover { background: var(--accent); color: var(--bg); }

/* ls ~/projects/ — category dirs */
.dirs { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.dir { color: #cfcfcf; padding: 0 4px; margin-left: -4px; }
.dir:hover { color: var(--fg); background: rgba(255, 255, 255, 0.08); }
.dir.is-current { background: var(--fg); color: var(--bg); }

/* cd <cat> && ls -la — list + README card */
.page:has(.browser) { max-width: 1080px; }
.browser {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: clamp(24px, 3vw, 40px);
  align-items: start;
}
.lslist { list-style: none; }
.lsrow {
  display: grid;
  grid-template-columns: 10ch 3ch minmax(0, 1fr);
  column-gap: 1.2ch;
  width: 100%;
  padding: 1px 6px;
  margin-left: -6px;
  font: inherit;
  line-height: 1.7;
  text-align: left;
  color: #cfcfcf;
  background: none;
  border: 0;
  cursor: pointer;
}
.lsrow .perm { color: #4a4a4a; }
.lsrow .kind { color: var(--accent); opacity: 0.7; }
.lsrow .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lsrow .g { color: var(--dim); }
.lsrow.is-selected { background: var(--fg); color: var(--bg); }
.lsrow.is-selected .perm, .lsrow.is-selected .kind, .lsrow.is-selected .g { color: var(--bg); opacity: 1; }

.readme {
  position: sticky;
  top: 24px;
  min-height: 260px;
  padding: 32px 28px 24px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.panel-label {
  position: absolute;
  top: -0.8em;
  left: 12px;
  padding: 0 6px;
  background: var(--bg);
  color: var(--dim);
  font-size: 12px;
}
.readme-num {
  position: absolute;
  top: 12px;
  right: 20px;
  font-size: 96px;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.16);
  pointer-events: none;
}
.readme-title { position: relative; font-weight: 400; font-size: 24px; line-height: 1.2; margin: 24px 0 12px; max-width: 80%; }
.readme .prose { position: relative; }
.readme-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.btn { font: inherit; color: var(--accent); background: none; border: 0; padding: 0 2px; cursor: pointer; } /* <a> and <button> alike */
.btn:hover, .btn:focus-visible { background: var(--accent); color: var(--bg); outline: none; }
.readme-url { margin-top: 14px; font-size: 12px; overflow-wrap: anywhere; }

@media (max-width: 1100px) {
  .browser { grid-template-columns: 1fr; }
  .readme { position: relative; top: 0; order: -1; }
}

/* ls -l ~/apps/ — app cards */
.page:has(.apps) { max-width: 1080px; }
.apps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 28px 20px;
  margin-top: 20px;
}
.app {
  position: relative;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 22px 18px 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.app:hover { border-color: rgba(255, 255, 255, 0.35); }
.app-icon { position: relative; width: 88px; height: 88px; }
.app-icon canvas, .app-icon img { position: absolute; inset: 0; width: 88px; height: 88px; }
.app-icon img { opacity: 0; border-radius: 18px; transition: opacity 0.2s steps(3); }
.app:hover .app-icon img { opacity: 1; } /* glyph icon by default, the real one on hover */
.app-name { font-weight: 400; font-size: 17px; line-height: 1.3; }
.app-body .dim { font-size: 12px; margin-top: 2px; }
.app-links { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 12px; font-size: 12px; }
.na { color: #3a3a3a; text-decoration: line-through; }

/* pwgen */
.hl { color: var(--fg); }
.pw-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.pw-len { display: flex; align-items: center; gap: 12px; color: var(--dim); }
.pw-len output { color: var(--fg); min-width: 2ch; display: inline-block; }
.pw-len input { width: 160px; accent-color: var(--accent); }
.pw-sets { display: flex; flex-wrap: wrap; gap: 8px; }
.flag {
  font: inherit;
  color: var(--dim);
  background: none;
  border: 0;
  padding: 0 4px;
  cursor: pointer;
}
.flag[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.flag:hover:not([aria-pressed="true"]) { color: var(--fg); }
.pw-go { font: inherit; background: none; border: 0; cursor: pointer; }
.pw-log { list-style: none; margin-top: 20px; }
.pw-log li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: baseline;
  padding: 4px 0;
  color: var(--dim);
}
.pw-log li:first-child .pw-out { color: var(--fg); font-size: 16px; }
.pw-out { font: inherit; color: #9a9a9a; overflow-wrap: anywhere; user-select: all; }

/* ./talk.sh — hire me chat */
.talk { margin-top: 8px; max-width: 760px; }
.talk-hello { color: var(--accent); font-size: 18px; margin-bottom: 14px; }
.tl { line-height: 1.7; color: #cfcfcf; }
.tl a { color: var(--accent); }
.tl a:hover { background: var(--accent); color: var(--bg); }
.who { color: var(--accent); margin-right: 0.5ch; }
.who-you { color: var(--dim); }
.talk-lead { color: var(--fg); }
.menu { list-style: none; margin: 10px 0 6px; }
.opt {
  display: flex;
  gap: 1ch;
  width: 100%;
  padding: 2px 6px;
  margin-left: -6px;
  font: inherit;
  line-height: 1.6;
  text-align: left;
  color: #cfcfcf;
  background: none;
  border: 0;
  cursor: pointer;
}
.opt .caret { color: var(--accent); width: 1ch; flex: none; }
.opt.green { color: #9ed6a5; }
.opt.red { color: #d98b8b; }
.opt .exit { margin-left: auto; color: #4a4a4a; }
.opt.is-selected { background: var(--fg); color: var(--bg); }
.opt.is-selected .caret, .opt.is-selected .exit { color: var(--bg); }
.hint { font-size: 12px; }
.talk-actions { margin-top: 14px; }
.talk-form { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 1ch; margin-top: 8px; }
.talk-form textarea {
  font: inherit;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  padding: 0 0 0 10px;
  resize: vertical;
  outline: none;
  caret-color: var(--accent);
}
.talk-form button { grid-column: 2; justify-self: start; font: inherit; background: none; border: 0; cursor: pointer; }
.talk-form button:disabled { color: #3a3a3a; cursor: default; background: none; }
.spacer + .dim { white-space: nowrap; }

/* current route in the sidebar */
.tree a.active { color: var(--accent); }
.tree a.active:hover, .tree a.active:focus-visible { color: var(--bg); } /* the highlighted line keeps its text readable */
.status .tag:hover { background: var(--accent); }

@media (max-width: 900px) {
  .about-head { grid-template-columns: 1fr; }
  .trow { grid-template-columns: max-content minmax(0, 1fr); }
  .trow .tv { grid-column: 2; padding-left: 0; margin-bottom: 4px; }
}

@media (max-width: 760px) {
  .screen { grid-template-columns: 1fr; }
  .session { border-right: 0; border-top: 1px solid rgba(255, 255, 255, 0.035); padding-right: var(--gutter); }
  body { height: auto; overflow: visible; }
  .pane { order: -1; overflow: visible; }
  .hero { height: auto; padding: 96px var(--gutter) 40px; container-type: inline-size; overflow: visible; } /* room for the fox ears */
  .stage { --logo-size: min(260px, 19.5cqi); }
}

@media (max-width: 600px) {
  .hide-sm { display: none; }
  .foot > span:first-child { display: none; } /* phones: keep just the live readout */
}

@media (prefers-reduced-motion: reduce) {
  .cursor, .dot, .out.reveal { animation: none; }
}
