/* The website's own styles on top of the Sphinx Book theme. */

/* Wide figures and tables use the theme's full width, the text column and the right margin, where the theme folds
   its contents list away while they are in view. Narrower screens show them in the text column. */
@media (min-width: 1200px) {
  .bd-article figure.full-width,
  .bd-article .pst-scrollable-table-container:has(> table.full-width) {
    width: calc(100% + var(--pst-sidebar-secondary) - 1rem);
    max-width: calc(100% + var(--pst-sidebar-secondary) - 1rem);
    position: relative;
    z-index: 2;
  }
}
.bd-article .pst-scrollable-table-container:has(> table.full-width) > table { width: 100%; }

/* Charts: the page scales a chart down where the column is narrower than the chart. */
.tnzr-chart { overflow-x: auto; overflow-y: hidden; padding: 0.25rem 0; }
.tnzr-chart .vega-embed { display: flex; flex-direction: column; align-items: flex-start; width: 100%; }
.tnzr-chart .vega-embed > svg, .tnzr-chart img { max-width: 100%; height: auto; }
/* On phones, charts and drawings keep a legible size, and the reader scrolls them sideways. A shadow at the edge of a
   chart marks the part beyond the screen. */
.ir-drawing-box, .tnzr-svg-box { overflow-x: auto; }
@media (max-width: 767.98px) {
  .tnzr-chart .vega-embed > svg, .tnzr-chart img, .ir-drawing-box .ir-drawing, .tnzr-svg-box > svg { max-width: none; }
  .tnzr-chart {
    background:
      linear-gradient(to right, var(--pst-color-background) 30%, transparent) left / 2.5rem 100%,
      linear-gradient(to left, var(--pst-color-background) 30%, transparent) right / 2.5rem 100%,
      radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.18), transparent) left / 0.9rem 100%,
      radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.18), transparent) right / 0.9rem 100%;
    background-repeat: no-repeat;
    background-attachment: local, local, scroll, scroll;
  }
}
/* A clickable text of a chart, such as a datatype in its header, shows the keyboard focus. */
.tnzr-chart svg text[tabindex]:focus { outline: none; }
.tnzr-chart svg text[tabindex]:focus-visible { outline: 2px solid var(--pst-color-primary); outline-offset: 2px; }

/* Captions: one style for figures and tables, each caption one paragraph that starts with the number. */
.bd-article figure { margin: 1.75rem 0 2rem; padding: 0; text-align: left; }
.bd-article figure figcaption, .bd-article figure figcaption p {
  text-align: left; font-size: 0.92rem; }
.bd-article figure figcaption { margin-top: 0.5rem; padding: 0; }
.bd-article figure figcaption p { color: var(--pst-color-text-base); margin-bottom: 0.25rem; }
.bd-article .caption-number { font-weight: 600; font-style: normal; }
.bd-article .caption-text { font-weight: normal; font-style: normal; }
.bd-article table caption { caption-side: top; text-align: left; font-style: normal; font-size: 0.92rem;
  color: var(--pst-color-text-base); padding: 0 0 0.5rem; }

/* Tables of numbers: numbers align right in digits of equal width and stay on one line, and so do all cells of the
   wide tables. Headers wrap and sit at the bottom of their row. */
.bd-content table.tnzr-numbers { font-size: 0.92rem; }
.bd-content table.tnzr-numbers th { vertical-align: bottom; }
.bd-content table th .tnzr-unit { white-space: nowrap; }
.bd-content table td.tnzr-n, .bd-content table th.tnzr-n { text-align: right; font-variant-numeric: tabular-nums; }
.bd-content table td.tnzr-n, .bd-content table.full-width td { white-space: nowrap; }

/* On phones, tables keep a legible width and scroll sideways, while their captions stay in view. */
@media (max-width: 767.98px) {
  .pst-scrollable-table-container > table { min-width: 36rem; }
  .pst-scrollable-table-container > table > caption { position: sticky; left: 0; max-width: calc(100vw - 2rem); }
}

/* Code in the text, such as einsums, axes and parts of programs, in the text color on a light background, and the
   einsums and extents of the workload tables in the same font. */
.bd-article code.literal { color: var(--pst-color-text-base); border: none; padding: 0.05rem 0.25rem; }
.bd-article a code.literal { color: inherit; }
.bd-content table[id^="tab-workloads-"] td { vertical-align: baseline; }
.bd-content table[id^="tab-workloads-"] td:nth-child(2), .bd-content table[id^="tab-workloads-"] td:nth-child(3) {
  font-family: var(--pst-font-family-monospace); font-size: 0.875em; }

/* The hover details of the charts let taps and clicks pass to the page beneath them. On touch screens, a tapped
   mark keeps its details until the next tap, and the page's script hides them when the page scrolls. */
#vg-tooltip-element { pointer-events: none; }

