:root {
  --abs-blue: #1b67a5;
  --abs-green: #16a34a;
  --abs-beige: #f5e5c4;

  --body-background-color: white;
  --body-font-family: system-ui, sans-serif;
  --body-font-size: 20px;
  --body-font-weight: 400;
  --body-width: 40rem;

  --heading-font-family: system-ui, sans-serif;
  --heading-font-weight: 600;

  --text-color: #1f2938;
  --text-color-muted: #6b7280;

  --link-color: var(--text-color);
  --link-color-hover: var(--abs-green);

  --code-font: Menlo, Monaco, 'Courier New', monospace;
  --code-font-size: 0.875em;
  --code-background-color: #282c34;
  --code-color: #e7e9eb;
  --inline-code-background-color: #f3f4f6;

  --tag-font-family: var(--body-font-family);
  --tag-font-weight: 500;
  --tag-border-color: var(--text-color);
  --tag-color: var(--text-color);

  --border-color: #d1d5db80;
  --border-radius: 4px;
  --content-padding: 2rem;

  --post-font-family: Lora, system-ui, sans-serif;
  --post-font-weight: 400;

  --callout-background-color: #f3f4f6;
  --callout-text-color: var(--text-color);

  --search-overlay: #11182744;
  --search-background-color: white;
  --search-text-color: var(--text-color);
}

@media (prefers-color-scheme: dark) {
  :root {
    --abs-blue: #479ce1;
    --abs-green: #16a34a;
    --abs-beige: #4e390d;

    --body-background-color: #1a1d20;

    --text-color: #e8ecf2;
    --text-color-muted: #858b99;
    --inline-code-background-color: #292e32;

    --border-color: #3d464c80;

    --callout-background-color: var(--code-background-color);
    --callout-text-color: var(--code-text-color);

    --search-overlay: #ffffff1c;
    --search-background-color: #292b30;
    --search-text-color: var(--text-color);
  }
}

@media screen and (max-width: 1000px) {
  :root {
    --body-font-size: 16px;
    --content-padding: 1rem;
  }
}

/* Dark mode utils */
.prefers-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .prefers-light {
    display: none;
  }

  .prefers-dark {
    display: unset;
  }

  .invertable {
    filter: invert();
  }
}

* {
  box-sizing: border-box;
}

*:focus {
  outline-color: var(--abs-green);
}

html,
body {
  padding: 0;
  margin: 0;
  font-family: var(--body-font-family);
  font-size: var(--body-font-size);
  font-weight: var(--body-font-weight);
  color: var(--text-color);
  background-color: var(--body-background-color);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--heading-font-family);
  font-weight: var(--heading-font-weight);
}

a[href] {
  color: var(--link-color);
}

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

hr {
  border: none;
  border-top: solid 2px var(--text-color);
  margin: 4rem -2rem;
  transform: rotate(-2deg);
}

@media screen and (max-width: 1000px) {
  hr {
    margin: 3rem 0;
  }
}

main {
  max-width: var(--body-width);
  padding: var(--content-padding);
  margin: 0 auto;
}

main :first-child {
  margin-top: 0;
}

header {
  max-width: var(--body-width);
  margin: 0 auto;
}

header:after {
  content: '';
  display: table;
  clear: both;
}

table {
  margin: 2rem 0;
}

table td,
table th {
  padding-right: 1rem;
}

abbr {
  text-decoration-color: var(--text-color);
  text-decoration-style: dotted;
  text-underline-offset: 0.125rem;
  cursor: help;
}

aside {
  font-style: italic;
  border: solid 3px var(--border-color);
  border-radius: calc(var(--border-radius) * 2) 0 calc(var(--border-radius) * 2) 0;
  padding: 1rem;
  margin: 1rem 0;
}

blockquote {
  position: relative;
  border-left: solid 3px var(--text-color);
  font-size: 1.25rem;
  font-style: italic;
  padding: 0 0 0 1rem;
  margin: 2rem -1rem 2rem -1rem;
}

@media screen and (max-width: 1000px) {
  blockquote {
    margin: 1rem 0 1rem 0;
  }
}

::selection {
  background-color: var(--abs-green);
  color: white;
}

/* Header */
header {
  text-align: center;
  padding-top: 1rem;
}

