* {
  box-sizing: border-box;
}

:root {
  font-family: system-ui, sans-serif;
  font-size: calc(1rem + 0.25vw);
  line-height: 1.6;
}
body {
  margin: 0;
  color: #222;
}
#content {
  margin: 2em 0;
}
#content > * {
  max-width: calc(min(50rem, 100%) - 2rem);
  margin-left: auto;
  margin-right: auto;
}
#content > canvas,
#content > video {
  display: block;
}
* {
  font-size: inherit;
}
hr {
  border: 1px solid black;
}

b,
strong {
  font-weight: 600;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 900;
}

@media print {
  * {
    font-size: 12pt;
  }

  .noprint {
    display: none;
  }

  a {
    color: inherit;
  }

  @page {
    margin: 20mm;
  }
}

/*
Known deficiency: text overflowing a code block does not have a background color.
Future fix: wrap code blocks in another wrapper, but this requires some JS/plugin work.
*/
code {
  background: #f5f5f5;
  font-size: 0.9em; /* default is huge */
}
#content pre {
  max-width: none;
  width: 100%;
  margin-right: 0;
  overflow-x: auto;
}
#content pre > code {
  display: block;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  max-width: calc(min(50rem, 100%));
  margin: 0 auto;
}
@media screen and (max-width: 60em) {
  #content pre {
    background-color: #f5f5f5;
  }
}

/*
  PrismJS theme.
  PrismJS idiotically doesn't have tokens for the main important things: named entities like variables.
  So instead of highlighting important things, we have to de-emphasize unimportant things.
  TODO: use a highlighter that actually parses the code, then use proper semantic highlighting.
*/
.token.punctuation,
.token.operator,
.token.keyword {
  color: #877;
}

#content > table {
  max-width: none;
  overflow-x: auto;
}

td,
th {
  text-align: left;
  padding-right: 1em;
  vertical-align: top;
}
th {
  font-weight: 600;
}

a:link,
a:visited {
  color: #119;
}
.no-link-underlines a:link {
  /* Links should look like links. But there are exceptions (like navigation) where context shows it's a link, and underlines become noise. */
  text-decoration: none;
}
.no-link-underlines a:hover {
  text-decoration: underline;
}

.jim_image {
  display: block;
  box-shadow: 2px 2px 10px #ccc;
}

blockquote {
  border-left: 2px solid black;
  margin-left: 0;
  padding-left: 1rem;
}

p > img,
p > a > img,
#content > video {
  border: 2px solid black;
  width: 100%;
}

.answer {
  border-color: #8ec58e;
  padding: 0 0.3rem;
  border-radius: 3px;
  border: 2px solid #8585d0;
}
.answer:not(.revealed) {
  color: rgba(0, 0, 0, 0);
  background-image: url(/assets/question-mark.svg);
  cursor: pointer;
}
.answer:not(.revealed) * {
  opacity: 0;
}

.aside {
  float: right;
  max-width: 400px;
  margin: 0 0 0 1em;
}

sup,
sub {
  font-size: 0.8em;
  vertical-align: baseline;
  position: relative;
  top: -0.4em;
}
sub {
  top: 0.4em;
}

small {
  font-size: smaller;
}

/* Bullet points should have normal bullets, but be flush with the text. */
ul {
  padding-inline-start: 16px;
}

.navbar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5em 1em;
  margin: 1em 0;
}
.navbar .navbar-item {
  text-align: center;
}

.posts {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1em;
}
.posts a.post {
  text-decoration: none;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.3em;
  padding: 0.5em 0;
  min-width: 15em;
  line-height: 1.3;
}
.posts a.post:hover .title {
  text-decoration: underline;
}
.post .title {
  font-weight: 600;
}
.post .date {
  opacity: 0.5;
}
.post .post-summary {
  font-size: 0.7em;
}

body.experiment-dont-show-link-summaries .post-summary {
  display: none;
}
