/* Self-hosted fonts */
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/Inter.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/Inter-Italic.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("/static/fonts/SpaceGrotesk.woff2") format("woff2-variations");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/JetBrainsMono.woff2") format("woff2-variations");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --surface: #000;
  --surface-raised: #141414;
  --underline: #555;
  --muted: #888;
  --text: #ccc;
  --highlight: #fff;
  --font-sans: "Inter", sans-serif;
  --font-heading: "Space Grotesk", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --line-height: 1.5;
  --space: 1.5rem;
  --content-width: 40rem;
}

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

html {
  min-height: 100%;
  background: var(--surface);
  color: var(--text);
  font: 400 1rem / var(--line-height) var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

/* scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface-raised) transparent;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--surface);
}
::-webkit-scrollbar-thumb {
  background: var(--surface-raised);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--underline);
}
::-webkit-scrollbar-corner {
  background: var(--surface);
}

/* headings */
h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--highlight);
  line-height: 1.25;
}
h1 {
  font-size: 1.75rem;
  margin-block: calc(var(--space) * 2) var(--space);
}
h2 {
  font-size: 1.375rem;
  margin-block: calc(var(--space) * 1.5) calc(var(--space) * 0.75);
}
h3 {
  font-size: 1.125rem;
  margin-block: var(--space) calc(var(--space) * 0.5);
}

/* prose */
p {
  font-family: var(--font-sans);
  margin-block: var(--space);
}
strong {
  color: var(--highlight);
}
a {
  font-weight: 450;
  color: var(--highlight);
  text-underline-offset: 2px;
  text-decoration: underline;
  text-decoration-color: var(--underline);
}
a:hover {
  text-decoration: underline;
}

/* code */
code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--surface-raised);
  color: var(--highlight);
  padding: 0.1rem 0.3rem;
}
pre {
  background: var(--surface-raised);
  margin-block: var(--space);
  padding: 1rem;
  overflow-x: auto;
  line-height: 1;
}
pre code {
  background: none;
  padding: 0;
  color: var(--text);
}

/* lists */
ul,
ol {
  padding-left: 1.5em;
  margin-block: var(--space);
}
li + li {
  margin-top: 0.25em;
}
li > ul,
li > ol {
  margin-block: 0.25em 0;
}

/* misc */
blockquote {
  color: var(--muted);
}
blockquote code {
  color: var(--muted);
}
blockquote ul,
blockquote ol {
  list-style: none;
  padding-left: 0;
}
hr {
  border: none;
  border-top: 1px solid var(--surface-raised);
  margin-block: var(--space);
}
img {
  display: block;
  max-width: 100%;
  outline: 1px solid var(--surface-raised);
  image-rendering: pixelated;
}
article > :first-child {
  margin-top: 0;
}
article > :last-child {
  margin-bottom: 0;
}

/* tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-block: var(--space);
  font-variant-numeric: tabular-nums;
  table-layout: fixed;
}
th,
td {
  padding: 0.5rem 1rem 0.5rem 0;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--surface-raised);
}
th {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--highlight);
}
tr:last-child td {
  border-bottom: none;
}

/* anchor links for linkable blocks */
:is(p, blockquote, pre)[id],
.linkable-block {
  position: relative;
}
.anchor-link {
  position: absolute;
  right: 100%;
  top: 0;
  padding-right: 0.4rem;
  opacity: 0;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.85em;
  font-weight: 400;
  line-height: var(--line-height);
  user-select: none;
}
:is(p, blockquote, pre)[id]:hover > .anchor-link,
.linkable-block:hover > .anchor-link {
  opacity: 0.6;
}
.anchor-link:hover {
  opacity: 1 !important;
  color: var(--highlight);
}

/* layout */
.layout {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100dvh;
  padding: 4rem 2rem;
}
.col-left,
.col-right {
  flex: 1;
  min-width: 0;
}
.col-left {
  display: flex;
  justify-content: flex-end;
}
aside {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 8rem;
  background-color: var(--surface);
}
.brand {
  display: block;
  font-weight: 700;
  margin-bottom: 2rem;
  text-decoration: none;
  color: var(--highlight);
}
.browse {
  font-size: 0.875rem;
}
aside nav {
  display: flex;
  flex-direction: column;
}
aside nav a {
  text-decoration: none;
  color: var(--muted);
}
aside nav a:hover,
aside nav a.active {
  color: var(--highlight);
}
aside nav a.active {
  font-weight: 500;
}
main {
  width: 100%;
  max-width: var(--content-width);
}
.content-wrapper {
  display: contents;
}
.mobile-bar {
  display: none;
}
@media (width < 1024px) {
  aside {
    display: none;
  }
  main {
    padding-bottom: 4rem;
  }
  .mobile-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background-color: var(--surface);
    border-top: 1px solid #222;
    z-index: 100;
  }
  .mobile-bar .brand {
    margin-bottom: 0;
  }
}