.header-link {
  display: inline-block;
  padding: 0 1rem;
  margin: 1rem 0;
}

.header-link :link:not(:hover) {
  text-decoration: none;
}

.wordmark {
  width: 460px;
  height: 211px;
  margin: 0 auto;
}

@media screen and (max-width: 1000px) {
  .wordmark {
    width: 300px;
    height: 139px;
  }
}

/* Nav */
.nav {
  display: block;
  font-family: var(--body-font-family);
  text-align: center;
  padding: calc(var(--content-padding) / 2) var(--content-padding);
  margin-bottom: 1rem;
}

.nav-item {
  display: inline-block;
  margin-right: 2.5rem;
}

.nav-item svg {
  width: 1em;
  height: 1em;
}

.nav-item:last-of-type {
  margin-right: 0;
}

.nav-item[href]:not(:hover) {
  text-decoration: none;
}

.nav-item-active {
  font-weight: 700;
  text-decoration: underline;
}

@media screen and (max-width: 1000px) {
  .nav {
    padding: 0.5rem;
  }

  .nav-item {
    margin-right: 1.25rem;
  }
}

/* Post previews */
.post-roll-item {
  margin-bottom: 4rem;
}

.post-roll-item-title {
  margin-bottom: 0.25rem;
}

.post-roll-item-date {
  display: block;
  font-family: var(--body-font-family);
  font-size: 0.875rem;
  font-style: italic;
  font-weight: 300;
  color: var(--text-color-muted);
  margin: 1rem 0 0.75rem 0;
}

.post-roll-item-tags {
  margin-top: 0.5rem;
}

.content .post-roll-item img,
.content .post-roll-item .video {
  margin: 1rem 0;
}

/* Post list */
.post-list-item {
  margin-bottom: 0.5rem;
}

.post-list-item-title {
  margin-bottom: 0.25rem;
}

.post-list-item-date {
  font-family: var(--body-font-family);
  font-size: 0.875rem;
  font-style: italic;
  font-weight: 300;
  color: var(--text-color-muted);
  white-space: nowrap;
}

/* Posts */
.post hr {
  position: relative;
  border: none;
  transform: none;
}

.post hr::after {
  position: relative;
  content: '···';
  top: 0;
  left: calc(50% - 1.33em);
  letter-spacing: 1em;
}

/* Tags */
.post-tag {
  display: inline-block;
  vertical-align: text-top;
  text-transform: uppercase;
  font-family: var(--tag-font-family);
  font-size: 0.75rem;
  font-weight: var(--tag-font-weight);
  line-height: 1;
  padding: 0.15rem 0.25rem;
  border: solid 2px var(--tag-border-color);
  color: var(--tag-color);
  border-radius: var(--border-radius) 0 var(--border-radius) 0;
  text-decoration: none;
  transition: 0.1s all ease;
}

.post-tag[href]:hover {
  background-color: var(--link-color-hover);
  border-color: var(--link-color-hover);
  color: white;
}

.post-tag[href]:focus {
  border-color: var(--link-color-hover);
}

.post-tag:not(:last-of-type) {
  margin-right: 0.25rem;
}

.post-tag-large {
  font-size: 1rem;
  padding: 0.5rem 1rem;
}

.tag-browser {
  line-height: 2.25;
}

/* Warning */
.warning {
  background-color: #ffc;
  padding: 1rem 0.625em;
}

.warning ol:only-child {
  margin: 0;
}

/* Direct Links / Markdown Headers */
.direct-link {
  font-family: sans-serif;
  text-decoration: none;
  font-style: normal;
  margin-left: 0.25rem;
}

a[href].direct-link,
a[href].direct-link:visited {
  color: transparent;
}

a[href].direct-link:focus,
a[href].direct-link:focus:visited,
:hover > a[href].direct-link,
:hover > a[href].direct-link:visited {
  color: var(--text-color);
}

/* Post nav (prev/next) */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 2rem;
  line-height: 1.4;
  margin: 2rem -2rem;
}

@media screen and (max-width: 1000px) {
  .post-nav {
    grid-template-columns: 1fr;
    grid-gap: 1rem;
    margin: 1rem;
  }

  .post-nav a:last-child {
    grid-row: 1;
  }
}

