/*
 * Article reading features (research.oraclizer.io, round 5): citations, glossary terms, the shared card,
 * section dividers, quotations, image figures in the figure kit, figure zoom, the citation dialog, the notice and
 * formula layout. Figure captions come from the figure kit (r3/figures/research-figure-kit.css), which the page loads.
 * Colours come from the docs tokens (r3/docs.css), so the dark theme needs no extra rules.
 */

/* ---------- citations ---------- */

.docs-prose sup.ref-sup {
  margin-left: 0.06em;
  font-size: 0.68em;
  font-weight: 600;
  line-height: 0;
  letter-spacing: 0;
  white-space: nowrap;
  vertical-align: super;
}
.docs-prose a.ref {
  padding: 0.1em 0.12em;
  border-radius: 2px;
  color: var(--blue-text);
  font-weight: 600;
  text-decoration: none;
}
.docs-prose a.ref:hover,
.docs-prose a.ref:focus-visible,
.docs-prose a.ref:target {
  background: var(--mark-bg);
}
.docs-prose .orz-ref-entry {
  /* the page's scroll-padding-top already clears the header (2026-10-17) */
  scroll-margin-top: 0;
  transition: background-color 0.8s ease;
}
.docs-prose .orz-ref-entry:target {
  background: var(--mark-bg);
  box-shadow: 0 0 0 6px var(--mark-bg);
}
.docs-prose a.ref-back {
  margin-left: 0.2em;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}
.docs-prose a.ref-back:hover {
  color: var(--blue-text);
}
@media (pointer: coarse) {
  .docs-prose a.ref {
    margin: -0.4em -0.1em;
    padding: 0.4em 0.22em;
  }
}

/* ---------- glossary terms ---------- */

.docs-prose a.gl {
  color: inherit;
  font-weight: inherit;
  text-decoration: underline dotted;
  text-decoration-color: var(--blue-soft, var(--blue));
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}
.docs-prose a.gl:hover,
.docs-prose a.gl:focus-visible {
  color: var(--blue-text);
  text-decoration-style: solid;
}

/* ---------- card (reference or term) ---------- */

.orz-card {
  position: fixed;
  inset: auto;
  z-index: 400;
  box-sizing: border-box;
  width: min(360px, calc(100vw - 24px));
  max-height: min(60vh, 440px);
  margin: 0;
  padding: 14px 16px 12px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink-soft);
  box-shadow: 0 14px 36px rgba(7, 16, 29, 0.16);
  font: 400 13.5px/1.6 var(--body);
  text-align: left;
}
.orz-card[hidden] {
  display: none;
}
.orz-card__kicker {
  margin: 0 28px 6px 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.orz-card__close {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.orz-card.is-sticky .orz-card__close {
  display: inline-flex;
}
.orz-card__close svg {
  width: 14px;
  height: 14px;
}
.orz-card__term {
  margin: 0 0 4px;
  color: var(--ink);
  font: 600 15px/1.35 var(--display);
  letter-spacing: -0.01em;
}
.orz-card__def,
.orz-card__body {
  margin: 0;
  overflow-wrap: anywhere;
}
.orz-card__body a {
  color: var(--blue-text);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--link-line);
  text-underline-offset: 2px;
}
.orz-card__actions {
  margin: 10px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}
.orz-card__action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blue-text);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
}
.orz-card__action:hover {
  text-decoration: underline;
}
.orz-card__action svg {
  width: 12px;
  height: 12px;
}

/* ---------- section dividers ---------- */

/* research.css draws a rule above every h2 (a border and 34px of padding). Next to the manuscript's own hr that
 * read as two lines in a row, and as a line at every section. Headings now stand on space alone, and the one
 * line left in the body is hr.orz-rule, which tidySections puts after the TL;DR block, before the conclusion
 * and before the references. The rule above the previous/next links is outside the body and stays. */
#article-body.docs-prose h2,
.docs-prose.orz-article h2 {
  padding-top: 0;
  border-top: 0;
}
#article-body.docs-prose hr.orz-rule,
.docs-prose.orz-article hr.orz-rule {
  height: 0;
  margin: 52px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
}
#article-body.docs-prose hr.orz-rule + h2,
.docs-prose.orz-article hr.orz-rule + h2 {
  margin-top: 44px;
}
/* The TL;DR block ends at the manuscript's own rule when an introduction follows it (tidySections, W7 2026-10-18):
   the introduction stands as far below the line as a heading would. */
#article-body.docs-prose hr.orz-rule + :not(h2),
.docs-prose.orz-article hr.orz-rule + :not(h2) {
  margin-top: 44px;
}

/* ---------- quotations ---------- */

