:root {
  color-scheme: light dark;
  --fg: #1f2328;
  --muted: #59626c;
  --bg: #fcfcfa;
  --rule: #d9dbdd;
  --link: #1d5bb8;
  --code: #eff0ed;
  --ph-fg: #7a4800;
  --ph-bg: #fff0c2;
  --ph-rule: #d29f1c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e2e4e7;
    --muted: #9ba4ae;
    --bg: #16181b;
    --rule: #363b41;
    --link: #86b6ff;
    --code: #25282c;
    --ph-fg: #f4d37f;
    --ph-bg: #3a3014;
    --ph-rule: #9c7a22;
  }
}

html { background: var(--bg); color: var(--fg); }

body {
  font: 17px/1.6 Georgia, "Source Serif 4", "Times New Roman", serif;
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

/* The documentation's sidebar: beside the page on wide screens, a menu above it on narrow ones. */
body.doc { max-width: 64rem; display: grid; grid-template-columns: 13.5rem minmax(0, 44rem); gap: 0 3rem; }
details.side {
  position: sticky; top: 0; align-self: start;
  max-height: 100vh; overflow-y: auto; box-sizing: border-box;
  margin: -1.5rem 0 0; padding: 1.5rem 0 2rem;
  font: .88rem/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}
details.side summary { display: none; }
.side a { text-decoration: none; }
.side a:hover { text-decoration: underline; }
.side a.site { display: block; color: var(--fg); font-weight: 600; margin: .15rem 0 1.1rem; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side li { margin: 0; }
.side > nav > ul > li { margin-bottom: 1rem; }
.side .program > span {
  display: block; color: var(--muted); font-size: .76rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; margin-bottom: .35rem;
}
.side li li { margin-bottom: .45rem; }
.side ul.sections { margin: .15rem 0 0 .2rem; padding-left: .7rem; border-left: 1px solid var(--rule); }
.side ul.sections li { margin: .12rem 0; }
.side ul.sections a { color: var(--muted); font-size: .82rem; }
.side ul.sections a:hover { color: var(--link); }
.side a[aria-current="page"] { color: var(--fg); font-weight: 600; }
body.doc > main { min-width: 0; }

h1 { font-size: 1.65rem; line-height: 1.25; margin: 0 0 1rem; }
h1 cite { font-style: italic; }
h2 {
  font-size: 1.22rem;
  line-height: 1.3;
  margin: 2.4rem 0 .6rem;
  padding-top: .5rem;
  border-top: 1px solid var(--rule);
}
h3 { font-size: 1.03rem; line-height: 1.35; margin: 1.6rem 0 .3rem; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: .3em; }
a code { color: inherit; }
sub, sup { line-height: 0; }
img { max-width: 100%; height: auto; }
figure { margin: 1.2rem 0 1.6rem; }
figcaption { color: var(--muted); font-size: .92rem; margin-top: .4rem; }

code {
  font: .86em/1.4 ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  background: var(--code);
  border-radius: 3px;
  padding: .05em .25em;
  overflow-wrap: anywhere;
}

dl { margin: .5rem 0 1rem; }
dt { margin-top: .8rem; font-weight: bold; }
dd { margin: .15rem 0 0 1.25rem; }
dl.files dt { font-weight: normal; }
dl.files dd { margin-top: .1rem; }

ul, ol { padding-left: 1.4rem; }
li { margin: .25rem 0; }

table { border-collapse: collapse; width: 100%; margin: .6rem 0 1.2rem; font-size: .95rem; }
th, td { text-align: left; vertical-align: top; padding: .4rem .7rem .4rem 0; border-bottom: 1px solid var(--rule); }
th { font-weight: bold; }
th:last-child, td:last-child { padding-right: 0; }
thead th { border-bottom-width: 2px; }
.scroll { overflow-x: auto; }

/* References to the paper, which has no public URL yet: visibly marked placeholders. */
.placeholder, .marker {
  font: .76em/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ph-fg);
  background: var(--ph-bg);
  border: 1px dashed var(--ph-rule);
  border-radius: 3px;
  padding: .1em .3em;
  white-space: nowrap;
}

/* Native MathML, rendered by build.mjs on the generated pages. */
math { font-family: "STIX Two Math", "Latin Modern Math", "Cambria Math", math; }
math[display="block"] { margin: .8rem 0; overflow-x: auto; overflow-y: hidden; }

/* Fenced code blocks, on the generated pages only. */
pre { background: var(--code); border-radius: 3px; padding: .6rem .8rem; overflow-x: auto; }
pre code { display: block; background: none; padding: 0; line-height: 1.45; overflow-wrap: normal; }
td code { white-space: nowrap; overflow-wrap: normal; }

.note { color: var(--muted); }
/* The link to michel.ac on every page: quiet, below the content. */
footer.site { margin-top: 3rem; color: var(--muted); font-size: .8rem; }
footer.site a { color: inherit; }
body.doc > footer.site { grid-column: 2; }
.nw { white-space: nowrap; }

/* The landing page with the interactive joint density: the plot fills the
   width, with the controls beside it on wide screens and below it on narrow ones. */
body.landing { max-width: 76rem; }
body.landing h1 { max-width: 44rem; }
.intro { max-width: 44rem; margin: 0 0 .5rem; }
.enter { margin: 0 0 1rem; font-weight: bold; }
.enter a { text-decoration: none; }
.enter a:hover { text-decoration: underline; }
.demo { display: grid; grid-template-columns: minmax(0, 1fr) 16.5rem; gap: 0 1.5rem; align-items: start; }
.demo #plot { grid-row: 1; }
.demo .controls { margin: 0; padding: .2rem 0 .2rem 1.2rem; border: 0; border-left: 1px solid var(--rule); }
.demo .controls .row { flex-direction: column; align-items: flex-start; gap: .55rem; }
.demo .controls .group { flex-direction: column; align-items: flex-start; }
.demo .controls .row + .row { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.controls { margin: 1.2rem 0 .4rem; padding: .7rem 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-size: .92rem; }
.controls .row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.4rem; }
.controls .row + .row { margin-top: .55rem; }
.controls label, .controls legend, .controls .group > span:first-child { color: var(--muted); }
.controls label:has(input:checked), .controls output { color: var(--fg); }
.controls fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .9rem; }
.controls legend { float: left; padding: 0; }
.controls .group { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.controls input[type="range"] { width: 8.5rem; vertical-align: middle; }
.controls input { accent-color: var(--link); }
.controls output { display: inline-block; min-width: 2.2em; font-variant-numeric: tabular-nums; }
.controls select, .controls button {
  font: inherit; color: var(--fg); background: var(--code);
  border: 1px solid var(--rule); border-radius: 4px; padding: .1rem .6rem; text-decoration: none; cursor: pointer;
}
.controls button:hover { border-color: var(--muted); }
/* Mutually exclusive buttons as one joined control; the pressed one is filled. */
.controls .segmented { display: inline-flex; flex-wrap: nowrap; }
.controls .segmented button { border-radius: 0; margin-left: -1px; white-space: nowrap; }
.controls .segmented button:first-child { border-radius: 4px 0 0 4px; margin-left: 0; }
.controls .segmented button:last-child { border-radius: 0 4px 4px 0; }
.controls .segmented button:hover { position: relative; }
.controls .segmented button[aria-pressed="true"] { position: relative; background: var(--link); border-color: var(--link); color: var(--bg); }
.controls select:disabled { opacity: .5; cursor: default; }
#plot { width: 100%; height: min(80vh, 48rem, 110vw); min-height: 320px; }
#plot .error { padding: 2.5rem 0; color: var(--muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (max-width: 56rem) {
  body.doc { display: block; }
  details.side { position: static; max-height: none; margin: 0 0 1.6rem; padding: 0; border-bottom: 1px solid var(--rule); }
  details.side summary {
    display: list-item; cursor: pointer; padding: .2rem 0 .6rem;
    font-weight: 600; color: var(--fg);
  }
  details.side[open] summary { margin-bottom: .4rem; }
  details.side[open] nav { padding-bottom: .6rem; }
  .demo { display: block; }
  .demo .controls { padding: .7rem 0; border-left: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-top: .4rem; }
  .demo .controls .row { flex-direction: row; align-items: center; gap: .5rem 1.4rem; }
  .demo .controls .group { flex-direction: row; align-items: center; }
  .demo .controls .row + .row { margin-top: .55rem; padding-top: 0; border-top: 0; }
}

@media (max-width: 36rem) {
  body { font-size: 16px; padding: 1rem 1rem 3rem; }
  body.landing h1 { font-size: 1.3rem; margin-bottom: .6rem; }
  dd { margin-left: .8rem; }
  th, td { padding-right: .45rem; }
}
