@font-face {
  font-family: VT323;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/vendor/vt323-latin.woff2) format("woff2");
}

/* Matches files.davidxie.dev, notes.davidxie.dev and the BIOS screen on davidxie.dev */
:root {
  --bg: #000;
  --bright: #e8e8e8;
  --text: #b4b4b4;
  --dim: #8c8c8c;
  --rule: #555;
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  margin: 0;
  font: 20px/1.35 VT323, ui-monospace, monospace;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* Pages that need a login stay blank until the session is checked. */
body.loading section { visibility: hidden; }

.screen { max-width: 768px; margin: 0 auto; padding: 40px 24px; }

.topline {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 24px;
  margin-bottom: 24px;
  color: var(--bright);
}
.home-link { text-decoration: none; }

nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
nav a, nav button { padding: 0 4px; color: var(--text); text-decoration: none; }
nav a[aria-current] { color: #000; background: var(--text); }

h1, h2 { margin: 24px 0 0; font: inherit; color: var(--bright); text-transform: uppercase; }
h1 { margin-top: 0; }

p { margin: 12px 0 0; }
.bright { color: var(--bright); }
.dim { font-size: 18px; color: var(--dim); }

a { color: inherit; }
a:hover { color: #fff; }

.badge { padding: 0 4px; color: #000; background: var(--text); }
.ok { color: var(--bright); }
.error { color: var(--danger); }
.error .badge { background: var(--danger); }

/* Buttons read as BIOS options: plain until hovered or focused, then inverted. */

button {
  padding: 0 4px;
  font: inherit;
  color: var(--text);
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:hover, button:focus-visible { color: #000; background: var(--text); outline: none; }
button.primary { padding: 0 8px; color: #000; background: var(--text); }
button.primary:hover, button.primary:focus-visible { background: var(--bright); }
button.danger { color: var(--danger); }
button.danger:hover, button.danger:focus-visible { color: #000; background: var(--danger); }
button:disabled { opacity: .5; cursor: default; }

input:not([type="checkbox"]), select {
  padding: 0 8px;
  font: inherit;
  color: var(--bright);
  background: #0b0b0b;
  border: 1px solid var(--rule);
  border-radius: 0;
}
input:focus, select:focus { border-color: var(--text); outline: none; }
input[type="checkbox"] { accent-color: var(--text); }

/* Label ......... [ value ] unit */
.field { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.field > span:first-child { white-space: nowrap; }
.field .dots { min-width: 2ch; }
.field input { width: 9ch; }
.field input.wide { width: min(100%, 22ch); }
.field .unit { min-width: 5ch; }

/* Drop zone, as on transfer: dashed while idle, inverted while dragging. */

.dropzone {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 40px 16px;
  text-align: center;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px dashed var(--rule);
}
.dropzone:hover, .dropzone:focus-visible { color: var(--bright); background: none; border-color: var(--text); }
.dropzone .armed { display: none; }
body.dragging .dropzone { color: #000; background: var(--text); border: 1px solid var(--text); }
body.dragging .dropzone .idle { display: none; }
body.dragging .dropzone .armed { display: inline; }

/* Lists: name ......... meta, with links and actions on the line below. */

ul { margin: 4px 0 0; padding: 0; list-style: none; }
ul:empty { display: none; }
li + li { margin-top: 8px; }

.row { display: flex; gap: 8px; white-space: nowrap; }
.name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dots { flex: 1 0 2ch; overflow: hidden; color: var(--rule); }
.dots::before { content: "................................................................................................................................"; }
.meta { white-space: pre; }
.failed .meta { color: var(--danger); }

.sub { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; padding-left: 2ch; font-size: 18px; color: var(--dim); }
.sub a { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.sub .grow { flex: 1; }

/* User profiles: a grid of files with previews */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-top: 12px;
}
.grid li + li { margin-top: 0; }
.tile { min-width: 0; padding: 8px; border: 1px dashed var(--rule); }
.tile .name { display: block; margin-top: 6px; white-space: nowrap; }
.tile .sub { padding-left: 0; }

.preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 150px;
  overflow: hidden;
  background: #0b0b0b;
}
.preview img, .preview video { width: 100%; height: 100%; object-fit: contain; }
.preview audio { width: 100%; }
.preview pre {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.2;
  color: var(--text);
  border: 0;
}
.preview .ext { font-size: 32px; color: var(--dim); text-transform: uppercase; }

/* Admin */

.stats { margin: 4px 0 0; }
.stats div { display: flex; gap: 8px; }
.stats dt, .stats dd { margin: 0; white-space: nowrap; }
.stats dd { color: var(--bright); }

.panel { margin-top: 8px; padding: 8px 12px; border: 1px dashed var(--rule); }
.panel .field + .field { margin-top: 4px; }

pre {
  margin: 12px 0 0;
  padding: 8px 12px;
  font: inherit;
  color: var(--bright);
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px dashed var(--rule);
}

/* Docs */

code { font: inherit; color: var(--bright); }
.params li { padding-left: 2ch; text-indent: -2ch; }
.params li::before { content: "- "; color: var(--rule); }

details { margin-top: 32px; font-size: 18px; color: var(--dim); }
summary { cursor: pointer; color: var(--text); }
summary:hover { color: #fff; }

footer {
  margin-top: 40px;
  padding-top: 12px;
  font-size: 18px;
  color: var(--dim);
  border-top: 1px dashed var(--rule);
}

/* Touch screens: tap wording and bigger targets. */

.touch { display: none; }

@media (hover: none) {
  .keys { display: none; }
  .touch { display: inline; }
  .sub button, nav a, nav button { padding: 6px 8px; }
  button.primary { padding: 8px 12px; }
}

@media (max-width: 560px) {
  .screen { padding: 24px 16px; }
}

/* Icon tiles, like a desktop file browser */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.tiles li + li { margin-top: 0; }

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 14px 8px 10px;
  text-align: center;
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
  -webkit-tap-highlight-color: transparent;
}
button.tile { width: 100%; font: inherit; background: none; cursor: pointer; }
.tile:hover, .tile:focus-visible { color: var(--text); background: #141414; border-color: var(--rule); outline: none; }
.tile .icon svg { display: block; width: auto; height: 60px; }
.tile-name {
  display: -webkit-box;
  max-width: 100%;
  padding: 0 4px;
  overflow: hidden;
  line-height: 1.15;
  color: var(--bright);
  word-break: break-word;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
/* The selected icon's label inverts, like on an old desktop. */
.tile:hover .tile-name, .tile:focus-visible .tile-name { color: #000; background: var(--text); }
.tile-meta { font-size: 16px; color: var(--dim); }

.tile.add { border: 1px dashed var(--rule); }
.tile.add .icon { display: grid; place-items: center; width: 60px; height: 60px; font-size: 48px; line-height: 1; color: var(--dim); }

.crumbs { margin: 0; color: var(--dim); }
.crumbs a { color: var(--text); }

.search {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 6px 12px;
}

/* The viewer */
.viewer {
  display: block;
  width: 100%;
  height: 78vh;
  margin-top: 12px;
  background: #fff;
  border: 1px solid var(--rule);
}
.viewer-wrap { position: relative; }

@media (max-width: 560px) {
  .tiles { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .tile .icon svg { height: 50px; }
}

/* The viewer gets more room than the other pages. */
.wide-screen { max-width: 1100px; }

/* Text notes: the editor and how they're shown */
.editor {
  display: block;
  width: 100%;
  min-height: 60vh;
  margin-top: 12px;
  padding: 12px 14px;
  font: inherit;
  line-height: 1.35;
  color: var(--bright);
  background: #0b0b0b;
  border: 1px solid var(--rule);
  resize: vertical;
}
.editor:focus { border-color: var(--text); outline: none; }

.note-text {
  margin-top: 12px;
  padding: 12px 14px;
  min-height: 30vh;
  white-space: pre-wrap;
  word-break: break-word;
}

/* A link item's address, under its details. */
.link-out { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--rule); word-break: break-all; }

/* ------------------------------------------------------------------ */
/* Control panel additions                                             */

:root { --warn: #e5c07b; --good: #8fd18f; --panel: #0b0b0b; }

.wide-screen { max-width: 1100px; }

.warn { color: var(--warn); }
.warn .badge, .badge.warn { background: var(--warn); }
.good { color: var(--good); }
.badge.good { background: var(--good); }
.badge.error { color: #000; background: var(--danger); }
.badge.dim { color: #000; background: var(--dim); }

/* Section headings with something on the right (a toggle or a button). */
.head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-top: 28px; }
.head h2 { margin: 0; }
.head .tools { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 18px; }
.tools button[aria-pressed="true"] { color: #000; background: var(--text); }

/* Alerts */
.alerts { margin-top: 12px; }
.alerts li { display: flex; gap: 8px; align-items: baseline; }
.alerts li + li { margin-top: 4px; }
.alerts a { text-decoration: none; }
.alerts a:hover { text-decoration: underline; }

/* Gauges: Label ...... [#####.......]  42%  detail */
.gauges { margin-top: 12px; }
.gauge { display: flex; gap: 8px; white-space: nowrap; }
.gauge + .gauge { margin-top: 2px; }
.gauge .label { min-width: 8ch; }
.gauge .bar { color: var(--bright); }
.gauge .detail { overflow: hidden; text-overflow: ellipsis; color: var(--dim); }

/* Charts */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 12px; }
.chart { padding: 8px 10px 6px; border: 1px dashed var(--rule); }
.chart .row { font-size: 18px; }
.chart svg { display: block; width: 100%; height: 70px; margin-top: 6px; overflow: visible; }
.chart .line { fill: none; stroke: var(--bright); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.chart .line.second { stroke: var(--dim); stroke-dasharray: 3 2; }
.chart .area { fill: rgba(232, 232, 232, .08); }
.chart .grid { stroke: #222; stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .axis { display: flex; justify-content: space-between; font-size: 15px; color: var(--dim); }
.legend-a::before { content: "— "; color: var(--bright); }
.legend-b::before { content: "-- "; color: var(--dim); }

/* Uptime strips: one cell per check */
.strip { display: flex; gap: 1px; height: 12px; margin: 4px 0 0 2ch; }
.strip span { flex: 1; max-width: 6px; background: var(--good); opacity: .75; }
.strip span.down { background: var(--danger); opacity: 1; }

/* Dialogs */
dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 16px 20px;
  font: inherit;
  color: var(--text);
  background: #000;
  border: 1px solid var(--text);
  box-shadow: 8px 8px 0 #1c1c1c;
}
dialog::backdrop { background: rgba(0, 0, 0, .7); }
dialog h2 { margin-top: 0; }
dialog .field input { width: 100%; }
dialog .actions { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 16px; }

select { padding: 0 4px; }
textarea { font: inherit; }

/* The command runner */
.term {
  margin-top: 12px;
  padding: 10px 12px;
  min-height: 50vh;
  max-height: 70vh;
  overflow: auto;
  font-size: 18px;
  line-height: 1.25;
  background: var(--panel);
  border: 1px solid var(--rule);
}
.term .job + .job { margin-top: 14px; padding-top: 10px; border-top: 1px dashed #2a2a2a; }
.term .cmd { color: var(--bright); white-space: pre-wrap; word-break: break-all; }
.term .cmd::before { content: attr(data-cwd) " # "; color: var(--dim); }
.term .out { margin: 4px 0 0; padding: 0; border: 0; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.term .end { margin-top: 4px; font-size: 16px; color: var(--dim); }
.term .end.failed { color: var(--danger); }
.term .hello { color: var(--dim); }
.prompt { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }
.prompt .cwd { max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); }
.prompt input { flex: 1; min-width: 0; padding: 4px 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 6px; }
.chips button { padding: 0 6px; font-size: 18px; border: 1px dashed var(--rule); }
.chip-group { margin-top: 10px; }
.chip-group > span { font-size: 16px; color: var(--dim); text-transform: uppercase; }

/* Logs */
.logview {
  margin-top: 12px;
  max-height: 72vh;
  overflow: auto;
  padding: 8px 10px;
  font-size: 17px;
  line-height: 1.2;
  background: var(--panel);
  border: 1px solid var(--rule);
}
.logline { white-space: pre-wrap; word-break: break-word; }
.logline .t { color: var(--dim); }
.logline .who { color: var(--text); }
.logline.p3, .logline.p2, .logline.p1, .logline.p0 { color: var(--danger); }
.logline.p4 { color: var(--warn); }
.logline .msg { color: var(--bright); }
.logline.p7 .msg { color: var(--dim); }
.controls { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-top: 12px; }
.controls label { display: inline-flex; gap: 6px; align-items: baseline; }

/* Lists of rows */
.rows .row .name { color: var(--bright); }
.rows .row .name.dimname { color: var(--text); }
.rows li.inactive .name { color: var(--dim); }
.filter { width: min(100%, 30ch); padding: 2px 8px; }

/* The editor */
.editor { min-height: 65vh; font-size: 18px; line-height: 1.25; tab-size: 4; white-space: pre; overflow: auto; }
.editor[readonly] { color: var(--text); }

/* QR code for two-step login */
.qr { display: inline-block; margin-top: 12px; padding: 12px; background: #fff; line-height: 0; }
.qr svg { width: 200px; height: 200px; }
.secret { letter-spacing: 1px; color: var(--bright); word-break: break-all; }

/* Little bar charts in text: failed logins per day */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 60px; margin-top: 8px; }
.bars div { flex: 1; max-width: 40px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; font-size: 14px; color: var(--dim); }
.bars i { display: block; width: 100%; min-height: 1px; background: var(--text); }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 32px; }

table.plain { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 18px; }
table.plain th { font-weight: normal; text-align: left; color: var(--dim); border-bottom: 1px dashed var(--rule); }
table.plain td, table.plain th { padding: 2px 8px 2px 0; vertical-align: top; white-space: nowrap; }
table.plain td.cmd { width: 100%; max-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
table.plain td.num, table.plain th.num { text-align: right; }
table.plain tr:hover td { background: #101010; }
.scroll-x { overflow-x: auto; }

@media (max-width: 560px) {
  .gauge .detail { display: none; }
  .term { font-size: 16px; }
  .hide-small { display: none; }
}
.chips a { padding: 0 6px; font-size: 18px; text-decoration: none; border: 1px dashed var(--rule); }
.chips a:hover, .chips a:focus-visible { color: #000; background: var(--text); outline: none; }
.filter.path { width: min(100%, 46ch); }
.badge.warn, .badge.good, .badge.error, .badge.dim, .warn .badge, .error .badge { color: #000; }
.logline.p0 .msg, .logline.p1 .msg, .logline.p2 .msg, .logline.p3 .msg { color: var(--danger); }
.logline.p4 .msg { color: var(--warn); }
dialog input:not([type="checkbox"]) { width: 100%; margin-top: 4px; padding: 4px 8px; }