/* Citations: a number in brackets after the work's name, a card with the work's entry on hover, focus or tap, and
   the page's list of references at its end. */
.tnzr-cite { white-space: nowrap; }
.tnzr-cite a.tnzr-cite-ref { text-decoration: none; }
.tnzr-cite a.tnzr-cite-ref:hover, .tnzr-cite a.tnzr-cite-ref:focus-visible { text-decoration: underline; }
.tnzr-cite-card {
  display: none; position: absolute; z-index: 1050; max-width: min(26rem, calc(100vw - 16px));
  padding: 0.6rem 0.8rem; font-size: 0.88rem; line-height: 1.45;
  background: var(--pst-color-background); color: var(--pst-color-text-base);
  border: 1px solid var(--pst-color-border); border-radius: 6px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15); }
.tnzr-cite-card.visible { display: block; }
.tnzr-cite-card .tnzr-ref-venue, ol.tnzr-references .tnzr-ref-venue { color: var(--pst-color-text-muted); }
ol.tnzr-references { list-style: none; padding-left: 0; }
ol.tnzr-references li { display: flex; gap: 0.6rem; margin-bottom: 0.6rem; scroll-margin-top: 5rem; }
ol.tnzr-references li:target { background: var(--pst-color-surface); border-radius: 4px; }
ol.tnzr-references .tnzr-ref-label { flex: 0 0 2.2rem; color: var(--pst-color-text-muted); }
ol.tnzr-references .tnzr-ref-back { text-decoration: none; margin-left: 0.2rem; }
.tnzr-cite a.tnzr-cite-ref, ol.tnzr-references li .tnzr-ref-label { font-variant-numeric: tabular-nums; }
[id^="cite-"] { scroll-margin-top: 5rem; }

/* The draft's todos. */
mark.todo { background: #fde68a; color: #0b0b0b; padding: 0 0.2em; border-radius: 3px; }
html[data-theme="dark"] mark.todo { background: #a16207; color: #f0efec; }

/* The overview's tagline. */
.tnzr-lead { font-size: 1.15rem; color: var(--pst-color-text-muted); margin-top: -0.5rem; }

/* The workflow diagram, recolored by the theme. */
.wf-drawing { max-width: 100%; height: auto; font-family: system-ui, sans-serif; }
.wf-drawing text { font-size: 14px; fill: var(--pst-color-text-base); }
.wf-drawing .wf-small { font-size: 13px; fill: var(--pst-color-text-muted); }
.wf-drawing .wf-label { font-size: 13px; fill: var(--pst-color-text-muted); }
.wf-drawing .wf-task rect { fill: var(--pst-color-background); stroke: var(--pst-color-text-muted); stroke-width: 1.5; }
.wf-drawing .wf-inside rect { fill: none; stroke-dasharray: none; }
.wf-drawing .wf-part rect { fill: var(--pst-color-surface); stroke: #2a78d6; stroke-width: 1.5; }
.wf-drawing .wf-review rect { stroke: var(--pst-color-text-muted); }
.wf-drawing .wf-compiler { fill: none; stroke: var(--pst-color-border); stroke-width: 1.2; }
.wf-drawing .wf-arrow { stroke: var(--pst-color-text-muted); stroke-width: 1.5; }
.wf-drawing .wf-arrowhead { fill: var(--pst-color-text-muted); }

/* The color mode menu: the gray background follows the pointer and the keyboard focus, and the current mode keeps the
   theme's blue, as the current chapter in the sidebar does. */
.bd-header-article .dropdown-menu .dropdown-item { background-color: transparent; }
.bd-header-article .dropdown-menu .dropdown-item:hover,
.bd-header-article .dropdown-menu .dropdown-item:focus-visible { background-color: var(--pst-color-surface); }
.bd-header-article .dropdown-menu .dropdown-item.active { color: var(--pst-color-primary); }
/* The color mode menu opens right-aligned with its button and just below it, on hover and on click. An invisible
   strip above the menu bridges the gap to the button, so that the hover menu stays open on the pointer's way. */
.bd-header-article .theme-switch-container .dropdown-menu { top: calc(100% + 0.125rem); right: 0; left: auto; margin-top: 0; transform: none; }
.bd-header-article .theme-switch-container .dropdown-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -0.25rem; height: 0.25rem; }

/* A sidebar dialog takes the focus itself when it opens (site.js), so that no link of the dialog shows a focus ring
   after a click. */
#pst-primary-sidebar-modal:focus, #pst-secondary-sidebar-modal:focus { outline: none; }

/* The theme marks its folded contents list with a glyph of an icon font that it does not load. A chevron of the
   page's font replaces the glyph. */
.bd-sidebar-secondary.hide:not(:hover) .onthispage::after { content: "\25BE"; font-family: inherit; font-weight: normal; }
