/* Source Serif 4, self-hosted from Google Fonts' files (SIL OFL 1.1, license in fonts/), so every reader gets the same
   font. Each file has every weight, and an optical size axis that browsers set from the font size, so headings get
   the display design. The roman Latin file is preloaded by partials/style.html; the others load only when a page
   uses them. Each Latin rule comes after its Latin Extended one, as in Google's CSS: where their ranges overlap, the
   later rule is tried first, and only the Latin file has œ and ı. */
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap; src: url(fonts/source-serif-4-latin-ext.woff2) format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap; src: url(fonts/source-serif-4-latin.woff2) format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 200 900; font-display: swap; src: url(fonts/source-serif-4-italic-latin-ext.woff2) format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 200 900; font-display: swap; src: url(fonts/source-serif-4-italic-latin.woff2) format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Until Source Serif 4 loads, or if it can't, text is set in a local font made to take about the same space, so little
   moves when it loads. Its lines are as tall, but a paragraph or title can still wrap to one more or one fewer line,
   and readers with neither font get the unadjusted fonts after them. size-adjust scales each face so the posts' text is
   as wide as in Source Serif 4 at their size (17.76px; measured over 12 posts, per style and weight; Source Serif 4's
   optical sizing makes other sizes match less closely). The overrides give it Source Serif 4's ascent (1.036em) and
   descent (0.335em), divided by the size-adjust that scales them, so its lines and baselines fall where Source Serif
   4's will. Safari ignores the overrides, which is why body sets a line height. Palatino is on macOS, iOS, and Windows
   (Palatino Linotype), and on Linux as P052, its metric clone. Its values were measured with macOS Palatino in Safari;
   P052 is within 1% of them. Noto Serif is Android's serif. */
@font-face { font-family: "Source Serif 4 Palatino"; font-style: normal; font-weight: 400; src: local("Palatino-Roman"), local("Palatino"), local("PalatinoLinotype-Roman"), local("Palatino Linotype"), local("P052-Roman"), local("P052 Roman");
    size-adjust: 102.47%; ascent-override: 101.10%; descent-override: 32.69%; line-gap-override: 0%; }
@font-face { font-family: "Source Serif 4 Palatino"; font-style: italic; font-weight: 400; src: local("Palatino-Italic"), local("Palatino Italic"), local("PalatinoLinotype-Italic"), local("Palatino Linotype Italic"), local("P052-Italic"), local("P052 Italic");
    size-adjust: 104.41%; ascent-override: 99.22%; descent-override: 32.09%; line-gap-override: 0%; }
@font-face { font-family: "Source Serif 4 Palatino"; font-style: normal; font-weight: 700; src: local("Palatino-Bold"), local("Palatino Bold"), local("PalatinoLinotype-Bold"), local("Palatino Linotype Bold"), local("P052-Bold"), local("P052 Bold");
    size-adjust: 102.57%; ascent-override: 101.00%; descent-override: 32.66%; line-gap-override: 0%; }
@font-face { font-family: "Source Serif 4 Palatino"; font-style: italic; font-weight: 700; src: local("Palatino-BoldItalic"), local("Palatino Bold Italic"), local("PalatinoLinotype-BoldItalic"), local("Palatino Linotype Bold Italic"), local("P052-BoldItalic"), local("P052 Bold Italic");
    size-adjust: 101.31%; ascent-override: 102.26%; descent-override: 33.07%; line-gap-override: 0%; }
@font-face { font-family: "Source Serif 4 Noto"; font-style: normal; font-weight: 400; src: local("NotoSerif-Regular"), local("Noto Serif"), local("Noto Serif Regular");
    size-adjust: 95.44%; ascent-override: 108.55%; descent-override: 35.10%; line-gap-override: 0%; }
@font-face { font-family: "Source Serif 4 Noto"; font-style: italic; font-weight: 400; src: local("NotoSerif-Italic"), local("Noto Serif Italic");
    size-adjust: 90.59%; ascent-override: 114.36%; descent-override: 36.98%; line-gap-override: 0%; }
@font-face { font-family: "Source Serif 4 Noto"; font-style: normal; font-weight: 700; src: local("NotoSerif-Bold"), local("Noto Serif Bold");
    size-adjust: 92.52%; ascent-override: 111.98%; descent-override: 36.21%; line-gap-override: 0%; }
@font-face { font-family: "Source Serif 4 Noto"; font-style: italic; font-weight: 700; src: local("NotoSerif-BoldItalic"), local("Noto Serif Bold Italic");
    size-adjust: 88.54%; ascent-override: 117.01%; descent-override: 37.84%; line-gap-override: 0%; }
/* Titles (32px) and section headings (h2 at 26.64px, h3 at 20.78px) are bold and bigger than the posts' text, and
   optical sizing makes Source Serif 4 narrower the bigger it is, so they get their own stand-ins: one measured over
   the titles of all posts, and one over all their h2 and h3 headings. */
