:root {
  --bg: #0b0e0d;
  --term: #131816;
  --bar: #1b211f;
  --border: #29312e;
  --fg: #d5dcd6;
  --dim: #8a958f;
  --accent: #f5c827;
  --prompt: #7bd88f;
  --selection: #3a3413;
  --font: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="light"] {
  --bg: #e9e0c8;
  --term: #fbf7ec;
  --bar: #efe6cf;
  --border: #d6c9a8;
  --fg: #1c211f;
  --dim: #5d655e;
  --accent: #8a5a00;
  --prompt: #2a7039;
  --selection: #f5e3a3;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #e9e0c8;
    --term: #fbf7ec;
    --bar: #efe6cf;
    --border: #d6c9a8;
    --fg: #1c211f;
    --dim: #5d655e;
    --accent: #8a5a00;
    --prompt: #2a7039;
    --selection: #f5e3a3;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 48px 16px;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.65 var(--font);
}

::selection {
  background: var(--selection);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

p,
ul {
  margin: 0 0 0.75em;
}

strong {
  font-weight: 700;
}

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

/* Window */

.term {
  max-width: 820px;
  margin: 0 auto;
  background: var(--term);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.35);
  overflow: hidden;
}

.titlebar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bar);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--dim);
}

.dots {
  display: flex;
  gap: 6px;
}

.dots i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ff5f57;
}

.dots i:nth-child(2) {
  background: #febc2e;
}

.dots i:nth-child(3) {
  background: #28c840;
}

.theme-toggle {
  justify-self: end;
  font: inherit;
  color: var(--dim);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--fg);
}

main {
  padding: 32px 36px 28px;
}

/* Hero */

.hero {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 40px;
}

.portrait {
  flex: none;
  margin: 0;
  width: 224px;
  height: 224px;
  touch-action: none;
}

.portrait img,
.portrait canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

h1 {
  margin: 0 0 4px;
  font-size: clamp(30px, 6vw, 44px);
  line-height: 1.1;
  color: var(--accent);
}

.role {
  font-size: 16px;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 16px;
}

.links a::before {
  content: "→ ";
  color: var(--dim);
}

/* Sections */

section {
  margin-bottom: 28px;
}

.prompt {
  margin: 0 0 8px;
  font-size: inherit;
  font-weight: 400;
}

.ps1 {
  color: var(--prompt);
  font-weight: 700;
}

.out {
  padding-left: 2ch;
}

.out ul {
  padding-left: 2ch;
  list-style: "- ";
}

.out li {
  margin-bottom: 4px;
}

.entry-head .dim {
  white-space: nowrap;
}

ul.ls {
  padding: 0;
  list-style: none;
}

.ls li {
  display: grid;
  grid-template-columns: 26ch 7ch 1fr;
  gap: 0 2ch;
  margin-bottom: 6px;
}

.ls .name {
  color: var(--fg);
  font-weight: 700;
}

.ls .lang {
  color: var(--dim);
}

/* Interactive shell */

.shell {
  border-top: 1px dashed var(--border);
  padding-top: 20px;
  margin-bottom: 0;
}

.shell-output > * {
  margin-bottom: 12px;
}

.shell-output .echo {
  margin-bottom: 4px;
}

.shell-output section {
  margin: 0 0 12px;
}

.shell-line {
  display: flex;
  align-items: baseline;
  gap: 0;
  margin: 0;
}

.shell-line .ps1 {
  margin-right: 1ch;
}

.shell-line input {
  flex: 1;
  min-width: 0;
  padding: 0;
  font: inherit;
  color: var(--fg);
  caret-color: var(--accent);
  background: none;
  border: 0;
  outline: none;
}

.shell-line input::placeholder {
  color: var(--dim);
  opacity: 0.7;
}

.shell-line:focus-within {
  outline: 1px solid var(--border);
  outline-offset: 4px;
  border-radius: 2px;
}

/* Small screens */

@media (max-width: 680px) {
  body {
    padding: 0;
  }

  .term {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    min-height: 100vh;
  }

  main {
    padding: 24px 16px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .portrait {
    width: 160px;
    height: 160px;
  }

  .ls li {
    grid-template-columns: 1fr auto;
  }

  .ls .desc {
    grid-column: 1 / -1;
    color: var(--dim);
  }
}

.nowrap {
  white-space: nowrap;
}
