/* ─────────────────────────────────────────────────────────────
   Tokens
   Color carries meaning, the way it does in a terminal:
     amber = the prompt, you, the thing to act on
     cyan  = links and anything interactive
     green = healthy status (systemctl "active", ok checks)
   ───────────────────────────────────────────────────────────── */
:root {
  --bg: #0a0e12;
  --bg-raise: #10161c;
  --bg-sunk: #070a0d;
  --rule: #1e2a34;
  --rule-strong: #2c3c49;
  --fg: #d3dce3;
  --fg-soft: #a9b6c0;
  --muted: #7c8c99;
  --amber: #f5b84b;
  --cyan: #6ccff6;
  --green: #8fd694;

  --mono: "Martian Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --sans: "Hanken Grotesk", system-ui, sans-serif;

  /* Type scale: 1.25 ratio from a 17px body */
  --t-xs: 0.75rem;
  --t-sm: 0.875rem;
  --t-base: 1.0625rem;
  --t-md: 1.3125rem;
  --t-lg: 1.625rem;
  --t-xl: 2.0625rem;

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --measure: 66ch;
  --radius: 6px;
  --bar-h: 2.5rem;

  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  /* Dot grid, like a rack diagram's graph paper. */
  background-image: radial-gradient(rgb(211 220 227 / 0.055) 1px, transparent 1.2px);
  background-size: 24px 24px;
  background-attachment: fixed;
  color: var(--fg);
  font: 400 var(--t-base)/1.6 var(--sans);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--cyan); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

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

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

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

.skip {
  position: absolute; left: var(--gutter); top: -3rem; z-index: 20;
  background: var(--amber); color: var(--bg); padding: 0.5rem 0.75rem;
  font: 600 var(--t-sm) var(--sans);
}
.skip:focus { top: 0.5rem; }

h1, h2, h3 { margin: 0; font-weight: 600; }

/* ───────────── tmux status line (nav) ───────────── */
.tmux {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1rem;
  height: var(--bar-h);
  padding: 0 var(--gutter);
  background: #13241a;
  border-bottom: 1px solid #1f3a29;
  font: 400 var(--t-xs)/1 var(--mono);
  letter-spacing: -0.01em;
}
.tmux a { color: var(--fg-soft); text-decoration: none; }
.tmux__session { color: var(--green) !important; font-weight: 600; flex: none; }
.tmux__windows {
  display: flex; gap: 0.25rem; flex: 1; min-width: 0;
  overflow-x: auto; scrollbar-width: none;
}
.tmux__windows::-webkit-scrollbar { display: none; }
.tmux__windows a { padding: 0.35rem 0.5rem; white-space: nowrap; border-radius: 2px; }
.tmux__windows a:hover { color: var(--fg); background: rgb(143 214 148 / 0.1); }
/* tmux marks the current window with an asterisk */
.tmux__windows a[aria-current="true"] { color: var(--bg); background: var(--green); }
.tmux__windows a[aria-current="true"]::after { content: "*"; }
.tmux__clock { color: var(--fg-soft); flex: none; }

@media (max-width: 560px) {
  .tmux__clock { display: none; }
}

/* ───────────── Prompt lines ───────────── */
.prompt {
  margin: 0 0 1.25rem;
  font: 400 var(--t-sm)/1.5 var(--mono);
  color: var(--fg-soft);
  overflow-wrap: anywhere;
}
.prompt__who { color: var(--green); }
.prompt__dir { color: var(--cyan); }
.prompt__cmd { color: var(--fg); }

.cursor {
  display: inline-block;
  width: 0.6em; height: 1.1em;
  margin-left: 0.15em;
  vertical-align: -0.2em;
  background: var(--fg);
  animation: blink 1.1s steps(1) infinite;
}
.cursor--amber { background: var(--amber); }
@keyframes blink { 50% { opacity: 0; } }

