/* ==========================================================================
   The Hub of Heliopolis - terminal theme

   Every colour comes from the palette below; pygment.css uses it too.
   ========================================================================== */

/* Intel One Mono, self-hosted (SIL OFL 1.1, see ../fonts/OFL.txt) */
@font-face {
  font-family: "Intel One Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/intel-one-mono-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Intel One Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/intel-one-mono-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Intel One Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/intel-one-mono-latin-ext-700-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Intel One Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/intel-one-mono-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Intel One Mono";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/intel-one-mono-latin-ext-400-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Intel One Mono";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/intel-one-mono-latin-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #1d2427;
  --bg-raised: #263035;
  --bg-sunken: #161c1e;
  --border: #36434b;

  --fg: #c8d1d5;
  --fg-dim: #8d9aa1;
  --fg-bright: #eef3f5;

  --green: #98c379;
  --yellow: #e5c07b;
  --orange: #e2a76f;
  --blue: #7fb3e6;
  --cyan: #67c4c4;
  --magenta: #c792ea;
  --red: #ef8585;

  --link: var(--orange);

  --font: "Intel One Mono", "JetBrains Mono", "Ubuntu Mono", ui-monospace, Menlo, Consolas, monospace;
  --lh: 1.65;
  --measure: 72ch;
  --aside: 30ch;
  --gutter: 16px;

  color-scheme: dark;
}

@media (min-width: 640px) {
  :root { --gutter: 2rem; }
}

/* ---- Base ---------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/var(--lh) var(--font);
  font-variant-ligatures: none;
}

@media (min-width: 1000px) {
  body { font-size: 16px; }
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  text-underline-offset: 3px;
}

a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

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

* { scrollbar-color: var(--border) transparent; scrollbar-width: thin; }

h1, h2, h3, h4, h5, h6 { line-height: 1.3; }

/* A shell command echoed before its output. */
.cmd {
  margin: 0 0 1rem;
  color: var(--fg-dim);
  overflow-wrap: anywhere;
}

.ps1 { color: var(--green); font-weight: 700; }

.cat { color: var(--blue); text-decoration: none; }
.tag { color: var(--cyan); text-decoration: none; }
.cat:hover, .tag:hover { text-decoration: underline; }

/* ---- Frame: header, main, status line share one centred column ----------- */

