/* The baskingspot palette (baskingspot/.github, brand/README.md). Heat is an
   accent, not a text color: it is 4.1:1 on paper and 3.9:1 on ink, under the
   4.5:1 that text needs, and a page of orange links is loud. Links take the
   text color and carry heat in the underline and on hover. */
:root {
  color-scheme: light dark;
  --ink: #16191d;
  --paper: #f4f1ec;
  --heat: #d4412b;
  --slate: #58616c;
  --bg: light-dark(var(--paper), var(--ink));
  --fg: light-dark(var(--ink), var(--paper));
  --muted: light-dark(var(--slate), #a3abb5);
  --link-hover: light-dark(#b8321d, #e8604a);
  --rule: color-mix(in srgb, var(--fg) 18%, transparent);
  --surface: color-mix(in srgb, var(--fg) 7%, var(--bg));
}

body {
  margin: 0 auto;
  max-width: 64rem;
  padding: 0 1rem 4rem;
  background: var(--bg);
  color: var(--fg);
  font:
    17px/1.6 system-ui,
    sans-serif;
}

::selection {
  background: color-mix(in srgb, var(--heat) 30%, transparent);
}

main {
  min-width: 0;
  max-width: 46rem;
}

/* A contents sidebar on wide screens; on narrow ones it flows above the page,
   with only the chapter titles. */
.layout {
  display: block;
}
@media (min-width: 56rem) {
  .layout.has-toc {
    display: grid;
    grid-template-columns: 15rem 1fr;
    gap: 2.5rem;
  }
  nav.toc {
    position: sticky;
    top: 1rem;
    align-self: start;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }
}

nav.toc {
  font-size: 0.9rem;
  padding-top: 1rem;
}
nav.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
nav.toc li {
  margin: 0.2rem 0;
}
nav.toc > ul > li {
  margin-top: 0.7rem;
  font-weight: 600;
}
nav.toc ul ul {
  padding-left: 0.75rem;
  font-weight: 400;
}
@media (max-width: 55.99rem) {
  nav.toc ul ul {
    display: none;
  }
}
nav.toc a {
  color: var(--muted);
  text-decoration: none;
}
nav.toc a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-color: var(--heat);
}

header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: center;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--rule);
}

header .site {
  display: block;
  line-height: 0;
}

header .github {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  margin-left: auto;
}

footer {
  margin-top: 4rem;
  padding-top: 1.25rem;
  font-size: 0.9rem;
  border-top: 1px solid var(--rule);
}
footer p {
  margin: 0 0 0.75rem;
}
footer .badge {
  display: inline-block;
  line-height: 0;
}

a {
  color: inherit;
  text-decoration-color: var(--heat);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}
a:hover {
  color: var(--link-hover);
}
h1,
h2,
h3 {
  line-height: 1.25;
  scroll-margin-top: 1rem;
}
h1 {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}
h1:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
h2 {
  margin-top: 2.25rem;
}
h1 a,
h2 a,
h3 a {
  color: inherit;
  text-decoration: none;
}

code,
pre {
  font:
    0.9em ui-monospace,
    monospace;
}
pre {
  padding: 0.9rem 1rem;
  overflow-x: auto;
  border-radius: 6px;
}
/* Zola writes the highlight theme's background into each pre. Put the page's
   surface under the code instead. The token colors stay the theme's. */
pre.giallo {
  background-color: var(--surface) !important;
}
:not(pre) > code {
  padding: 0.1em 0.3em;
  border-radius: 4px;
  background: var(--surface);
}

table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
}
th,
td {
  padding: 0.35rem 0.75rem 0.35rem 0;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}