@font-face { font-family: "Source Serif 4 Palatino Title"; font-style: normal; font-weight: 700; src: local("Palatino-Bold"), local("Palatino Bold"), local("PalatinoLinotype-Bold"), local("Palatino Linotype Bold"), local("P052-Bold"), local("P052 Bold");
    size-adjust: 96.96%; ascent-override: 106.85%; descent-override: 34.55%; line-gap-override: 0%; }
@font-face { font-family: "Source Serif 4 Noto Title"; font-style: normal; font-weight: 700; src: local("NotoSerif-Bold"), local("Noto Serif Bold");
    size-adjust: 88.22%; ascent-override: 117.43%; descent-override: 37.97%; line-gap-override: 0%; }
@font-face { font-family: "Source Serif 4 Palatino Heading"; font-style: normal; font-weight: 700; src: local("Palatino-Bold"), local("Palatino Bold"), local("PalatinoLinotype-Bold"), local("Palatino Linotype Bold"), local("P052-Bold"), local("P052 Bold");
    size-adjust: 98.82%; ascent-override: 104.84%; descent-override: 33.90%; line-gap-override: 0%; }
@font-face { font-family: "Source Serif 4 Noto Heading"; font-style: normal; font-weight: 700; src: local("NotoSerif-Bold"), local("Noto Serif Bold");
    size-adjust: 89.76%; ascent-override: 115.42%; descent-override: 37.32%; line-gap-override: 0%; }

body {
    /* After the stand-ins, the fonts are for characters Source Serif 4 doesn't have. Windows has no built-in serif
       fonts that look very good :( Sitka, Constantia, Cambria are at least decent */
    --serif-rest: "Source Serif Pro", P052, "Noto Serif", "Abyssinica SIL", C059, "Nimbus Roman", Utopia, Sitka, Constantia, Cambria, Palatino, "Palatino Linotype", "Palatino LT STD", Georgia, serif;
    font-family: "Source Serif 4", "Source Serif 4 Palatino", "Source Serif 4 Noto", var(--serif-rest);
    /* Source Serif 4's own normal line height ((1036 + 335) / 1000), set so that text in a stand-in font, whose
       normal line height differs, is just as tall in browsers that ignore the overrides above. normal rounds the
       ascent and descent to whole pixels, so each line here is a fraction of a pixel shorter than with normal; only
       on pages of hundreds of items, like the stream pages, does that add up to a visible total. */
    line-height: 1.371;
}

/* The sans-serif parts don't use Source Serif 4, so they keep their font's line height. */
#topbar, #metop, #search {
    line-height: normal;
}

/* body::before {
    /* https://stackoverflow.com/a/33091315/10113238 * /
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: -1;

    display: block;
    /* background-image: url('https://i.sm4.ca/justbg.png'); * /
    background-image: url('/justbg2.jpg');
    background-size: cover;
    width: 100%;
    height: 100%;

    filter: opacity(0.1) blur(4px);
} */

#lastmod-info {
    color: rgb(77, 77, 77);
}

#content pre {
    margin-top: 0;
    padding: 0.5rem;
    line-height: 1.4;
    font-size: 0.8rem;
    margin-bottom: 1em;
    text-align: left;
    overflow-x: scroll;
}

h2, h3, h4, h5, h6 {
    margin: 0;
}

#content :is(h2, h3) {
    font-family: "Source Serif 4", "Source Serif 4 Palatino Heading", "Source Serif 4 Noto Heading", var(--serif-rest);
}

#things-i-like h2 {
    margin-left: 1rem;
}

#hi-message {
    font-size: 300%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

p, ul, ol {
    margin: 0;
    padding-bottom: 1rem;
}

.h-card {
    text-align: center;
}

.smitop {
    font-weight: bold;
    color: black;
    text-decoration: none;
}

img {
    display: block;
    margin-bottom: 1rem;
}

figure {
    margin: 0;
}

figure > img {
    margin-bottom: 0.2em;
}

/* Image-first Bayesian network embeds from /bn */
[data-bn-embed] {
    margin-bottom: 1rem;
}

figcaption {
    font-size: 95%;
    font-style: italic;
    text-align: center;
}

/* A footnote reference doesn't make its line taller than the lines around it. */
sup {
    line-height: 0;
}

kbd {
    border: 1px solid #c6cbd1;
    border-radius: 4px;
    box-shadow: 1px 1px 0 #959da5;
    color: #232323;
    display: inline-block;
    font-size: 17px;
    line-height: 17px;
    padding: 3px 5px;
    vertical-align: middle;
}

#content, footer {
    max-width: 45rem;
    line-height: 1.5;
    width: 100%;
}
#content {
    margin-top: 1em;
    text-align: justify;
    font-size: 111%;
}

