/* ozdc.us — retro console / disassembler theme */

@font-face {
  font-family: "VT323";
  src: url("../fonts/vt323-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "Press Start 2P";
  src: url("../fonts/press-start-2p-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}

:root {
  /* 16-colour VGA palette */
  --black:  #000000;
  --blue:   #0000aa;
  --green:  #00aa00;
  --cyan:   #00aaaa;
  --red:    #aa0000;
  --mag:    #aa00aa;
  --brown:  #aa5500;
  --lgray:  #aaaaaa;
  --dgray:  #555555;
  --lblue:  #5555ff;
  --lgreen: #55ff55;
  --lcyan:  #55ffff;
  --lred:   #ff5555;
  --lmag:   #ff55ff;
  --yellow: #ffff55;
  --white:  #ffffff;

  --screen: #020302;
  --fg:     #bdbdbd;

  --addr: var(--green);
  --mn:   var(--lcyan);
  --rg:   var(--white);
  --nm:   var(--lmag);
  --st:   var(--yellow);
  --nu:   var(--lgreen);
  --cm:   var(--lblue);
  --kw:   var(--lgray);
  --frame: var(--cyan);

  --adw: 17ch;
  --font: "VT323", "Lucida Console", "Courier New", monospace;
  --pixel: "Press Start 2P", "VT323", monospace;
  --glow: 0 0 5px rgba(160, 255, 220, .22);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--screen);
  color: var(--fg);
  font: 400 21px/1.15 var(--font);
  text-shadow: var(--glow);
  -webkit-font-smoothing: none;
  -webkit-text-size-adjust: 100%;
}
::selection { background: var(--lgray); color: var(--black); text-shadow: none; }
a { color: inherit; text-decoration: none; }
code, pre, kbd, samp { font-family: inherit; font-size: inherit; }
:focus-visible { outline: 1px dashed var(--yellow); outline-offset: 1px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; z-index: 50; background: var(--yellow); color: var(--black); padding: 2px 10px; }
.skip:focus { left: 8px; }

/* CRT: scanlines + vignette */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 100; pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .28) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, .55) 100%);
  mix-blend-mode: multiply;
}

/* ---------- layout ---------- */

.app {
  display: grid;
  height: 100vh; height: 100dvh;
  grid-template-columns: 330px minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  grid-template-areas: "menu menu" "band band" "funcs view" "con con" "status status";
  gap: 0;
}

/* windows: DOS double-line frame with title in the border */
.win {
  position: relative; min-height: 0; min-width: 0;
  border: 3px double var(--frame);
  margin: 12px 6px 4px;
  display: flex; flex-direction: column;
  padding-top: .55em;
}
.win-t {
  position: absolute; top: -.72em; left: 50%; transform: translateX(-50%);
  z-index: 4; max-width: calc(100% - 4ch);
  display: flex; gap: 1ch; white-space: nowrap; overflow: hidden;
  padding: 0 1ch; background: var(--screen);
  color: var(--white); line-height: 1.2;
}
.win-t::before { content: "╡"; color: var(--frame); margin-right: -.6ch; }
.win-t::after  { content: "╞"; color: var(--frame); margin-left: -.6ch; }
.win:focus-within > .win-t, .viewwin > .win-t { color: var(--yellow); }

