/* PARAM-JASANI(1) — a portfolio set as a Unix manual page.
   Black & white, one typeface, no radii, no shadows. */

:root {
  --paper: #0e0e0e;
  --ink: #cfcfcf;
  --ink-strong: #ffffff;
  --ink-dim: #7c7c7c;
  --rule: #2b2b2b;
  --hl: #ffffff;       /* hover/selection block */
  --hl-ink: #0e0e0e;

  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --indent: 11ch;
  --measure: 76ch;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --paper: #f3f2ee;
    --ink: #2a2a2a;
    --ink-strong: #000000;
    --ink-dim: #6e6e6e;
    --rule: #d4d2cb;
    --hl: #000000;
    --hl-ink: #f3f2ee;
  }
}
:root[data-theme="light"] {
  --paper: #f3f2ee;
  --ink: #2a2a2a;
  --ink-strong: #000000;
  --ink-dim: #6e6e6e;
  --rule: #d4d2cb;
  --hl: #000000;
  --hl-ink: #f3f2ee;
}

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

html {
  scroll-padding-top: 64px;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.7;
  font-feature-settings: "zero" 1;
  -webkit-font-smoothing: antialiased;
}

ul, ol { list-style: none; }
b, strong { color: var(--ink-strong); font-weight: 600; }
i { font-style: italic; }
code { font-family: inherit; color: var(--ink-strong); }
img { display: block; max-width: 100%; height: auto; }

a {
  color: var(--ink-strong);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { background: var(--hl); color: var(--hl-ink); text-decoration: none; }
::selection { background: var(--hl); color: var(--hl-ink); }
:focus-visible { outline: 2px solid var(--ink-strong); outline-offset: 2px; }

.skip {
  position: absolute; left: 8px; top: -48px; z-index: 50;
  background: var(--hl); color: var(--hl-ink); padding: 6px 10px;
}
.skip:focus { top: 8px; }

/* ---------- Sticky top bar ---------- */
.manbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.manbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.manbar-title {
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.manbar nav { flex: 1; min-width: 0; }
.toc {
  display: flex;
  gap: 4px 18px;
  justify-content: center;
  overflow-x: auto;
  scrollbar-width: none;
}
.toc::-webkit-scrollbar { display: none; }
.toc a { color: var(--ink); text-decoration: none; white-space: nowrap; padding: 0 2px; }
.toc a:hover { color: var(--hl-ink); }
.toc a.is-here { color: var(--ink-strong); text-decoration: underline; text-underline-offset: 5px; }

.theme {
  font: inherit;
  color: var(--ink-dim);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0 2px;
  white-space: nowrap;
}
.theme:hover { background: var(--hl); color: var(--hl-ink); }

@media (max-width: 720px) {
  .manbar-inner { flex-wrap: wrap; gap: 6px 12px; }
  .manbar-title { order: 1; }
  .theme { order: 2; margin-left: auto; }
  .manbar nav { order: 3; flex-basis: 100%; }
  .toc { justify-content: flex-start; }
  html { scroll-padding-top: 88px; }
}

/* ---------- Page ---------- */
.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 16px 40px;
}

.man-header,
.man-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-dim);
}
.man-header { margin-bottom: 40px; }
.man-header span:nth-child(2) { font-style: italic; }
@media (max-width: 560px) { .man-header span:nth-child(3) { display: none; } }

.man-footer {
  margin-top: 72px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}
.man-footer a { color: var(--ink-dim); text-decoration: none; }
.man-footer a:hover { color: var(--hl-ink); }

/* Section: bold heading flush left, body indented — like man(1). */
.sec { margin-top: 44px; }
.sh {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ink-strong);
  margin-bottom: 10px;
}
.body { padding-left: var(--indent); }
@media (max-width: 720px) { .body { padding-left: 2ch; } }

.prose p, p.prose { max-width: var(--measure); }
.prose p + p { margin-top: 1em; }
.note { color: var(--ink-dim); margin-top: 14px; text-align: left; }

/* ---------- NAME ---------- */
.sec-name { margin-top: 0; }
.name-body {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px 40px;
  align-items: center;
}
.who {
  font-size: clamp(44px, 8.4vw, 92px);
  font-weight: 700;
  line-height: .95;
  letter-spacing: -.045em;
  color: var(--ink-strong);
}
.whatis { margin-top: 18px; max-width: 52ch; font-size: 16px; }