/* In prose, a long word that doesn't fit breaks with a hyphen, instead of moving whole to the next line and
   spreading out the justified line before it. Only paragraphs and list items are prose: a hyphen added to text a
   post shows as-is, such as the output of one of its demos, would read as part of that text. */
#content :is(p, li) {
    -webkit-hyphens: auto;
    hyphens: auto;
}

/* Likewise for code in prose. */
#content :is(pre, code, kbd, samp) {
    -webkit-hyphens: manual;
    hyphens: manual;
}

/* Long inline code (marked by post/single.html) breaks anywhere instead of moving whole to the next line, which would spread out the justified line before it. */
#content code.long {
    word-break: break-all;
}

/* A link in a post or page, or in the lists on the homepage and stream pages, ends with a mark of where it goes: a
   raised dot for iter.ca (a path here, iter.ca, or kb.iter.ca) and an arrow for any other site. Links within the page
   (#...), such as footnote references, links around an image, mailto links, the generated lists of posts, and the
   headings of the homepage's lists (which look like headings, not links) get none.
   The mark is drawn in the link's own padding, so a line can't break between the link and its mark, and in the link's
   color, visited or not. It's placed down from the top of the link's box, whose height above the text is the font's
   ascent, so its offsets fit Source Serif 4: the dot's top is at cap height, the arrow's tip a little above it, and
   both end just below x-height. */
:is(#content, #homepage-content, .stream) a:is([href^="/"]:not([href^="//"]), [href^="https://iter.ca/"], [href="https://iter.ca"], [href^="https://kb.iter.ca/"]):not(:has(img), .reclist a, .home-col h2 a) {
    padding-right: 0.42em;
    background-image: radial-gradient(circle closest-side, currentColor calc(100% - 0.6px), transparent);
    background-repeat: no-repeat;
    background-size: 0.32em 0.32em;
    background-position: right 0.04em top 0.35em;
}

/* The arrow is a line along its top, a line down its right side, and a diagonal into that corner. */
:is(#content, #homepage-content, .stream) a:is([href^="http://"], [href^="https://"]):not([href^="https://iter.ca/"], [href="https://iter.ca"], [href^="https://kb.iter.ca/"], :has(img), .reclist a, .home-col h2 a) {
    padding-right: 0.55em;
    background-image:
        linear-gradient(currentColor, currentColor),
        linear-gradient(currentColor, currentColor),
        linear-gradient(-45deg, transparent calc(50% - 0.55px), currentColor calc(50% - 0.55px), currentColor calc(50% + 0.55px), transparent calc(50% + 0.55px));
    background-repeat: no-repeat;
    background-size: 0.3em 1.1px, 1.1px 0.3em, 0.36em 0.36em;
    background-position: right 0.03em top 0.31em;
}

#main-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

#me-links > div, #me-links > div > ul {
    padding: 0;
    text-align: center;
}
#me-links > div ul {
    display: inline-block;
}
#me-links > div {
    margin-top: 1em;
}

#me-links p {
    text-align: center;
    padding-bottom: 0;
}

#me-links li {
    list-style-type: none;
    display: inline;
}

#me-links li:not(:last-child):after {
    content: " • ";
}

#me-links button {
    position: relative;
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    color: #0000ee;
    color: LinkText;
    text-decoration: underline;
    cursor: pointer;
}

#copy-discord:hover::after,
#copy-discord:focus-visible::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    top: 100%;
    /* Centered under the button, but shifted to stay 4px inside the viewport.
       --x is the button's center, set by the homepage script. */
    transform: translateX(clamp(calc(4px - var(--x, 50vw)), -50%, calc(100vw - 4px - var(--x, 50vw) - 100%)));
    /* A see-through gap that still counts as the button, so the pointer can
       move onto the tooltip without it disappearing. */
    border-top: 0.35em solid transparent;
    background: #222;
    background-clip: padding-box;
    padding: 0.15em 0.4em;
    color: #fff;
    font-size: 0.72em;
    line-height: 1.3;
    white-space: nowrap;
    text-decoration: none;
    z-index: 2;
}

/* Escape hides the tooltip until it next appears. */
#copy-discord.tip-hidden::after {
    display: none;
}

.source-link {
    color: #222;
    display: block;
    text-align: center;
    margin-top: 5rem;
}

h1 {
    margin: 0;
    margin-top: 0.25em;
    font-family: "Source Serif 4", "Source Serif 4 Palatino Title", "Source Serif 4 Noto Title", var(--serif-rest);
}

