/* bitars :: terminal phosphor */
:root {
  --bg: #001B0F;
  --bg-lift: #012816;
  --fg: #33FF88;
  --fg-dim: #25c56a;
  --amber: #FFB000;
  --cell: 1.6rem;
  --bar-h: 3.5rem;
  --mono: "Fira Code", "Cascadia Mono", Consolas, "DejaVu Sans Mono", "Courier New", monospace;
  --pixel: "VT323", "Lucida Console", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  color: var(--fg);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(51, 255, 136, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(51, 255, 136, .03) 1px, transparent 1px);
  background-size: 100% var(--cell), 2ch 100%;
  font-family: var(--mono);
  font-size: 16px;
  line-height: var(--cell);
  font-variant-ligatures: none;
  overflow-wrap: anywhere;
}

/* scanlines: purely decorative, never blocks clicks */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 90; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .16) 0, rgba(0, 0, 0, .16) 1px, transparent 1px, transparent 3px);
}

h1, h2, h3 { font-family: var(--pixel); font-weight: 400; margin: 0; letter-spacing: .02em; }
h1 { font-size: clamp(3.2rem, 15vw, 6.5rem); line-height: .95; text-shadow: 0 0 12px rgba(51, 255, 136, .5); }
h2 { font-size: clamp(1.9rem, 6.5vw, 2.6rem); line-height: 1.1; margin-bottom: calc(var(--cell) / 2); }
h3 { font-size: 1.6rem; line-height: 1.15; color: var(--amber); margin-bottom: calc(var(--cell) / 4); }
p, ul, ol, dl, pre { margin: 0 0 var(--cell); }
a { color: var(--amber); text-decoration: underline; text-underline-offset: 3px; }
a:hover { background: var(--amber); color: var(--bg); text-decoration: none; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
::selection { background: var(--fg); color: var(--bg); }
strong { color: var(--amber); font-weight: 500; }
svg, pre { max-width: 100%; }

.to-main { position: absolute; left: 1ch; top: -5rem; background: var(--amber); color: var(--bg); padding: .5rem 1ch; z-index: 99; }
.to-main:focus { top: .5rem; }

/* ----- status bar ----- */
.statusbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--bar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1ch;
  padding: 0 2ch;
  background: var(--bg);
  border-bottom: 3px double var(--fg);
}
.prompt { font-family: var(--pixel); font-size: 1.7rem; color: var(--fg); text-decoration: none; white-space: nowrap; min-width: 0; }
.prompt:hover { background: none; color: var(--amber); }
.prompt .path { color: var(--amber); }
.cur {
  display: inline-block; width: .55em; height: .9em; margin-left: .15em; vertical-align: -0.08em;
  background-color: var(--fg);
  animation: blink 1.1s steps(1, end) infinite;
}
@keyframes blink { 50% { background-color: transparent; } }

.cmdk {
  flex: none;
  font-family: var(--mono); font-size: 1rem; line-height: 1;
  color: var(--bg); background: var(--fg);
  border: 0; border-radius: 0;
  min-height: 44px; min-width: 44px; padding: 0 1.5ch;
  cursor: pointer;
}
.cmdk kbd { font: inherit; display: none; opacity: .75; }
.cmdk:hover, .cmdk[aria-expanded="true"] { background: var(--amber); }