.frame {
  max-width: calc(var(--aside) + var(--measure) + 3rem + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-header {
  padding-top: 1.5rem;
  padding-bottom: 1rem;
}

.prompt {
  margin: 0;
  font-size: 1.05em;
  overflow-wrap: anywhere;
}

.prompt a { text-decoration: none; }
.prompt a:hover { text-decoration: underline; }
.prompt-user { color: var(--green); font-weight: 700; }
.prompt-cwd, .prompt-cwd a { color: var(--blue); font-weight: 700; }

.cursor {
  color: var(--fg-bright);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

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

.menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 2ch;
  margin-top: 0.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.menu a { color: var(--fg-dim); text-decoration: none; }
.menu a:hover { color: var(--fg-bright); }

.site-main { padding-top: 1.5rem; padding-bottom: 2rem; }

.single { max-width: var(--measure); }

.with-aside {
  display: grid;
  grid-template-columns: var(--aside) minmax(0, var(--measure));
  gap: 3rem;
  align-items: start;
}

.aside {
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  font-size: 0.85em;
}

@media (max-width: 999px) {
  .with-aside { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .aside { position: static; max-height: none; overflow: visible; }
  .aside:empty { display: none; }
}

/* ---- Status line (tmux style) ------------------------------------------- */

.statusline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 2ch;
  margin-bottom: 1.5rem;
  background: var(--bg-raised);
  background-clip: content-box;
}

/* Size the items rather than the bar, so that the frame width (in ch) matches. */
.statusline > * { padding-block: 0.15rem; font-size: 0.85em; }

.status-session {
  background: var(--green);
  color: var(--bg);
  font-weight: 700;
  padding-inline: 1ch;
}

.status-window { color: var(--fg-bright); }

.status-links { display: flex; flex-wrap: wrap; gap: 0 1.5ch; }

.statusline a { color: var(--fg-dim); text-decoration: none; }
.statusline a:hover { color: var(--fg-bright); }

.status-right { margin-left: auto; color: var(--fg-dim); }

/* ---- Home page ----------------------------------------------------------- */

.motd { margin-bottom: 2.5rem; }

.motd-art {
  display: flex;
  align-items: center;
  gap: 2ch;
}

.motd-logo { flex: none; width: 88px; height: auto; }

.ascii {
  margin: 0;
  font-family: inherit;
  font-size: clamp(7px, 2.2vw, 13px);
  line-height: 1.15;
  overflow: hidden;
}

.motd-text { margin: 1rem 0 0; }
.motd-text strong { color: var(--fg-bright); }

/* ---- Post listings (ls -lt) ---------------------------------------------- */

.year {
  display: flex;
  align-items: center;
  gap: 1ch;
  margin: 2rem 0 1.25rem;
  font-size: 1em;
  font-weight: 400;
  color: var(--fg-dim);
}

.year::before { content: ""; width: 2ch; border-top: 1px solid var(--border); }
.year::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

.post-list { list-style: none; margin: 0; padding: 0; }

.post {
  display: grid;
  grid-template-columns: 6ch 4ch minmax(0, 1fr);
  column-gap: 2ch;
  margin-bottom: 1.75rem;
}

.post-date, .post-time {
  color: var(--fg-dim);
  font-size: 0.85em;
  /* Line up with the first line of the (larger) title next to it. */
  line-height: 2.04;
}

.post-time { text-align: right; }

.post-title { margin: 0; font-size: 1.05em; }

.post-title, .post-title a { color: var(--fg-bright); text-decoration: none; }
.post-title:hover, .post-title a:hover { color: var(--yellow); text-decoration: underline; }

.post-summary { margin: 0.35rem 0; font-size: 0.92em; }
.post-summary p { margin: 0; }

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5ch;
  margin: 0;
  font-size: 0.82em;
}

.compact .post { margin-bottom: 0.4rem; }
.compact .post-title { font-size: 1em; }
.compact .post-date, .compact .post-time { line-height: 1.94; }

@media (max-width: 639px) {
  .post { grid-template-columns: auto auto minmax(0, 1fr); }
  .post-body { grid-column: 1 / -1; }
  .post-time { text-align: left; }
  .compact .post { margin-bottom: 0.9rem; }
}

/* less(1) prompt, in reverse video. */
.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2ch;
  width: fit-content;
  margin-top: 2rem;
  padding: 0 1ch;
  background: var(--fg);
  color: var(--bg);
}

.pager a { color: var(--bg); font-weight: 700; }

/* ls -l style lists: tags, categories. */
.ls-l { list-style: none; margin: 0; padding: 0; }
.ls-l li {
  display: grid;
  grid-template-columns: 3ch minmax(0, 1fr);
  column-gap: 1ch;
  break-inside: avoid;
}
.ls-l .count { text-align: right; color: var(--fg-dim); }
.ls-columns { columns: 3 20ch; column-gap: 3ch; }

/* ---- Article ------------------------------------------------------------- */

.article-header { margin-bottom: 1.5rem; }

.article-title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.45rem, 1.1rem + 1.5vw, 2rem);
  line-height: 1.25;
  color: var(--fg-bright);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 1.75ch;
  margin: 0;
  font-size: 0.85em;
  color: var(--fg-dim);
}

.lead {
  margin: 0 0 2rem;
  font-size: 1.05em;
  font-style: italic;
  color: var(--yellow);
}

.lead p { margin: 0; }

/* Table of contents as tree(1) output. */
.toc summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 700;
  list-style: none;
  overflow-wrap: anywhere;
}

.toc summary::-webkit-details-marker { display: none; }
.toc summary::before { content: "\25B8  "; color: var(--fg-dim); }
.toc[open] summary::before { content: "\25BE  "; }