.avatar { width: 188px; }
.avatar img {
  width: 188px;
  height: 188px;
  border: 1px solid var(--ink-strong);
  filter: grayscale(1) contrast(1.08);
  transition: filter .35s ease;
}
.avatar:hover img { filter: none; }
.avatar figcaption { margin-top: 6px; font-size: 12px; color: var(--ink-dim); font-style: italic; }

@media (max-width: 640px) {
  .name-body { grid-template-columns: 1fr; }
  .avatar { order: -1; width: auto; }
  .avatar figcaption { white-space: nowrap; }
  .avatar img { width: 128px; height: 128px; }
}

/* ---------- SYNOPSIS ---------- */
.synopsis { font-size: 15px; }
.synopsis .opt { white-space: nowrap; }
.synopsis a { font-weight: 500; }

/* ---------- ENVIRONMENT / OPTIONS / SEE ALSO: two-column definition lists ---------- */
.env > div,
.opts > div,
.see > div {
  display: grid;
  grid-template-columns: 12ch 1fr;
  gap: 0 2ch;
}
.env dt, .opts dt, .see dt { color: var(--ink-strong); font-weight: 600; }
.opts > div + div, .see > div + div { margin-top: 10px; }
.env dd { overflow-wrap: anywhere; }
@media (max-width: 520px) {
  .env > div { grid-template-columns: 9ch 1fr; gap: 0 1ch; }
  .opts > div, .see > div { grid-template-columns: 1fr; }
  .opts dd, .see dd { padding-left: 2ch; }
}

/* ---------- EXIT STATUS ---------- */
.exit { border-collapse: collapse; width: 100%; max-width: var(--measure); }
.exit caption { caption-side: top; margin: 0 0 8px; }
.exit th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-strong);
  white-space: nowrap;
  padding: 3px 3ch 3px 0;
  vertical-align: top;
  width: 12ch;
}
.exit td { padding: 3px 0; }
@media (max-width: 520px) {
  .exit tr { display: block; margin-bottom: 8px; }
  .exit th, .exit td { display: block; padding: 0; width: auto; }
  .exit td { padding-left: 2ch; }
}

/* ---------- HISTORY / PROJECTS: date gutter + entry ---------- */
.log > li,
.projects > li {
  display: grid;
  grid-template-columns: 20ch 1fr;
  gap: 0 2ch;
  padding: 14px 0;
  border-top: 1px dashed var(--rule);
}
.log > li:first-child { border-top: 0; padding-top: 0; }
.when { color: var(--ink-dim); white-space: nowrap; }
.log h3, .projects h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-strong);
}
.dash { margin-top: 4px; max-width: var(--measure); }
.dash li { position: relative; padding-left: 2ch; }
.dash li::before { content: "-"; position: absolute; left: 0; color: var(--ink-dim); }

.projects > li > div > p:not(.stack) { margin-top: 4px; max-width: var(--measure); }
.stack { margin-top: 6px; color: var(--ink-dim); font-size: 13px; }
.stack::before { content: "# "; }
.projects > li.is-hidden { display: none; }

.projects > li { grid-template-columns: 10ch 1fr; }

@media (max-width: 640px) {
  .log > li, .projects > li { grid-template-columns: 1fr; }
}

