:root {
  color-scheme: light dark;
  --color-accent: #fcc419;
  --color-muted: lightgray;
  --color-text: black;
  --color-background: white;
  --color-text-code: #24292e;
  --color-background-code: white;
  --color-link: #9e9eff;
}


style {
  WTF, W3C? ;
  display: none !important;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-accent: #c5b203;
    --color-muted: #4b4b4b;
    --color-text: white;
    --color-background: #1c1b22;
    --color-text-code: #c9d1d9;
    --color-background-code: #0d1117;
  }

  img.icon {
    filter: invert(1);
  }

  /* default chromium colors for dark mode */
  :link {
    color: var(--color-link);
  }

  :visited {
    color: #d0adf0;
  }
}

:root {
  --ff-sans:
    Roboto, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
    "Segoe UI Symbol", "Noto Color Emoji";
  --ff-mono: "Fira Code", "Source Code Pro", monospace;
  font-family: var(--ff-sans);
  font-size: 18.666px;
  --font-size-a-bit-smaller: 16px;
  line-height: 1.5;
  background-color: var(--color-background);
}

.main-column {
  --max-width: 72ch;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 8px;
}

.fullwidth {
  margin-inline: min(0px, (100vw - var(--max-width)) / -2);
}

@media print {
  body {
    margin-inline: 1em;
  }
}

.figcaption {
  text-align: center;
  margin-block-start: -1em;
}

.cw {
  height: 100vh;
  background: var(--color-accent);
  color: #450901;
  margin-inline: -8px;
  padding-inline: 8px;
}

.muted {
  color: var(--color-muted);
}

hr.footnotes-sep {
  border: unset;
  color: unset;
  &::before {
    display: block;
    content: "FOOTNOTES";
    text-align: center;
    font-variant-caps: all-small-caps;
  }
}

td:not(:last-child) {
  padding-inline-end: 0.5em;
}

:any-link[href*="://"]::after {
  content: "";
  background-image: url(/images/link-external-small-ltr-progressive.svg);
  background-position: center 80%;
  background-repeat: no-repeat;
  font-kerning: none;
  margin-left: 1px;
  padding-right: 12px;
}

:any-link:active {
  color: var(--color-accent);
}

code {
  color: var(--color-text-code);
  background: var(--color-background-code);
  font-family: var(--ff-mono);
  border-radius: 1px;
  padding-inline: 2px;
}

pre code:not(.hljs) {
  display: block;
}

pre code {
  font-size: var(--font-size-a-bit-smaller);
  white-space: pre-wrap;
  padding: 1em;
}

blockquote {
  margin-inline: 0;
  padding-inline-start: 1em;
  border-inline-start: solid 2px var(--color-accent);
}

/* Highlighting the target with the accent put white text (2.1:1) and
   --color-link (1.1:1) on bright yellow. An outline marks the target while
   leaving text on its own background. */
:target {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

code128 {
  font-family: "Noto Sans Mono", monospace;
  display: inline-block;
  font-size: 0.5em;
  vertical-align: middle;
  transform: scaleY(2.5);
  transform-origin: center calc(0.5em + 1ch);
}

rt > code128 {
  transform-origin: unset;
}

.main-column > header {
  margin-block-end: 1em;

  & nav {
    font-size: var(--font-size-a-bit-smaller);
    display: flex;
    flex-wrap: wrap-reverse;
    justify-content: space-between;
    align-items: center;
    column-gap: 12px;
    margin-block-start: 18px;
  }

  & .nav-links {
    display: flex;
    flex-wrap: wrap;
    column-gap: 2px;
    margin: unset;
    padding: unset;
    align-items: flex-start;
    justify-items: stretch;
  }

  & .nav-links > * {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
  }

  & nav img {
    vertical-align: middle;
  }

  & .nav-separator {
    color: rgb(59 130 246 / 0.5);
    align-self: flex-start;
    margin-block-start: 5px;
  }

  & nav math {
    font-family: inherit;

    & mtd {
      padding: 0;
    }
  }

  & .site-title {
    font-feature-settings: "smcp";
  }
}

.main-column > footer {
  margin-block-start: 1rem;
}

/* only top-level title get centered */
.main-column > main,
.main-column > main > div {
  :is(& > h1, & > h2, section > h1, section > h2) {
    text-align: center;
  }

  :is(& > h1, section > h1) {
    font-size: 1.5rem;
  }
  :is(& > h2, section > h2) {
    font-size: 1.25rem;
  }
}

.main-column > main img {
  vertical-align: middle;
}

.cc-notice {
  font-size: smaller;
  display: flex;
  justify-content: space-between;
}

/* The bowtie is drawn crisp (see EOFBow.tsx); padding keeps the row at 32px
   with the 2px rule centred on a whole pixel. */
.eof-bow {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding-block: 8px;
}

.eof-bow-tie {
  display: block;
}

.eof-bow-rule {
  height: 2px;
  background: #fcc419;
}

.small {
  font-size: smaller;
}

.disabled {
  opacity: 0.5;
}

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

.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1em;
}
.grid-2col > * {
  container-type: inline-size;
  --max-width: 100vw;
}

details > :not(summary) {
  margin-inline-start: 4px;
  padding-inline-start: 12px;
  list-style-position: inside;
}
details {
  margin-block: 1em;
}
