@font-face {
  font-family: "Atkinson Hyperlegible";
  src:
    url("/fonts/Atkinson-Hyperlegible-Regular-102a.woff2") format("woff2"),
    url("/fonts/Atkinson-Hyperlegible-Regular-102.woff") format("woff");
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src:
    url("/fonts/Atkinson-Hyperlegible-Bold-102a.woff2") format("woff2"),
    url("/fonts/Atkinson-Hyperlegible-Bold-102.woff") format("woff");
  font-weight: bold;
  font-style: normal;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src:
    url("/fonts/Atkinson-Hyperlegible-Italic-102a.woff2") format("woff2"),
    url("/fonts/Atkinson-Hyperlegible-Italic-102.woff") format("woff");
  font-weight: normal;
  font-style: italic;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src:
    url("/fonts/Atkinson-Hyperlegible-BoldItalic-102a.woff2") format("woff2"),
    url("/fonts/Atkinson-Hyperlegible-BoldItalic-102.woff") format("woff");
  font-weight: bold;
  font-style: italic;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: bold;
  font-style: normal;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Italic.woff2") format("woff2");
  font-weight: normal;
  font-style: italic;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-BoldItalic.woff2") format("woff2");
  font-weight: bold;
  font-style: italic;
}

:root {
  /* Colors. */
  --blue-2: #a5d8ff;
  --blue-4: #4dabf7;
  --blue-5: #339af0;
  --blue-7: #1c7ed6;
  --grape-2: #eebefa;
  --grape-4: #da77f2;
  --grape-5: #cc5de8;
  --gray-0: #f8f9fa;
  --gray-1: #f1f3f5;
  --gray-2: #e9ecef;
  --gray-3: #dee2e6;
  --gray-8: #343a40;
  --gray-9: #212529;
  --green-5: #51cf66;
  --green-7: #37b24d;
  --orange-7: #f76707;

  /* Font settings. */
  --font-family: Atkinson Hyperlegible, sans-serif;
  --code-font-family: JetBrains Mono, monospace;
  --headings-font-family: Charter, serif;
  --font-size: 18px;
  --code-font-size: 16px;

  --border-width: 3px;

  --line-spacing: 1.5;

  --max-width: 40rem;

  --spacing-small: 0.25rem;
  --spacing-medium: 1rem;
  --spacing-large: 2rem;
  --spacing-xlarge: 3rem;
  --spacing-2xl: 4rem;
  --spacing-3xl: 5rem;
  --spacing-4xl: 6rem;
  --spacing-5xl: 7rem;
}

html {
  font-family: var(--font-family);
  font-size: var(--font-size);
  line-height: var(--line-spacing);
  background: var(--gray-9);
  color: var(--gray-0);
}

body {
  margin: 0;
  padding: 0;
}

body main {
  padding: var(--spacing-medium);
  max-width: var(--max-width);
  margin: auto;
}

header,
footer {
  background-color: var(--gray-8);
  text-align: center;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

header {
  padding: var(--spacing-small) var(--spacing-medium);
}

footer {
  padding: var(--spacing-large);
  margin-top: var(--spacing-2xl);
}

header nav ul {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--spacing-medium);
  list-style: none;
}

a {
  color: var(--blue-4);
  &:hover {
    color: var(--blue-2);
    text-decoration: none;
  }
  &:visited {
    color: var(--grape-4);
  }
  &:visited:hover {
    color: var(--grape-2);
  }

  &[href^="http://"]::after,
	&[href^="https://"]::after
  {
    content: "\00a0⎋";
  }
}

p {
  font-size: 1rem;
}

h6 {
  font-size: 1rem;
}

h5 {
  font-size: 1.25rem;
  code {
    font-size: calc(1.25 * var(--code-font-size));
  }
}

h4 {
  font-size: 1.5rem;
  code {
    font-size: calc(1.5 * var(--code-font-size));
  }
}

h3 {
  font-size: 1.75rem;
  code {
    font-size: calc(1.75 * var(--code-font-size));
  }
}

h2 {
  font-size: 2.25rem;
  code {
    font-size: calc(2.25 * var(--code-font-size));
  }
}

h1 {
  font-size: 3rem;
  code {
    font-size: calc(3 * var(--code-font-size));
  }
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin-block-start: var(--spacing-2xl);
  margin-block-end: var(--spacing-large);
}