/* ----- command palette ----- */
.veil { position: fixed; inset: 0; z-index: 40; background: rgba(0, 12, 6, .82); }
.palette {
  position: fixed; z-index: 50;
  top: calc(var(--bar-h) + 1rem); left: 50%; transform: translateX(-50%);
  width: min(42rem, calc(100% - 1.5rem));
  max-height: calc(100vh - var(--bar-h) - 2rem); overflow-y: auto;
  background: var(--bg);
  border: 3px double var(--amber);
  box-shadow: 0 0 0 1px var(--bg), 0 0 40px rgba(255, 176, 0, .18);
  padding: 1rem 1.5ch 1.2rem;
}
.palette-label { display: block; color: var(--amber); margin-bottom: .4rem; }
.palette-in { display: flex; align-items: center; gap: 1ch; border-bottom: 1px dashed var(--fg-dim); padding-bottom: .6rem; margin-bottom: .6rem; }
.palette-in span { color: var(--amber); }
.palette-in input {
  flex: 1; min-width: 0; min-height: 44px;
  font: inherit; color: var(--fg); caret-color: var(--amber);
  background: transparent; border: 0; padding: 0;
}
.palette-in input::placeholder { color: var(--fg-dim); opacity: 1; }
.palette-in input:focus { outline: none; }
.palette-in:focus-within { border-bottom-color: var(--amber); border-bottom-style: solid; }
.palette ul { list-style: none; margin: 0; padding: 0; }
.palette li a {
  display: grid; grid-template-columns: 3ch minmax(0, 1fr); column-gap: 1ch;
  padding: .55rem 1ch; min-height: 48px; align-items: center;
  color: var(--fg); text-decoration: none;
}
.palette li a::before { content: ">"; color: var(--fg-dim); grid-row: 1 / span 2; }
.palette li a b { font-weight: 500; display: block; grid-column: 2; }
.palette li a i { font-style: normal; color: var(--fg-dim); display: block; font-size: .92rem; grid-column: 2; line-height: 1.35; }
.palette li a:hover, .palette li a:focus-visible { background: var(--fg); color: var(--bg); outline: none; }
.palette li a:hover i, .palette li a:focus-visible i, .palette li a:hover::before, .palette li a:focus-visible::before { color: var(--bg); }
.palette li a[aria-current="page"] b::after { content: "  [here]"; color: var(--amber); }
.palette li a[aria-current="page"]:hover b::after, .palette li a[aria-current="page"]:focus-visible b::after { color: var(--bg); }
.palette-none { color: var(--amber); padding: .5rem 1ch; margin: 0; }
.palette-keys { margin: .8rem 0 0; color: var(--fg-dim); font-size: .9rem; border-top: 1px dashed var(--fg-dim); padding-top: .6rem; }

/* ----- screen ----- */
.tty { max-width: 104ch; margin: 0 auto; padding: var(--cell) 2ch calc(var(--cell) * 3); }
.tty > * + * { margin-top: calc(var(--cell) * 1.5); }

.rule { display: block; overflow: hidden; white-space: nowrap; color: var(--fg-dim); line-height: 1; user-select: none; }
.cmd { color: var(--fg-dim); margin-bottom: calc(var(--cell) / 2); }
.cmd::before { content: "$ "; color: var(--amber); }
.dim { color: var(--fg-dim); }
.amber { color: var(--amber); }