.post-nav a {
  display: block;
  font-family: var(--body-font-family);
  font-weight: 600;
  text-decoration: none;
  border: solid 2px var(--text-color);
  border-radius: var(--border-radius);
  padding: 1rem;
}

.post-nav small {
  display: block;
  font-size: 0.875rem;
  font-weight: 300;
  margin-bottom: 0.5rem;
}

/* Post tags */
.post-template .tags {
  margin-top: 2rem;
}

/* Content */
.content {
  font-family: var(--post-font-family);
  font-size: var(--post-font-size);
  font-weight: var(--post-font-weight);
}

.content h1 {
  font-size: 2rem;
  line-height: 1.25;
}

.content h2,
.content h3,
.content h4,
.content h5,
.content h6 {
  line-height: 1.25;
  margin: 1.5rem 0 0.5rem 0;
}

.content ul,
.content ol,
.content p {
  line-height: 1.8;
}

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

.content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  margin: 3rem auto;
}

.content iframe[src^="https://www.youtube.com/embed/"]
{
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 9;
  margin: 1rem 0;
}

.content .post-date {
  font-family: var(--body-font-family);
  font-size: 0.875rem;
  font-style: italic;
  font-weight: 300;
  color: var(--text-color-muted);
}

.content mark {
  background-color: var(--abs-beige);
  border-radius: 0.5em 0;
  padding: 0.125rem 0.25rem;
}

.content kbd {
  font-family: var(--code-font);
  font-size: var(--code-font-size);
  border: solid 1px currentColor;
  border-radius: var(--border-radius);
  padding: 0.125rem 0.25rem;
}

.content .starred::before {
  content: '★';
  position: absolute;
  margin-left: -1.33em;
}

@media screen and (max-width: 1000px) {
  .content .starred {
    margin-left: 1.33em;
  }
}

.content details {
  border: solid 2px var(--border-color);
  border-radius: var(--border-radius);
  padding: 1rem 1rem 1rem 1rem;
}

.content details summary {
  padding: 1rem;
  margin: -1rem;
  cursor: pointer;
}

.content details[open] summary {
  border-bottom: solid 2px var(--border-color);
  padding: 1rem;
  margin-bottom: 1rem;
}

/* Embedded videos */
.content .video {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  max-width: 100%;
  margin: 3rem auto;
}

.content .video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--border-radius);
}

/* Tables */
.content table {
  width: 750px;
  border-collapse: collapse;
  margin: 50px auto;
}

.content tr:nth-of-type(even) {
  background: #f9fafb;
}

.content th {
  background: #f9fafb;
  font-weight: bold;
}

.content td,
.content th {
  padding: 10px;
  text-align: left;
  font-size: 18px;
}

/* Avatars */
.content .avatar {
  max-width: 256px;
  max-height: 256px;
  border-radius: var(--border-radius);
  float: right;
  margin: 0 0 0 2rem;
}

.content .avatar-small {
  max-width: 128px;
  max-height: 128px;
}

@media screen and (max-width: 1000px) {
  .content .avatar {
    max-width: 128px;
    max-height: 128px;
  }

  .content .avatar-small {
    max-width: 64px;
    max-height: 64px;
  }
}

.legacy-warning {
  position: relative;
  background-color: var(--callout-background-color);
  border-top-right-radius: var(--border-radius);
  border-bottom-right-radius: var(--border-radius);
  border-left: solid 3px currentColor;
  font-style: italic;
  color: var(--callout-text-color);
  padding: 1rem 8em 1rem 1rem;
  margin: 1.5rem 0;
}

.legacy-warning img {
  position: absolute;
  top: calc(50% - 80px);
  right: 1.75rem;
  height: 160px;
  margin: 0;
}

.legacy-warning p:first-of-type {
  margin-top: 0;
}

.legacy-warning p:last-of-type {
  margin-bottom: 0;
}

@media screen and (max-width: 1000px) {
  .legacy-warning {
    padding: 1rem;
  }

  .legacy-warning img {
    display: block;
    position: static;
    margin: 0 auto 1rem auto;
  }
}

/* One offs */
.artwork-on-the-mountain {
  width: auto;
  max-height: 300px;
  float: right;
  margin-left: 2rem;
}

