/* ipynbtopdfscanner — the printed page.
 * Only plain hex/rgb colours here: these styles are also read by the PDF renderer. */

.paper {
  --fs: 14px;
  --font-body: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-head: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, Menlo, monospace;
  --gutter: 0px;
  position: absolute;
  top: 0;
  left: 0;
  box-sizing: border-box;
  width: var(--pw);
  padding: var(--m);
  background: #ffffff;
  color: #1f2328;
  font-family: var(--font-body);
  font-size: var(--fs);
  line-height: 1.6;
  text-align: left;
  transform-origin: 0 0;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
.paper.serif { --font-body: 'Source Serif 4', Georgia, 'Times New Roman', serif; --font-head: 'Source Serif 4', Georgia, serif; }
.paper.prompts { --gutter: 4.6em; }
.paper *, .paper *::before, .paper *::after { box-sizing: border-box; }

.nb { position: relative; width: var(--cw); }

/* ---------- cells ---------- */
.cell { position: relative; margin: 0 0 1em; }
.cell.page-first { margin-top: 0 !important; }
.cell.cont > :first-child, .page-first > :first-child { margin-top: 0 !important; }
.cell > :last-child { margin-bottom: 0; }

.prompt {
  position: absolute;
  left: calc(-1 * var(--gutter));
  width: calc(var(--gutter) - 0.6em);
  top: 0.62em;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.72em;
  line-height: 1.5;
  color: #3667c4;
  white-space: nowrap;
}
.prompt.out { color: #c4512b; top: 0.2em; }
.code-cell, .raw-cell { padding-left: var(--gutter); }
.input { position: relative; }

/* ---------- title ---------- */
.nb-title { padding-bottom: 0.9em; margin-bottom: 1.6em; border-bottom: 2px solid #1f2328; }
.nb-title h1 { font-family: var(--font-head); font-size: 2.05em; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 0.25em; font-weight: 700; }
.nb-title p { margin: 0; color: #6a737d; font-size: 0.9em; }
.nb-title p.by { color: #24292f; font-size: 1.05em; font-weight: 600; margin-bottom: 0.2em; }
.nb-title.no-h1 { border-bottom-width: 1px; border-bottom-color: #d0d7de; padding-bottom: 0.6em; margin-bottom: 1.2em; }

/* ---------- table of contents ---------- */
.toc { margin-bottom: 0; }
.toc-head { font-family: var(--font-head); font-size: 1.45em; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 0.7em; color: #111418; }
.toc-row { display: flex; align-items: baseline; gap: 0.5em; padding: 0.28em 0; color: #24292f; text-decoration: none; }
.toc-row .toc-t { flex: 0 1 auto; min-width: 0; }
.toc-row .toc-dots { flex: 1 1 auto; min-width: 1.5em; border-bottom: 1.5px dotted #b8bfc7; transform: translateY(-0.3em); }
.toc-row .toc-p { flex: none; min-width: 2.5ch; text-align: right; font-variant-numeric: tabular-nums; color: #57606a; }
.toc-row.l0 { font-weight: 600; margin-top: 0.35em; }
.toc-row.l1 { padding-left: 1.4em; }
.toc-row.l2 { padding-left: 2.8em; font-size: 0.94em; color: #444c56; }

/* ---------- "Jupyter (as is)" layout: looks like the notebook in Jupyter ---------- */
.paper.jupyter { --gutter: 5.6em; line-height: 1.5; }
.paper.jupyter .cell { margin-bottom: 0.7em; }
.paper.jupyter .prompt { font-size: 0.74em; top: 0.55em; }
.paper.jupyter .prompt.in { color: #303f9f; }
.paper.jupyter .prompt.out { color: #d84315; top: 0.25em; }
.paper.jupyter .code {
  background: #f7f7f7;
  border: 1px solid #cfcfcf;
  border-radius: 2px;
  padding: 0.45em 0.6em;
  font-size: 0.82em;
  line-height: 1.45;
}
.paper.jupyter .code.broken, .paper.jupyter .code.cont { border-style: solid; }
.paper.jupyter .text-out { border-left: 0; padding-left: 0.6em; }
.paper.jupyter .text-out.stderr { background: #ffdddd; }
.paper.jupyter .text-out.error { background: #ffdddd; border-left: 0; border-radius: 0; }
.paper.jupyter .md, .paper.jupyter .raw-cell { padding-left: var(--gutter); }
.paper.jupyter .md h1, .paper.jupyter .md h2 { border-bottom: 0; padding-bottom: 0; }
.paper.jupyter .md h1 { font-size: 1.85em; }
.paper.jupyter .md h2 { font-size: 1.5em; }
.paper.jupyter .md code { background: #eff0f1; border-radius: 2px; }
.paper.jupyter .out-html thead th { border-bottom: 1px solid #000000; }
.paper.jupyter .out-html tbody tr:nth-child(odd) { background: #f5f5f5; }
/* Jupyter's own code colours */
.paper.jupyter .hljs-keyword, .paper.jupyter .hljs-built_in { color: #008000; font-weight: 700; }
.paper.jupyter .hljs-string { color: #ba2121; }
.paper.jupyter .hljs-number, .paper.jupyter .hljs-literal { color: #008000; }
.paper.jupyter .hljs-comment { color: #408080; font-style: italic; }
.paper.jupyter .hljs-title, .paper.jupyter .hljs-title.function_, .paper.jupyter .hljs-title.class_ { color: #0000ff; }
.paper.jupyter .hljs-meta, .paper.jupyter .hljs-decorator { color: #aa22ff; }
.paper.jupyter .hljs-operator { color: #aa22ff; font-weight: 700; }
.paper.jupyter .hljs-params, .paper.jupyter .hljs-variable, .paper.jupyter .hljs-attr { color: #212121; }

/* ---------- ink saver: no grey fills, lighter rules ---------- */
.paper.ink .code { background: #ffffff; border-color: #c9ced4; }
.paper.ink .md code, .paper.ink .out-md code { background: none; padding: 0; }
.paper.ink .text-out.stderr, .paper.ink .text-out.error { background: #ffffff; }
.paper.ink .out-html tbody tr:nth-child(odd), .paper.ink .md table.md-table thead th { background: none; }
.paper.ink .nb-title { border-bottom-width: 1px; }

/* ---------- watermark ---------- */
.wm-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.wm, .wm-print {
  position: absolute;
  left: 50%;
  white-space: nowrap;
  font: 800 var(--wm-size, 96px)/1 'Inter', Helvetica, Arial, sans-serif;
  letter-spacing: 0.04em;
  color: rgba(60, 60, 60, 0.1);
  transform: translate(-50%, -50%) rotate(var(--wm-angle, -45deg));
  pointer-events: none;
  user-select: none;
}
.wm-print { display: none; }

/* ---------- markdown ---------- */
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6, .out-md h1, .out-md h2, .out-md h3 {
  font-family: var(--font-head);
  line-height: 1.25;
  font-weight: 700;
  margin: 1.3em 0 0.5em;
  color: #111418;
  letter-spacing: -0.01em;
}
.md > :first-child { margin-top: 0; }
.md h1 { font-size: 1.85em; padding-bottom: 0.25em; border-bottom: 1px solid #d8dde3; }
.md h2 { font-size: 1.45em; padding-bottom: 0.2em; border-bottom: 1px solid #e6e9ed; }
.md h3 { font-size: 1.22em; }
.md h4 { font-size: 1.06em; }
.md h5, .md h6 { font-size: 0.95em; color: #444c56; }
.md p, .out-md p { margin: 0 0 0.75em; overflow-wrap: break-word; }
.md ul, .md ol, .out-md ul, .out-md ol { margin: 0 0 0.75em; padding-left: 1.6em; }
.md li { margin: 0.15em 0; }
.md li > p { margin: 0.2em 0; }
.md a, .out-md a, .out-html a { color: #0b62c4; text-decoration: underline; text-decoration-color: #9fc1ea; text-underline-offset: 2px; }
.md blockquote { margin: 0 0 0.8em; padding: 0.2em 1em; border-left: 3px solid #d0d7de; color: #4b545e; }
.md hr { border: 0; border-top: 1px solid #d8dde3; margin: 1.4em 0; }
.md img { max-width: 100%; height: auto; max-height: var(--max-img, 900px); object-fit: contain; }
.md code, .out-md code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: #f0f2f5;
  border-radius: 4px;
  padding: 0.1em 0.35em;
  overflow-wrap: anywhere;
}
.md .katex-display, .out-md .katex-display { margin: 0.7em 0; overflow: hidden; }
.md table.md-table { border-collapse: collapse; margin: 0 0 0.9em; font-size: 0.92em; }
.md table.md-table th, .md table.md-table td { border: 1px solid #d0d7de; padding: 0.35em 0.7em; vertical-align: top; }
.md table.md-table thead th { background: #f3f5f7; font-weight: 600; }
.img-missing { display: block; font-size: 0.82em; color: #8a6d3b; background: #fcf8e3; border: 1px dashed #e0c98a; border-radius: 6px; padding: 0.5em 0.8em; margin: 0.4em 0; }

/* ---------- code ---------- */
.code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  line-height: 1.55;
  background: #f6f8fa;
  border: 1px solid #e1e5ea;
  border-radius: 7px;
  padding: 0.62em 0.95em;
  margin: 0 0 0.8em;
  color: #24292f;
  font-variant-ligatures: none;
}
.input .code { margin: 0; }
.code.broken { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-style: dashed; padding-bottom: 0.3em; }
.code.cont { border-top-left-radius: 0; border-top-right-radius: 0; border-top-style: dashed; padding-top: 0.3em; }
.cl { white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; tab-size: 4; -moz-tab-size: 4; min-height: 1.55em; }
.numbered .cl { display: flex; }
.numbered .ln { flex: 0 0 calc(var(--lnw) + 1.4ch); padding-right: 1.4ch; text-align: right; color: #a0a8b1; user-select: none; }
.numbered .cx { flex: 1 1 auto; min-width: 0; }

/* syntax colours (GitHub-light style, print friendly) */
.hljs-keyword, .hljs-selector-tag, .hljs-built_in.hljs-keyword, .hljs-type, .hljs-meta .hljs-keyword { color: #cf222e; }
.hljs-built_in { color: #8250df; }
.hljs-title, .hljs-title.function_, .hljs-title.class_, .hljs-section { color: #6639ba; }
.hljs-string, .hljs-regexp, .hljs-meta .hljs-string { color: #0a3069; }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet, .hljs-attr, .hljs-variable, .hljs-template-variable { color: #0550ae; }
.hljs-comment, .hljs-quote { color: #6e7781; font-style: italic; }
.hljs-meta, .hljs-decorator { color: #953800; }
.hljs-params { color: #24292f; }
.hljs-subst { color: #24292f; }
.hljs-name, .hljs-tag { color: #116329; }
.hljs-deletion { color: #82071e; background: #ffebe9; }
.hljs-addition { color: #116329; background: #dafbe1; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 600; }

/* ---------- outputs ---------- */
.outputs { margin-top: 0.5em; }
.outputs.alone { margin-top: 0; }
.output { position: relative; }
.output + .output { margin-top: 0.45em; }
.text-out {
  font-family: var(--font-mono);
  font-size: 0.8em;
  line-height: 1.5;
  padding: 0.15em 0 0.15em 0.95em;
  border-left: 2px solid #e3e7ec;
  color: #24292f;
  font-variant-ligatures: none;
}
.ol { white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 8; min-height: 1.5em; }
.ol.trim { color: #8b949e; font-style: italic; text-align: center; padding: 0.25em 0; }
.text-out.stderr { background: #fff8f6; border-left-color: #f1b8a8; }
.text-out.error { background: #fff3f2; border-left: 3px solid #e5534b; padding: 0.5em 0.8em; border-radius: 0 6px 6px 0; }
.raw .text-out { border-left-style: dotted; color: #57606a; }

.out-img { display: block; max-width: 100%; height: auto; max-height: var(--max-img, 900px); object-fit: contain; margin: 0.15em 0; }
.out-latex { padding: 0.2em 0; overflow: hidden; }
.out-note { font-size: 0.82em; color: #6a737d; font-style: italic; padding: 0.4em 0.8em; border: 1px dashed #d0d7de; border-radius: 6px; }
.plotly-slot { min-height: 120px; display: flex; align-items: center; justify-content: center; color: #8b949e; font-size: 0.85em; border: 1px dashed #d0d7de; border-radius: 6px; }

.out-html { font-size: 0.92em; overflow-wrap: break-word; }
.out-html.scaled { overflow: hidden; }
.fitbox { transform-origin: 0 0; }
.out-html pre { font-family: var(--font-mono); font-size: 0.86em; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0.3em 0; }
.out-html img { max-width: 100%; height: auto; }
.out-html table {
  border-collapse: collapse;
  border: 0;
  margin: 0.2em 0 0.4em;
  font-size: 0.84em;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  color: #24292f;
}
.out-html th, .out-html td { padding: 0.32em 0.75em; border: 0; border-bottom: 1px solid #e6e9ed; text-align: right; vertical-align: middle; white-space: nowrap; }
.out-html thead th { border-bottom: 1.5px solid #8c959f; font-weight: 600; vertical-align: bottom; }
.out-html tbody th { font-weight: 600; }
.out-html tbody tr:nth-child(odd) { background: #f7f8fa; }
.out-html table.wrap-cells th, .out-html table.wrap-cells td { white-space: normal; overflow-wrap: anywhere; }
.thead-repeat th { color: #57606a; }
.out-html .dataframe { margin-left: 0; }
.out-html p { margin: 0.3em 0; }

/* KaTeX tweaks */
.paper .katex { font-size: 1.08em; }
.paper .katex-display > .katex { text-align: center; }
.tex { color: #b3261e; }

/* ---------- page seams (preview only) ---------- */
.pg-break { margin: 0 calc(-1 * var(--m)); }
.pg-fill, .pg-top { background: #ffffff; }
.pg-gap {
  position: relative;
  background: var(--gap-bg, #e9e6df);
  box-shadow: inset 0 7px 7px -7px rgba(0, 0, 0, 0.28), inset 0 -7px 7px -7px rgba(0, 0, 0, 0.28);
}
.pg-label {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font: 600 11px/1 'Inter', sans-serif;
  letter-spacing: 0.02em;
  color: var(--gap-ink, #8a857a);
}
.pg-end { background: #ffffff; }
.pg-group { display: contents; }

/* hover / selection for "hide this cell" (preview only) */
.paper:not(.stage) .cell[data-cell] { border-radius: 4px; }
.paper:not(.stage) .cell.sel { outline: 2px solid #f08a4b; outline-offset: 4px; }
@media (hover: hover) {
  .paper:not(.stage) .cell[data-cell]:hover { outline: 2px dashed #f4b48b; outline-offset: 4px; }
  .paper:not(.stage) .cell.sel:hover { outline-style: solid; }
}

/* ---------- printing (vector PDF via the browser) ---------- */
@media print {
  html, body { background: #ffffff !important; height: auto !important; overflow: visible !important; }
  body > :not(#workspace) { display: none !important; }
  #workspace > :not(.viewer), .viewer > :not(.scroller) { display: none !important; }
  #workspace, .viewer, .scroller, .paper-wrap {
    display: block !important; position: static !important; overflow: visible !important;
    width: auto !important; height: auto !important; max-height: none !important;
    margin: 0 !important; padding: 0 !important; border: 0 !important; box-shadow: none !important;
    background: #ffffff !important; transform: none !important;
  }
  .paper { position: static !important; width: auto !important; padding: 0 !important; transform: none !important; box-shadow: none !important; }
  .nb { width: auto !important; }
  /* One box per page, exactly one page tall: tiny print/screen metric differences can never spill a blank page. */
  .pg-group { display: block; height: var(--sheet-h); overflow: hidden; break-after: page; page-break-after: always; }
  .pg-group.multi { height: auto; overflow: visible; }
  .pg-group.last { height: auto; overflow: visible; break-after: auto; page-break-after: auto; }
  .pg-break, .pg-end, .cell-tool, .wm-layer { display: none !important; }
  /* A fixed element is repeated on every printed page. */
  .wm-print { display: block; position: fixed; top: 50%; }
  .cell[data-cell] { outline: none !important; }
  .cl, .ol, tr, img, .katex-display, h1, h2, h3, h4, h5, h6, pre, .atom { break-inside: avoid; page-break-inside: avoid; }
  h1, h2, h3, h4, h5, h6 { break-after: avoid; page-break-after: avoid; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}