/* window = double-line box with a bracketed tag sitting on its top edge */
.win { position: relative; border: 3px double var(--fg); padding: calc(var(--cell) * 1.25) 2ch var(--cell); background: rgba(0, 27, 15, .88); min-width: 0; }
.win > :last-child { margin-bottom: 0; }
.win-tag {
  position: absolute; top: -.85rem; left: 1.5ch; max-width: calc(100% - 3ch);
  background: var(--bg); padding: 0 1ch; line-height: 1.5rem;
  color: var(--amber); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.win-amber { border-color: var(--amber); }
.win-thin { border: 1px solid var(--fg-dim); }

.cols { display: grid; gap: calc(var(--cell) * 1.5) 3ch; }
.cols > * { min-width: 0; }

/* ----- home: boot ----- */
.boot { display: grid; gap: var(--cell) 4ch; align-items: end; }
.boot > * { min-width: 0; }
.boot-log { color: var(--fg-dim); margin-bottom: var(--cell); list-style: none; padding: 0; }
.boot-log li::before { content: "[ ok ] "; color: var(--fg); }
.tagline { font-family: var(--pixel); font-size: clamp(1.5rem, 5.4vw, 2.1rem); line-height: 1.15; color: var(--amber); margin: .6rem 0 var(--cell); }
.byteart { font-family: var(--mono); font-size: clamp(.95rem, 4.4vw, 1.5rem); line-height: 1.22; color: var(--fg); margin: 0; white-space: pre; overflow: hidden; text-shadow: 0 0 8px rgba(51, 255, 136, .45); }
.byteart b { color: var(--amber); font-weight: 400; }

/* ----- home: ls ----- */
.ls { list-style: none; margin: 0; padding: 0; }
.ls li { border-top: 1px dashed var(--fg-dim); }
.ls li:last-child { border-bottom: 1px dashed var(--fg-dim); }
.ls a { display: grid; gap: 0 2ch; padding: .7rem 1ch; color: var(--fg); text-decoration: none; }
.ls a .perm { color: var(--fg-dim); }
.ls a .file { color: var(--amber); font-weight: 500; }
.ls a:hover, .ls a:focus-visible { background: var(--fg); color: var(--bg); }
.ls a:hover .perm, .ls a:hover .file, .ls a:focus-visible .perm, .ls a:focus-visible .file { color: var(--bg); }

/* ----- bit flipper ----- */
.bits { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; margin-bottom: var(--cell); }
.bit {
  min-width: 0; min-height: 6.5rem; padding: .4rem .2rem .5rem;
  display: grid; justify-items: center; align-content: space-between; gap: .3rem;
  font-family: var(--mono); font-size: .9rem; line-height: 1.2;
  color: var(--fg-dim); background: transparent;
  border: 1px solid var(--fg-dim); border-radius: 0;
  cursor: pointer;
}
.bit .lever { position: relative; width: 1.5rem; height: 2.6rem; border: 1px solid currentColor; }
.bit .lever::after { content: ""; position: absolute; left: 3px; right: 3px; bottom: 3px; height: 1rem; background: currentColor; transition: transform .12s steps(3); }
.bit .state { font-family: var(--pixel); font-size: 1.8rem; line-height: .9; }
.bit:hover { border-color: var(--amber); }
.bit[aria-checked="true"] { color: var(--bg); background: var(--fg); border-color: var(--fg); box-shadow: 0 0 14px rgba(51, 255, 136, .45); }
.bit[aria-checked="true"] .lever::after { transform: translateY(calc(-2.6rem + 1rem + 8px)); }
.readout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin-bottom: var(--cell); }
.readout div { border: 1px solid var(--fg-dim); padding: .5rem 1ch; min-width: 0; }
.readout dt { color: var(--amber); font-size: .9rem; }
.readout dd { margin: 0; font-family: var(--pixel); font-size: 2rem; line-height: 1.1; }
.readout .wide { grid-column: 1 / -1; }
.ops { display: flex; flex-wrap: wrap; gap: .6rem; }
.ops button {
  font: inherit; color: var(--fg); background: transparent; border: 1px solid var(--fg); border-radius: 0;
  min-height: 44px; padding: 0 1.5ch; cursor: pointer;
}
.ops button:hover { background: var(--fg); color: var(--bg); }

/* ----- man page ----- */
.man { display: grid; gap: 0; }
.man-head { display: flex; justify-content: space-between; gap: 2ch; color: var(--fg-dim); margin-bottom: var(--cell); }
.man section { display: grid; gap: 0 3ch; padding: var(--cell) 0; border-top: 1px dashed var(--fg-dim); }
.man section > * { min-width: 0; }
.man section > h2 { font-size: 1.7rem; color: var(--amber); }
.man section > div > :last-child { margin-bottom: 0; }
.opts { margin: 0; }
.opts dt { color: var(--amber); }
.opts dd { margin: 0 0 calc(var(--cell) / 2) 3ch; }

