:root {
  color-scheme: dark;
  --terminal: #08090d;
  --text: #e5e7eb;
  --muted: #8b929e;
  --rail: #6b7280;
  --blue: #2d6cdf;
  --blue-bright: #77a5ff;
  --green: #56d364;
  --red: #ff7b72;
  --selection: rgba(45, 108, 223, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--terminal);
  color: var(--text);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: clamp(0.9rem, 1.5vw, 1rem);
  line-height: 1.65;
}

button,
input {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

::selection {
  color: #fff;
  background: var(--blue);
}

.terminal {
  width: min(100%, 86rem);
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(1.5rem, 6vw, 5.5rem);
}

.transcript {
  max-width: 76ch;
}

.command-line {
  display: flex;
  align-items: baseline;
  min-height: 1.65em;
  max-width: 76ch;
}

.prompt-mark {
  display: inline;
  flex: 0 0 auto;
  margin-right: 0.75ch;
  color: var(--green);
}

#command-input {
  min-width: 1ch;
  max-width: calc(100% - 3ch);
  flex: 0 1 auto;
  width: 1ch;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  caret-color: transparent;
  background: transparent;
}

.cursor {
  display: inline-block;
  width: 0.58ch;
  height: 0.8em;
  flex: 0 0 auto;
  margin-left: 0.1ch;
  background: var(--text);
  animation: cursor-blink 1s steps(1, end) infinite;
}

@keyframes cursor-blink {
  0%,
  49% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

.entry {
  margin: 0 0 1.65rem;
}

.entry:last-child {
  margin-bottom: 0;
}

.executed-command {
  margin: 0;
  color: var(--text);
}

.command-rail {
  color: var(--rail);
}

.command-prompt {
  color: var(--green);
}

.directory {
  display: grid;
  gap: 0.15rem;
  margin-top: 0.55rem;
}

.directory-entry {
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: 0.12rem 0.38rem;
  color: var(--blue-bright);
  white-space: normal;
}

.directory-entry::before {
  content: "-";
  margin-right: 0.65rem;
  color: var(--rail);
}

.document {
  color: var(--text);
}

.document h1,
.document h2,
.document h3 {
  margin: 0 0 0.55rem;
  color: var(--blue-bright);
  font: inherit;
  font-weight: 700;
}

.document h1::before,
.document h2::before,
.document h3::before {
  margin-right: 0.65ch;
  color: var(--rail);
}

.document h1::before {
  content: "#";
}

.document h2::before {
  content: "##";
}

.document h3::before {
  content: "###";
}

.document p {
  margin: 0 0 0.85rem;
}

.document p:last-child {
  margin-bottom: 0;
}

.document ul {
  display: grid;
  gap: 0.28rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.document li {
  display: grid;
  grid-template-columns: 1.15rem minmax(0, 1fr);
  gap: 0.35rem;
}

.document li::before {
  content: "-";
  color: var(--rail);
}

.document a {
  color: var(--blue-bright);
  text-decoration: none;
  text-decoration-color: color-mix(in srgb, currentColor 55%, transparent);
  text-underline-offset: 0.18em;
}

.document a:hover,
.document a:focus-visible {
  color: #fff;
  text-decoration: underline;
  outline: 0;
}

.document a:focus-visible {
  box-shadow: 0 0 0 1px var(--blue-bright);
}

.help {
  color: var(--muted);
  white-space: pre-wrap;
}

.error {
  color: var(--red);
}

@media (max-width: 40rem) {
  .terminal {
    padding: 1.5rem 1.1rem;
  }

  .directory-entry {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor {
    animation: none;
  }
}