.stream {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.stream.mini {
    display: inline-block;
}

.stream.mini > .stream-item {
    display: block;
    max-width: 15rem;
}

.stream.mini .stream-item-date, .stream.mini h2 {
    display: inline;
}

.stream-item {
    max-width: 20rem;
    border: 2px solid gray;
    border-radius: 0.5rem;
    padding: 0.25rem;
    /* create new context */
    position: relative;
    text-align: center;
    overflow: hidden;
    max-height: 16rem;
    background: rgba(255,255,255,0.65);
}

.stream.mini .stream-item {
    border: none;
    max-width: unset;
    text-align: unset;
    display: list-item;
    list-style-position: inside;
}
.stream.mini .stream-item > div {
    display: inline;
}
.stream.mini .stream-item .stream-item-type {
    display: none;
}
.stream.mini .stream-item h2 {
    font-size: 100%;
    font-weight: 400;
}
.stream.mini .stream-item a {
    font-weight: bold;
}

/* The homepage's lists of stream items (partials/homecols.html). On a wide screen they are a row of columns; on a
   narrower one each is a card, two to a row, or one to a row on a phone. */
.home-cols {
    --home-rule: #c2c2c2;
    --home-card-head: #e7e7e7;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    max-width: 96rem;
}

/* A word too long for its list breaks instead of overflowing it. */
.home-col {
    overflow-wrap: anywhere;
}

.home-col h2 {
    border-bottom: 1px solid var(--home-rule);
    font-size: 1.3em;
}

/* A heading links to where its list's "more..." goes, and looks like a heading. */
.home-col h2 a {
    color: inherit;
    text-decoration: none;
}

.home-col ul {
    list-style: none;
    padding: 0;
}

.home-col li {
    padding: 0.35rem 0;
    line-height: 1.3;
}

.home-col li:not(.home-col-more) a {
    font-weight: bold;
}

.home-col-date {
    display: block;
    color: #555;
    font-size: 85%;
}

@media not all and (min-width: 72rem) {
    .home-col {
        border: 1px solid var(--home-rule);
        border-radius: 0.5rem;
        /* keeps the heading's background inside the rounded corners */
        overflow: hidden;
    }
    .home-col h2 {
        background: var(--home-card-head);
        padding: 0.4rem 0.75rem;
    }
    .home-col ul {
        padding: 0.3rem 0.75rem 0.5rem;
    }
}

@media (min-width: 40rem) {
    .home-cols {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 72rem) {
    .home-cols {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
        gap: 2rem;
    }
    .home-col h2 {
        padding-bottom: 0.2rem;
        margin-bottom: 0.5rem;
    }
}

.stream-item-thumb-wrapper {
    display: flex;
    align-items: center;
    flex-direction: column;
}

.stream-item-type {
    margin: 0;
    padding: 0;
    line-height: 1;
    text-align: center;
    font-family: monospace;
    font-size: 110%;
}

.stream-item h2 {
    margin: 0;
    text-align: center;
    font-size: 1.27rem;
}

.stream-item-date {
    text-align: center;
    margin-bottom: 0.25rem;
}

.stream-item.featured {
    border-color: #939300;
    background: #ffffe4;
}

.fstar {
    display: inline;
    margin: 0;
    position: absolute;
    top: 0.2rem;
    left: 0.2rem;
}

li > ul, li > ol {
    padding-bottom: 0;
}

/* The footnote list follows a rule, not a paragraph whose padding would set it apart. */
.footnotes > ol {
    margin-top: 1em;
}

#avatar {
    border-radius: 2rem;
    margin-bottom: 0;
    margin-top: 0.5rem;
}

.highlight > pre {
    margin: 0;
}

/* Override Hugo's inline Monokai comment color for readable contrast. */
.highlight [style*="#75715e"] {
    color: #a6a28c !important;
}

a.playground {
    font-size: 1rem;
    margin: 0;
}

#about {
    max-width: 58rem;
}

/* A post's table of contents (toc = 1): a box above the post, or on a screen wide enough for margin notes, a list in
   the left margin, mirroring them (see .margin-notes). It isn't floated beside the post, which would squeeze the
   justified text next to it into a narrow column. */
#TableOfContents {
    background: rgb(231, 231, 231);
    border: 1px solid gray;
    width: fit-content;
    margin: 0 0 1.25em;
    padding: 0.75em 1em 0.75em 0;
    font-size: 0.9em;
    line-height: 1.4;
    text-align: left;
}

/* https://stackoverflow.com/questions/4098195/can-ordered-list-produce-result-that-looks-like-1-1-1-2-1-3-instead-of-just-1 */

#TableOfContents ul {
    counter-reset: item;
    padding-inline-start: 1em;
    padding-bottom: 0;
    margin-block-start: 0;
    margin-block-end: 0;
}

/* Entries are headings, not prose, so they aren't hyphenated like the post's list items. */
#TableOfContents li {
    display: block;
    -webkit-hyphens: manual;
    hyphens: manual;
}