/* Filter "flags" */
.cmd { margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.prompt { color: var(--ink-dim); margin-right: 4px; }
.flag {
  font: inherit;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0 3px;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 4px;
}
.flag:hover { background: var(--hl); color: var(--hl-ink); text-decoration: none; }
.flag.is-on { background: var(--hl); color: var(--hl-ink); text-decoration: none; }

/* ---------- FILES ---------- */
.path { font-size: 15px; font-weight: 600; margin-top: 22px; }
.path:first-child { margin-top: 0; }
.files { margin-top: 6px; }
.files li {
  display: grid;
  grid-template-columns: 12ch 1fr;
  gap: 0 2ch;
  padding: 2px 0;
}
.files time, .files .kind { color: var(--ink-dim); }
.files a { justify-self: start; }
@media (max-width: 560px) {
  .files li { grid-template-columns: 1fr; padding: 6px 0; }
}

/* ---------- SEE ALSO ---------- */
.see dd { color: var(--ink-dim); }
.see a { white-space: nowrap; }

/* ---------- AUTHOR ---------- */
.mail { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; font-size: clamp(16px, 2.4vw, 22px); }
.mail a { font-weight: 600; overflow-wrap: anywhere; }
.mail .flag { font-size: 15px; }
.copied { font-size: 13px; color: var(--ink-dim); }

/* ---------- Shared helpers ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dim { color: var(--ink-dim); font-weight: 400; }
kbd {
  font: inherit;
  color: var(--ink-strong);
  border: 1px solid var(--rule);
  padding: 0 5px;
}

/* Blinking block cursor after the name */
.who::after {
  content: "";
  display: inline-block;
  width: .5em;
  height: .78em;
  margin-left: .12em;
  background: var(--ink-strong);
  vertical-align: baseline;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- CHALLENGES ---------- */
.body > .prose + .path { margin-top: 22px; }
.alerts { border-collapse: collapse; margin-top: 8px; width: 100%; }
.alerts thead th {
  text-align: left;
  font-weight: 400;
  color: var(--ink-dim);
  border-bottom: 1px dashed var(--rule);
  padding: 0 0 4px;
}
.alerts td { padding: 3px 0; vertical-align: baseline; }
.al-n { width: 5ch; text-align: right; padding-right: 2ch !important; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.al-bar { width: 22ch; white-space: nowrap; color: var(--ink-dim); letter-spacing: -1px; font-size: 13px; padding-right: 2ch !important; }
.alerts tr:hover .al-bar { color: var(--ink-strong); }
.al-tag { display: block; font-size: 13px; color: var(--ink-dim); }
@media (min-width: 900px) {
  .al-tag { display: inline; margin-left: 2ch; }
}
@media (max-width: 560px) {
  .al-bar { display: none; }
  .alerts thead th:nth-child(2) { display: none; }
}

.web3 { margin-top: 8px; }
.web3 li { display: grid; grid-template-columns: 8ch 16ch 1fr; gap: 0 1ch; padding: 2px 0; }
.lvl { color: var(--ink-strong); }
.w3 { color: var(--ink-strong); }

/* ---------- EXAMPLES: interactive shell ---------- */
.shell {
  margin-top: 14px;
  max-width: var(--measure);
  border: 1px solid var(--rule);
  padding: 14px 16px;
  cursor: text;
}
.shell-out { max-height: 320px; overflow-y: auto; }
.shell-out p { white-space: pre-wrap; overflow-wrap: anywhere; }
.shell-out p + p { margin-top: 2px; }
.shell-out .gap { margin-top: 10px; }
.ps { color: var(--ink-dim); white-space: nowrap; }
.shell-in { display: flex; gap: 1ch; align-items: baseline; margin-top: 4px; }
.shell-in input {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--ink-strong);
  background: none;
  border: 0;
  outline: 0;
  caret-color: var(--ink-strong);
  caret-shape: block;
}
.shell:focus-within { border-color: var(--ink-dim); }

/* ---------- less(1) status line ---------- */
body { padding-bottom: 34px; }
.less {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 9;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 16px;
  background: var(--hl);
  color: var(--hl-ink);
  font-size: 13px;
}
.less kbd { color: inherit; border-color: currentColor; }
@media (max-width: 560px) { .less-keys { display: none; } }

.keys {
  position: fixed;
  inset: 0;
  z-index: 20;
  margin: auto;
  width: min(460px, calc(100% - 32px));
  height: fit-content;
  padding: 20px 22px;
  background: var(--paper);
  border: 1px solid var(--ink-strong);
  box-shadow: 0 0 0 100vmax color-mix(in srgb, var(--paper) 70%, transparent);
}
.keys[hidden] { display: none; }
.keys h2 { font-size: 15px; color: var(--ink-strong); margin-bottom: 12px; }
.keys dl > div { display: grid; grid-template-columns: 10ch 1fr; gap: 2ch; }
.keys dt { color: var(--ink-strong); font-weight: 600; }
.keys .flag { margin-top: 14px; }

@media (prefers-reduced-motion: reduce) {
  .who::after { animation: none; }
  .avatar img { transition: none; }
}

@media print {
  .less, .keys, #examples { display: none !important; }
  .manbar, .cmd, .skip, #copy-email { display: none !important; }
  .avatar img { filter: none; }
  a { text-decoration: none; }
}