/* ───────────── Layout ───────────── */
main, .foot {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section {
  padding-block: clamp(4rem, 10vw, 7rem) 0;
}
.section h2 {
  font: 700 var(--t-xl)/1.1 var(--mono);
  font-variation-settings: "wdth" 100;
  letter-spacing: -0.03em;
  margin-bottom: 2rem;
}

/* ───────────── Hero ───────────── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  min-height: calc(100svh - var(--bar-h));
  padding-block: clamp(3rem, 8vw, 5rem);
}

.hero__name {
  font-family: var(--mono);
  font-weight: 800;
  /* The name is the one place the type gets loud: extra-wide Martian Mono. */
  font-variation-settings: "wdth" 112.5;
  font-size: clamp(3rem, 6.4vw, 5.25rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
  color: var(--fg);
  margin-bottom: 1.25rem;
}

.hero__roles {
  margin: 0 0 1.5rem;
  font: 500 var(--t-md)/1.3 var(--mono);
  color: var(--amber);
  min-height: 1.3em;
}
.hero__roles .cursor { height: 1em; vertical-align: -0.12em; }

.hero__lede {
  max-width: 52ch;
  margin: 0 0 2rem;
  color: var(--fg-soft);
  font-size: var(--t-md);
  line-height: 1.5;
}

.links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.links a {
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  color: var(--fg);
  font: 500 var(--t-sm)/1 var(--mono);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.links a i { font-size: 1rem; }
.links a:hover { border-color: var(--cyan); color: var(--cyan); background: rgb(108 207 246 / 0.06); }

/* systemctl status window */
.status {
  margin: 0;
  background: var(--bg-sunk);
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  box-shadow: 0 30px 60px -30px rgb(0 0 0 / 0.8), 0 0 0 1px rgb(0 0 0 / 0.4);
  overflow: hidden;
  position: relative;
}
/* Faint scanlines, only on this one window. */
.status::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgb(255 255 255 / 0.018) 2px 3px);
}
.status__bar {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-raise);
  font: 400 var(--t-xs)/1 var(--mono);
  color: var(--muted);
}
.dots { display: inline-flex; gap: 6px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--rule-strong); }
.status__body {
  margin: 0;
  padding: 1.1rem 1.1rem 1.25rem;
  overflow-x: auto;
  font: 400 clamp(0.66rem, 1.1vw, 0.84rem)/1.75 var(--mono);
  font-variation-settings: "wdth" 85;
  color: var(--fg-soft);
}
.status__body b { color: var(--fg); font-weight: 600; }
.status__body a { color: var(--cyan); }
.ok { color: var(--green); }
.dim { color: var(--muted); }
.note { color: var(--amber); }

@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .status__body { font-size: 0.72rem; }
}

/* ───────────── About ───────────── */
.about {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.about__text p { max-width: var(--measure); margin: 0 0 1.1em; color: var(--fg-soft); }
.about__text p:first-of-type { color: var(--fg); font-size: 1.1875rem; line-height: 1.55; }

.facts {
  margin: 0;
  padding: 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-raise);
  font: 400 var(--t-xs)/1.7 var(--mono);
}
.facts div { padding-left: 1.5em; text-indent: -1.5em; }
.facts dt { color: var(--cyan); }
.facts dt::after { content: "="; color: var(--muted); }
.facts dt, .facts dd { display: inline; }
.facts dd { margin: 0; color: var(--amber); }

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

/* ───────────── Skills ───────────── */
.stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}
.stack__group { background: var(--bg); padding: 1.5rem 1.5rem 1.75rem; }
.stack__group h3 {
  font: 600 var(--t-sm)/1 var(--mono);
  color: var(--cyan);
  margin-bottom: 1.1rem;
}
/* Infra groups lead, so they get the amber directory color. */
.stack__group--lead { background: var(--bg-raise); }
.stack__group--lead h3 { color: var(--amber); }
.stack__group ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.6rem; }
.stack__group li { display: flex; align-items: center; gap: 0.7rem; color: var(--fg); }
.stack__group li i, .glyph {
  flex: none; width: 1.25rem; text-align: center;
  font-size: 1.1rem; color: var(--muted);
  font-style: normal;
}
.glyph { font: 600 0.85rem/1 var(--mono); }

@media (max-width: 900px) { .stack { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .stack { grid-template-columns: 1fr; } }

/* ───────────── Experience (journal) ───────────── */
.journal { list-style: none; margin: 0; padding: 0; position: relative; }
.entry {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 0 2rem;
  position: relative;
  padding-bottom: 2.5rem;
}
/* The rail: a vertical line joining entries, with a node per entry. */
.entry::before {
  content: ""; position: absolute;
  left: calc(11rem + 1rem); top: 0.55rem; bottom: -0.55rem;
  width: 1px; background: var(--rule-strong);
}
.entry:last-child::before { bottom: auto; height: 0; }
.entry__body { position: relative; padding-left: 1.5rem; }
.entry__body::before {
  content: ""; position: absolute; left: calc(-1rem - 4px); top: 0.45rem;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--muted);
}
.entry--award .entry__body::before { border-color: var(--amber); background: var(--amber); }

