/* Terminal / phosphor theme. No JS required to render. */
:root {
  --bg: #0a0e0a;
  --bg-soft: #0f140f;
  --fg: #c8f7c5;          /* soft phosphor green */
  --fg-dim: #6e8a6c;
  --accent: #39ff14;      /* bright green */
  --amber: #ffb000;
  --link: #7fdbff;
  --border: #1d2a1d;
  --mono: "JetBrains Mono", "IBM Plex Mono", "SFMono-Regular", "Menlo",
    "Consolas", ui-monospace, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: 0.02em;
  max-width: 760px;
  padding: 1.5rem 1.25rem 4rem;
  margin-inline: auto;
  /* faint scanlines */
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.18) 3px
  );
}

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

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--bg-soft);
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
}

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

/* the big "~/blog" masthead on the first line (an <h1> on the home page,
   a plain <div> on single posts where the post title is the <h1>). */
.brand {
  margin: 0 0 0.75rem;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(57, 255, 20, 0.35);
}
.brand a { color: inherit; text-decoration: none; }

/* header / terminal ----------------------------------------------------- */
.term-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

/* progressive enhancement: show one or the other */
.no-js .term-live { display: none; }
.js .term-static { display: none; }

.term-prompt .user { color: var(--accent); }
.term-prompt .cwd { color: var(--link); }
.term-static .cmd { margin-left: 0.4rem; }

/* interactive terminal */
.term-live { cursor: text; }
.term-output { margin: 0 0 0.2rem; }
.term-out-line { white-space: pre-wrap; line-height: 1.5; }
.term-out-line.echo { color: var(--fg-dim); }
.term-out-line.err { color: var(--amber); }
.term-out-line a { color: var(--fg); }
.term-out-line a:hover { color: var(--accent); }

.term-line {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.term-field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
}
.term-prompt { margin-right: 0.5rem; white-space: nowrap; }
.term-typed { white-space: pre; color: var(--fg); }
.term-hint { color: var(--fg-dim); opacity: 0.55; font-style: italic; }
/* ghost autosuggestion: faint preview of what Tab will complete */
.term-ghost { white-space: pre; color: var(--fg-dim); opacity: 0.5; pointer-events: none; }

/* search results list (reused by the modal) */
.term-results {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
}
.term-results[hidden] { display: none; }
.term-results:empty { display: none; }
.term-results li {
  display: flex;
  gap: 0.85rem;
  align-items: baseline;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.term-results li:last-child { border-bottom: none; }
.term-results li.sel,
.term-results li:hover { background: rgba(57, 255, 20, 0.08); }
.term-results .ls-date { color: var(--fg-dim); font-variant-numeric: tabular-nums; }
.term-results .r-title { color: var(--fg); }
.term-results mark { background: transparent; color: var(--accent); font-weight: 700; }

/* the real input is transparent and overlays the prompt line to catch
   keystrokes/focus; the visible text is .term-typed, the caret is .cursor */
.term-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font: inherit;
  cursor: text;
}

.cursor {
  display: inline-block;
  margin-left: 0.1rem;
  color: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.nav {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: stretch;
}
/* terminal-style chips: green border, invert + glow on hover */
.nav a,
.nav-search {
  font: inherit;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.12s, background 0.12s, box-shadow 0.12s;
}
.nav a:hover,
.nav-search:hover,
.nav a:focus-visible,
.nav-search:focus-visible {
  color: var(--bg);
  background: var(--accent);
  outline: none;
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.35);
}
.no-js .nav-search { display: none; } /* needs JS — hide when unavailable */

@media (prefers-reduced-motion: reduce) {
  .nav a,
  .nav-search { transition: none; }
}

/* layout: single column by default, main + sidebar on wide screens -------- */
.layout { display: block; }

.sidebar { margin-top: 2.5rem; }

@media (min-width: 880px) {
  body { max-width: 1080px; }
  /* left sidebar | content filling and centered in the rest */
  .layout {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 2.5rem;
    align-items: start;
  }
  .sidebar { grid-column: 1; grid-row: 1; margin-top: 0; position: sticky; top: 1.5rem; }
  .main {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    max-width: 720px;
    margin-inline: auto;
  }
}

/* terminal "whoami" card */
.card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-soft);
  overflow: hidden;
}
.card-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--border);
}
.card-title { color: var(--fg-dim); font-size: 0.8rem; }
.card-body { position: relative; z-index: 1; padding: 0.85rem 0.95rem; font-size: 0.9rem; }

.card-name {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.25;
  color: var(--accent);
  font-weight: 700;
}
.card-tag { margin: 0.2rem 0 0; font-size: 0.82rem; }