/* menu bar */
.menubar {
  grid-area: menu;
  display: flex; align-items: center; gap: 2ch;
  height: 34px; padding: 0 1ch;
  background: var(--blue); color: var(--lgray);
  text-shadow: none;
}
.brand {
  font: 13px/1 var(--pixel);
  background: var(--yellow); color: var(--black);
  padding: 6px 9px 5px;
  box-shadow: 4px 4px 0 var(--black);
}
.brand:hover { background: var(--white); }
.menu { display: flex; gap: .5ch; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.menu a { color: var(--white); padding: 0 1ch; white-space: nowrap; }
.menu a u { text-decoration: none; color: var(--lred); }
.menu a:hover, .menu a.on { background: var(--black); color: var(--white); }
.menu a.on u { color: var(--yellow); }
.arch { margin-left: auto; color: var(--lgray); white-space: nowrap; }
.drawer-btn { display: none; }

/* overview band */
.navband {
  grid-area: band; position: relative;
  height: 12px; margin: 6px 6px 0; padding: 1px;
  background: var(--black); border: 1px solid var(--dgray);
}
.navband svg { display: block; width: 100%; height: 8px; }
.s-hdr  { fill: var(--dgray); }
.s-code { fill: var(--blue); }
.s-fn0  { fill: var(--lblue); }
.s-fn1  { fill: #3c3cdd; }
.s-rod  { fill: var(--cyan); }
.s-dat  { fill: #2a2a2a; }
.s-unx  { fill: #3d2600; }
.marker { position: absolute; top: -5px; left: 0; display: none; transition: left .5s steps(12); }
.js .marker { display: block; }
.marker::before { content: ""; position: absolute; left: -1px; top: 0; width: 3px; height: 20px; background: var(--yellow); }
.marker::after  { content: ""; position: absolute; left: -5px; top: -2px; border: 6px solid transparent; border-top-color: var(--yellow); border-bottom: 0; }

/* ---------- Functions window ---------- */

.funcs { grid-area: funcs; margin-right: 3px; }
.funcs .count { color: var(--lgreen); }
.cols {
  display: flex; justify-content: space-between;
  padding: 10px 1ch 2px 3.4ch; color: var(--black); background: var(--lgray);
  text-shadow: none; margin-top: 2px;
  padding-top: 2px;
}
.fnlist { list-style: none; margin: 0; padding: 2px 0; overflow-y: auto; flex: 1 1 auto; min-height: 0; scrollbar-color: var(--cyan) var(--black); }
.fn {
  display: grid; grid-template-columns: 2.4ch minmax(0, 1fr) auto; align-items: baseline; gap: .6ch;
  padding: 0 1ch; color: var(--fg);
}
.fn:hover { color: var(--white); background: #111; }
.fn.on { background: var(--cyan); color: var(--black); text-shadow: none; }
.fi { color: var(--lcyan); font-style: italic; }
.fn.on .fi, .fn.on .faddr { color: var(--black); }
.fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.faddr { color: var(--addr); }
.fn.hide { display: none; }
.fn-empty { padding: 4px 1ch; color: var(--cm); flex: 1 1 auto; }
.fn-empty div:nth-child(2) { color: var(--dgray); }
.filter {
  display: flex; align-items: center; gap: 1ch;
  padding: 2px 1ch; border-top: 1px solid var(--cyan);
  color: var(--lgray);
}
.filter input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0;
  color: var(--yellow); font: inherit; padding: 0; text-shadow: var(--glow);
}
.filter input::placeholder { color: var(--dgray); }

/* ---------- disassembly view ---------- */

.viewwin { grid-area: view; margin-left: 3px; }
.tname { color: var(--lmag); }
.view {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  outline: none;
  scrollbar-color: var(--cyan) var(--black);
}
.listing { padding: 14px 0 40px; }

.ln { display: flex; align-items: baseline; min-height: 1.15em; padding-right: 2ch; }
.ln:hover { background: #0b0b0b; }
.ln.cur { background: #00002e; }
.ln.cur > .ad { color: var(--yellow); }
.ln > .ad {
  flex: 0 0 var(--adw);
  padding-left: 1ch; white-space: nowrap;
  color: var(--addr); user-select: none;
}
.ln > .ad .sg { opacity: .7; }
.ins, .bd { flex: 1 1 auto; min-width: 0; padding-left: 1ch; }
.ins { white-space: pre-wrap; }
.ins .lb { display: inline-block; min-width: 15ch; }
.ins .mn { display: inline-block; min-width: 8ch; padding-right: 1ch; }
.mn  { color: var(--mn); }
.rg  { color: var(--rg); }
.nm, .nm-l { color: var(--nm); }
.st  { color: var(--st); }
.nu  { color: var(--nu); }
.kw  { color: var(--kw); }
.cm  { color: var(--cm); }
.ins .cm { margin-left: 2ch; }
.ln.c .ins .cm, .ln.lbl .ins .cm { margin-left: 0; }
.ln.lbl .ins .lb + .cm { margin-left: 4ch; }
.ln.end .cm { color: var(--dgray); }
.ln.bad .mn { color: var(--lred); }
.ln.gap { min-height: .6em; }

/* prose blocks */
.k-p .bd, .k-list .bd, .k-quote .bd, .k-h .bd, .k-code .bd, .k-hr .bd { max-width: 80ch; }
.bd p { margin: 0; font-size: 22px; line-height: 1.25; color: var(--fg); }
.k-p { margin-bottom: .55em; }
.bd p code, .bd li code { color: var(--black); background: var(--lgray); padding: 0 .4ch; text-shadow: none; }
.bd a { color: var(--lcyan); text-decoration: underline; text-underline-offset: 3px; }
.bd a:hover { background: var(--lcyan); color: var(--black); text-decoration: none; text-shadow: none; }
.bd a.ext::after { content: "»"; margin-left: .2ch; }
.bd strong { color: var(--white); font-weight: 400; text-shadow: 0 0 6px rgba(255, 255, 255, .45); }
.bd em { color: var(--yellow); font-style: normal; }
.bd del { color: var(--dgray); }
.bd img { display: block; max-width: 100%; height: auto; margin: .4em 0; border: 2px solid var(--dgray); image-rendering: auto; }

.bd h2, .bd h3, .bd h4 { margin: .9em 0 .2em; color: var(--lmag); font-weight: 400; line-height: 1.1; }
.bd h2 { font-size: 26px; }
.bd h3 { font-size: 23px; }
.bd h4 { font-size: 22px; color: var(--mag); }
.bd h2::after, .bd h3::after, .bd h4::after { content: ":"; color: var(--lgray); }
.bd h2::before { content: "; ══════════════════════════"; display: block; color: var(--cm); font-size: 21px; overflow: hidden; white-space: nowrap; }

.bd ul, .bd ol { margin: 0 0 .5em; padding-left: 0; list-style: none; font-size: 22px; line-height: 1.25; counter-reset: li; }
.bd li { position: relative; padding-left: 3ch; }
.bd ul li::before { content: "■"; position: absolute; left: .4ch; color: var(--lcyan); font-size: .8em; top: .1em; }
.bd ol li { counter-increment: li; padding-left: 4ch; }
.bd ol li::before { content: counter(li, decimal-leading-zero) "h"; position: absolute; left: 0; color: var(--nu); }

.bd blockquote { margin: .1em 0 .6em; padding: .2em 1.5ch; border-left: 3px double var(--cm); }
.bd blockquote p { color: #9a9aff; }
.bd blockquote p::before { content: "; "; color: var(--cm); }

.bd hr { border: 0; height: auto; margin: .6em 0; }
.bd hr::before { content: "────────────────────────────────────────"; color: var(--dgray); display: block; overflow: hidden; white-space: nowrap; }

/* code blocks */
pre.code {
  position: relative; margin: .2em 0 .8em;
  padding: .5em 1.5ch; overflow-x: auto;
  background: #000; border: 1px solid var(--dgray);
  font: 20px/1.15 var(--font); color: var(--lgray);
  tab-size: 4; scrollbar-color: var(--dgray) var(--black);
}
pre.code[data-lang]::before {
  content: " " attr(data-lang) " ";
  position: absolute; top: -.6em; right: 1.5ch;
  background: var(--screen); color: var(--dgray);
}
pre.code .ad { color: var(--addr); }
pre.code .by { color: var(--dgray); }
pre.code .z  { color: var(--dgray); }

/* page titles */
.ptitle {
  margin: .25em 0 .35em; font: 22px/1.5 var(--pixel); font-weight: 400;
  color: var(--white); text-shadow: 3px 3px 0 var(--blue), 0 0 10px rgba(255, 255, 255, .25);
}
.ptitle.err { color: var(--lred); text-shadow: 3px 3px 0 var(--red); }

/* cross-reference lines */
.xref { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0 1ch; padding: 0 .5ch; margin-left: -.5ch; }
.xref .mn { min-width: 8ch; display: inline-block; }
.xref .nm { text-decoration: underline; text-underline-offset: 3px; }
.xref .tags { color: var(--dgray); }
.xref:hover { background: var(--cyan); text-shadow: none; }
.xref:hover * { color: var(--black) !important; }

/* ---------- hero: ozdc.us ---------- */

.k-hero .bd { padding-top: .8em; padding-bottom: 1em; }
.wordmark {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  margin: 0; font-weight: 400; line-height: 1;
  font-family: var(--pixel);
  font-size: clamp(30px, 6.4vw, 92px);
}
.cell { display: inline-flex; flex-direction: column; align-items: center; padding: .08em .06em 0; cursor: default; }
.cell b {
  font-weight: 400; color: var(--white);
  text-shadow: .07em .07em 0 var(--blue), 0 0 18px rgba(170, 220, 255, .35);
}
.cell i {
  font: 400 max(19px, .3em)/1 var(--font); font-style: normal;
  margin-top: .45em; padding: .1em .2ch; color: var(--green);
}
.cell.dot b { color: var(--yellow); text-shadow: .07em .07em 0 var(--brown), 0 0 18px rgba(255, 255, 85, .45); }
.cell.nul i { color: var(--dgray); }
.cell:hover, .cell.flash { background: var(--lgray); }
.cell:hover b, .cell.flash b { color: var(--black); text-shadow: none; }
.cell:hover i, .cell.flash i { color: var(--black); text-shadow: none; }
.caret {
  display: inline-block; width: .62em; height: .62em; vertical-align: baseline;
  background: var(--lgreen); box-shadow: 0 0 14px rgba(85, 255, 85, .5);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.tagline { margin: .9em 0 0; font-size: 22px; }
.tagline .nm { display: inline-block; min-width: 10ch; }
.tagline .mn { display: inline-block; min-width: 4ch; }

.empty p { margin: 0; }

/* ---------- console ---------- */

.console { grid-area: con; height: 7.6em; margin-top: 14px; }
.log { flex: 1 1 auto; overflow-y: auto; padding: 0 1ch; color: var(--lgray); scrollbar-color: var(--cyan) var(--black); }
.log .dim { color: var(--dgray); }
.log b { color: var(--white); font-weight: 400; }
.log .err { color: var(--lred); }
.log .ok { color: var(--lgreen); }
.log .in { color: var(--white); }
.log .in::before { content: "ozdc> "; color: var(--lgray); }
.log a { color: var(--lcyan); text-decoration: underline; }
.prompt { display: none; align-items: center; gap: 1ch; padding: 0 1ch 2px; }
.js .prompt { display: flex; }
.prompt label { color: var(--lgray); }
.prompt input {
  flex: 1; min-width: 0; border: 0; outline: 0; padding: 0;
  background: transparent; color: var(--white); font: inherit; text-shadow: var(--glow);
  caret-color: var(--lgreen); caret-shape: block;
}

/* ---------- status bar ---------- */

.statusbar {
  grid-area: status;
  display: flex; align-items: center; gap: 2ch;
  height: 26px; padding: 0 1ch; margin-top: 4px;
  background: var(--cyan); color: var(--black); text-shadow: none;
  white-space: nowrap; overflow: hidden;
}
.statusbar .sp { flex: 1; }
.statusbar b { color: var(--red); font-weight: 400; }
.busy #au { background: var(--black); color: var(--yellow); padding: 0 .5ch; }

/* ---------- transitions ---------- */

.view.out .listing > .ln { animation: ln-out .16s steps(4) both; }
@keyframes ln-out { to { opacity: 0; transform: translateX(1ch); } }
.view.in .listing > .ln { animation: ln-in .3s steps(6) both; animation-delay: var(--d, 0ms); }
@keyframes ln-in {
  from { opacity: 0; clip-path: inset(0 100% 0 0); }
  20%  { opacity: 1; }
  to   { opacity: 1; clip-path: inset(0 0 0 0); }
}
/* screen flicker while switching */
.viewwin.flick { animation: flick .28s steps(2) both; }
@keyframes flick {
  0%   { filter: brightness(1.6) contrast(1.2); }
  40%  { filter: brightness(.6); }
  100% { filter: none; }
}
/* a horizontal "refresh" bar sweeping down */
.viewwin::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3em; pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(85, 255, 255, .08) 60%, rgba(85, 255, 255, .18));
  opacity: 0;
}
.viewwin.flick::after { animation: sweep .45s linear both; }
@keyframes sweep { from { opacity: 1; transform: translateY(-3em); } to { opacity: 1; transform: translateY(70vh); } }

.fnlist li { animation: fn-in .3s steps(5) both; animation-delay: calc(var(--i, 0) * 40ms + 100ms); }
@keyframes fn-in { from { opacity: 0; clip-path: inset(0 100% 0 0); } to { opacity: 1; clip-path: inset(0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
  .caret { animation: none; }
}

/* ---------- narrow screens ---------- */

@media (max-width: 860px) {
  :root { --adw: 9.5ch; }
  body { font-size: 19px; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "menu" "band" "view" "con" "status"; }
  .menubar { gap: 1ch; padding: 0 .5ch 0 0; }
  .drawer-btn {
    display: grid; place-items: center; width: 34px; height: 34px;
    background: transparent; border: 0; color: var(--white); font: 26px/1 var(--font); cursor: pointer;
  }
  .brand { font-size: 11px; }
  .arch, .menu .rss { display: none; }
  .menu { margin-left: auto; }
  .funcs {
    position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; margin: 0;
    width: min(330px, 86vw); background: var(--screen);
    transform: translateX(-104%); transition: transform .25s steps(5);
  }
  .funcs .win-t { top: 0; }
  .funcs .cols { margin-top: 24px; }
  .drawer .funcs { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .7); }
  .scrim[hidden] { display: none; }
  .viewwin, .console { margin-left: 4px; margin-right: 4px; }
  .ln > .ad { padding-left: .5ch; }
  .ln > .ad .sg { display: none; }
  .ins .lb { min-width: 9ch; }
  .ins .mn { min-width: 6ch; }
  .ln { padding-right: 1ch; }
  .bd p, .bd ul, .bd ol { font-size: 20px; }
  .ptitle { font-size: 16px; }
  .console { height: auto; }
  .log { display: none; }
  .console .prompt { padding-top: 2px; }
  .k-hero > .ad { display: none; }
  .k-hero .bd { padding-left: 1ch; }
  .wordmark { font-size: 8vw; }
  .keys { display: none; }
}
@media (max-width: 480px) {
  .wordmark { font-size: 8.6vw; }
  .cell i { font-size: 16px; }
}
.log .addr { color: var(--addr); }
