:root {
  --font-family: "IBM Plex Mono", "JetBrains Mono", Menlo, Monaco, "Courier New", monospace;
  --line-height: 1.6rem;
  --border-thickness: 2px;
  --text-color: #000;
  --text-color-alt: #666;
  --background-color: #fff;
  --background-color-alt: #eee;
  --sidebar-color: #202020;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-bold: 700;

  font-family: var(--font-family);
  font-optical-sizing: auto;
  font-weight: var(--font-weight-normal);
  font-style: normal;
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #fff;
    --text-color-alt: #aaa;
    --background-color: #000;
    --background-color-alt: #111;
    --sidebar-color: #111;
  }
}

* {
  box-sizing: border-box;
}

* + * {
  margin-top: var(--line-height);
}

html {
  display: flex;
  width: 100%;
  margin: 0;
  padding: 0;
  flex-direction: column;
  align-items: center;
  background: var(--background-color);
  color: var(--text-color);
  font-family: var(--font-family);
  font-size: 16px;
  line-height: var(--line-height);
}

body {
  position: relative;
  width: 100%;
  margin: 0;
  padding: 0;
  line-height: var(--line-height);
  overflow-x: hidden;
  background: var(--background-color);
  color: var(--text-color);
}

.container {
  max-width: calc(min(90ch, round(down, 100%, 1ch)));
  margin: 0 auto;
  padding: var(--line-height) 2ch;
}

@media screen and (max-width: 480px) {
  .container {
    padding: var(--line-height) 1ch;
  }
}

@media screen and (max-width: 480px) {
  :root {
    font-size: 14px;
  }
}

/* Header */
.header {
  margin-bottom: calc(var(--line-height) * 2);
  width: 100%;
}

.header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: var(--font-weight-bold);
  line-height: calc(2 * var(--line-height));
}

.header h1 a {
  color: var(--text-color);
  text-decoration: none;
}

.header h1 a:hover {
  text-decoration: underline;
}

.header-content {
  vertical-align: top;
  padding-right: 2ch;
}

.header-description {
  color: var(--text-color-alt);
  font-size: 1rem;
  line-height: var(--line-height);
  font-weight: var(--font-weight-normal);
  vertical-align: top;
  padding-right: 2ch;
}

.header-nav {
  text-align: center;
  vertical-align: middle;
  width: 8ch;
}

.header-nav .nav-item {
  color: var(--text-color);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
}

.header-nav .nav-item:hover {
  text-decoration: underline;
}

.header-nav-spacer {
  text-align: center;
  vertical-align: middle;
}

/* Content */
.content {
  margin: 0;
  padding: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  margin: calc(var(--line-height) * 2) 0 var(--line-height);
  line-height: var(--line-height);
  color: var(--text-color);
}

.post h1 {
  margin-bottom: 0;
}

h1 {
  font-size: 2rem;
  line-height: calc(2 * var(--line-height));
  margin-bottom: calc(var(--line-height) * 2);
  text-transform: uppercase;
}

h2 {
  font-size: 1rem;
  text-transform: uppercase;
  margin-top: calc(var(--line-height) * 2);
}

h3 {
  font-size: 1rem;
  margin-top: calc(var(--line-height) * 1.5);
}

h4, h5, h6 {
  font-size: 1rem;
  margin-top: var(--line-height);
}

p {
  margin-bottom: var(--line-height);
  word-break: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

/* Improve spacing between elements */
p + p {
  margin-top: var(--line-height);
}

strong {
  font-weight: var(--font-weight-bold);
}

em {
  font-style: italic;
}

a {
  color: var(--text-color);
  text-decoration-thickness: var(--border-thickness);
}

a:hover,
a:focus {
  text-decoration: underline;
}

/* Code */
pre, code {
  font-family: var(--font-family);
}

code {
  font-weight: var(--font-weight-bold);
  background-color: var(--background-color-alt);
  padding: 0.08em 0.25em;
  border-radius: 0;
}

pre {
  white-space: pre;
  overflow-x: auto;
  margin: var(--line-height) 0;
  overflow-y: hidden;
  background-color: var(--background-color-alt);
  padding: var(--line-height) 1ch;
}

pre code {
  background-color: transparent;
  padding: 0;
}

/* Lists */
ul, ol {
  padding: 0;
  margin: 0 0 var(--line-height);
}

ul {
  list-style-type: square;
  padding: 0 0 0 2ch;
}

ol {
  list-style-type: none;
  counter-reset: item;
  padding: 0 0 0 3ch;
}

ol li {
  position: relative;
}

ol li:before { 
  content: counters(item, ".") ". ";
  counter-increment: item;
  font-weight: var(--font-weight-medium);
  position: absolute;
  left: -3ch;
}

li {
  margin: 0;
  padding: 0;
}

li::marker {
  line-height: 0;
}

/* Tables */
table {
  position: relative;
  width: calc(round(down, 100%, 1ch));
  border-collapse: collapse;
  margin: 0 0 calc(var(--line-height) * 2);
  border: var(--border-thickness) solid var(--text-color);
}

th, td {
  border: var(--border-thickness) solid var(--text-color);
  padding: 
    calc((var(--line-height) / 2))
    calc(1ch - var(--border-thickness) / 2)
    calc((var(--line-height) / 2) - (var(--border-thickness)))
  ;
  line-height: var(--line-height);
  vertical-align: top;
  text-align: left;
}

th {
  font-weight: var(--font-weight-bold);
}

/* Horizontal rule */
hr {
  position: relative;
  display: block;
  height: var(--line-height);
  margin: calc(var(--line-height) * 1.5) 0;
  border: none;
  color: var(--text-color);
}

hr:after {
  display: block;
  content: "";
  position: absolute;
  top: calc(var(--line-height) / 2 - var(--border-thickness));
  left: 0;
  width: 100%;
  border-top: calc(var(--border-thickness) * 3) double var(--text-color);
  height: 0;
}

/* Images */
img {
  display: block;
  width: 100%;
  max-width: 100%;
  object-fit: contain;
  overflow: hidden;
  font-style: italic;
  color: var(--text-color-alt);
  margin: var(--line-height) 0;
}

/* Blockquotes */
blockquote {
  border-left: calc(var(--border-thickness) * 2) solid var(--text-color);
  padding: 0 0 0 2ch;
  margin: var(--line-height) 0;
  color: var(--text-color-alt);
}

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

/* Posts */
.post {
  margin-bottom: calc(var(--line-height) * 2);
}

.post-title {
  margin-top: 0;
  margin-bottom: 0;
}

.post-title a {
  color: var(--text-color);
}

.post-date {
  display: block;
  margin-top: calc(var(--line-height) / 8);
  margin-bottom: var(--line-height);
  color: var(--text-color-alt);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
}

.read-more-link {
  margin-top: calc(var(--line-height) / 2);
}

/* Page */
.page {
  margin-bottom: calc(var(--line-height) * 3);
}

.page-title {
  margin-top: 0;
  margin-bottom: var(--line-height);
}