#TableOfContents li:before {
    content: counters(item, ".") ". ";
    counter-increment: item;
}

blockquote {
    border-left: 4px solid gray;
    background: #eee;
    margin: 0;
    padding: 0;
    padding-left: 0.5em;
    padding-right: 0.5em;
    margin-bottom: 1em;
}

blockquote > p:last-child {
    padding-bottom: 0;
}

.related-posts .stream-item {
    display: inline-block;
}

#topbar {
    background: #e7e7e7;
    border-bottom: 1px solid #c2c2c2;
    padding: 0.5rem;
    font-family: sans-serif;
    margin: -0.5rem -0.5rem 0 -0.5rem;
    font-size: 1rem;
}

#metop {
    display: flex;
    flex-direction: row;
    font-family: sans-serif;
    max-width: 60em;
    margin-bottom: 2em;
    gap: 2em;
}

#metop-left {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

#metop-right {
    font-size: 1.3em;
}

#me-links {
    margin-top: 1em;
}

#avatar {
    box-shadow: 0px 0px 20px 0px black;
    display: inline;
}

/* on the homepage, the spinning octahedron (/avatar/oct.js) replaces the avatar when the "oct" class is set. The hidden
   avatar's link keeps its place in the layout, so nothing around it moves, and the picture isn't rendered, so (being
   loading="lazy") it isn't downloaded unless the gem goes away; the gem is --oct big (oct.js reads it), centered on the
   avatar's spot, and overflows it */
#oct-box {
    --oct: 224px;
    display: inline-block;
    position: relative;
    margin-top: 0.5rem;
}

#oct-box #avatar {
    display: block;
    margin-top: 0;
}

#oct, #oct-still, #oct-hit, #sparks {
    display: none;
}

.oct #oct-box > a {
    display: block;
    width: 160px;
    height: 160px;
    visibility: hidden;
}

.oct #oct-box #avatar {
    display: none;
}

/* nudged (which moves nothing else) so the gem clears the top bar and the window's left edge */
.oct #oct-box {
    left: 16px;
    top: 16px;
}

/* a soft haze in the gem's colors behind it, under the page's text */
.oct #oct-box::before {
    content: "";
    position: absolute;
    left: calc(50% - var(--oct) / 2);
    top: calc(50% - var(--oct) / 2);
    width: var(--oct);
    height: var(--oct);
    border-radius: 50%;
    background: conic-gradient(#e700ce, #a400e8, #4500e7, #00e7e7, #2fe700, #e7cf00, #e700ce);
    filter: blur(30px);
    opacity: 0.38;
    pointer-events: none;
    z-index: -1;
}

/* the canvas is bigger than the gem, so a popped or charged gem has room to grow. Until the gem is first hovered or
   touched, a picture of the canvas's first frame (oct-still.webp, see oct.js) sits in its place */
.oct #oct, .oct #oct-still {
    display: block;
    position: absolute;
    left: calc(50% - var(--oct) * 0.75);
    top: calc(50% - var(--oct) * 0.75);
    width: calc(var(--oct) * 1.5);
    height: calc(var(--oct) * 1.5);
    pointer-events: none;
    z-index: 1;
}

.oct #oct-hit {
    display: block;
    position: absolute;
    left: calc(50% - var(--oct) * 0.4);
    top: calc(50% - var(--oct) * 0.4);
    width: calc(var(--oct) * 0.8);
    height: calc(var(--oct) * 0.8);
    border-radius: 50%;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    z-index: 2;
}

#oct-hit.drag {
    cursor: grabbing;
}

/* the gem's sparks fly over the page, under the gem */
.oct #sparks {
    display: block;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    image-rendering: pixelated;
    z-index: 0;
}

#me-links {
    line-height: 1.8;
}

#about-summary {
    font-family: sans-serif;
    font-size: 150%;
}

.byline-avatar {
    display: inline;
    margin: 0;
    vertical-align: top;
}

.dia {
    display: flex;
    line-height: 1;
    gap: 0.5em;
    margin-bottom: 1em;
}

.dia > img.dia-img {
    display: inline;
    height: 4em;
    margin: 0;
}

.dia-text {
    display: inline-block;
    line-height: 1.5;
    background: rgb(224, 224, 224);
    border: 2px solid gray;
    padding: 0.5em;
    height: min-content;
    border-radius: 0.75em;
}

dl {
    margin-top: 0;
}

.rel-list {
    list-style: none;
    padding: 0;
}

#meta {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
}

#meta a, #ai-info a {
    text-decoration: none;
}

#meta a:hover {
    text-decoration: underline;
}

#meta > .meta-other {
    text-align: right;
}

.meta-other > #license-info {
    margin-top: 1rem;
}

#ai-info {
    margin-top: 1em;
    color: #121212;
}

#comments h2 {
    margin-bottom: 0.5em;
}