.entry__when {
  margin: 0;
  font: 400 var(--t-xs)/2 var(--mono);
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}
.entry h3 { font: 600 var(--t-md)/1.3 var(--sans); color: var(--fg); }
.entry__where { margin: 0.15rem 0 0.75rem; color: var(--muted); font-size: var(--t-sm); }
.entry ul { margin: 0; padding: 0 0 0 1.1rem; max-width: var(--measure); color: var(--fg-soft); }
.entry li { margin-bottom: 0.35rem; }
.entry li::marker { color: var(--muted); content: "– "; }
.entry strong { color: var(--fg); font-weight: 600; }
.entry--award strong { color: var(--amber); }

/* Collapsed journal: the last visible entry's rail fades out to show there's more below. */
.journal .entry[hidden] { display: none; }
.journal.is-collapsed .entry--edge::before {
  background: linear-gradient(var(--rule-strong), transparent);
}

.journal__pager {
  display: flex; align-items: center; flex-wrap: wrap; gap: 1rem;
  margin-left: calc(11rem + 2rem);
}
.journal__pager[hidden] { display: none; }
.journal__count { font: 400 var(--t-xs)/1 var(--mono); color: var(--muted); }
.journal__toggle {
  padding: 0.6rem 1rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg);
  font: 500 var(--t-sm)/1 var(--mono);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.journal__toggle:hover { border-color: var(--cyan); color: var(--cyan); background: rgb(108 207 246 / 0.06); }
.journal__toggle::after {
  content: "";
  display: inline-block;
  width: 0.4em; height: 0.4em;
  margin-left: 0.6em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.15em) rotate(45deg);
  transition: transform 0.2s;
}
.journal__toggle[aria-expanded="true"]::after { transform: translateY(0.1em) rotate(-135deg); }

@media (prefers-reduced-motion: no-preference) {
  .entry.is-revealed { animation: entry-in 0.35s ease both; }
}
@keyframes entry-in { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 680px) {
  .entry { grid-template-columns: 1fr; padding-left: 1.5rem; }
  .entry::before { left: 0.25rem; }
  .entry__when { text-align: left; }
  .entry__body { padding-left: 0; }
  .entry__body::before { left: calc(-1.25rem - 4px); top: -1.55rem; }
  .journal__pager { margin-left: 1.5rem; }
}

/* ───────────── Projects ───────────── */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 1.5rem;
}
.projects__empty {
  grid-column: 1 / -1; margin: 0; padding: 1.5rem;
  border: 1px dashed var(--rule-strong); border-radius: var(--radius);
  color: var(--muted); font-size: var(--t-sm);
}
.projects__empty code { color: var(--amber); font-family: var(--mono); font-size: 0.9em; }
.projects__more { margin: 2rem 0 0; font: 400 var(--t-sm) var(--mono); }

.card {
  display: flex; flex-direction: column;
  background: var(--bg-raise);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}
.card:hover, .card:focus-within { border-color: var(--cyan); transform: translateY(-2px); }

/* Image slot. A real screenshot (images/projects/<repo>.png) sits on top of the
   placeholder; if the file doesn't exist, main.js removes the <img> and the placeholder shows. */
.card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--bg-sunk);
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
}
.card__media img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: top;
  transition: transform 0.4s ease;
}
.card:hover .card__media img { transform: scale(1.03); }

.placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 1rem 1.1rem;
  font: 400 var(--t-xs)/1.7 var(--mono);
  color: var(--muted);
  background:
    linear-gradient(to bottom, transparent 40%, var(--bg-sunk)),
    radial-gradient(rgb(211 220 227 / 0.07) 1px, transparent 1.2px) 0 0 / 14px 14px;
}
.placeholder__cmd { color: var(--fg-soft); }
.placeholder__cmd b { color: var(--green); font-weight: 400; }
.placeholder__ls { color: var(--cyan); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.placeholder__mark {
  position: absolute; top: 1rem; right: 1.1rem;
  font: 700 2.5rem/1 var(--mono);
  font-variation-settings: "wdth" 112.5;
  color: var(--rule-strong);
  letter-spacing: -0.04em;
}
.card:hover .placeholder__mark { color: var(--amber); }

.card__body { display: flex; flex-direction: column; flex: 1; padding: 1.25rem 1.25rem 1rem; }
.card__title { font: 600 var(--t-md)/1.25 var(--sans); color: var(--fg); margin-bottom: 0.25rem; }
.card__repo { font: 400 var(--t-xs)/1.4 var(--mono); color: var(--muted); margin: 0 0 0.75rem; }
.card__note { color: var(--amber); font-size: var(--t-sm); margin: 0 0 0.5rem; font-weight: 500; }
.card__desc { margin: 0 0 1rem; color: var(--fg-soft); font-size: 0.97rem; line-height: 1.55; }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 1.25rem; padding: 0; list-style: none; }
.tags li {
  font: 400 0.7rem/1 var(--mono);
  padding: 0.35rem 0.5rem;
  border-radius: 3px;
  background: rgb(108 207 246 / 0.08);
  color: var(--cyan);
}