.pf {
  margin: 0.85rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--border);
  display: grid;
  gap: 0.15rem;
}
.pf-row {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.2rem 0.4rem;
  margin: 0 -0.4rem;
  border-radius: 3px;
  transition: background 0.12s;
}
.pf-row:hover { background: rgba(57, 255, 20, 0.07); }
.pf-key {
  color: var(--fg-dim);
  flex: 0 0 auto;
  min-width: 6rem;
  white-space: nowrap;
}
.pf-key::before { content: "› "; color: var(--accent); }
.pf-key::after { content: ":"; }
.pf-val { margin: 0; color: var(--fg); min-width: 0; overflow-wrap: anywhere; }
/* Solo rows (no key) keep the terminal bullet on the value itself. */
.pf-row--solo .pf-val::before { content: "› "; color: var(--accent); }
.pf-val a { color: var(--link); }
.pf-val a:hover { color: var(--accent); }

/* ---- search modal (command palette) ----------------------------------- */
body.modal-open { overflow: hidden; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 1rem 1rem;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
}
.modal-window {
  position: relative;
  width: 100%;
  max-width: 640px;
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 6px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6), 0 0 26px rgba(57, 255, 20, 0.1);
  overflow: hidden;
  animation: modal-in 0.12s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(-6px); }
}
.win-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.win-dots { display: flex; gap: 0.35rem; }
.win-dots i {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  display: block;
  background: var(--border);
}
.win-dots i:nth-child(1) { background: #ff5f56; }
.win-dots i:nth-child(2) { background: #ffbd2e; }
.win-dots i:nth-child(3) { background: #27c93f; }
.win-title { flex: 1; color: var(--fg-dim); font-size: 0.85rem; }
.win-close {
  font: inherit;
  font-size: 0.75rem;
  color: var(--fg-dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.05rem 0.45rem;
  cursor: pointer;
}
.win-close:hover { color: var(--accent); border-color: var(--accent); }
.win-body { padding: 0.85rem 0.9rem; }
.win-body .term-field { font-size: 1.05rem; }
.modal-results {
  margin-top: 0.6rem;
  max-height: 46vh;
  overflow-y: auto;
}
.modal-results .r-empty { color: var(--fg-dim); cursor: default; }
.modal-results .r-empty:hover { background: none; }
.win-foot {
  padding: 0.45rem 0.9rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
}

/* index listing --------------------------------------------------------- */
/* an already-run command: a filled block (the command), with the list below
   as its output, and a plain-language caption in between */
.cmd-echo {
  display: inline-block;
  margin: 0 0 1.2rem;
  padding: 0.4rem 0.75rem;
  color: var(--fg);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
}
.ls { list-style: none; padding: 0; margin: 0; }
.ls li { padding: 0.3rem 0; display: flex; gap: 1rem; align-items: baseline; }
.ls-date { color: var(--fg-dim); font-variant-numeric: tabular-nums; }
/* post titles in the listing are <h2> but should read like inline links */
.ls-title { margin: 0; font-size: 1.2rem; font-weight: 400; line-height: inherit; }
.ls a, .ls-title a { color: var(--fg); }
.ls a:hover, .ls-title a:hover { color: var(--accent); }

/* post ------------------------------------------------------------------ */
.post-title {
  color: var(--accent);
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  line-height: 1.2;
  margin: 0 0 0.4rem;
}
.post-meta { margin: 0 0 2rem; font-size: 0.9rem; }
.tag { color: var(--amber); font-size: 0.85rem; }

.post-body h2, .post-body h3 { color: var(--amber); margin-top: 2rem; }
.post-body h2::before { content: "## "; color: var(--fg-dim); }
.post-body h3::before { content: "### "; color: var(--fg-dim); }
.post-body a.header-anchor { color: var(--fg-dim); text-decoration: none; }

.post-body p, .post-body li { color: var(--fg); }
.post-body code {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
  font-size: 0.9em;
  color: var(--amber);
}
.post-body pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 1rem;
  overflow-x: auto;
}
.post-body pre code { background: none; border: none; padding: 0; color: var(--fg); }
.post-body blockquote {
  border-left: 3px solid var(--fg-dim);
  margin: 1.5rem 0;
  padding-left: 1rem;
  color: var(--fg-dim);
}
.post-body img { max-width: 100%; }
.post-body hr { border: none; border-top: 1px dashed var(--border); margin: 2rem 0; }

.back { margin-top: 3rem; }

/* footer ---------------------------------------------------------------- */
.term-footer {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
}
.term-footer .links a { color: var(--fg-dim); }
.term-footer .links a:hover { color: var(--accent); }

/* respect reduced motion ------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
  body { background-image: none; }
}
