:root {
  --color-background: #050505;
  --color-panel: #0a0a0a;
  --color-panel-raised: #0d0f0d;
  --color-border: #123d1c;
  --color-border-strong: #00ff41;
  --color-accent: #00ff41;
  --color-text: #22c94a;
  --color-text-dim: #189437;
  --color-text-faint: #0d4a1c;
  --font-mono: "JetBrains Mono", "Fira Code", "DejaVu Sans Mono", Menlo, Consolas, monospace;
  --sidebar-width: 340px;
  --radius: 4px;
  --glow: 0 0 6px rgba(0, 255, 65, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
}

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

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

/* Background: faint drifting commands */

.background {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.background-line {
  position: absolute;
  left: 0;
  white-space: nowrap;
  color: var(--color-text-faint);
  opacity: 0.35;
  animation: drift linear infinite;
}

@keyframes drift {
  from { transform: translateX(100vw); }
  to { transform: translateX(-100%); }
}

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

/* Layout */

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* Sidebar */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 18px 20px 24px 60px;
  background: rgba(5, 5, 5, 0.92);
  border-right: 1px solid var(--color-border);
}

.avatar {
  width: 120px;
  height: 120px;
  margin: 12px auto 24px;
  border: 2px solid var(--color-accent);
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--glow);
}

.avatar img,
.avatar canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.avatar img {
  object-fit: cover;
}

.navigation {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.navigation a {
  display: block;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-panel);
  color: var(--color-text);
  font-size: 13px;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.navigation a:hover,
.navigation a:focus-visible {
  border-color: var(--color-accent);
  color: var(--color-accent);
  outline: none;
}

.navigation a.active {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-panel-raised);
  box-shadow: inset 3px 0 0 var(--color-accent);
}

/* Keyboard selection (assets/js/keyboard-navigation.js). The menu item that
   is open keeps its highlight; the blinking ">" marks what the keyboard
   would open next. */
html[data-focus="menu"] .navigation a.selected {
  color: var(--color-accent);
}

html[data-focus="menu"] .navigation a.selected::before,
html[data-focus="menu"] .sidebar-actions .selected::before {
  content: "> ";
  animation: caret-blink 1.06s steps(1) infinite;
}

/* The cursor in the content (assets/js/keyboard-navigation.js): a blinking underscore under a character. */
.content {
  position: relative;
}

.text-cursor {
  position: absolute;
  box-sizing: border-box;
  border-bottom: 2px solid var(--color-accent);
  pointer-events: none;
  animation: caret-blink 1.06s steps(1) infinite;
}

html[data-focus="menu"] .text-cursor {
  display: none;
}

@keyframes caret-blink {
  0% { opacity: 1; }
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html[data-focus="menu"] .navigation a.selected::before,
  html[data-focus="menu"] .sidebar-actions .selected::before {
    animation: none;
  }

  .text-cursor {
    animation: none;
  }
}

.navigation a.external::after {
  content: " \2197";
  color: var(--color-text-dim);
}

.sidebar-actions:empty {
  display: none;
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.button {
  display: block;
  width: 100%;
  padding: 6px 12px;
  border: 1px solid var(--color-accent);
  border-radius: 2px;
  background: transparent;
  color: var(--color-accent);
  font: inherit;
  font-size: 16px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content .button {
  display: inline-block;
  width: auto;
}

.button:hover,
.button:focus-visible {
  background: var(--color-accent);
  color: var(--color-background);
  outline: none;
}

/* Main column */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 24px 40px 32px;
}

.banner {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 24px;
}

.banner-tagline {
  margin: 0;
  color: var(--color-text-dim);
  font-size: 13px;
  text-align: right;
  text-wrap: pretty;
}

.banner-art {
  margin: 0;
  color: var(--color-accent);
  font-size: clamp(6px, 1.05vw, 14px);
  line-height: 1.15;
  text-shadow: 0 0 3px rgba(0, 255, 65, 0.4);
  overflow-x: auto;
}

.content {
  transition: border-color 0.15s;
  width: 100%;
  max-width: 900px;
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: rgba(10, 10, 10, 0.88);
}

.footer {
  margin-top: auto;
  padding-top: 16px;
  color: var(--color-text-dim);
  font-size: 12px;
}

.prompt {
  color: var(--color-accent);
}

/* Building blocks for pages */

.card {
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-panel);
}

.card + .card {
  margin-top: 12px;
}