.comment {
    margin-bottom: 1em;
    border-left: 1px dashed black;
    padding: 0.25em;
    padding-left: 0.5em;
}

.comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4em;
}

.comment-avatar {
    width: 1.5em;
    height: 1.5em;
    border-radius: 50%;
    /* Without the margin every img gets, which would raise the avatar above the name next to it. */
    margin-bottom: 0;
}

.comment-author {
    font-weight: bold;
}

.comment-meta a {
    text-decoration: none;
}

.comment-meta a:hover {
    text-decoration: underline;
}

.comment-author-badge {
    background: #1d3557;
    color: #fff;
    border-radius: 4px;
    padding: 0.05em 0.4em;
    font-size: 80%;
}

.comment-date {
    color: #555;
    font-size: 90%;
}

.comment-text {
    margin-top: 0.2em;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.comment-html {
    margin-top: 0.2em;
    overflow-wrap: break-word;
}

.comment-html > :last-child {
    padding-bottom: 0;
    margin-bottom: 0;
}

/* LessWrong footnotes: keep the note on the same line as its ^ back-link. */
.comment-html li > div,
.comment-html li > div > p:first-child {
    display: inline;
}

.comment-html li > div {
    margin-left: 0.3em;
}

.comment-html img {
    max-width: 100%;
    height: auto;
}

.comment-html :is(h1, h2, h3, h4, h5, h6) {
    font-size: 1em;
}

.comment-html summary > * {
    display: inline;
}

/* Wide tables scroll inside the comment instead of widening the page. */
.comment-html table {
    display: block;
    overflow-x: auto;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.comment-html :is(td, th) {
    border: 1px solid #ccc;
    padding: 0.2em 0.4em;
}

.comment-html :is(td, th) > p {
    padding-bottom: 0;
}

.list-entry {
    display: flex;
    text-align: left;
}

.list-entry > a {
    min-width: 0;
    overflow-wrap: anywhere;
}

.list-date {
    flex: 0 0 11em;
    display: block;
}

details {
    border: 1px solid rgb(70, 70, 70);
    background: rgb(241, 241, 241);
    padding: 0.5em;
    margin-bottom: 1em;
}

details > summary {
    cursor: pointer;
}

details:not([open]) > summary::after {
    content: "(click to expand)";
    font-size: 0.85em;
    opacity: 0.5;
    margin-left: 0.4em;
}

.sidenote {
    border: 1px solid rgb(70, 70, 70);
    background: rgb(241, 241, 241);
    padding: 1em 0.75em 0;
    margin: 1em 0;
    position: relative;
}

.sidenote > :last-child {
    margin-bottom: 0;
}

.sidenote-label {
    position: absolute;
    top: -0.7em;
    left: 0.75em;
    background: rgb(241, 241, 241);
    padding: 0 0.4em;
    font-style: italic;
    font-size: 0.9em;
    color: rgb(70, 70, 70);
}

.post-cta {
    border: 1px solid rgb(50, 100, 140);
    background: rgb(234, 243, 250);
    padding: 1em 0.75em 0.75em;
    margin: 0.75em 0 1em;
    position: relative;
}

.post-cta-label {
    position: absolute;
    top: -0.7em;
    left: 0.75em;
    background: rgb(234, 243, 250);
    padding: 0 0.4em;
    font-weight: bold;
    font-size: 0.9em;
    color: rgb(50, 100, 140);
}

.post-cta > p:last-of-type {
    margin-bottom: 0;
}

.post-cta-lastmod {
    margin-top: 0.5em;
    font-size: 0.8em;
    color: rgb(100, 120, 140);
    font-style: italic;
}

/* Clicking it swaps in the newsletter form, so it looks like a button, with the form's border. */
#newsletter-open {
    display: inline-block;
    margin: 0.25em 0;
    padding: 0.3em 0.8em;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f8f8f8;
    color: inherit;
    text-decoration: none;
}

#newsletter-open:hover {
    border-color: #999;
    background: #eeeeee;
}

ol.spec-list {
    margin-top: 0;
    counter-reset: item;
    list-style-type: none;
}

ol.spec-list > li:before {
    content: attr(data-prefix) '.' counter(item, decimal) '. ';
    counter-increment: item;
}

#blog-posts > summary {
    cursor: pointer;
}

#blog-posts[open] {
    cursor: unset;
    background: white;
}

summary h2 {
    display: inline;
}

/* #verbose-slider[value="-1"] ~ .stream > .stream-item[data-verbose="0"],
#verbose-slider[value="-1"] ~ .stream > .stream-item[data-verbose="1"],
#verbose-slider[value="0"]  ~ .stream > .stream-item[data-verbose="1"] 
{
    display: none;
} */

.cw {
    background-color: rgb(253, 255, 243);
    border: 1.5px solid rgb(184, 120, 0);
    padding: 0.5em;
    margin-bottom: 1em;
}

