/* deanwild.co.uk: the terminal. A full-screen file browser in amber phosphor.
   One monospace face on a whole-pixel line grid, so box drawing lines up on every device. */

@font-face {
  font-family: 'JetBrains Mono NL';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/JetBrainsMonoNL-Regular.woff2) format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono NL';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/fonts/JetBrainsMonoNL-Bold.woff2) format('woff2');
}

/* Italics written on the dashboard; loaded only when a page uses them. */
@font-face {
  font-family: 'JetBrains Mono NL';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/JetBrainsMonoNL-Italic.woff2) format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono NL';
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url(/fonts/JetBrainsMonoNL-BoldItalic.woff2) format('woff2');
}

:root {
  --bg: #0a0702;
  --fg: #ffb22e;
  --dim: #ad741c;
  --hi: #ffe4ad;
  --mono: 'JetBrains Mono NL', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --lh: 21px;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
  line-height: var(--lh);
  font-variant-ligatures: none;
  -webkit-text-size-adjust: 100%;
}

/* The home page is handing over to the desktop's boot screen (see start.js). */
html.to-desktop,
html.to-desktop body {
  background: #000;
}

html.to-desktop body {
  visibility: hidden;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  background: var(--fg);
  color: var(--bg);
  text-decoration: none;
}

:focus-visible {
  outline: 1px solid var(--hi);
  outline-offset: 1px;
}

.skip {
  position: absolute;
  left: 8px;
  top: -100px;
  z-index: 10;
  padding: 0 1ch;
  background: var(--fg);
  color: var(--bg);
}

.skip:focus {
  top: 8px;
}

.draft-bar {
  flex: none;
  padding: 6px 1ch;
  background: var(--hi);
  color: var(--bg);
}

.draft-bar a:hover {
  background: var(--bg);
  color: var(--hi);
}

/* ------------------------------------------------------------- frame */

.tui {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

.tui-top {
  display: flex;
  align-items: center;
  gap: 2ch;
  padding: 4px 1ch 0;
  color: var(--dim);
  white-space: nowrap;
  min-width: 0;
}

.tui-top .host {
  color: var(--hi);
  font-weight: 700;
  text-decoration: none;
}

.tui-top .where {
  overflow: hidden;
  text-overflow: ellipsis;
}

.gui-chip {
  margin-left: auto;
  flex: none;
  padding: 0 8px;
  border: 1px solid var(--dim);
  color: var(--fg);
  text-decoration: none;
  font-size: 12px;
  line-height: 20px;
}

.clock {
  flex: none;
}

.clock:empty {
  display: none;
}

.tui-main {
  display: grid;
  grid-template-columns: minmax(24ch, 32ch) minmax(0, 1fr);
  gap: 0 1ch;
  padding: 16px 1ch 8px;
  min-height: 0;
}

.pane {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  padding: 14px 1ch 8px;
  border: 1px solid var(--dim);
}

.pane.is-active {
  border-color: var(--fg);
}

.pane:focus {
  outline: none;
}

.pane-title {
  position: absolute;
  top: -11px;
  left: 1ch;
  max-width: calc(100% - 2ch);
  margin: 0;
  padding: 0 1ch;
  overflow: hidden;
  background: var(--bg);
  color: var(--dim);
  font: inherit;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.pane.is-active .pane-title {
  color: var(--fg);
}

.tree {
  position: relative;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-color: var(--dim) transparent;
}

.entry {
  display: block;
  padding: 0 1ch;
  overflow: hidden;
  white-space: pre;
  text-overflow: ellipsis;
  text-decoration: none;
}

.entry:hover {
  background: none;
  color: var(--hi);
}

.entry .branch {
  color: var(--dim);
}

.entry[aria-current='page'] {
  background: var(--dim);
  color: var(--bg);
}

.pane.is-active .entry[aria-current='page'] {
  background: var(--fg);
}

.entry[aria-current='page'] .branch {
  color: inherit;
}

.view-body {
  min-height: 0;
  padding-right: 1ch;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--dim) transparent;
}

.view-body.is-loading {
  opacity: 0.6;
}

.tui-status {
  display: flex;
  justify-content: space-between;
  gap: 2ch;
  padding: 0 1ch env(safe-area-inset-bottom, 0px);
  background: var(--fg);
  color: var(--bg);
  white-space: pre;
  overflow: hidden;
}

.tui-status .keys {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------- file contents */

.ln,
.para {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.para {
  margin-bottom: var(--lh);
}

.gap {
  height: var(--lh);
}

.d {
  color: var(--dim);
}

.h,
strong {
  color: var(--hi);
  font-weight: 700;
}

.rule {
  margin: 0;
  overflow: hidden;
  font: inherit;
  white-space: nowrap;
}

.prose {
  overflow-wrap: anywhere;
}

.prose > * {
  margin: 0 0 var(--lh);
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  color: var(--hi);
  font: inherit;
  font-weight: 700;
}

.prose ul,
.prose ol {
  padding-left: 2ch;
}

.prose ul {
  list-style: none;
}

.prose ul > li::before {
  content: '- ';
  margin-left: -2ch;
  color: var(--dim);
}

.prose blockquote {
  margin-left: 0;
  padding-left: 2ch;
  border-left: 1px solid var(--dim);
}

.prose code {
  color: var(--hi);
  font: inherit;
}

.prose pre {
  overflow-x: auto;
}

.kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 2ch;
  margin: 0;
}

.kv dt {
  color: var(--dim);
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.tbl {
  display: grid;
  grid-template-columns: max-content max-content minmax(0, 1fr);
  column-gap: 2ch;
}

/* A job's longer write-up sits under its row, indented to the company column. */
.tbl-more {
  grid-column: 2 / -1;
  margin: 0 0 var(--lh);
  color: var(--dim);
}

.tbl-more > :last-child {
  margin-bottom: 0;
}

.plist {
  display: grid;
  grid-template-columns: 2ch max-content minmax(0, 1fr);
  column-gap: 2ch;
}

.next {
  margin-top: var(--lh);
}

/* media in the scrollback: pictures as uploaded, phone screens side by side */
.media {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--lh) 2ch;
  margin-bottom: var(--lh);
}

.shot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin: 0;
}

.shot--tall {
  width: min(200px, 44%);
}

.shot--wide {
  width: min(680px, 100%);
}

.frame {
  display: block;
  border: 1px solid var(--dim);
  background: #000;
  line-height: 0;
}

a.frame {
  cursor: zoom-in;
}

a.frame:hover {
  border-color: var(--fg);
  background: #000;
}

.frame img,
.frame video {
  display: block;
  width: 100%;
  height: auto;
}

.cap {
  color: var(--dim);
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------ viewer */

.lb {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: rgb(10 7 2 / 0.96);
}

.lb:focus {
  outline: none;
}

.lb-fig {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-fig img {
  max-width: 100%;
  max-height: 100%;
  border: 1px solid var(--dim);
  object-fit: contain;
}

.lb-cap {
  text-align: center;
  overflow-wrap: anywhere;
}

.lb-keys {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3ch;
}

.lb-keys button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--fg);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.lb-keys button:hover {
  background: var(--fg);
  color: var(--bg);
}

/* ------------------------------------------------------------- phone */

@media (max-width: 640px) {
  body {
    font-size: 13px;
    --lh: 19px;
  }

  .tui-top .where {
    display: none;
  }

  .tui-main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 18px;
  }

  .tree {
    max-height: calc(7 * var(--lh));
  }

  .tbl {
    grid-template-columns: minmax(0, 1fr);
  }

  .tbl > .w {
    margin-bottom: var(--lh);
  }

  .tbl > .w:has(+ .tbl-more) {
    margin-bottom: 0;
  }

  .tbl-more {
    grid-column: 1;
    padding-left: 2ch;
  }

  .plist {
    grid-template-columns: 2ch minmax(0, 1fr);
  }

  .plist__headline {
    grid-column: 2;
    color: var(--dim);
  }

  .tui-status .keys {
    visibility: hidden;
  }
}

/* ------------------------------------------------------------- the shell */

/* A command line over the whole screen (shell.js). Same face, colours and line grid
   as the file browser. While it is up, the browser underneath is out of sight. */

html.shell-on,
html.shell-on body {
  overflow: hidden;
}

html.shell-on body > :not(.shell) {
  visibility: hidden;
}

.shell {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--bg);
  --ind: 13ch;
}

