:root {
  color-scheme: dark;
  --bg: #16181c;
  --panel: #1e2127;
  --bar: #2a2e36;
  --border: #353b45;
  --text: #d7dae0;
  --muted: #8b929e;
  --green: #98c379;
  --amber: #e5c07b;
  --cyan: #61afef;
  --font: "SF Mono", ui-monospace, Menlo, Monaco, "Cascadia Mono", Consolas,
    "Liberation Mono", monospace;

  /* Spacing scale: every gap on the page uses one of these. */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
}

h1,
p,
ul {
  margin: 0;
}

a {
  color: var(--cyan);
  text-decoration: none;
}

a:hover,
a:focus-visible,
.cmd-link:hover,
.cmd-link:focus-visible {
  color: var(--bg);
  background: var(--cyan);
  outline: none;
}

::selection {
  background: var(--green);
  color: var(--bg);
}

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

.hl {
  color: var(--amber);
}

/* ---------- Window ---------- */

.window {
  max-width: 820px;
  margin: var(--s6) auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--s2);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.titlebar {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s3) var(--s4);
  background: var(--bar);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  line-height: 1;
  color: var(--muted);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff5f57;
}

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

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

.titlebar .title {
  flex: 1;
  text-align: center;
  /* width of the three dots, so the title is truly centred */
  margin-right: 52px;
}

.screen {
  padding: var(--s4) var(--s5) var(--s6);
}

/* ---------- Nav ---------- */

nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s4);
  padding-bottom: var(--s3);
  border-bottom: 1px dashed var(--border);
}

nav a {
  color: var(--muted);
}

nav a::before {
  content: "[";
}

nav a::after {
  content: "]";
}

nav a.active {
  color: var(--green);
}

/* ---------- Prompt lines ---------- */

.prompt {
  margin: var(--s5) 0 var(--s2);
  font-weight: 700;
}

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

.prompt .path {
  color: var(--cyan);
}

.cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  margin-left: var(--s1);
  vertical-align: text-bottom;
  background: var(--green);
  opacity: 0.8;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* ---------- Output blocks ---------- */

/* Command output: indented with a guide line, items spaced evenly. */
.out {
  padding-left: var(--s4);
  border-left: 1px solid var(--border);
}

.out > * + * {
  margin-top: var(--s2);
}

.out > .entry + .entry {
  margin-top: var(--s4);
}

.entry-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  column-gap: var(--s4);
}

.entry-head .name {
  font-weight: 700;
  color: var(--green);
}

.entry-head .date {
  color: var(--muted);
}

.entry > p,
.entry > ul {
  margin-top: var(--s1);
}

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

ul.log li {
  position: relative;
  padding-left: 2ch;
}

ul.log li + li {
  margin-top: var(--s1);
}

ul.log li::before {
  content: ">";
  position: absolute;
  left: 0;
  color: var(--green);
}

/* ---------- whoami ---------- */

.hero h1 {
  font-size: 16px;
  color: var(--green);
}

.contacts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) var(--s4);
  margin-top: var(--s2);
}

/* ---------- Skills ---------- */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

.out.tags > * + * {
  margin-top: 0;
}

.tag {
  padding: 2px var(--s2);
  border: 1px solid var(--border);
}

.tag b {
  color: var(--green);
  font-weight: 400;
}

/* ---------- About ---------- */

/* Compact header (photo + name), then the bio at full width. */
.out.about > * + * {
  margin-top: var(--s4);
}

.profile {
  display: flex;
  align-items: center;
  gap: var(--s4);
}

.profile h1 {
  font-size: 20px;
  line-height: 1.3;
  color: var(--green);
}

.avatar {
  flex-shrink: 0;
  width: 96px;
  height: 96px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.bio > * + * {
  margin-top: var(--s2);
}

/* ---------- Interactive terminal ---------- */

.cmdline {
  display: none;
}

.js .block {
  display: none;
}

.js .cmdline {
  display: flex;
  align-items: center;
}

.cmdline label {
  margin-right: 1ch;
}

.cmdline .cursor {
  flex-shrink: 0;
  margin-left: 0;
}

html:not(.js) .block[data-cmd="contact"] {
  display: none;
}

/* The input grows with its text and a blinking block cursor follows it. */
.cmdline input {
  width: 0;
  max-width: calc(100% - 20ch);
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  caret-color: transparent;
}

.out.pre p {
  white-space: pre;
  overflow-x: auto;
}

.out.warn p {
  color: var(--amber);
}

.cmd-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--cyan);
  font: inherit;
  cursor: pointer;
}

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

ul.help li {
  display: grid;
  grid-template-columns: 14ch 1fr;
  column-gap: var(--s4);
}

ul.help li + li {
  margin-top: var(--s1);
}

ul.help .cmd-link {
  justify-self: start;
  text-align: left;
}

/* ---------- Welcome banner ---------- */

.banner {
  display: flex;
  align-items: center;
  gap: var(--s5);
  margin-top: var(--s5);
}

.banner .hand {
  flex-shrink: 0;
  width: 25ch;
  margin: 0;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  color: var(--amber);
}

.banner .greet {
  margin-bottom: var(--s2);
  font-size: 30px;
  line-height: 1.25;
  color: var(--green);
}

.banner .intro > * + * {
  margin-top: var(--s1);
}

.banner .cmds {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2ch;
}


/* ---------- Motion & small screens ---------- */

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

@media (max-width: 600px) {
  .window {
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .screen {
    padding: var(--s4) var(--s4) var(--s5);
  }

  .titlebar .title {
    margin-right: 0;
  }

  .banner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s4);
  }

  .banner .greet {
    font-size: 24px;
  }

  .avatar {
    width: 80px;
    height: 80px;
  }

  ul.help li {
    grid-template-columns: 11ch 1fr;
  }

  /* stack name and date so every entry lines up the same way */
  .entry-head {
    flex-direction: column;
  }
}
