/* code.benoitguivarch.fr — "the source is the design" */

:root {
  --bg: #1b1d21;
  --bg-raised: #212429;
  --ink: #e6e1d6;
  --ink-dim: #a39e93;
  --mark: #6b7280;
  --amber: #f2b134;
  --sage: #86c7a2;
  --rust: #e0705e;
  --rule: #2e3238;
  --gutter: 4ch;
  --measure: 72ch;
  --font: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3efe6;
    --bg-raised: #ebe6da;
    --ink: #1f2226;
    --ink-dim: #5c5a54;
    --mark: #9a958a;
    --amber: #b0700a;
    --sage: #2f7a55;
    --rust: #b8452f;
    --rule: #d9d3c5;
  }
}

* { box-sizing: border-box; }

html { font-size: 15px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.65;
  padding: 0 16px 6rem;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--amber); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ---- header: a path -------------------------------------------------- */

.top {
  max-width: calc(var(--gutter) + var(--measure));
  margin: 1.5rem auto 2.5rem;
  padding-left: var(--gutter);
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top .host { color: var(--ink-dim); text-decoration: none; }
.top .host:hover { color: var(--amber); }
.top .sep { color: var(--mark); margin: 0 .25ch; }
.top .file { color: var(--ink); }

/* ---- document: rendered markdown with its marks left in the gutter --- */

.doc {
  max-width: calc(var(--gutter) + var(--measure));
  margin: 0 auto;
  padding-left: var(--gutter);
}

.doc h1, .doc h2, .doc h3, .doc blockquote, .doc li, .doc p.cmd {
  position: relative;
}

.doc h1::before, .doc h2::before, .doc h3::before,
.doc blockquote::before, .doc li::before, .doc p.cmd::before {
  position: absolute;
  right: 100%;
  width: var(--gutter);
  color: var(--mark);
  font-weight: 400;
  text-align: left;
  user-select: none;
}

.doc h1 { font-size: 1.6rem; line-height: 1.25; font-weight: 600; margin: 0 0 .5rem; }
.doc h1::before { content: "# "; }
.doc h2 { font-size: 1.15rem; font-weight: 600; margin: 2.75rem 0 .75rem; }
.doc h2::before { content: "## "; }
.doc h3 { font-size: 1rem; font-weight: 600; margin: 2rem 0 .5rem; }
.doc h3::before { content: "### "; }

.doc p { margin: 0 0 1.25rem; }
.doc p.meta { color: var(--ink-dim); margin: 0 0 2.5rem; }

.doc strong { font-weight: 600; }
.doc strong::before, .doc strong::after { content: "**"; color: var(--mark); font-weight: 400; }
.doc em::before, .doc em::after { content: "_"; color: var(--mark); font-style: normal; }

.doc ul, .doc ol { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.doc li { margin: 0 0 .35rem; }
.doc ul li::before { content: "- "; }
.doc ol { counter-reset: item; }
.doc ol li::before { counter-increment: item; content: counter(item) ". "; }
.doc li > ul, .doc li > ol { margin: .35rem 0 0 2ch; }

.doc blockquote {
  margin: 0 0 1.25rem;
  padding: 0;
  color: var(--ink-dim);
}
.doc blockquote::before { content: "> "; }
.doc blockquote p { margin: 0; }

.doc hr { border: 0; color: var(--mark); margin: 2.5rem 0; }
.doc hr::before { content: "---"; }

.doc code {
  font-family: inherit;
  font-size: .95em;
  background: var(--bg-raised);
  padding: .05em .3em;
  border-radius: 3px;
}
.doc :not(pre) > code::before, .doc :not(pre) > code::after { content: "`"; color: var(--mark); }

.doc pre {
  margin: 0 0 1.5rem calc(-1 * var(--gutter));
  padding: 1rem 1rem 1rem var(--gutter);
  background: var(--bg-raised);
  border-left: 2px solid var(--rule);
  overflow-x: auto;
  line-height: 1.5;
  position: relative;
}
.doc pre::before {
  content: "```";
  position: absolute;
  top: .1rem;
  left: 0;
  width: var(--gutter);
  color: var(--mark);
}
.doc pre code { background: none; padding: 0; font-size: .92rem; }
.doc pre code::before, .doc pre code::after { content: none; }

.doc table { border-collapse: collapse; margin: 0 0 1.5rem; width: 100%; }
.doc th, .doc td { text-align: left; padding: .3rem 1ch .3rem 0; vertical-align: top; }
.doc th { font-weight: 600; border-bottom: 1px solid var(--rule); }

/* footnotes = the sources section */
.doc .footnote { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--rule); color: var(--ink-dim); font-size: .92rem; }
.doc .footnote hr { display: none; }
.doc .footnote ol { margin: 0; }
.doc .footnote li { position: relative; padding-left: 0; margin-bottom: .5rem; word-break: break-word; scroll-margin-bottom: 4rem; }
.doc sup[id^="fnref"] { scroll-margin-top: 2rem; }
.doc .footnote li::before { content: "[^" counter(item) "]"; }
.doc .footnote li p { margin: 0; display: inline; }
.doc .footnote a { color: var(--amber); }
.doc .footnote a:hover { color: var(--amber); }
.doc .footnote-ref { text-decoration: none; }
.doc .footnote-ref::before { content: "[^"; color: var(--mark); }
.doc .footnote-ref::after { content: "]"; color: var(--mark); }
.doc sup { line-height: 0; font-size: .85em; }
.doc .footnote-backref { text-decoration: none; margin-left: .5ch; }

/* agent-authored lines: a diff-style green bar */
.doc .agent { border-left: 2px solid var(--sage); padding-left: 1ch; margin-left: -1ch; }

/* ---- index listing: ls -la ------------------------------------------- */

.listing { margin-top: 3rem; }
.listing .cmd { color: var(--ink-dim); margin-bottom: .5rem; }
.listing .cmd::before { content: "$ "; color: var(--amber); }
.listing table { width: 100%; border-collapse: collapse; }
.listing td { padding: .25rem 1.5ch .25rem 0; vertical-align: top; white-space: nowrap; }
.listing td:last-child { white-space: normal; }
.listing .perm, .listing .size, .listing .date { color: var(--ink-dim); }
.listing .size { text-align: right; }
.listing .summary { color: var(--ink-dim); }

@media (max-width: 640px) {
  .listing .perm { display: none; }
}

/* ---- statusline -------------------------------------------------------- */

.statusline {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  gap: 0;
  background: var(--bg-raised);
  border-top: 1px solid var(--rule);
  color: var(--ink-dim);
  font-size: .85rem;
  line-height: 1.9;
  white-space: nowrap;
  overflow: hidden;
}
.statusline .mode {
  background: var(--amber);
  color: #1b1d21;
  font-weight: 600;
  padding: 0 1.5ch;
}
.statusline .cell { padding: 0 1.5ch; border-right: 1px solid var(--rule); }
.statusline .cell:last-child { border-right: 0; }
.statusline .grow { flex: 1; border: 0; }
.statusline a { color: inherit; }
.statusline a:hover { color: var(--amber); }

@media (max-width: 640px) {
  .statusline .cell:nth-child(n+5):not(:last-child) { display: none; }
}

/* ---- pygments (codehilite) -------------------------------------------- */

.hl .c, .hl .c1, .hl .cm { color: var(--mark); font-style: italic; }
.hl .k, .hl .kd, .hl .kn { color: var(--amber); }
.hl .s, .hl .s1, .hl .s2, .hl .sb { color: var(--sage); }
.hl .nb, .hl .nf, .hl .nt { color: var(--ink); }
.hl .m, .hl .mi { color: var(--rust); }
.hl .gp { color: var(--amber); user-select: none; }
.hl .go { color: var(--ink-dim); }