/* Footnotes copied into the right margin, next to their references (see post/single.html). Shown only on screens
   whose margin can fit a 12rem column: the post is 45rem wide and centered, and the column leaves 2rem on each side.
   A printout, however wide its paper, has just the footnotes at the bottom. */
.margin-notes {
    display: none;
}

@media screen and (min-width: 77rem) {
    #content {
        position: relative;
    }
    .margin-notes {
        display: block;
        position: absolute;
        top: 0;
        left: calc(100% + 2rem);
        width: min(18rem, calc((100vw - 45rem) / 2 - 4rem));
    }
    #TableOfContents {
        position: absolute;
        top: 0;
        right: calc(100% + 2rem);
        width: min(16rem, calc((100vw - 45rem) / 2 - 4rem));
        margin: 0;
        padding: 0;
        background: none;
        border: none;
        font-size: 0.8em;
    }
    #TableOfContents ul {
        padding-inline-start: 0;
    }
    #TableOfContents ul ul {
        padding-inline-start: 1em;
    }
    #TableOfContents a {
        text-decoration: none;
    }
    /* A wrapped entry lines up under its own text, not under its number. */
    #TableOfContents li {
        display: grid;
        grid-template-columns: auto 1fr;
        column-gap: 0.3em;
    }
    #TableOfContents li > ul {
        grid-column: 1 / -1;
    }
    /* Only where its margin note is shown. */
    .footnote-ref-hover {
        background: #fff8d4;
        box-shadow: 0 0 0 0.15em #fff8d4;
    }
}

.margin-note {
    position: absolute;
    left: 0;
    right: 0;
    font-size: 0.8em;
    line-height: 1.4;
    text-align: left;
    color: #1a1a1a;
}

/* The shadow widens the highlight past the note's edges without moving its text. */
.margin-note-hover {
    background: #fff8d4;
    box-shadow: 0 0 0 0.4em #fff8d4;
}

.margin-note p {
    padding-bottom: 0.5em;
}

.margin-note > :last-child {
    padding-bottom: 0;
}

.margin-note-num {
    font-weight: bold;
    margin-right: 0.4em;
}

@media (max-width: 900px) {
    #metop {
        flex-direction: column;
        margin-bottom: 1em;
        gap: 0;
    }
    #metop-left {
        display: block;
    }
    #me-links, #me-links > div {
        margin-top: 0;
    }
    #me-links p {
        margin-top: 0.5em;
    }
    #me-links > div, #me-links > div > ul, #me-links p, .h-card {
        text-align: left;
    }
    #on-this-site {
        display: none;
    }
}

/* On a phone, where the homepage's lists are one card wide (see .home-cols), the gem, the greeting, and the links are
   centered over them. */
@media not all and (min-width: 40rem) {
    #me-links > div, #me-links > div > ul, #me-links p, #metop .h-card {
        text-align: center;
    }
    /* centered, the gem needs no nudge to clear the window's left edge */
    .oct #oct-box {
        left: 0;
    }
}

/* Centered, the gem's canvas (1.5 × --oct wide, see .oct #oct) has to fit in the window, or it sticks out of the right
   edge and the page scrolls sideways. On a screen narrower than it, the gem is smaller. */
@media not all and (min-width: 336px) {
    #oct-box {
        --oct: 200px;
    }
}

@media (max-width: 47rem) {
    #main-section {
        /* don't try to center, causes some text to go off screen */
        display: block;
    }
    #meta {
        display: block;
    }
    /* A column this narrow has too few words on a line to justify without wide gaps. */
    #content {
        text-align: left;
    }
    #content img {
        position: relative;
        left: -8px; /* body margin */
        width: calc(100% + 8px * 2);
    }
}

@media (max-width: 470px) {
    .list-entry {
        display: block;
    }
    .stream {
        display: block;
    }
    .stream-item {
        width: 100%;
        max-width: unset;
        margin-bottom: 1rem;
        box-sizing: border-box;
        height: unset;
        padding-left: 0;
        padding-right: 0;
        padding-bottom: 0;
    }
    .stream-item h2 {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
    .stream-item img:not(.fstar) {
        margin-bottom: 0;
        width: 100%;
        height: 100%;
    }
    .stream.mini .stream-item {
        list-style-position: unset;
        display: block;
        margin-bottom: 0.25em;
    }
    .stream.mini .stream-item h2 {
        padding: 0;
        margin: 0;
    }
}

/* The search box that Ctrl-K or ⌘K opens (static/search/search.js) */
#search {
    width: min(40rem, calc(100vw - 2rem));
    max-height: min(40rem, calc(100vh - 4rem));
    margin: 8vh auto auto;
    padding: 0;
    border: 1px solid #c2c2c2;
    border-radius: 6px;
    background: #ffffff;
    color: #111111;
    font-family: sans-serif;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.25);
}