@media screen and (max-width: 1000px) {
  .artwork-on-the-mountain {
    float: none;
    margin: 2rem auto;
  }
}

/* Site search */
.site-search {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--search-overlay);
}

.site-search[hidden] {
  display: none;
}

.site-search-panel {
  display: flex;
  flex-direction: column;
  max-width: 560px;
  max-height: calc(100vh - 10rem);
  background-color: var(--search-background-color);
  border-radius: var(--border-radius);
  border: none;
  margin: 8rem auto;
  overflow: hidden;
}

@media screen and (max-width: 1000px) {
  .site-search-panel {
    max-width: 100%;
    max-height: 40vh;
    margin: 2vh 1em;
  }
}

.site-search-header {
  flex: 0 0 auto;
  background: var(--search-background-color);
  padding: 0;
  margin: 0;
}

.site-search-body {
  flex: 1 1 auto;
  overflow: auto;
}

.site-search input {
  display: block;
  width: 100%;
  background: var(--search-background-color);
  border: none;
  border-radius: var(--border-radius);
  font: inherit;
  font-size: 1.4rem;
  color: var(--search-text-color);
  padding: 1rem;
  margin: 0;
  -webkit-appearance: none;
}

.site-search input:focus {
  outline: none;
}

.site-search.site-search-has-results input {
  border-bottom: solid 2px var(--border-color);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.site-search-results {
  display: none;
  line-height: 1.6;
  padding: 1.5rem;
  margin: 0;
}

.site-search-has-results .site-search-results {
  display: block;
}

.site-search-results li {
  margin-left: 1rem;
}

.site-search-results li:not(:last-of-type) {
  margin-bottom: 1rem;
}

body.search-visible {
  overflow: hidden;
}

/* Code blocks and inline code */
code {
  white-space: nowrap;
}

pre,
code {
  font-family: var(--code-font);
  font-size: var(--code-font-size);
}

pre,
code[class*='language-'] {
  background: var(--code-background-color);
  border-radius: 0.125rem;
  color: var(--code-color);
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.6;
  tab-size: 2;
  -webkit-hyphens: none;
  -moz-hyphens: none;
  -ms-hyphens: none;
  hyphens: none;
}

pre[class*='language-']::selection,
pre[class*='language-'] ::selection,
code[class*='language-']::selection,
code[class*='language-'] ::selection {
  background: #575f70;
}

pre {
  padding: 1.5rem;
  margin: 1.5rem 0;
  overflow: auto;
}

@media screen and (max-width: 1000px) {
  pre {
    padding: 1rem;
  }
}

:not(pre) > code {
  background-color: var(--inline-code-background-color);
  border-radius: 0.5em 0;
  padding: 0.125rem 0.25rem;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #6f7584;
}

.token.punctuation {
  color: #abb2bf;
}

.token.selector,
.token.tag {
  color: #e06c75;
}

.token.property,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.attr-name,
.token.deleted {
  color: #d19a66;
}

.token.string,
.token.char,
.token.attr-value,
.token.builtin,
.token.inserted {
  color: #98c379;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
  color: #56b6c2;
}

.token.atrule,
.token.keyword {
  color: #c678dd;
}

.token.function {
  color: #61afef;
}

.token.regex,
.token.important,
.token.variable {
  color: #c678dd;
}

.token.important,
.token.bold {
  font-weight: bold;
}

.token.italic {
  font-style: italic;
}

.token.entity {
  cursor: help;
}

pre.line-numbers {
  position: relative;
  padding-left: 3.8rem;
  counter-reset: linenumber;
}

pre.line-numbers > code {
  position: relative;
}

.line-numbers .line-numbers-rows {
  position: absolute;
  pointer-events: none;
  top: 0;
  font-size: 100%;
  left: -3.8rem;
  width: 3rem;
  letter-spacing: -1px;
  border-right: 0;
  user-select: none;
}

.line-numbers-rows > span {
  pointer-events: none;
  display: block;
  counter-increment: linenumber;
}

.line-numbers-rows > span:before {
  content: counter(linenumber);
  color: #5c6370;
  display: block;
  padding-right: 0.8rem;
  text-align: right;
}