.card__foot {
  margin-top: auto;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  font: 400 var(--t-xs)/1 var(--mono);
  color: var(--muted);
}
.card__foot .spacer { flex: 1; }
.card__foot a { color: var(--fg); text-decoration: none; }
.card__foot a:hover { color: var(--cyan); text-decoration: underline; }

/* ───────────── Certifications ───────────── */
.certs {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
}
.certs__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.cert {
  display: flex; gap: 1rem; align-items: center;
  padding: 0.9rem 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-raise);
}
/* A small certificate "seal" drawn in CSS */
.cert__seal {
  flex: none;
  display: grid; place-items: center;
  width: 2.5rem; height: 2.5rem;
  border-radius: 50%;
  border: 1.5px solid var(--green);
  box-shadow: inset 0 0 0 3px var(--bg-raise), inset 0 0 0 4px rgb(143 214 148 / 0.35);
  color: var(--green);
  font: 700 0.7rem/1 var(--mono);
}
.cert h3 { font: 600 1rem/1.35 var(--sans); color: var(--fg); }
.cert p { margin: 0.1rem 0 0; font-size: var(--t-sm); color: var(--muted); }

.awards__h { font: 600 var(--t-sm)/1 var(--mono); color: var(--amber); margin: 0.9rem 0 1.25rem; }
.awards__list { list-style: none; margin: 0; padding: 0; }
.awards__list li {
  display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: 0.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--rule);
  color: var(--fg-soft);
}
.awards__list li:first-child { border-top: 0; padding-top: 0; }
.awards__year { font: 400 var(--t-xs)/2 var(--mono); color: var(--muted); }

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

/* ───────────── Contact ───────────── */
.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.contact__intro p { max-width: 44ch; color: var(--fg-soft); margin: 0 0 2rem; font-size: var(--t-md); line-height: 1.5; }
.contact__links { list-style: none; margin: 0; padding: 0; font: 400 var(--t-sm)/1.4 var(--mono); }
.contact__links li { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: 0.5rem; padding: 0.55rem 0; overflow-wrap: anywhere; }
.contact__links span { color: var(--muted); }

.mail {
  display: grid; gap: 0.4rem;
  padding: 1.5rem;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--bg-raise);
}
.mail label { font: 400 var(--t-xs)/1.4 var(--mono); color: var(--muted); margin-top: 0.6rem; }
.mail label:first-child { margin-top: 0; }
.mail input, .mail textarea {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  background: var(--bg-sunk);
  color: var(--fg);
  font: 400 1rem/1.5 var(--sans);
  caret-color: var(--amber);
  transition: border-color 0.15s;
}
.mail textarea { resize: vertical; min-height: 8rem; }
.mail input:focus, .mail textarea:focus { outline: none; border-color: var(--amber); }
.mail button {
  justify-self: start;
  margin-top: 1rem;
  padding: 0.75rem 1.2rem;
  border: 0; border-radius: 4px;
  background: var(--amber);
  color: #1a1204;
  font: 600 var(--t-sm)/1 var(--mono);
  cursor: pointer;
  transition: filter 0.15s;
}
.mail button:hover { filter: brightness(1.08); }
.mail__hint { margin: 0.5rem 0 0; font-size: var(--t-xs); color: var(--muted); }

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

/* ───────────── Footer ───────────── */
.foot { padding-block: clamp(5rem, 12vw, 8rem) 3rem; }
.foot .prompt { margin-bottom: 0.25rem; }
.foot__line { margin: 0; font: 400 var(--t-xs)/1.6 var(--mono); color: var(--muted); }

/* ───────────── Motion ─────────────
   Only when JS is on (.js on <html>) and the visitor hasn't asked for reduced motion.
   The hero plays one boot sequence; each later section types its command and then
   shows its output once it scrolls into view. */
@media (prefers-reduced-motion: no-preference) {
  .js [data-boot],
  .js .section__out {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }
  .js [data-boot].is-in,
  .js .section__out.is-in {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor { animation: none; }
  .card, .card__media img { transition: none; }
  .card:hover { transform: none; }
}