#search::backdrop {
    background: rgba(0, 0, 0, 0.3);
}

/* The dialog's height follows the results, up to its max-height, past which they scroll */
.search-box {
    display: flex;
    flex-direction: column;
    max-height: inherit;
}

.search-box input {
    font: inherit;
    font-size: 1.15rem;
    padding: 0.75rem 1rem;
    border: 0;
    border-bottom: 1px solid #c2c2c2;
    outline: none;
    background: transparent;
    color: inherit;
}

.search-status {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    color: #555555;
}

.search-status:empty {
    display: none;
}

#search-results {
    margin: 0;
    padding: 0 0 0.5rem;
    list-style: none;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#search-results a {
    display: block;
    padding: 0.5rem 1rem;
    text-decoration: none;
}

#search-results [aria-selected="true"] a {
    background: #e7e7e7;
}

.search-title {
    display: block;
    font-weight: bold;
}

.search-type {
    font-weight: normal;
    font-size: 0.8rem;
    color: #555555;
    white-space: nowrap;
}

.search-preview {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    margin-top: 0.15rem;
    font-size: 0.875rem;
    line-height: 1.4;
    color: #444444;
}

#search mark {
    background: #fff0a0;
    color: inherit;
}

/* Dark mode, for visitors whose system asks for it. Everything above is the light theme; this only swaps its colors.
   color-scheme also gives links, form controls, and scrollbars the browser's dark colors. */
:root {
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    body {
        background: #111111;
        color: #ffffff;
    }

    /* Many charts and diagrams in posts are transparent, with black lines and text drawn for a white page. The color is for
       the alt text of an image that fails to load. Give an image drawn for any background class="keep-transparent". */
    #content img:not(.keep-transparent) {
        background: white;
        color: #111111;
    }

    #lastmod-info {
        color: #b0b0b0;
    }

    kbd {
        border-color: #5c6168;
        box-shadow: 1px 1px 0 #3d4147;
        color: #ffffff;
    }

    #copy-discord:hover::after,
    #copy-discord:focus-visible::after {
        background: #ffffff;
        background-clip: padding-box;
        color: #111111;
    }

    .source-link {
        color: #cccccc;
    }

    .stream-item {
        background: none;
    }

    .stream-item.featured {
        background: #26260f;
    }

    .home-cols {
        --home-rule: #383838;
        --home-card-head: #1e1e1e;
    }

    .home-col-date {
        color: #aaaaaa;
    }

    #TableOfContents {
        background: #1e1e1e;
    }

    blockquote {
        background: #222222;
    }

    #topbar {
        background: #1e1e1e;
        border-bottom-color: #383838;
    }

    .dia-text {
        background: #2a2a2a;
    }

    #ai-info {
        color: #d8d8d8;
    }

    .comment {
        border-left-color: #888888;
    }

    .comment-date {
        color: #aaaaaa;
    }

    .comment-html :is(td, th) {
        border-color: #444444;
    }

    details, .sidenote {
        border-color: #666666;
        background: #1c1c1c;
    }

    .sidenote-label {
        background: #1c1c1c;
        color: #aaaaaa;
    }

    .post-cta {
        border-color: rgb(90, 140, 185);
        background: rgb(20, 32, 44);
    }

    .post-cta-label {
        background: rgb(20, 32, 44);
        color: rgb(125, 175, 215);
    }

    .post-cta-lastmod {
        color: rgb(140, 160, 180);
    }

    #newsletter-open {
        border-color: #555555;
        background: #1c1c1c;
    }

    #newsletter-open:hover {
        border-color: #888888;
        background: #2a2a2a;
    }

    .cw {
        background: rgb(38, 33, 18);
    }

    .margin-note {
        color: #d0d0d0;
    }

    .margin-note-hover {
        background: #3a3520;
        box-shadow: 0 0 0 0.4em #3a3520;
    }

    #search {
        border-color: #383838;
        background: #1e1e1e;
        color: #ffffff;
    }

    #search::backdrop {
        background: rgba(0, 0, 0, 0.6);
    }

    .search-box input {
        border-bottom-color: #383838;
    }

    .search-status, .search-type {
        color: #aaaaaa;
    }

    #search-results [aria-selected="true"] a {
        background: #2e2e2e;
    }

    .search-preview {
        color: #cccccc;
    }

    #search mark {
        background: #5a4f10;
    }
}

@media screen and (min-width: 77rem) and (prefers-color-scheme: dark) {
    /* In the margin it has no box, so it doesn't take the dark box color. */
    #TableOfContents {
        background: none;
    }
    .footnote-ref-hover {
        background: #3a3520;
        box-shadow: 0 0 0 0.15em #3a3520;
    }
}