/* A quotation reads as a quotation (Jay 2026-10-17, confirmed on the Core article): an oversized blue opening mark
 * hangs in the left margin, the quoted words sit indented beside it in the display face, one step larger than the
 * body, and the source is small and muted under them. styleQuotes marks the parts and drops the dash before the
 * source. Italics of the quoted words are dropped: the mark already says it is a quotation. The words keep the
 * regular weight; only the author's own bold stands out (Jay 2026-10-17: a heavier weight read as all bold). */
#article-body.docs-prose blockquote.orz-quote,
.docs-prose.orz-article blockquote.orz-quote {
  position: relative;
  margin: 44px 0;
  padding: 2px 0 2px 64px;
  border: 0;
  background: none;
}
#article-body.docs-prose blockquote.orz-quote::before,
.docs-prose.orz-article blockquote.orz-quote::before {
  position: absolute;
  top: -10px;
  left: 0;
  color: var(--blue);
  content: "\201C";
  font-family: var(--display);
  font-size: 84px;
  font-weight: 600;
  line-height: 1;
}
#article-body.docs-prose blockquote.orz-quote > p,
.docs-prose.orz-article blockquote.orz-quote > p {
  margin: 0;
  color: var(--ink);
  font-family: var(--display);
  font-size: 24px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.45;
  text-wrap: pretty;
}
#article-body.docs-prose blockquote.orz-quote > p em,
.docs-prose.orz-article blockquote.orz-quote > p em {
  font-style: normal;
}
#article-body.docs-prose blockquote.orz-quote > p + p,
.docs-prose.orz-article blockquote.orz-quote > p + p {
  margin-top: 14px;
}
#article-body.docs-prose .orz-quote__source,
.docs-prose.orz-article .orz-quote__source {
  display: block;
  margin-top: 16px;
  color: var(--muted);
  font-family: var(--body);
  font-size: 13px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.55;
}
@media (max-width: 640px) {
  #article-body.docs-prose blockquote.orz-quote,
  .docs-prose.orz-article blockquote.orz-quote {
    padding-left: 44px;
  }
  #article-body.docs-prose blockquote.orz-quote::before,
  .docs-prose.orz-article blockquote.orz-quote::before {
    top: -6px;
    font-size: 60px;
  }
  #article-body.docs-prose blockquote.orz-quote > p,
  .docs-prose.orz-article blockquote.orz-quote > p {
    font-size: 19.5px;
  }
}

/* A stated definition or result kept in a quotation block (site.js marks it orz-statement): no quotation mark, a
 * blue rule down its left edge, the words in the display face one step above the body. */
#article-body.docs-prose blockquote.orz-statement {
  padding: 4px 0 4px 24px;
  border-left: 3px solid var(--blue);
}
#article-body.docs-prose blockquote.orz-statement::before {
  content: none;
}
#article-body.docs-prose blockquote.orz-statement > p {
  font-size: 20px;
  line-height: 1.5;
}
@media (max-width: 640px) {
  #article-body.docs-prose blockquote.orz-statement {
    padding-left: 18px;
  }
  #article-body.docs-prose blockquote.orz-statement > p {
    font-size: 17.5px;
  }
}

/* A paragraph of formulas only (site.js promoteMathParagraphs, Jay 2026-10-17 item 9): centred like a display
 * formula, each formula whole, wrapping as whole formulas on narrow screens. */
#article-body.docs-prose p.orz-math-line {
  align-items: baseline;
  column-gap: 1.8em;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 22px 0 26px;
  row-gap: 10px;
}
#article-body.docs-prose p.orz-math-line .orz-math-line__item {
  white-space: nowrap;
}

/* ---------- figures that came from images or older diagrams ---------- */

/* unifyCaptions marks them rfig, so the figure kit draws their caption (blue "Figure n", title in ink) in both
 * themes; here they only take the kit's figure spacing instead of the WordPress image margins. */
#article-body.docs-prose figure.orz-figure,
.docs-prose.orz-article figure.orz-figure {
  margin: 12px 0 36px;
}
#article-body.docs-prose figure.orz-figure img,
.docs-prose.orz-article figure.orz-figure img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ---------- figure zoom ---------- */

.orz-zoomable {
  position: relative;
}
.orz-zoom-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  cursor: zoom-in;
  opacity: 0.85;
  transition: opacity 0.12s, border-color 0.12s, color 0.12s;
}
.orz-zoom-btn:hover,
.orz-zoom-btn:focus-visible {
  border-color: var(--blue);
  color: var(--blue-text);
  opacity: 1;
}
.orz-zoom-btn svg {
  width: 16px;
  height: 16px;
}
@media (pointer: coarse) {
  .orz-zoom-btn {
    width: 40px;
    height: 40px;
    opacity: 1;
  }
}
.orz-zoom .orz-zoom-btn {
  display: none;
}
html.orz-zoom-open {
  overflow: hidden;
}

