/* The Source: a terminal, white on black. */

:root {
  --core: rgb(196, 63, 63); /* red: you, INK@CORE */
  --root: rgb(71, 199, 125); /* green: PEN@ROOT */
  --fold: rgb(66, 150, 228); /* blue: ONE@FOLD, and links */
  --ghost: rgb(160, 160, 160); /* grey: PEN's guess at the rest of your line */
}

@font-face {
  font-family: 'Inconsolata';
  font-style: normal;
  font-weight: 300;
  src: url('assets/inconsolata-v20-latin-regular.woff2') format('woff2');
}

html {
  overflow-x: hidden;
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  display: none;
}

html,
body {
  height: 100%;
  margin: 0;
  font-size: 11pt;
  font-family: Inconsolata, monospace;
  color: white;
  background-color: black;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

::selection {
  background-color: white;
  color: black;
}

a {
  color: var(--fold);
}

img {
  max-width: 100%;
  height: auto;
}

#container {
  padding: 0 1em 3em 1em;
}

/* ------------------------------------------------------------ colors */

.core {
  color: var(--core);
}

.root {
  color: var(--root);
}

.fold {
  color: var(--fold);
}

.missing {
  color: black;
  background-color: white;
}

/* ------------------------------------------------------------ ticker */

#pen {
  position: sticky;
  top: 0;
  z-index: 150;
  overflow-x: hidden;
  white-space: nowrap;
  background-color: black;
}

/* PEN@ROOT stays put; the state slides under it. */
#head {
  position: relative;
  z-index: 666;
  background-color: black;
}

/* The state, and a copy of it that follows while it loops (terminal.js). */
#state {
  display: inline-block;
  margin-left: 7px;
}

#state > :last-child {
  display: none;
  margin-left: 4ch;
}

#state.ticking > :last-child {
  display: inline;
}

/* ------------------------------------------------------------ output */

output h1 {
  font-size: 1.7em;
  letter-spacing: 4px;
}

output h2 {
  letter-spacing: 4px;
}

output h3 {
  letter-spacing: 4px;
  margin: 0;
}

output pre {
  margin-left: 30px;
}

.content {
  position: relative;
}

.handle {
  margin-right: 1ch;
}

.text {
  overflow-wrap: break-word;
  word-break: break-word;
  -webkit-hyphens: auto;
  hyphens: auto;
}

.content .tooltip {
  visibility: hidden;
  position: absolute;
  z-index: 100;
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  color: black;
  background-color: white;
}

.content:hover .tooltip {
  visibility: visible;
}

/* /help */
/* /help's list, in columns of balanced length (print.js). */
.help {
  display: flex;
  width: 25em;
}

.help ul {
  flex: 1;
  margin: 0;
  padding: 0;
  list-style-type: none;
}

/* The welcome sigil. */
.logo {
  float: left;
  width: 5em;
  margin: 0 1em 1em 0;
}

/* ------------------------------------------------------------ command line */

/* The command line wraps, as a terminal's does: the prompt sits at the
   start of the first line and long lines run on under it. A mirror holds
   the same text, unseen, with the ghost after it; the mirror gives the line
   its height, and the textarea lies over it, so both wrap alike and the
   ghost starts where the typed text ends. --indent is the prompt's width
   (terminal.js). */
#input-line {
  position: relative;
  clear: both;
}

#prompt {
  position: absolute;
  top: 0;
  left: 0;
  white-space: pre;
}

#mirror,
#command {
  margin: 0;
  padding: 0;
  border: none;
  font: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  text-indent: var(--indent, 0px);
}

#mirror {
  pointer-events: none;
  user-select: none;
}

/* Keeps a line's height when the line is empty. */
#mirror::after {
  content: '\200b';
}

#typed {
  color: transparent;
}

#command {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  resize: none;
  overflow: hidden;
  outline: none;
  color: inherit;
  background-color: transparent;
}

/* The guess at the rest of the line (ghost.js), after the typed text in the
   mirror. */
#ghost {
  color: var(--ghost);
  /* Now and then a wave of fading runs along the guess, left to right, to
     show it is live. The mask is three times the guess's width; sliding it
     carries the faded middle across, then it rests. */
  mask-image: linear-gradient(90deg, #000 40%, rgba(0, 0, 0, 0.2) 50%, #000 60%);
  mask-size: 300% 100%;
  mask-position: 100% 0;
  animation: wave 3s linear infinite;
}

@keyframes wave {
  0% {
    mask-position: 100% 0;
  }
  60%,
  100% {
    mask-position: 0% 0;
  }
}

/* No wave while there is nothing to show: an animation runs every frame. */
#ghost:empty {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  #ghost {
    animation: none;
  }
}

/* ------------------------------------------------------------ the atom */

/* The banner's art: a nucleus and three electrons, each on its own orbit. */
#atom {
  position: relative;
  float: left;
  width: 5em;
  height: 5em;
  margin: 0 1em 1em 0;
}

#nucleus,
.orbit,
.electron {
  position: absolute;
  inset: 0;
  width: 20px;
  height: 20px;
  margin: auto;
  border-radius: 75%;
}

#nucleus {
  background: #fff;
  box-shadow: 0 0 15px #fff;
  animation: shine 2s infinite linear;
}

/* Each orbit sets how long its electron takes to go round (--spin) and
   where in the round it starts (--lag); the electron and its trail share
   both, so the trail cannot fall behind. */
.orbit {
  --spin: 3s;
  --lag: 0s;
  width: 5em;
  height: 5em;
  border: 0;
  transform-style: preserve-3d;
}

.orbit::before {
  content: ' ';
  position: absolute;
  z-index: -1;
  inset: 0;
  border: 0.123em solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

/* The trail: a thin ring, bright at the electron and fading out a third of
   the way round behind it, turning with it. The gradient's bright end
   starts where the electron does (90deg, three o'clock). */
.orbit::after {
  content: ' ';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 90deg, transparent 0deg, transparent 240deg, rgba(255, 255, 255, 0.6) 360deg);
  mask: radial-gradient(farthest-side, transparent calc(100% - 0.14em), #000 calc(100% - 0.1em));
  animation: trail var(--spin) var(--lag) infinite linear;
}

.orbit .electron {
  position: relative;
  top: 2.3em;
  width: 0.4em;
  height: 0.4em;
  background: #fff;
  box-shadow: 0 0 30px #fff;
  border-radius: 75%;
  transform: translateX(100px);
  animation: revolve var(--spin) var(--lag) infinite linear;
}

.orbit:nth-child(2) {
  --spin: 1s;
  transform: rotateY(65deg) rotateX(-54deg);
}

.orbit:nth-child(3) {
  transform: rotateY(65deg) rotateX(54deg);
}

.orbit:nth-child(4) {
  --lag: -1s;
  transform: rotateY(65deg) rotateX(5deg);
}

@keyframes revolve {
  0% {
    transform: rotateZ(0deg) translateX(2.45em) rotateZ(0deg) rotateY(-65deg);
  }
  100% {
    transform: rotateZ(360deg) translateX(2.45em) rotateZ(-360deg) rotateY(-65deg);
  }
}

@keyframes trail {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shine {
  0% {
    box-shadow: 0 0 0 transparent;
  }
  50% {
    box-shadow: 0 0 40px #fff;
  }
  100% {
    box-shadow: 0 0 0 transparent;
  }
}