.shell[hidden] {
  display: none;
}

.sh-term {
  overflow-y: auto;
  padding-block: 12px 18px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  cursor: text;
}

.sh-ln {
  min-height: var(--lh);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sh-ind {
  padding-left: var(--ind);
}

.sh-li {
  padding-left: 2ch;
  text-indent: -2ch;
}

.sh-ind.sh-li {
  padding-left: calc(var(--ind) + 2ch);
}

.sh-pr,
.sh-hi {
  color: var(--hi);
}

.sh-pr,
.sh-b {
  font-weight: 700;
}

.sh-i {
  font-style: italic;
}

.sh-dim {
  color: var(--dim);
}

.sh-grid {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 2ch;
}

.sh-grid > * {
  min-height: var(--lh);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sh-names {
  display: flex;
  flex-wrap: wrap;
  column-gap: 2ch;
}

.sh-c,
.sh-term a {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-align: left;
  text-decoration: underline dotted 1px;
  text-underline-offset: 4px;
  cursor: pointer;
}

.sh-term a {
  text-decoration-style: solid;
}

.sh-c:hover,
.sh-term a:hover {
  color: var(--hi);
}

.sh-c:focus-visible,
.sh-term a:focus-visible,
.sh-keys button:focus-visible {
  outline: 1px solid var(--hi);
  outline-offset: 1px;
}

.sh-row {
  display: flex;
}

.sh-row[hidden] {
  display: none;
}

.sh-row .sh-pr {
  white-space: pre;
}

.sh-input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  line-height: inherit;
  caret-color: var(--fg);
  caret-shape: block;
}

/* Phones: keys a touch keyboard lacks, above it. */
.sh-keys {
  display: none;
  gap: 8px;
  overflow-x: auto;
  padding-block: 8px calc(8px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  border-top: 1px solid var(--dim);
}

.sh-keys button {
  flex: none;
  min-width: 44px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--dim);
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
}

.sh-keys button:active {
  background: var(--fg);
  color: var(--bg);
}

@media (pointer: coarse), (max-width: 640px) {
  .sh-keys {
    display: flex;
  }

  .shell {
    --ind: 2ch;
  }

  .sh-dates {
    display: block;
  }

  /* 16px stops phones zooming in when the line is tapped. */
  .sh-input {
    font-size: 16px;
  }
}