.toc .toctitle { display: none; }

.toc ul { list-style: none; margin: 0; padding: 0; }

.toc li {
  position: relative;
  padding-left: 3ch;
  line-height: 1.6;
}

.toc li::before,
.toc li::after {
  content: "";
  position: absolute;
  left: 0.5ch;
  border-color: var(--border);
  border-style: solid;
  border-width: 0;
}

.toc li::before { top: 0; bottom: 0; border-left-width: 1px; }
.toc li:last-child::before { bottom: auto; height: 0.8em; }
.toc li::after { top: 0.8em; width: 2ch; border-top-width: 1px; }

.toc a { color: var(--fg-dim); text-decoration: none; }
.toc a:hover { color: var(--fg-bright); }
.toc a.current { color: var(--yellow); }

@media (max-width: 999px) {
  .toc {
    padding: 0.75rem 2ch;
    border: 1px solid var(--border);
    border-radius: 6px;
  }
  .toc[open] summary { margin-bottom: 0.5rem; }
}

/* ---- Article body -------------------------------------------------------- */

.entry-content p { margin: 0 0 1rem; }

.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4 {
  margin: 2.5rem 0 1rem;
  scroll-margin-top: 1.5rem;
}

/* Headings keep their Markdown markers. */
.entry-content h1 { font-size: 1.3em; color: var(--green); padding-left: 2ch; text-indent: -2ch; }
.entry-content h2 { font-size: 1.12em; color: var(--cyan); padding-left: 3ch; text-indent: -3ch; }
.entry-content h3 { font-size: 1em; color: var(--magenta); padding-left: 4ch; text-indent: -4ch; }
.entry-content h4 { font-size: 1em; color: var(--blue); padding-left: 5ch; text-indent: -5ch; }

.entry-content h1::before { content: "# "; }
.entry-content h2::before { content: "## "; }
.entry-content h3::before { content: "### "; }
.entry-content h4::before { content: "#### "; }

.entry-content :is(h1, h2, h3, h4)::before { color: var(--fg-dim); font-weight: 400; }

.headerlink {
  margin-left: 1ch;
  color: var(--fg-dim);
  text-decoration: none;
  opacity: 0;
}

:is(h1, h2, h3, h4):hover > .headerlink,
.headerlink:focus-visible { opacity: 1; }

.entry-content ul,
.entry-content ol { margin: 0 0 1rem; padding-left: 3ch; }

.entry-content ul { list-style: none; }
.entry-content ul > li { position: relative; }
.entry-content ul > li::before {
  content: "-";
  position: absolute;
  left: -2ch;
  color: var(--green);
}
.entry-content ul ul > li::before { content: "*"; }

.entry-content ol > li::marker { color: var(--green); }

.entry-content li + li { margin-top: 0.3rem; }
.entry-content li > p { margin-bottom: 0.5rem; }
.entry-content li > ul,
.entry-content li > ol { margin: 0.3rem 0 0; }

.entry-content blockquote {
  margin: 1.5rem 0;
  padding: 0.1rem 0 0.1rem 2ch;
  border-left: 2px solid var(--orange);
  font-style: italic;
}

.entry-content blockquote p:last-child { margin-bottom: 0; }

.entry-content hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px dashed var(--border);
}

.entry-content code {
  padding: 0.1em 0.4ch;
  border-radius: 3px;
  background: var(--bg-raised);
  color: var(--cyan);
  font-family: inherit;
  font-size: 0.92em;
}

kbd {
  padding: 0.05em 0.6ch;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg-raised);
  color: var(--fg-bright);
  font-family: inherit;
  font-size: 0.82em;
  white-space: nowrap;
}

/* Code blocks */

.entry-content .highlight {
  position: relative;
  margin: 1.25rem 0 1.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-sunken);
}

.entry-content .highlight pre {
  margin: 0;
  padding: 1rem 2ch;
  overflow-x: auto;
  font-family: inherit;
  font-size: 0.88em;
  line-height: 1.55;
}

