/* Styles for posts using the distill layout (_layouts/distill.html).
   main.css still styles the site header and footer. */

body.distill-page {
  background-color: #fff;
}

/* Distill sets its own fonts on these elements; use the site's Google Sans. */
d-title,
d-byline,
d-article,
d-appendix {
  font-family: "Google Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
}

d-article strong,
d-article b,
d-appendix strong,
d-appendix b {
  font-weight: 700;
}

d-byline a,
d-byline a:visited {
  color: inherit;
}

d-article a,
d-article a:visited,
d-appendix a,
d-appendix a:visited {
  color: #2a7ae2;
}

d-article a:hover {
  color: #25316f;
  text-decoration: none;
}

/* Title block */

d-title {
  padding-top: 2.5rem !important;
  padding-bottom: 1.5rem !important;
}

d-title .post-topic {
  grid-column: text;
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #25316f;
}

d-title h1 {
  font-size: 2.6rem;
  line-height: 1.15;
  margin-bottom: 0.8rem;
}

d-title .post-subtitle {
  grid-column: text;
  font-size: 1.15rem;
  line-height: 1.55;
  color: rgba(0, 0, 0, 0.65);
}

d-title .post-links {
  grid-column: text;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.2rem;
}

d-title .post-links a,
d-title .post-links a:visited {
  display: inline-block;
  padding: 0.25rem 0.85rem;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 999px;
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.8);
  text-decoration: none;
}

d-title .post-links a:hover {
  border-color: #25316f;
  color: #25316f;
  text-decoration: none;
}

/* Table of contents */

d-article .post-toc {
  grid-column: text;
  margin-bottom: 2rem;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.6;
}

d-article .post-toc h3 {
  margin: 0 0 0.5rem;
  padding: 0;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.55);
  border: none;
}

d-article .post-toc ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

d-article .post-toc ul ul {
  padding-left: 1.1rem;
}

d-article .post-toc li {
  margin: 0.15rem 0;
}

d-article .post-toc a,
d-article .post-toc a:visited {
  color: rgba(0, 0, 0, 0.75);
  border-bottom: none;
}

/* Figures */

d-article figure {
  margin: 1.5rem 0 2rem;
}

d-article figure img {
  display: block;
  max-width: 100%;
  margin: 0 auto;
}

d-article figcaption {
  margin-top: 0.6rem;
  text-align: center;
  color: rgba(0, 0, 0, 0.6);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Small inline images (e.g. equations rendered as images). */
d-article img.inline-eq {
  display: inline;
  vertical-align: middle;
}

/* Code */

d-article div.highlighter-rouge,
d-article pre {
  grid-column: text;
}

d-article pre {
  margin: 0 0 1.5rem;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  background-color: #f6f8fa;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.55;
}

d-article pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

/* Math */

d-article mjx-container[display="true"] {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.2rem 0;
}

/* Callout used for summaries and TL;DRs */

d-article blockquote {
  margin: 0 0 1.5rem;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 3px solid #25316f;
  color: rgba(0, 0, 0, 0.75);
}

/* Appendix */

d-appendix pre.citation {
  grid-column: text;
  margin: 0 0 1.5rem;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  background-color: #f6f8fa;
  border-radius: 6px;
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* The site footer sits after the appendix; give it a little room. */
body.distill-page .site-footer {
  margin-top: 0;
}

@media (max-width: 768px) {
  d-title h1 {
    font-size: 2rem;
  }
}

/* Equation images placed inside list items. */
d-article img.list-eq {
  display: block;
  width: 65%;
  max-width: 100%;
  margin: 0.4rem auto 0.8rem;
}

/* Captions under display equations. */
d-article .eq-caption {
  margin-top: -0.5rem;
  text-align: center;
  color: rgba(0, 0, 0, 0.6);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Markdown tables: scroll sideways on narrow screens instead of widening the page. */
d-article table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  margin: 0.5rem 0 1.5rem;
  border-collapse: collapse;
  font-size: 0.85rem;
  line-height: 1.5;
}

d-article table th,
d-article table td {
  padding: 0.4rem 0.75rem 0.4rem 0;
  vertical-align: top;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

d-article table thead th {
  font-weight: 600;
  border-bottom: 1px solid rgba(0, 0, 0, 0.3);
}

/* Footnotes from Markdown [^notes]. */
d-article .footnotes {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.7);
}

d-article .footnotes ol {
  padding-left: 1.2rem;
}

/* Tables marked {: .l-page} use the wider page column. */
d-article table.l-page {
  grid-column: page;
}