/* ----- pipeline (process) ----- */
.pipe { list-style: none; margin: 0; padding: 0; }
.pipe > li { position: relative; padding-left: 5ch; padding-bottom: calc(var(--cell) * 1.5); }
.pipe > li::before { content: ""; position: absolute; left: 1.5ch; top: 2.2rem; bottom: 0; border-left: 1px solid var(--fg-dim); }
.pipe > li:last-child { padding-bottom: 0; }
.pipe > li:last-child::before { display: none; }
.pipe .pid {
  position: absolute; left: 0; top: 0; width: 3ch; height: 2rem; display: grid; place-items: center;
  font-family: var(--pixel); font-size: 1.6rem; color: var(--bg); background: var(--amber);
}
.pipe .status { display: inline-block; color: var(--fg-dim); margin-bottom: .2rem; }
.pipe .status b { color: var(--fg); font-weight: 400; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { padding-left: 5ch; text-indent: -5ch; margin-bottom: calc(var(--cell) / 4); }
.checks li::before { content: "[ ] "; color: var(--amber); white-space: pre; }
.checks.q li::before { content: " ?  "; }

/* ----- config listing (company info, contact, footer) ----- */
.conf { margin: 0; counter-reset: ln; }
.conf > div { counter-increment: ln; display: grid; grid-template-columns: 3ch minmax(0, 1fr); gap: 0 2ch; padding: .35rem 0; border-bottom: 1px dashed rgba(51, 255, 136, .28); }
.conf > div::before { content: counter(ln, decimal-leading-zero); color: var(--fg-dim); grid-row: span 2; }
.conf dt { color: var(--amber); grid-column: 2; }
.conf dt::after { content: " ="; color: var(--fg-dim); }
.conf dd { margin: 0; grid-column: 2; }

/* ----- composer (contact form) ----- */
.composer { display: grid; gap: var(--cell); }
.composer > * { min-width: 0; }
.slot label { display: block; color: var(--amber); }
.slot label::after { content: ":"; }
.slot input, .slot textarea {
  display: block; width: 100%; min-height: 48px;
  font: inherit; color: var(--fg); caret-color: var(--amber);
  background: var(--bg-lift); border: 1px solid var(--fg-dim); border-radius: 0;
  padding: .6rem 1ch;
}
.slot textarea { min-height: calc(var(--cell) * 8); resize: vertical; }
.slot input:focus, .slot textarea:focus { outline: 2px solid var(--amber); outline-offset: 0; border-color: var(--amber); }
.slot.bad input, .slot.bad textarea { border-color: var(--amber); border-style: dashed; }
.err { display: block; color: var(--amber); margin-top: .3rem; }
.err::before { content: "error: "; }
.run {
  font-family: var(--pixel); font-size: 1.7rem; line-height: 1;
  color: var(--bg); background: var(--amber); border: 0; border-radius: 0;
  min-height: 52px; padding: 0 2.5ch; cursor: pointer;
}
.run:hover { background: var(--fg); }
.note { color: var(--fg-dim); margin: 0; }
.stdout { color: var(--amber); min-height: var(--cell); margin: 0; }

/* ----- motd (footer) ----- */
.motd { border-top: 3px double var(--fg); padding: calc(var(--cell) * 1.5) 2ch calc(var(--cell) * 2); background: rgba(0, 14, 8, .7); }
.motd-in { max-width: 104ch; margin: 0 auto; display: grid; gap: calc(var(--cell) * 1.5) 4ch; }
.motd-in > * { min-width: 0; }
.motd h2 { font-size: 1.6rem; color: var(--amber); }
.sitemap { list-style: none; margin: 0; padding: 0; }
.sitemap li::before { content: "./"; color: var(--fg-dim); }
.sitemap a { display: inline-block; padding: .3rem 0; }
.eof { max-width: 104ch; margin: calc(var(--cell) * 1.5) auto 0; color: var(--fg-dim); }

/* ----- wider terminals ----- */
@media (min-width: 640px) {
  .cmdk kbd { display: inline; }
  .bits { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .bits .bit:nth-child(4) { margin-right: 1ch; }
  .bits .bit:nth-child(5) { margin-left: 1ch; }
  .readout { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .readout .wide { grid-column: auto; }
  .ls a { grid-template-columns: 11ch 20ch minmax(0, 1fr); }
  .composer .pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3ch; }
}
@media (min-width: 900px) {
  .tty { padding-top: calc(var(--cell) * 2); }
  .boot { grid-template-columns: minmax(0, 1.3fr) minmax(0, .7fr); }
  .cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
  .man section { grid-template-columns: 16ch minmax(0, 1fr); }
  .motd-in { grid-template-columns: 1fr 1fr 1.6fr; }
  .win { padding-left: 3ch; padding-right: 3ch; }
}

@media (prefers-reduced-motion: reduce) {
  .cur { animation: none; }
  .bit .lever::after { transition: none; }
}