.entry-content pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: inherit;
}

/* Blocks with line numbers: div.highlight > table.highlighttable */
.entry-content .highlighttable {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
}

.entry-content .highlighttable td { padding: 0; border: 0; vertical-align: top; }

.entry-content .linenos pre,
.entry-content .linenodiv pre {
  margin: 0;
  padding: 1rem 1ch 1rem 2ch;
  border-right: 1px solid var(--border);
  color: var(--fg-dim);
  font-family: inherit;
  font-size: 0.88em;
  line-height: 1.55;
  text-align: right;
  user-select: none;
}

figure.code { margin: 1.25rem 0 1.5rem; }

figure.code > figcaption {
  display: inline-block;
  padding: 0.1rem 1.5ch;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: var(--bg-raised);
  color: var(--fg-dim);
  font-size: 0.8em;
}

figure.code > .highlight { margin: 0; border-top-left-radius: 0; }

.copy {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  padding: 0.05rem 0.8ch;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-raised);
  color: var(--fg-dim);
  font: inherit;
  font-size: 0.75em;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.highlight:hover > .copy,
.copy:focus-visible { opacity: 1; }

.copy:hover { color: var(--fg-bright); }

@media (hover: none) {
  .copy { opacity: 1; }
}

/* Images and figures */

.entry-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem auto;
  border-radius: 4px;
}

.entry-content figure:not(.code) { margin: 1.5rem 0; }
.entry-content figure img { margin: 0 auto; }

.entry-content figure:not(.code) > figcaption {
  margin-top: 0.6rem;
  color: var(--fg-dim);
  font-size: 0.85em;
  font-style: italic;
  text-align: center;
}

/* Tables */

.entry-content table:not(.highlighttable) {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  margin: 1.5rem 0;
  border-collapse: collapse;
  font-size: 0.9em;
}

.entry-content th,
.entry-content td:not(.linenos):not(.code) {
  padding: 0.4rem 1.5ch;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.entry-content th {
  border-bottom-color: var(--fg-dim);
  color: var(--fg-bright);
}

/* ---- Article footer ------------------------------------------------------ */

.neighbors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 3ch;
  margin: 3rem 0 2rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border);
}

.neighbor { color: var(--fg-bright); text-decoration: none; }
.neighbor:hover { color: var(--yellow); }
.neighbor .label { display: block; color: var(--fg-dim); font-size: 0.82em; }
.neighbor.next { grid-column: 2; text-align: right; }

@media (max-width: 639px) {
  .neighbors { grid-template-columns: 1fr; }
  .neighbor.next { grid-column: 1; text-align: left; }
}

.comments { margin-top: 2rem; }

/* ---- About --------------------------------------------------------------- */

.avatar {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
  margin-bottom: 1.5rem;
  border: 2px solid var(--border);
  border-radius: 50%;
}

.links { list-style: none; margin: 0; padding: 0; }

.links a {
  display: block;
  overflow: hidden;
  color: var(--fg-dim);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.links .link-name { color: var(--cyan); }
.links a:hover .link-target { color: var(--fg-bright); text-decoration: underline; }

/* The "Changelog" in about.md, shown as `git log --graph --oneline`. */
#timeline-content::before {
  content: "$ git log --graph --oneline";
  display: block;
  margin-bottom: 0.5rem;
  color: var(--fg-dim);
}

.entry-content .timeline {
  display: flex;
  flex-direction: column-reverse;
  margin: 0 0 1rem;
  padding: 0;
}

.entry-content .timeline > li {
  position: relative;
  margin: 0;
  padding-left: 8ch;
}

.entry-content .timeline > li::before {
  content: "*";
  left: 0;
  color: var(--green);
  font-weight: 700;
}

.timeline > li::after {
  content: attr(data-date);
  position: absolute;
  top: 0;
  left: 2ch;
  color: var(--yellow);
}

.entry-content .timeline p { margin: 0; }
.timeline br { display: none; }