dialog.orz-zoom {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: var(--page, #f5f7fb);
  color: var(--ink);
  font-size: 16px;
}
dialog.orz-zoom::backdrop {
  background: rgba(5, 8, 13, 0.55);
}
.orz-zoom__stage {
  position: absolute;
  inset: 0 0 56px;
  overflow: hidden;
  outline: none;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.orz-zoom__stage.is-dragging {
  cursor: grabbing;
}
.orz-zoom__canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}
.orz-zoom__canvas > * {
  max-width: none !important;
  margin: 0 !important;
}
.orz-zoom__bar {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 56px;
  padding: 0 8px 0 20px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.docs-prose .orz-zoom__cap,
.orz-zoom__cap {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font: 600 13px/1.4 var(--body);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.orz-zoom__tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: 2px;
}
.orz-zoom__pct {
  min-width: 52px;
  color: var(--muted);
  font: 600 12px/1 var(--body);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.orz-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.orz-icon-btn:hover,
.orz-icon-btn:focus-visible {
  border-color: var(--line-strong);
  color: var(--ink);
}
.orz-icon-btn svg {
  width: 18px;
  height: 18px;
}
@media (max-width: 640px) {
  .orz-zoom__cap {
    display: none;
  }
  .orz-zoom__bar {
    justify-content: center;
    padding: 0 8px;
  }
}

/* ---------- citation dialog ---------- */

dialog.orz-dialog {
  box-sizing: border-box;
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink-soft);
  box-shadow: 0 24px 64px rgba(5, 8, 13, 0.28);
  font: 400 14px/1.6 var(--body);
}
dialog.orz-dialog::backdrop {
  background: rgba(5, 8, 13, 0.45);
}
.orz-dialog__box {
  padding: 20px 22px 24px;
}
.orz-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 -8px 14px 0;
}
.orz-dialog__head h2 {
  margin: 0;
  color: var(--ink);
  font: 560 22px/1.2 var(--display);
  letter-spacing: -0.02em;
}
.orz-cite__fmt + .orz-cite__fmt {
  margin-top: 18px;
}
.orz-cite__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.orz-cite__row h3 {
  margin: 0;
  color: var(--muted);
  font: 800 11px/1 var(--body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.orz-copy {
  min-width: 76px;
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: 700 12px/1 var(--body);
}
.orz-copy:hover,
.orz-copy:focus-visible,
.orz-copy.is-done {
  border-color: var(--blue);
  color: var(--blue-text);
}
.orz-cite__text,
.orz-cite__bib {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.orz-cite__text {
  font-size: 14px;
  line-height: 1.6;
}
.orz-cite__bib {
  font: 12.5px/1.65 var(--mono);
  white-space: pre-wrap;
}

/* ---------- notice ---------- */

/* Every box property is set here, so no other notice rule on the page can stretch it (a share-menu rule of the
 * same old name once pinned it to both the top and the bottom of the window): one line at the bottom centre. */
.orz-article-toast {
  position: fixed;
  top: auto;
  right: auto;
  bottom: 24px;
  left: 50%;
  z-index: 500;
  display: block;
  box-sizing: border-box;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  max-width: calc(100vw - 32px);
  max-height: none;
  margin: 0;
  padding: 10px 16px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--ink);
  color: var(--panel);
  box-shadow: 0 8px 24px rgba(7, 16, 29, 0.18);
  font: 600 13px/1.4 var(--body);
  letter-spacing: 0;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0;
  visibility: visible;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.18s, transform 0.18s;
  animation: none;
}
.orz-article-toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- formulas (KaTeX) ---------- */

/* Display formulas must reflow or be rewritten for the viewport. Figures and formulas do not use scroll boxes. */
.docs-prose .math--display {
  display: block;
  max-width: 100%;
  margin: 0.9em 0;
  overflow: visible;
}

/* The print line under the title appears only on paper (print.css). */
.orz-print-meta {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .orz-article-toast,
  .docs-prose .orz-ref-entry,
  .orz-zoom-btn {
    transition: none;
  }
}

/* Phones: the enlarge button stays off the figure's own heading (round 4) without a row of its own (round 6).
   With a caption it floats at the end of the caption's first line and the text flows around it; without one
   it sits small in the figure's bottom right corner. */
@media (max-width: 760px) {
  .orz-zoom-btn.orz-zoom-btn--cap {
    position: relative;
    top: auto;
    right: auto;
    float: right;
    width: 34px;
    height: 34px;
    margin: -4px 0 4px 14px;
  }
  .orz-zoomable > .orz-zoom-btn {
    top: auto;
    bottom: 8px;
    width: 34px;
    height: 34px;
  }
  /* A 44px touch target around the 34px button. The caption button sits on the caption's right edge, so its
     target grows to the left only and the figure keeps scrollWidth <= clientWidth (2026-10-17). */
  .orz-zoom-btn::after {
    content: "";
    position: absolute;
    inset: -5px;
  }
  .orz-zoom-btn.orz-zoom-btn--cap::after {
    inset: -5px 0 -5px -10px;
  }
}
