website

Personal website
git clone https://github.com/michaelneuper/website.git
README | Files | Log | Refs

website/src/styles/post/org.css (7732B)


/* A post is an Org buffer the way Doom shows one with mixed-pitch-mode: #+
   keywords and markup in mono, the text in the serif, starred headings in
   the org-level colours (the same as the posts list on the home page), and
   code between #+begin_src and #+end_src. Code is coloured from the current
   theme through the variables Shiki's css-variables theme reads. */

:root {
  --astro-code-foreground: var(--fg);
  --astro-code-background: var(--hl);
  --astro-code-token-comment: var(--dim);
  --astro-code-token-keyword: var(--magenta);
  --astro-code-token-string: var(--green);
  --astro-code-token-string-expression: var(--green);
  --astro-code-token-constant: var(--orange);
  --astro-code-token-function: var(--blue);
  --astro-code-token-parameter: var(--fg);
  --astro-code-token-punctuation: var(--dim);
  --astro-code-token-link: var(--cyan);
}

.sec.post {
  padding-top: 112px;
}

@media (max-width: 640px) {
  .sec.post {
    padding-top: 104px;
  }
}

/* post file names are long; on a phone they're cut short rather than wrapped */
.post > .winbar .file {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post > .winbar .meta {
  white-space: nowrap;
}

.org-head {
  margin: 0 0 56px;
  font-size: 13px;
  line-height: 1.75;
}

.org-head .org-key {
  color: var(--dim);
}

.org-ts {
  color: var(--cyan);
}

.org-filetags .t {
  color: var(--tag, var(--dim));
}

.post-title {
  max-width: 18em;
  margin: 0 0 20px;
  font: 400 clamp(34px, 4.8vw, 54px)/1.08 var(--serif);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.post-title .org-key {
  margin-right: 0.3ch;
  font: 400 15px/1 var(--mono);
  letter-spacing: 0;
  vertical-align: 0.5em;
}

.post-body {
  max-width: 680px;
  font: 400 19px/1.6 var(--serif);
  /* long URLs break rather than push a phone's page sideways */
  overflow-wrap: anywhere;
}

.post-body > :first-child {
  margin-top: 0;
}

.post-body p,
.post-body ul,
.post-body ol,
.post-body dl {
  margin: 0 0 1em;
}

.post-body ul,
.post-body ol {
  padding-left: 1.3em;
}

.post-body ul {
  list-style-type: "- ";
}

.post-body li {
  margin: 0.25em 0;
}

.post-body li::marker {
  color: var(--dim);
  font: 400 15px var(--mono);
}

.post-body li > p {
  margin: 0;
}

/* headings, coloured like org-level-1, -2 and -3 */
.post-body h2,
.post-body h3,
.post-body h4 {
  margin: 1.7em 0 0.5em;
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.2;
}

.post-body h2 {
  color: var(--blue);
  font-size: 30px;
}

.post-body h3 {
  color: var(--magenta);
  font-size: 24px;
}

.post-body h4 {
  color: var(--violet);
  font-size: 20px;
}

/* The stars, in mono at the heading's own size, the way Org draws them.
   src/scripts/post/folding.js swaps them for buttons that fold the heading. */
.post-body :is(h2, h3, h4)::before,
.post-body .org-stars {
  margin-right: 0.35ch;
  font-family: var(--mono);
  font-size: 1em;
  font-weight: 400;
  line-height: inherit;
  vertical-align: baseline;
}

.post-body h2::before { content: "*"; }
.post-body h3::before { content: "**"; }
.post-body h4::before { content: "***"; }

.post-body .has-stars::before {
  content: none;
}

.post-body .org-stars {
  cursor: pointer;
}

.post-body .org-ellipsis {
  margin-left: 0.3ch;
}

.post-body .is-folded-away {
  display: none !important;
}

/* emphasis keeps its Org markers: ~code~ /italic/ *bold* +strike+ */
.post-body :not(pre) > code {
  color: var(--orange);
  font-size: 0.74em;
}

.post-body :not(pre) > code::before,
.post-body :not(pre) > code::after {
  content: "~";
}

.post-body em::before,
.post-body em::after {
  content: "/";
}

.post-body strong::before,
.post-body strong::after {
  content: "*";
}

.post-body :is(s, del)::before,
.post-body :is(s, del)::after {
  content: "+";
}

/* A strike around whole paragraphs is a block, with its markers at the start
   of the first paragraph and the end of the last instead of on lines of their own. */
.post-body :is(s, del):has(> :is(p, ul, ol, blockquote)) {
  display: block;
}

.post-body :is(s, del):has(> :is(p, ul, ol, blockquote))::before,
.post-body :is(s, del):has(> :is(p, ul, ol, blockquote))::after {
  content: none;
}

.post-body :is(s, del) > p:first-child::before,
.post-body :is(s, del) > p:last-child::after {
  content: "+";
}

.post-body :not(pre) > code::before,
.post-body :not(pre) > code::after,
.post-body :is(em, strong, s, del)::before,
.post-body :is(em, strong, s, del)::after,
.post-body :is(s, del) > p:first-child::before,
.post-body :is(s, del) > p:last-child::after {
  color: var(--dim);
  font-family: var(--mono);
  font-style: normal;
  font-weight: 400;
  text-decoration: none;
}

/* inline-block, so the strike's line doesn't run through its own markers */
.post-body :is(s, del)::before,
.post-body :is(s, del)::after,
.post-body :is(s, del) > p:first-child::before,
.post-body :is(s, del) > p:last-child::after {
  display: inline-block;
}

.post-body kbd {
  font: 400 0.72em/1 var(--mono);
  vertical-align: 0.1em;
}

/* #+begin_src lang ... #+end_src */
.post-body pre {
  margin: 1.4em 0;
  padding: 0 16px;
  overflow-x: auto;
  background: var(--hl);
  font: 400 13px/1.6 var(--mono);
  tab-size: 4;
}

.post-body pre::before,
.post-body pre::after {
  display: block;
  color: var(--dim);
}

.post-body pre::before {
  content: "#+begin_src " attr(data-language);
  padding-top: 8px;
}

.post-body pre[data-language="py"]::before {
  content: "#+begin_src python";
}

.post-body pre::after {
  content: "#+end_src";
  padding-bottom: 8px;
}

.post-body pre code {
  font-size: inherit;
}

.post-body blockquote {
  margin: 1.4em 0;
  color: var(--dim);
}

.post-body blockquote::before,
.post-body blockquote::after {
  display: block;
  margin-left: -40px;
  color: var(--dim);
  font: 400 13px/1.6 var(--mono);
}

.post-body blockquote::before {
  content: "#+begin_quote";
}

.post-body blockquote::after {
  content: "#+end_quote";
}

.post-body img,
.post-body video {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.4em 0;
}

.post-body hr {
  margin: 2em 0;
  border: 0;
}

.post-body hr::before {
  content: "-----";
  color: var(--dim);
  font: 400 13px/1 var(--mono);
}

/* org tables: | a | b | */
.post-body table {
  display: block;
  margin: 1.4em 0;
  overflow-x: auto;
  border-collapse: collapse;
  font: 400 13px/1.5 var(--mono);
}

.post-body th,
.post-body td {
  padding: 4px 1ch;
  border: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.post-body th {
  color: var(--blue);
  font-weight: 400;
}

/* KaTeX's font is Computer Modern too, so it can match the text size. */
.post-body .katex {
  font-size: 1em;
}

.post-body .katex-display {
  margin: 1.2em 0;
  padding: 0.2em 0;
  overflow-x: auto;
  overflow-y: hidden;
}

/* [fn:1] references, and the notes under a * Footnotes heading */
.post-body sup:has(> a[data-footnote-ref]) {
  font: 400 13px/1 var(--mono);
  vertical-align: baseline;
}

.post-body a[data-footnote-ref] {
  color: var(--cyan);
  text-decoration: none;
}

.post-body a[data-footnote-ref]::before {
  content: "[fn:";
}

.post-body a[data-footnote-ref]::after {
  content: "]";
}

.post-body .footnotes {
  margin-top: 1.7em;
  font-size: 17px;
}

.post-body .footnotes h2.sr-only {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  white-space: normal;
}

.post-body .footnotes ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: fn;
}

.post-body .footnotes li {
  counter-increment: fn;
}

.post-body .footnotes li::before {
  content: "[fn:" counter(fn) "] ";
  color: var(--cyan);
  font: 400 13px var(--mono);
}

.post-body .footnotes li > p {
  display: inline;
}