h1,
h2,
h3,
h4,
h5,
h6,
caption,
figcaption {
  font-family: var(--headings-font-family);
  text-wrap: balance;
}

p,
ul,
ol,
blockquote {
  text-wrap: pretty;
}

pre {
  padding: var(--spacing-medium);
  border-width: var(--border-width);
}

pre code {
  border: none;
}

code:not(pre code) {
  border-width: 1px;
  color: var(--green-7);
  padding: 0 var(--spacing-small);
}

pre,
code {
  font-family: var(--code-font-family);
  font-size: var(--code-font-size);
  background-color: var(--gray-8);
  border-style: solid;
  border-color: var(--green-7);
  border-radius: var(--spacing-small);
}

blockquote {
  border-inline-start: 5px solid var(--green-7);
  padding: var(--spacing-small) var(--spacing-medium);
  font-family: var(--headings-font-family);

  p:first-child {
    margin-block-start: 0;
  }

  cite {
    font-style: italic;
    margin-top: var(--spacing-medium);
    a {
      overflow-wrap: anywhere;
    }
  }
}

table {
  border-spacing: 0;

  td,
  th {
    padding: var(--spacing-small);
    border: 1px solid var(--blue-7);
  }

  thead {
    /* FIXME: Allow horizontal scrolling on mobile. */
    background-color: var(--blue-7);
    position: sticky;
    top: 0;
  }

  thead th:first-child {
    border-top-left-radius: var(--spacing-small);
  }

  thead th:last-child {
    border-top-right-radius: var(--spacing-small);
  }

  tr:last-child td:first-child {
    border-bottom-left-radius: var(--spacing-small);
  }

  tr:last-child td:last-child {
    border-bottom-right-radius: var(--spacing-small);
  }
}

img {
  max-width: min(98%, var(--max-width));
  margin: var(--spacing-medium) 0;
}

hr {
  margin: var(--spacing-large) 0;

  &.dots {
    background: none;
    border: none;

    &::before {
      content: "···";
      font-size: 2rem;
      letter-spacing: var(--spacing-large);
    }
  }
}

.site-title {
  display: flex;
  flex-direction: row;
  gap: var(--spacing-medium);
  align-items: center;
  flex-grow: 1;
  padding: var(--spacing-small);

  h1 {
    font-size: 2rem;
    @media (min-width: 760px) {
      font-size: 3rem;
    }
    margin: 0;
  }

  a,
  a:visited {
    color: var(--gray-0);
    text-decoration: none;
  }

  a:hover {
    color: var(--gray-3);
    text-decoration: underline;
  }

  img {
    max-width: 100px;
    border-radius: var(--spacing-small);
  }
}

.notice {
  border-style: solid;
  border-width: var(--border-width);
  border-radius: var(--spacing-small);
  margin: var(--spacing-medium) 0;

  & > p:empty {
    display: none;
  }

  .title {
    margin: 0;
    font-weight: bold;

    p {
      margin: 0;
    }
  }

  & > *:not(pre) {
    padding: var(--spacing-small) var(--spacing-medium);
  }
  & > pre {
    margin: var(--spacing-small) var(--spacing-medium);
  }

  &.info {
    border-color: var(--blue-7);
    .title {
      background-color: var(--blue-7);
    }
  }

  &.warning {
    border-color: var(--orange-7);
    .title {
      background-color: var(--orange-7);
    }
  }
}

.about {
  border-bottom: 3px dashed var(--gray-0);
  /* border-radius: var(--spacing-small); */
  padding: var(--spacing-large);
  margin: 1rem 0;

  img {
    border-radius: 100%;
    max-width: 200px;
  }
}

.post-list {
  list-style: none;
  padding-inline-start: 0;

  li {
    display: flex;
    gap: var(--spacing-medium);
  }
}

.post-title {
  margin-block-end: var(--spacing-large);
  border-bottom: 3px dashed var(--gray-0);
  text-align: center;
}

.row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
}

.large {
  font-size: 2rem;
}

.medium {
  font-size: 1.5rem;
}

.center {
  text-align: center;
}
.right {
  text-align: right;
}

.no-border {
  border: none;
}

#content {
  padding: 0;
}
