:root {
  --fg-color: #000000;
  --bg-color: #eeeeee;
  --bg-secondary-color: #d0d0d0;
  --link-color: #005faf;
  --text-color-on-secondary: #000000;
  --outline-color: #d75f00;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg-color: #e8e6e3;
    --bg-color: #181a1b;
    --bg-secondary-color: #333739;
    --link-color: #8ac3ff;
    --text-color-on-secondary: #ffffff;
  }
}

@font-face {
  font-family: 'iA Writer Mono';
  src: url('/iAWriterMonoS-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'iA Writer Mono';
  src: url('/iAWriterMonoS-Italic.woff2') format('woff2');
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'iA Writer Mono';
  src: url('/iAWriterMonoS-Bold.woff2') format('woff2');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'iA Writer Mono';
  src: url('/iAWriterMonoS-BoldItalic.woff2') format('woff2');
  font-weight: bold;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'iA Writer Duo';
  src: url('/iAWriterDuoS-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'iA Writer Duo';
  src: url('/iAWriterDuoS-Italic.woff2') format('woff2');
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'iA Writer Duo';
  src: url('/iAWriterDuoS-Bold.woff2') format('woff2');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'iA Writer Duo';
  src: url('/iAWriterDuoS-BoldItalic.woff2') format('woff2');
  font-weight: bold;
  font-style: italic;
  font-display: swap;
}


* {
  font-family: "iA Writer Duo", ui-monospace, monospace;
  max-width: 70ch;
  padding: 0;
  margin: 0;
  font-size: 16px;
  line-height: 1.6em;
}

html {
  box-sizing: border-box;
  color: var(--fg-color);
  background-color: var(--bg-color);
  padding: 1em;
  margin: 0 auto;
}

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

main,
article {
  /* fit overflow figures like wide pre blocks and force them to scroll, esp for 70ch wide screens; account for scroll bar width on desktop/windows too */
  max-width: calc(100vw - 5.5ch);
}

#main-nav {
  position: absolute;
  left: 1em;
  top: 1em;
  margin-left: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: bold;
  margin: 0 0 1.5em;
}

img {
  max-width: 100%;
  height: auto;
}

header {
  margin-top: 4em;
  margin-bottom: -1em;
  text-align: center;
}

header>* {
  margin-bottom: 0;
}

p {
  margin-bottom: 2em;
}

details summary {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  list-style: none;
  cursor: pointer;
}

details summary::before {
  content: "▶";
  display: inline-block;
  transition: transform .2s;
}

details[open] summary {
  margin-bottom: 1em;
}

details[open] summary::before {
  transform: rotate(90deg);
}

summary span {
  flex: 0 0 auto;
}

summary kbd {
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow-x: auto;
}

/* simulating hbar text on top of header */
h2 {
  position: relative;
  margin-top: 6em;
  margin-bottom: 3em;
  scroll-margin-top: 2em;
  text-transform: uppercase;
  /* nicer anchor behavior */
}

h2::before {
  content: "___" / "";
  position: absolute;
  font-weight: normal;
  /* in case im using bold header text */
  top: -1.6em;
  /* match line height */
}


/* bracketed links, used on homepage */
h2>span::before {
  content: "[" / "";
}

h2>span::after {
  content: "]" / "";
}

h2>span {
  font-weight: normal;
  /* in case im using bold header text */
  position: absolute;
  right: -1.5ch;
  /* compromise bt -2ch perfect symmetry without scrollbar (ie mobile) and -1ch symmetry with scrollbar taking up vw space (ie desktop) */
}

h2>span>a {
  /* treat anchor tag link as more of a UI element than text, and hopefully help parsers ignore these elements */
  user-select: none;
}

h3:before {
  content: ">>> ";
  font-weight: normal;
}

nav {
  display: inline-block;
  margin: 0;
  white-space: nowrap;
}

nav {
  margin-bottom: 2em;
}

nav:last-of-type {
  margin-bottom: 0;
}

nav span {
  white-space: nowrap;
}

nav::before {
  content: "[ " / "";
}

nav::after {
  content: " ]" / "";
}

nav>*:not(:first-child)::before {
  content: " | " / "";
}


.tags>span::before {
  content: "#" / "";
}

.tags>*:not(:last-child)::after {
  content: ", " / "";
}

h1 {
  display: none;
}

main {
  padding-top: 3em;
}

hgroup {
  margin-bottom: 0;
}

hgroup>h3 {
  margin: 0;
}

hgroup>p {
  margin-left: 4ch;
  margin-bottom: 0;
}

/* lists prefixed with dashes fitting monospace grid, instead of default browser dots */
ul {
  margin-left: 2ch;
  list-style-type: "- ";
}

li {
  text-align: left;
  margin-bottom: 1em;
  position: relative;
}

li>p {
  /* margin-left: 2ch; */
  margin-right: 1ch;
  margin-bottom: 1em;
}

/* blockquote example:
 *
 *  |  "So this is a quote
 *  |  and this vertical bar on
 *  |  the left will keep going"
 */
blockquote {
  margin-left: 1ch;
  padding-left: 4ch;
  position: relative;
  overflow: hidden;
}

blockquote:before {
  position: absolute;
  top: 0;
  left: 0;
  white-space: pre;
  content: "|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|" / "";
}

.footnote>a {
  scroll-margin-top: 1.8em;
}

.footnote::before {
  content: "[" / "";
}

.footnote::after {
  content: "]" / "";
}

.dinkus {
  margin-top: 3em;
  margin-bottom: 3em;
  width: 100%;
  text-align: center;
}

.dinkus:last-of-type {
  margin-top: 4.5em;
  margin-bottom: 66vh;
}

.dinkus::before {
  content: "~" / "";
}

code,
kbd,
pre {
  background-color: var(--bg-secondary-color);
  color: var(--text-color-on-secondary);
  font-family: 'iA Writer Mono', ui-monospace, monospace;
  overflow-x: auto;
  padding: 1em;
  border-radius: 3px;
}

code,
kbd {
  display: inline;
  white-space: nowrap;
  padding: 1px 0.5ch;
  border-radius: 3px;
}

code {
  background-color: var(--bg-color);
}

.long-line {
  /* If a long string is likely to exceed max-width (~35ch mobile), 
	 * use this class to stay single line and force scrolling on overflow.
	 *
	 * Note that this (display: block) will cause a line break before this element.
	 */
  display: block;
  overflow-x: auto;
  margin-bottom: 0;
}

.box-container .box-child:before,
.box-container .box-child:after {
  content: "|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A|\A" / "";
  white-space: pre;
  position: absolute;
  top: 0;
}

.box-container .box-child:before {
  left: 0;
}

.box-container .box-child:after {
  right: 0;
}

.box-container .box-child {
  position: relative;
  overflow: hidden;
  padding-left: 3ch;
  padding-right: 2ch;
  /* padding-top: 1.5em; */
  margin-bottom: 0;
}

.box-container>div:last-child,
.box-container>div:first-child {
  /* horizontal box lines */
  overflow: hidden;
  margin-left: 0ch;
  margin-right: 0ch;
  user-select: none;
  margin-bottom: 0;
  white-space: pre;
}

.dropcap {
  white-space: pre;
  float: left;
  margin-top: -1.5em;
  margin-right: 1ch;
  margin-bottom: 1.5em;
}

.visually-hidden {
  position: absolute;
  top: auto;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  width: 1px;
  height: 1px;
  white-space: nowrap;
}

br {
  margin-bottom: 0;
}

a:link {
  color: var(--link-color);
}

a:visited {
  color: var(--link-color);
}

a:hover {
  color: var(--link-color);
}

a:active {
  color: var(--link-color);
}

a:focus {
  outline-color: var(--outline-color);
}

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