:root {
  --bg: #0e1216;
  --fg: #cfd6dc;
  --muted: #87919b;
  /* accent picker — one line on, the rest off */
  /*--accent: #e0c482;*/ /* yellow */
  --accent: #82b4e0; /* blue */
  /*--accent: #7fd68b;*/ /* green */
  /*--accent: #e87dbd;*/ /* pink */
  --err: #e08282;
  --border: #1e262e;
  --code-bg: rgba(255, 255, 255, 0.045);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.65 ui-monospace, "SF Mono", "Cascadia Mono",
    "JetBrains Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

header,
main,
footer {
  width: 100%;
  max-width: 44rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 5vw, 1.5rem);
}

/* the chrome spans wider than the text column */
header,
footer {
  max-width: 64rem;
}

/* ---------- chrome ---------- */

header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.4rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.site {
  margin: 0;
  font-weight: 700;
}

.site a {
  color: var(--accent);
  text-decoration: none;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  padding-block: 0.25rem;
}

nav a:hover {
  color: var(--fg);
}

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

nav a.active::after {
  content: "*";
  margin-left: 0.1rem;
}

.cursor {
  display: inline-block;
  width: 0.5em;
  height: 1.05em;
  margin-left: 0.2em;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

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

footer {
  margin-top: 4rem;
  padding-block: 1.4rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

footer p {
  margin: 0;
  color: var(--muted);
}

footer a {
  white-space: nowrap;
}

/* ---------- content ---------- */

main {
  flex: 1 0 auto;
  padding-block: 2.25rem 0;
}

h1,
h2,
h3 {
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 1rem;
}

h1 {
  font-size: 1.3rem;
}

h2 {
  font-size: 1.05rem;
  margin-top: 2.5rem;
}

h3 {
  font-size: 1rem;
  margin-top: 1.75rem;
}

h1::before {
  content: "# ";
  color: var(--accent);
}

h2::before {
  content: "## ";
  color: var(--accent);
}

h3::before {
  content: "### ";
  color: var(--accent);
}

p {
  margin: 0 0 1rem;
  overflow-wrap: break-word;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: var(--accent);
}

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

main ul {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

main ul li {
  margin: 0.3rem 0;
  padding-left: 1.25rem;
  position: relative;
}

main ul li::before {
  content: "- ";
  position: absolute;
  left: 0;
  color: var(--muted);
}

/* command prompt lines */
.cmd {
  color: var(--fg);
  margin-bottom: 0.75rem;
}

.cmd .prompt {
  color: var(--muted);
  user-select: none;
}

.cmd-err {
  color: var(--err);
  margin-bottom: 1.5rem;
}

/* home: ls-style link list */
.ls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
}

.ls li {
  padding-left: 0;
}

.ls li::before {
  content: none;
}

/* projects */
article {
  margin-top: 2.75rem;
}

.year {
  color: var(--muted);
  font-weight: 400;
}

.stack {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: -0.6rem;
}

.stack::before {
  content: "stack: ";
  color: var(--accent);
}

.awards li {
  margin: 0.15rem 0;
}

.awards li::before {
  content: "↳ ";
}

.links {
  font-size: 0.9rem;
}

.links a {
  text-decoration-thickness: 1px;
}

/* contact */
dl.contact {
  display: grid;
  grid-template-columns: minmax(7ch, auto) 1fr;
  gap: 0.3rem 1.5rem;
  margin: 0 0 1rem;
}

dl.contact dt {
  color: var(--muted);
}

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

/* about: labeled skill groups */
.tool-group {
  color: var(--accent);
}

/* cv */
.cv-head {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: -0.5rem;
}

.cv-item {
  margin-bottom: 1.25rem;
}

.cv-role {
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.cv-when {
  color: var(--muted);
  font-weight: 400;
}

.print-hint {
  margin-top: 2.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* blog */
.posts time {
  color: var(--muted);
  margin-right: 0.75rem;
}

.post .meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.back {
  margin-top: 2rem;
}

/* wip: optional screenshots */
.shot {
  display: block;
  border: 1px solid var(--border);
  margin: 0.5rem 0 1rem;
  max-width: 100%;
}

/* essays: ls -lat listing */
.fs-total {
  color: var(--muted);
  margin-top: -0.5rem;
  margin-bottom: 0.25rem;
}

.fs-row {
  display: grid;
  grid-template-columns: max-content max-content max-content 1fr;
  column-gap: 1rem;
  align-items: baseline;
  padding-block: 0.45rem;
}

.fs-row:hover {
  background: var(--code-bg);
}

.fs-perms,
.fs-size,
.fs-date,
.fs-alt,
.fs-note {
  color: var(--muted);
}

.fs-note {
  font-size: 0.9rem;
}

.fs-alt {
  font-size: 0.9rem;
  margin-left: 0.5rem;
}

/* about: directory rows (ls /mnt) */
.fs-dir {
  grid-template-columns: max-content max-content 1fr;
}

.fs-dirname {
  color: var(--accent);
}

/* about: tree output (toolbox) */
.tree-line {
  margin: 0 0 0.35rem;
}

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

.tree-group {
  color: var(--accent);
}

/* index: boot sequence + CRT — pure CSS, no JS.
   Every element sets its own --d (delay); reduced-motion shows all
   instantly. Scoped to the index via :has(.bootlog). */

.bootlog {
  margin-bottom: 1.25rem;
}

.boot {
  margin: 0 0 0.2rem;
  color: var(--muted);
  font-size: 0.9rem;
  animation: reveal 0.12s steps(1) backwards;
  animation-delay: var(--d);
}

.boot .ok {
  color: var(--accent);
}

.type {
  width: 22ch; /* "ben@siebert:~$ whoami" — keep in sync with the template */
  overflow: hidden;
  white-space: nowrap;
  animation: typing 0.55s steps(22) backwards;
  animation-delay: var(--d);
}

.reveal,
.ls li {
  animation: reveal 0.2s ease-out backwards;
  animation-delay: var(--d);
}

.ls li {
  animation-duration: 0.12s;
}

@keyframes typing {
  from {
    width: 0;
  }
}

@keyframes reveal {
  from {
    opacity: 0;
  }
}

/* CRT scanlines — index only, above everything, never clickable */
body:has(.bootlog)::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(255, 255, 255, 0.02) 2px,
    rgba(255, 255, 255, 0.02) 3px
  );
}

/* phosphor glow on the brand and the name — index only */
body:has(.bootlog) .site a,
body:has(.bootlog) .glow {
  text-shadow: 0 0 16px color-mix(in srgb, var(--accent) 40%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .boot,
  .type,
  .reveal,
  .ls li {
    animation: none;
  }

  .type {
    width: auto;
  }
}

@media (max-width: 640px) {
  .fs-row {
    grid-template-columns: max-content 1fr;
  }

  .fs-perms,
  .fs-size {
    display: none;
  }
}

/* markdown bodies */
blockquote {
  margin: 0 0 1rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border);
  color: var(--muted);
}

code {
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.9em;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
}

img {
  max-width: 100%;
}

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

/* a11y */

.skip {
  position: absolute;
  top: -3rem;
  left: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--accent);
  color: var(--accent);
  text-decoration: none;
  z-index: 10;
}

.skip:focus {
  top: 1rem;
}

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

@media print {
  header nav,
  footer,
  .skip,
  .print-hint,
  .cmd,
  .cursor {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 10pt;
    line-height: 1.4;
  }

  main {
    padding-block: 0;
  }

  h2 {
    break-after: avoid;
  }

  p {
    margin-bottom: 0.7rem;
  }

  .cv-item {
    margin-bottom: 0.8rem;
  }

  /* markdown markers look wrong on paper — plain headings instead */
  .cv h2::before {
    content: none;
  }

  .cv h2 {
    margin-top: 1.1rem;
    margin-bottom: 0.4rem;
  }

  .cv-item,
  article {
    break-inside: avoid;
  }

  a {
    color: inherit;
    text-decoration: underline;
  }

  /* muted greys print too light — darken for paper */
  .cv-head,
  .cv-when,
  .year,
  .stack,
  .meta {
    color: #444;
  }

  @page {
    margin: 1.5cm;
  }
}

.project-entry {
  margin-left: 2rem;
}

.command-output {
  margin-left: 2rem;
}