@charset "utf-8";

html {
    font-size: 18px;
}

/* the fonts, colours, links, column, title and menu are in site.css, shared with the explorer */

body {
    hyphens: auto;
    /* only split words of 10+ letters, 4+ on each side, never two lines running */
    hyphenate-limit-chars: 10 4 4;
    hyphenate-limit-lines: 1;
}

/* no hyphenation in headings, the byline, or web addresses */
h1, h2, .byline, code {
    hyphens: manual;
}

/* browsers reset the numeral style on list numbers, so set it again */
::marker {
    font-variant-numeric: lining-nums;
}

h2 {
    padding-top: 1em;
}

h2 {
    font-style: italic;
}

h2 {
    font-size: 24px;
}

.byline {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin: 0.35rem 0 1.6rem;
    font-size: 70%;
    line-height: 1.35;
    text-align: left;
}

.byline .author {
    font-size: 0.85rem;
}

/* a divider is the text -.- centred between sections; being text, it
   can still be copied */
.divider {
    margin: 0.5em 0 -.4em;
    text-align: center;
    letter-spacing: 0.2em;
}

body {
    counter-reset: sidenote;
}

.sidenote-ref {
    counter-increment: sidenote;
}

.sidenote-ref::after,
.sidenote::before {
    content: counter(sidenote);
    font-size: 70%;
    font-weight: 600;
    line-height: 0;
    vertical-align: super;
}

/* hang the number outside the note so the note text stays flush left;
   it sits on the note's first line, raised like the marker in the text */
.sidenote::before {
    position: absolute;
    right: 100%;
    top: -0.45em;
    padding-right: 0.3em;
    line-height: calc(1.35 / 0.7);
    vertical-align: baseline;
    font-weight: 600;
    white-space: nowrap;
}

.sidenote-toggle {
    display: none;
}

.sidenote-ref {
    cursor: pointer;
}

.sidenote {
    display: none;
    position: relative;
    font-size: 70%;
    line-height: 1.35;
    text-align: left;
    overflow-wrap: anywhere;
}

/* narrow screens: tapping a number opens its note in a box over the text,
   just below the line the number is on; tapping again closes it */
@media (max-width: 1279.98px) {
    p {
        position: relative;
    }

    /* the number of an open note is inverted */
    .sidenote-toggle:checked + .sidenote-ref::after {
        background: #1d1d1d;
        color: #fff;
    }

    .sidenote-toggle:checked + .sidenote-ref + .sidenote {
        display: block;
        position: absolute;
        left: 0;
        right: 0;
        z-index: 1;
        margin: 0.3em 1.5em 0em 1.5em;
        padding: 0.7em 1em 0.7em 1.4em;
        background: #fff;

        border: 1px solid #1d1d1d;
    }

    .sidenote::before {
        right: auto;
        left: 0.9em;
        top: 0.55em;
        padding-right: 0;
    }
}

/* phones: smaller text, no gap above the title */
@media (max-width: 500px) {
    html {
        font-size: 16px;
    }

    h2 {
        font-size: 20px;
    }
}

/* wide screens: notes always show, out in the right margin */
@media (min-width: 1280px) {
    .sidenote-ref {
        cursor: auto;
    }

    .sidenote {
        display: block;
        float: right;
        clear: right;
        width: 220px;
        margin: 0.2em -260px 0.8em 0;
    }
}

ol {
    padding-left: 1.4em;
}

li {
    position: relative;
    margin: 0.4em 0;
    text-align: left;
}

li > p {
    margin: 0;
}


/* a list of posts: title, then author and date, then a one-line summary */
h2:has(+ ul.posts) {
    margin-bottom: 0.5em;
}

ul.posts {
    margin-top: 0;
}

ul.posts > li {
    margin: 0.7em 0;
}

ul.posts > li:first-child {
    margin-top: 0;
}

.post-title {
    font-style: italic;
}

.post-meta {
    display: block;
    margin-top: 0.15em;
    font-size: 70%;
    line-height: 1.35;
}

.post-tldr {
    margin: 0.3em 0 0;
    font-size: 85%;
    line-height: 1.4;
}

/* code as in the explorer (explore/web/explore.css) */
code {
    font-family: 'DejaVu Sans Mono', Menlo, Consolas, monospace;
    font-size: 82%;
    overflow-wrap: anywhere;
}

/* code blocks keep their lines and scroll sideways rather than wrap */
pre {
    margin: 1em 0;
    padding: 1rem;
    background: #f6f6f4;
    border-left: 2px solid #d6d6d6;
    overflow-x: auto;
    font-family: 'DejaVu Sans Mono', Menlo, Consolas, monospace;
    font-size: .8rem;
    line-height: 1.5;
}

/* the block, not the code inside it, carries the size, so the lines are spaced for the code */
pre code {
    font-size: inherit;
    overflow-wrap: normal;
}

/* definitions and theorems, written in the markdown as a fenced div:
       ::: theorem
       **Theorem.** ...
       :::
   boxed like the explorer's theorem cards (explore/web/cg-pilot.css) */
.definition, .theorem {
    box-sizing: border-box;
    margin: 1.15rem 0;
    padding: 1.1rem 1.25rem;
    border-left: 4px solid #111;
    background: #f4f4f4;
}