/* Which pane the keyboard controls: outline the content. */
html[data-focus="content"] .content {
  border-color: var(--color-accent);
  box-shadow: 0 0 8px rgba(0, 255, 65, 0.35);
}

/* Keeps a card that was scrolled to from sitting flush against the window edge. */
.content .card {
  scroll-margin: 16px;
}

.grid > .card {
  margin-top: 0;
}

.card > :first-child {
  margin-top: 0;
}

.card > :last-child {
  margin-bottom: 0;
}

h1,
h2,
h3 {
  color: var(--color-accent);
  line-height: 1.3;
}

h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }

strong {
  color: var(--color-accent);
}

code {
  font-family: inherit;
  color: var(--color-accent);
}

.label {
  color: var(--color-accent);
  font-weight: bold;
}

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

.command {
  color: var(--color-accent);
  margin-bottom: 4px;
}

/* A link written as a command: "$ cd folder". The cursor sits behind the whole text. */
.command-link {
  text-decoration: none;
  /* A long path would otherwise run out of a narrow card. */
  overflow-wrap: anywhere;
}

.command-link:hover,
.command-link.under-cursor {
  text-decoration: underline;
}

.command:has(+ .command-output) {
  margin-bottom: 0;
}

.command-output {
  color: var(--color-text-dim);
  margin-bottom: 4px;
}

ol {
  padding-left: 24px;
}

ol li::marker {
  color: var(--color-accent);
}

ol li + li {
  margin-top: 4px;
}

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

ul.plain li::before {
  content: "* ";
  color: var(--color-accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.grid-wide {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

/* Usage: <div class="skill" style="--level: 85">Docker</div> */
.skill {
  padding: 6px 10px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-background);
  color: var(--color-accent);
  font-size: 12px;
  text-align: center;
}

.skill::after {
  content: "";
  display: block;
  height: 4px;
  margin-top: 6px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--color-accent) calc(var(--level, 50) * 1%),
    var(--color-border) 0
  );
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  padding: 1px 8px;
  border: 1px solid var(--color-border);
  border-radius: 2px;
  color: var(--color-text-dim);
  font-size: 11px;
}

.tag.under-cursor {
  background: var(--color-accent);
  color: var(--color-background);
}

.timeline-item {
  padding-left: 16px;
  border-left: 2px solid var(--color-border);
}

.timeline-item + .timeline-item {
  margin-top: 16px;
}

.timeline-item .when {
  color: var(--color-text-dim);
  font-size: 12px;
}

/* A card whose last line (a link) sits centred at the bottom, so links
   line up when cards in a grid row have different heights. */
.project {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project > * {
  margin: 0;
}

.project .card-link {
  margin-top: auto;
  padding-top: 4px;
}

/* Intro animation (assets/js/boot-animation.js) */

/* Failsafe: if the script never runs, show the page anyway. */
.booting .layout {
  opacity: 0;
  animation: boot-failsafe 0s linear 3s forwards;
}

@keyframes boot-failsafe {
  to { opacity: 1; }
}

[data-boot-pending] {
  opacity: 0;
}

/* Only the text is hidden, so the title's background still leaves a gap in the top edge. */
html[data-theme] .layout.boot-frame-only::before {
  color: transparent;
}

.boot-curtain {
  position: absolute;
  z-index: 5;
  background: var(--color-background);
  pointer-events: none;
}

.boot-overlay {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  overflow: visible;
  pointer-events: none;
}

.boot-trace {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 1.5;
  filter: drop-shadow(0 0 3px var(--color-accent)) drop-shadow(0 0 8px rgba(0, 255, 65, 0.5));
}

.boot-trace.settled {
  filter: drop-shadow(0 0 0 transparent) drop-shadow(0 0 0 transparent);
  transition:
    stroke var(--boot-settle-duration) ease-out,
    stroke-width var(--boot-settle-duration) ease-out,
    filter var(--boot-settle-duration) ease-out;
}

/* Small screens: sidebar stacks above content */

@media (max-width: 800px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  .avatar {
    width: 80px;
    height: 80px;
    margin: 16px 0;
  }

  .navigation {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-actions .button {
    width: auto;
    font-size: 13px;
  }

  .main {
    padding: 16px;
  }

  .banner {
    align-items: center;
  }

  .banner-tagline {
    text-align: center;
  }

  .banner-art {
    font-size: clamp(5px, 1.9vw, 12px);
  }

  .content {
    padding: 14px;
  }
}