.definition > p, .theorem > p { margin: .65rem 0; }
.definition > :first-child, .theorem > :first-child { margin-top: 0; }
.definition > :last-child, .theorem > :last-child { margin-bottom: 0; }

/* the label in italics, as the explorer's "Theorem (Name)." */
.definition > p:first-child > strong:first-child,
.theorem > p:first-child > strong:first-child { font-style: italic; }

/* code inside a box, as code inside the explorer's cards */
.definition pre, .theorem pre { background: #ededed; }

@media (max-width: 600px) {
    .definition, .theorem { padding-inline: .9rem; }
}

/* wide display maths scrolls inside the box instead of overflowing it */
.definition .katex-display, .theorem .katex-display { overflow-x: auto; overflow-y: hidden; }

img {
    width: 100%;
    height: auto;
}

#nameSmall {
    float: right;
    width: auto;
    height: 5em;
}

/* the interactive program figure (design/ops-figure.js): <div class="opsfig" data-opsfig> */
.opsfig { margin: 1.5em 0 2em; }
.opsfig h4 { margin: 1.3em 0 .45em; font-size: 1em; font-weight: 600; }
.opsfig h4 .opsfig-sub { font-weight: 400; color: #6b6b6b; }
.opsfig code { font-size: 82%; }

.opsfig-controls { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center;
    padding-bottom: .75rem; border-bottom: 1px solid #d6d6d6; }
.opsfig button { font: inherit; color: #1d1d1d; background: #fff; border: 1px solid #1d1d1d;
    border-radius: 0; cursor: pointer; }
.opsfig button:disabled { color: #b8b8b8; border-color: #d6d6d6; cursor: default; }
.opsfig-tabs { display: flex; }
.opsfig-tabs button { padding: .3rem .8rem; }
.opsfig-tabs button + button { border-left: 0; }
.opsfig-tabs button.on { background: #1d1d1d; color: #fff; }
.opsfig pre.opsfig-prog { margin: 0; }

/* theorem cards, as .theorem above */
.opsfig-thm { margin: .8rem 0; padding: .9rem 1.1rem; border-left: 4px solid #111; background: #f4f4f4; }
.opsfig-thm p { margin: .45rem 0; }
.opsfig-thm > :first-child { margin-top: 0; }
.opsfig-thm > :last-child { margin-bottom: 0; }
.opsfig-thm > p:first-child > b:first-child { font-style: italic; }
.opsfig-thm .katex-display { margin: .7rem 0; overflow-x: auto; overflow-y: hidden; }
/* the Lean statement, an expansion as in the explorer's cards */
.opsfig-lean-details { margin-top: .7rem; font-size: .85rem; }
.opsfig-lean-details > summary { color: #6b6b6b; cursor: pointer; }
.opsfig-lean-details[open] > summary { color: #1d1d1d; }
.opsfig-lean-details pre { margin: .5rem 0 0; background: #ededed; }
.opsfig-prog span { display: inline-block; min-width: 100%; }
.opsfig-prog .opsfig-comment { color: #6b6b6b; }

.opsfig table { width: 100%; border-collapse: collapse; font-size: 92%; }
.opsfig td { padding: .4em .5em .4em 0; border-bottom: 1px solid #d6d6d6; vertical-align: top; }
.opsfig-ops code { font-weight: 600; }
.opsfig-f { display: block; margin-top: .15em; font-family: 'DejaVu Sans Mono', Menlo, Consolas, monospace; font-size: 82%; }
.opsfig-lean { color: #6b6b6b; font-size: 85%; }
.opsfig-ops .opsfig-lean { display: block; }
.opsfig-note { color: #6b6b6b; font-size: 92%; margin: .6em 0 0; }

/* one operation, highlighted wherever it appears */
.opsfig [data-op] { cursor: default; }
.opsfig tr.hl td, .opsfig-prog span.hl { background: #f6dff7; }
.opsfig-prog span.hl { color: #1d1d1d; }

/* the implementation table of the linked program */
.opsfig-impl td { padding: .55em 0; }
.opsfig-proves { display: block; margin-top: .15em; }
.opsfig-impl .opsfig-lean { display: block; }
.opsfig [data-op]:focus { outline: 1px dotted #a813ae; outline-offset: 1px; }
.opsfig-caption { min-height: 3em; margin: 1em 0 0; padding: .6em .9em; background: #f4f4f4;
    border-left: 4px solid #1d1d1d; font-size: 95%; }
.opsfig-caption code { background: none; }
.opsfig-switch { display: inline-flex; margin-left: .6rem; vertical-align: 1px; font-weight: 400; }
.opsfig-switch button { padding: .05rem .5rem; font-size: 85%; }
.opsfig-switch button + button { border-left: 0; }
.opsfig-switch button.on { background: #1d1d1d; color: #fff; }
.opsfig-entry { display: block; font-weight: 600; }
.opsfig-cost { display: block; margin-top: .1em; }
.opsfig-prog .opsfig-comment.hl { color: #6b6b6b; }
.opsfig-model { margin: 0 0 .4em; font-size: 95%; }

/* highlighting in code blocks (md2html.py): keywords and comments */
pre .kw { font-weight: 600; }
pre .co { color: #9a9a9a; font-style: italic; }
