/* Calibration documentation only. Every selector is scoped to .nrv-* content. */
.rst-content .nrv-language-switcher {
  display: flex;
  width: min(calc(100% - 3rem), 940px);
  max-width: 940px;
  margin: 0 0 1rem clamp(1.5rem, 3vw, 3rem);
  gap: 0.35rem;
  align-items: center;
  justify-content: flex-end;
}

.rst-content .nrv-language-label {
  margin-right: 0.35rem;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rst-content .nrv-language-link {
  box-sizing: border-box;
  min-width: 4.4rem;
  padding: 0.42rem 0.72rem;
  border: 1px solid #d7dee8;
  background: #fff;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.rst-content a.nrv-language-link:hover {
  border-color: #d50f34;
  color: #a70d2b;
}

.rst-content .nrv-language-link.current {
  border-color: #d50f34;
  background: #d50f34;
  color: #fff;
}

.rst-content .nrv-lead {
  max-width: 920px;
  margin: 0 0 1.6rem;
  color: #475569;
  font-size: 1.08rem;
  line-height: 1.75;
}

/* Loaded only by the calibration pages: section headings use the guide accent. */
.rst-content h2 {
  margin-top: 2.8rem;
  color: #172033;
}

.rst-content h2::before {
  display: block;
  width: 44px;
  height: 3px;
  margin: 0 0 0.65rem;
  background: #d50f34;
  content: "";
}

.rst-content .nrv-doc-note,
.rst-content .nrv-concept-callout,
.rst-content .nrv-output-note,
.rst-content .nrv-next-section-card,
.rst-content .nrv-transition-note {
  box-sizing: border-box;
  margin: 1.5rem 0;
  padding: 1.1rem 1.3rem;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #d50f34;
  background: #f8fafc;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.035);
}

.rst-content .nrv-doc-note {
  display: grid;
  grid-template-columns: minmax(150px, 0.3fr) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}

.rst-content .nrv-doc-note strong,
.rst-content .nrv-doc-note span {
  color: #1f2937;
  line-height: 1.55;
}

.rst-content .nrv-doc-note span { color: #64748b; }

.rst-content .nrv-concept-callout > span,
.rst-content .nrv-next-section-card > span,
.rst-content .nrv-transition-note > span,
.rst-content .nrv-figure > .figure-label,
.rst-content .nrv-two-up > .figure-label,
.rst-content .nrv-three-up > .figure-label {
  display: block;
  margin: 0 0 0.5rem;
  color: #a70d2b;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.rst-content .nrv-concept-callout h3,
.rst-content .nrv-next-section-card p,
.rst-content .nrv-transition-note p { color: #111827; }

.rst-content .nrv-figure,
.rst-content .nrv-two-up,
.rst-content .nrv-three-up {
  box-sizing: border-box;
  width: 100%;
  max-width: 940px;
  margin: 1.6rem auto;
  border: 1px solid #e2e8f0;
  border-top: 3px solid #d50f34;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.035);
  overflow: hidden;
}

.rst-content .nrv-figure.is-wide { max-width: 780px; }
.rst-content .nrv-figure.is-compact { max-width: 700px; }
.rst-content .nrv-figure.is-monitor { max-width: 560px; }

.rst-content .nrv-figure > .figure-label,
.rst-content .nrv-two-up > .figure-label,
.rst-content .nrv-three-up > .figure-label {
  margin: 0;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.rst-content .nrv-figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 420px;
  margin: 0 auto;
  padding: 1rem;
  box-sizing: border-box;
  object-fit: contain;
  background: #fff;
}

.rst-content .nrv-figure.is-wide img { max-height: 340px; }
.rst-content .nrv-figure.is-compact img { max-height: 320px; }
.rst-content .nrv-figure.is-monitor img { max-height: 260px; }

.rst-content .nrv-figure figcaption {
  margin: 0;
  padding: 0.8rem 1rem;
  border-top: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 0.92rem;
  line-height: 1.5;
}

.rst-content .nrv-two-up,
.rst-content .nrv-three-up {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.rst-content .nrv-two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rst-content .nrv-three-up { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.rst-content .nrv-two-up > .figure-label,
.rst-content .nrv-three-up > .figure-label {
  grid-column: 1 / -1;
  margin: -1rem -1rem 0;
}

.rst-content .nrv-two-up > div:not(.figure-label),
.rst-content .nrv-three-up > div:not(.figure-label) {
  min-width: 0;
  padding: 0;
  border: 1px solid #e2e8f0;
  background: #fff;
}

.rst-content .nrv-two-up img,
.rst-content .nrv-three-up img {
  display: block;
  width: 100%;
  height: 210px;
  object-fit: contain;
  background: #fff;
}

.rst-content .nrv-three-up img { height: 165px; }

.rst-content .nrv-two-up span,
.rst-content .nrv-three-up span {
  display: block;
  padding: 0.8rem 0.9rem;
  color: #111827;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.4;
}

.rst-content .nrv-two-up figcaption,
.rst-content .nrv-three-up figcaption {
  grid-column: 1 / -1;
  margin: 0 -1rem -1rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 0.92rem;
  line-height: 1.5;
}

.rst-content .nrv-card-grid,
.rst-content .nrv-download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(295px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.rst-content .nrv-card,
.rst-content .nrv-download-card,
.rst-content .nrv-output-panel {
  box-sizing: border-box;
  min-width: 0;
  padding: 1.2rem;
  border: 1px solid #e2e8f0;
  border-top: 3px solid #d50f34;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.035);
}

.rst-content .nrv-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.rst-content .nrv-card-index {
  display: inline-flex;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  border: 1px solid #f1c6cf;
  color: #d50f34;
  font-size: 0.88rem;
  font-weight: 800;
}

.rst-content .nrv-card h3,
.rst-content .nrv-download-card h3,
.rst-content .nrv-output-panel h3 {
  margin: 0 0 0.55rem;
  color: #111827;
  font-size: 1.14rem;
  line-height: 1.28;
}

.rst-content .nrv-card p,
.rst-content .nrv-download-card p,
.rst-content .nrv-output-panel p {
  margin: 0;
  color: #64748b;
  line-height: 1.55;
}

.rst-content .nrv-download-card > span,
.rst-content .nrv-output-panel-head span,
.rst-content .nrv-output-used > span {
  color: #a70d2b;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rst-content .nrv-download-card a {
  display: inline-block;
  margin-top: 0.9rem;
  color: #a70d2b;
  font-weight: 700;
}

.rst-content .nrv-monitor-roles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.rst-content .nrv-monitor-role {
  padding: 1rem 1.1rem;
  border-left: 3px solid #d50f34;
  background: #f8fafc;
}

.rst-content .nrv-monitor-role span,
.rst-content .nrv-monitor-role strong { display: block; }
.rst-content .nrv-monitor-role span { color: #a70d2b; font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; }
.rst-content .nrv-monitor-role strong { margin-top: 0.25rem; color: #111827; }
.rst-content .nrv-monitor-role p { margin: 0.45rem 0 0; color: #64748b; }

.rst-content .nrv-procedure-steps {
  display: grid;
  gap: 0;
  margin: 1.4rem 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid #e2e8f0;
}

.rst-content .nrv-procedure-steps li {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.rst-content .nrv-procedure-steps li > span {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  background: #d50f34;
  color: #fff;
  font-size: 0.86rem;
  font-weight: 800;
}

.rst-content .nrv-procedure-steps p { margin: 0; }

.rst-content .nrv-formula-panel {
  max-width: 760px;
  margin: 1.4rem auto;
  padding: 1rem 1.2rem;
  border: 1px solid #e2e8f0;
  border-top: 3px solid #d50f34;
  background: #fff;
}

.rst-content .nrv-formula-row {
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) auto minmax(260px, 1fr);
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 0;
}

.rst-content .nrv-formula-row + .nrv-formula-row { border-top: 1px solid #e2e8f0; }
.rst-content .nrv-formula-row strong { color: #a70d2b; }

.rst-content .nrv-fraction {
  display: inline-grid;
  grid-template-rows: auto auto;
  justify-items: center;
  line-height: 1.2;
  white-space: nowrap;
}

.rst-content .nrv-fraction > span:first-child { padding: 0 0.5rem 0.22rem; border-bottom: 1px solid #111827; }
.rst-content .nrv-fraction > span:last-child { padding-top: 0.22rem; }

.rst-content .nrv-capture-table-wrap { margin: 0 0 1.3rem; overflow-x: auto; }
.rst-content .nrv-capture-table { width: 100%; margin: 0; table-layout: fixed; border-collapse: collapse; }
.rst-content .nrv-capture-table th,
.rst-content .nrv-capture-table td { padding: 0.75rem 0.85rem; border: 1px solid #e2e8f0; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.rst-content .nrv-capture-table th { width: 28%; color: #111827; background: #f8fafc; }

.rst-content .nrv-output-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
  margin: 1.6rem 0;
}

.rst-content .nrv-output-panel.mono { border-top-color: #111827; }
.rst-content .nrv-output-panel.stereo { border-top-color: #d50f34; }
.rst-content .nrv-output-panel-head { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 0.85rem; margin-bottom: 0.8rem; border-bottom: 1px solid #e2e8f0; }
.rst-content .nrv-output-item { padding: 0.8rem 0; border-bottom: 1px solid #e2e8f0; }
.rst-content .nrv-output-callout { margin: 0.9rem 0; padding: 0.85rem; border-left: 3px solid #d50f34; background: #f8fafc; font-weight: 700; }
.rst-content .nrv-output-used { padding-top: 0.95rem; }

.rst-content .nrv-chip-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 1.6rem; }
.rst-content .nrv-chip-list span { padding: 0.38rem 0.6rem; border: 1px solid #e2e8f0; background: #f8fafc; color: #475569; font-size: 0.86rem; }

.rst-content .nrv-yaml-file {
  max-width: 340px;
  margin: 0.9rem 0;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid #d50f34;
  background: #f8fafc;
  color: #111827;
}

.rst-content .nrv-chapter-switcher {
  margin: 0 0 1.6rem;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  background: #fff;
}

.rst-content .nrv-chapter-switcher-bottom { margin-top: 2.4rem; }
.rst-content .nrv-chapter-switcher-title { display: block; margin-bottom: 0.85rem; color: #a70d2b; font-size: 0.82rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.rst-content .nrv-chapter-switcher-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0.7rem; }
.rst-content .nrv-chapter-switcher-list a,
.rst-content .nrv-chapter-switcher-list .current { display: block; padding: 0.85rem 0.95rem; border: 1px solid #e2e8f0; color: #334155; font-weight: 700; text-decoration: none; }
.rst-content .nrv-chapter-switcher-list a:hover { border-color: #d50f34; color: #a70d2b; }
.rst-content .nrv-chapter-switcher-list .current { border-left: 4px solid #d50f34; color: #a70d2b; background: #fff; }

.rst-content .nrv-article-pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 2rem 0 0; }
.rst-content .nrv-pager-link { display: block; min-height: 70px; padding: 1rem 1.15rem; box-sizing: border-box; border: 1px solid #e2e8f0; background: #fff; color: #111827; font-weight: 800; line-height: 1.35; text-decoration: none; box-shadow: 0 10px 22px rgba(15, 23, 42, 0.035); }
.rst-content .nrv-pager-link:hover { border-color: rgba(213, 15, 52, 0.45); color: #a70d2b; }
.rst-content .nrv-pager-prev { border-left: 3px solid #d50f34; }
.rst-content .nrv-pager-next { border-right: 3px solid #d50f34; text-align: right; }
.rst-content .nrv-pager-disabled { color: #94a3b8; background: #f8fafc; }

/* One accent rail per component. These rules intentionally override the
   earlier page-local prototype styles used by Chapters 1 and 2. */
.rst-content .nrv-chapter-switcher-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.65rem !important;
}

.rst-content .nrv-chapter-switcher-list a,
.rst-content .nrv-chapter-switcher-list .current {
  border: 1px solid #e2e8f0 !important;
  border-left: 1px solid #e2e8f0 !important;
  background: #f8fafc !important;
}

.rst-content .nrv-chapter-switcher-list .current {
  border-left: 4px solid #d50f34 !important;
  color: #a70d2b !important;
  background: #fff !important;
}

.rst-content .nrv-card,
.rst-content .nrv-download-card {
  border-top: 3px solid #d50f34 !important;
  border-left: 1px solid #e2e8f0 !important;
}

.rst-content .nrv-card:hover,
.rst-content .nrv-card:focus-within,
.rst-content .nrv-card:nth-child(4) {
  border-left-color: #e2e8f0 !important;
}

.rst-content .nrv-output-panel {
  border-left: 1px solid #e2e8f0 !important;
}

.rst-content .nrv-output-panel.mono { border-top-color: #111827 !important; }
.rst-content .nrv-output-panel.stereo { border-top-color: #d50f34 !important; }

.rst-content .nrv-concept-callout,
.rst-content .nrv-output-callout,
.rst-content .nrv-output-note,
.rst-content .nrv-next-section-card,
.rst-content .nrv-transition-note,
.rst-content .nrv-formula-panel {
  border: 1px solid #e2e8f0 !important;
  border-top: 1px solid #e2e8f0 !important;
  border-left: 4px solid #d50f34 !important;
}

.rst-content .nrv-figure,
.rst-content .nrv-two-up,
.rst-content .nrv-three-up {
  border: 1px solid #e2e8f0 !important;
  border-top: 3px solid #d50f34 !important;
  border-left: 1px solid #e2e8f0 !important;
}

.rst-content .nrv-two-up > div:not(.figure-label),
.rst-content .nrv-three-up > div:not(.figure-label) {
  border: 1px solid #e2e8f0 !important;
  border-top: 1px solid #e2e8f0 !important;
}

.rst-content .nrv-article-pager-single { grid-template-columns: minmax(0, 1fr); }
.rst-content .nrv-article-pager-single .nrv-pager-prev { border-right: 1px solid #e2e8f0; }

.rst-content .nrv-byline { margin: 1.5rem 0 0.35rem; color: #cbd5e1; font-size: 0.68rem; letter-spacing: 0.08em; opacity: 0.55; text-align: right; }

@media (max-width: 900px) {
  .rst-content .nrv-two-up,
  .rst-content .nrv-three-up,
  .rst-content .nrv-output-compare,
  .rst-content .nrv-monitor-roles { grid-template-columns: 1fr; }
  .rst-content .nrv-doc-note,
  .rst-content .nrv-formula-row { grid-template-columns: 1fr; }
  .rst-content .nrv-formula-row { justify-items: start; }
}

@media (max-width: 720px) {
  .rst-content .nrv-article-pager { grid-template-columns: 1fr; }
  .rst-content .nrv-pager-next { border-right: 1px solid #e2e8f0; border-left: 3px solid #d50f34; text-align: left; }
  .rst-content .nrv-two-up img { height: 180px; }
}

/* Chapters 3–4 follow the calibration example site's restrained layout. */
.rst-content .nrv-document-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.85rem;
  color: #d50f34;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.rst-content .nrv-document-kicker span:last-child {
  padding: 0.25rem 0.55rem;
  border: 1px solid #efc5cd;
  background: #fff7f8;
  color: #a70d2b;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}

.rst-content .nrv-figure,
.rst-content .nrv-two-up,
.rst-content .nrv-three-up {
  margin: 2.2rem 0 2.75rem;
  border: 1px solid #e2e8f0 !important;
  border-top: 1px solid #e2e8f0 !important;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.035);
}

.rst-content .nrv-figure img {
  width: 100%;
  max-width: 100%;
  max-height: none;
  margin: 0 auto;
  padding: 0;
  object-fit: initial;
}

.rst-content .nrv-workflow-figure {
  width: min(100%, 960px);
  max-width: 960px;
  margin: 1.35rem auto 1.15rem;
}

.rst-content .nrv-workflow-entry-figure {
  width: min(100%, 780px);
  max-width: 780px;
}

.rst-content .nrv-workflow-figure img {
  max-height: 480px;
  object-fit: contain;
}

.rst-content .nrv-workflow-figure figcaption {
  padding: 1rem 1.15rem;
  color: #172033;
  font-size: 0.88rem;
  line-height: 1.6;
}

.rst-content .nrv-sorting-samples-figure {
  width: min(100%, 360px);
  max-width: 360px;
  margin: 1.25rem auto 1.5rem;
}

.rst-content .nrv-sorting-samples-figure img {
  max-height: 210px;
  object-fit: contain;
}

.rst-content .nrv-wide-figure img {
  max-height: 540px;
  object-fit: contain;
}

.rst-content .nrv-monitor-setup-figure img {
  max-height: 620px;
  object-fit: contain;
  background: #f4f4f4;
}

.rst-content .nrv-measurement-figure img {
  background: #7f837d;
}

.rst-content .nrv-card {
  position: static;
  min-height: 0;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid #e2e8f0 !important;
  border-top: 1px solid #e2e8f0 !important;
  background: #fff;
  box-shadow: none;
  transition: none;
}

.rst-content .nrv-card.nrv-card-accent {
  border-left: 4px solid #d50f34 !important;
}

.rst-content .nrv-card:hover,
.rst-content .nrv-card:focus-within {
  border-color: #e2e8f0 !important;
  transform: none;
  box-shadow: none;
}

.rst-content .nrv-card.nrv-card-accent:hover,
.rst-content .nrv-card.nrv-card-accent:focus-within {
  border-left-color: #d50f34 !important;
}

.rst-content .nrv-card-index {
  width: 36px;
  height: 36px;
  border: 1px solid #efc5cd;
  background: #fff7f8;
  font-size: 0.74rem;
}

.rst-content .nrv-monitor-roles {
  gap: 1px;
  margin: 1.7rem 0 1.1rem;
  border: 1px solid #e2e8f0;
  background: #e2e8f0;
}

.rst-content .nrv-monitor-role {
  padding: 1.15rem;
  border-left: 0;
  background: #f8fafc;
}

.rst-content .nrv-download-card {
  min-height: 250px;
  border: 1px solid #e2e8f0 !important;
  border-top: 4px solid #d50f34 !important;
}

.rst-content .nrv-two-up,
.rst-content .nrv-three-up {
  padding: 1rem;
}

.rst-content .nrv-two-up img {
  aspect-ratio: 4 / 3;
  height: auto;
  object-fit: contain;
}

.rst-content .nrv-capture-guidance-figure {
  width: min(100%, 1080px);
  margin: 1.75rem auto 2rem;
}

.rst-content .nrv-capture-guidance-figure img {
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: contain;
}

.rst-content .nrv-transition-note {
  margin: 2.5rem 0 0;
  padding: 1.1rem 1.2rem;
  border: 0 !important;
  border-left: 4px solid #d50f34 !important;
  background: #f8fafc;
  box-shadow: none;
  color: #334155;
  font-weight: 650;
}

@media (max-width: 640px) {
  .rst-content .nrv-document-kicker {
    align-items: flex-start;
  }
}

/* Chapters 1–3: keep the example site's shorter line length and calmer rhythm.
   Chapter 4 is intentionally excluded because its workflow layout is approved. */
.rst-content .section > h1:is(
  [id="1-what-is-camera-calibration"],
  [id="2-nrv-dvs-calibration-method"],
  [id="3-capture-environment-and-preparation"]
) ~ p {
  max-width: 760px;
  margin-bottom: 1.15rem;
  line-height: 1.75;
}

.rst-content .section > h1:is(
  [id="1-what-is-camera-calibration"],
  [id="2-nrv-dvs-calibration-method"],
  [id="3-capture-environment-and-preparation"]
) ~ ul,
.rst-content .section > h1:is(
  [id="1-what-is-camera-calibration"],
  [id="2-nrv-dvs-calibration-method"],
  [id="3-capture-environment-and-preparation"]
) ~ ol {
  max-width: 760px;
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.rst-content .section > h1:is(
  [id="1-what-is-camera-calibration"],
  [id="2-nrv-dvs-calibration-method"],
  [id="3-capture-environment-and-preparation"]
) ~ h2 {
  margin-top: 3.6rem;
  margin-bottom: 1.35rem;
}

.rst-content .section > h1[id="3-capture-environment-and-preparation"] ~ h3 {
  margin-top: 2.8rem;
  margin-bottom: 1.15rem;
}

.rst-content .section > h1[id="1-what-is-camera-calibration"] ~ .nrv-figure,
.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-figure,
.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-two-up,
.rst-content .section > h1[id="3-capture-environment-and-preparation"] ~ .nrv-figure,
.rst-content .section > h1[id="3-capture-environment-and-preparation"] ~ .nrv-two-up,
.rst-content .section > h1[id="3-capture-environment-and-preparation"] ~ .nrv-three-up {
  width: min(100%, 680px);
  max-width: 680px;
  margin-right: auto;
  margin-left: auto;
}

.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-figure.is-compact {
  width: min(100%, 650px);
  max-width: 650px;
}

.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-card-grid .nrv-card h3 {
  text-transform: uppercase;
}

/* Chapter 2 comparison: keep the short labels balanced beneath both images. */
.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-cis-dvs-comparison > div:not(.figure-label) > span {
  white-space: nowrap;
  overflow-wrap: normal;
  font-size: 0.78rem;
  letter-spacing: -0.012em;
}

/* Chapter 2 rationale: a compact three-card summary, separate from other chapter cards. */
.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-card-grid {
  width: min(calc(100% - 1.5rem), 820px);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin: 1.35rem 0 1.55rem 1.5rem;
}

.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-card-grid .nrv-card {
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 0.65rem;
  padding: 0.8rem;
}

.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-card-grid .nrv-card-index {
  width: 30px;
  height: 30px;
  font-size: 0.68rem;
}

.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-card-grid .nrv-card h3 {
  margin-bottom: 0.28rem;
  font-size: 0.92rem;
}

.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-card-grid .nrv-card strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.86rem;
  line-height: 1.35;
}

.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-card-grid .nrv-card p {
  font-size: 0.79rem;
  line-height: 1.48;
}

/* Keep the Chapter 1 rectification note readable with one restrained accent. */
.rst-content .nrv-rectify-callout h3 {
  color: #172033 !important;
}

.rst-content .nrv-rectify-callout .nrv-step-definitions dt {
  color: #334155 !important;
}

.rst-content .section > h1[id="1-what-is-camera-calibration"] ~ .nrv-figure img,
.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-figure img,
.rst-content .section > h1[id="3-capture-environment-and-preparation"] ~ .nrv-figure img {
  max-height: 460px;
  object-fit: contain;
}

/* Follow Chapter 4's left-hand reading flow without allowing overly long lines. */
.rst-content:has(h1[id="1-what-is-camera-calibration"]) .section > p,
.rst-content:has(h1[id="2-nrv-dvs-calibration-method"]) .section > p,
.rst-content:has(h1[id="3-capture-environment-and-preparation"]) .section > p,
.rst-content:has(h1[id="1-what-is-camera-calibration"]) .section > ul,
.rst-content:has(h1[id="2-nrv-dvs-calibration-method"]) .section > ul,
.rst-content:has(h1[id="3-capture-environment-and-preparation"]) .section > ul,
.rst-content:has(h1[id="1-what-is-camera-calibration"]) .section > ol,
.rst-content:has(h1[id="2-nrv-dvs-calibration-method"]) .section > ol,
.rst-content:has(h1[id="3-capture-environment-and-preparation"]) .section > ol {
  width: min(calc(100% - 1.5rem), 820px);
  max-width: 820px;
  margin-right: 0;
  margin-left: 1.5rem;
}

/* Keep the Chapter 1 parameter comparison compact instead of stretching both cards. */
.rst-content:has(h1[id="1-what-is-camera-calibration"]) .nrv-output-compare {
  width: min(calc(100% - 1.5rem), 820px);
  max-width: 820px;
  align-items: start;
  gap: 0.85rem;
  margin: 1.4rem 0 1.6rem 1.5rem;
}

.rst-content:has(h1[id="1-what-is-camera-calibration"]) .nrv-output-panel {
  align-self: start;
  padding: 0.95rem !important;
}

.rst-content:has(h1[id="1-what-is-camera-calibration"]) .nrv-output-panel h3 {
  margin-bottom: 0.35rem;
  font-size: 1.02rem;
}

.rst-content:has(h1[id="1-what-is-camera-calibration"]) .nrv-output-panel p {
  line-height: 1.45;
}

.rst-content:has(h1[id="1-what-is-camera-calibration"]) .nrv-output-panel-head {
  margin-bottom: 0.55rem;
  padding-bottom: 0.65rem;
}

.rst-content:has(h1[id="1-what-is-camera-calibration"]) .nrv-output-item {
  padding: 0.55rem 0;
}

.rst-content:has(h1[id="1-what-is-camera-calibration"]) .nrv-output-callout {
  margin: 0.65rem 0;
  padding: 0.65rem 0.75rem !important;
}

.rst-content:has(h1[id="1-what-is-camera-calibration"]) .nrv-output-used {
  padding-top: 0.65rem;
}

/* The author marker is intentionally omitted from the published guide. */
.rst-content .nrv-byline {
  display: none !important;
}

@media (max-width: 760px) {
  .rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-card-grid {
    width: 100%;
    grid-template-columns: 1fr;
    margin-left: 0;
  }

  .rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-cis-dvs-comparison > div:not(.figure-label) > span {
    white-space: normal;
  }

  .rst-content .section > h1:is(
    [id="1-what-is-camera-calibration"],
    [id="2-nrv-dvs-calibration-method"],
    [id="3-capture-environment-and-preparation"]
  ) ~ p,
  .rst-content .section > h1:is(
    [id="1-what-is-camera-calibration"],
    [id="2-nrv-dvs-calibration-method"],
    [id="3-capture-environment-and-preparation"]
  ) ~ ul,
  .rst-content .section > h1:is(
    [id="1-what-is-camera-calibration"],
    [id="2-nrv-dvs-calibration-method"],
    [id="3-capture-environment-and-preparation"]
  ) ~ ol {
    max-width: none;
  }

  .rst-content:has(h1[id="1-what-is-camera-calibration"]) .section > p,
  .rst-content:has(h1[id="2-nrv-dvs-calibration-method"]) .section > p,
  .rst-content:has(h1[id="3-capture-environment-and-preparation"]) .section > p,
  .rst-content:has(h1[id="1-what-is-camera-calibration"]) .section > ul,
  .rst-content:has(h1[id="2-nrv-dvs-calibration-method"]) .section > ul,
  .rst-content:has(h1[id="3-capture-environment-and-preparation"]) .section > ul,
  .rst-content:has(h1[id="1-what-is-camera-calibration"]) .section > ol,
  .rst-content:has(h1[id="2-nrv-dvs-calibration-method"]) .section > ol,
  .rst-content:has(h1[id="3-capture-environment-and-preparation"]) .section > ol,
  .rst-content:has(h1[id="1-what-is-camera-calibration"]) .nrv-output-compare {
    width: 100%;
    max-width: none;
    margin-right: 0;
    margin-left: 0;
  }
}

/* Chapter 2 media is deliberately compact and follows the reading-column anchor. */
.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-two-up {
  width: min(calc(100% - 2rem), 600px) !important;
  max-width: 600px !important;
  margin-right: 0 !important;
  margin-left: 2rem !important;
}

.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-figure {
  width: min(calc(100% - 2rem), 520px) !important;
  max-width: 520px !important;
  margin-right: 0 !important;
  margin-left: 2rem !important;
}

/* The monitor setup photo is supporting evidence, not a full-width hero. */
.rst-content .section > h1[id="3-capture-environment-and-preparation"] ~ .nrv-monitor-setup-figure {
  width: min(calc(100% - 2rem), 560px) !important;
  max-width: 560px !important;
  margin-right: 0 !important;
  margin-left: 2rem !important;
}

.rst-content .nrv-monitor-setup-figure img {
  max-height: 340px !important;
}

@media (max-width: 760px) {
  .rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-two-up,
  .rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-figure,
  .rst-content .section > h1[id="3-capture-environment-and-preparation"] ~ .nrv-monitor-setup-figure {
    width: 100% !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
  }
}

/* Calibration-only shared alignment.
   Keep visual blocks near the reading column instead of centering them in the page. */
.rst-content .nrv-chapter-switcher,
.rst-content .nrv-doc-note,
.rst-content .nrv-card-grid,
.rst-content .nrv-download-grid,
.rst-content .nrv-monitor-roles,
.rst-content .nrv-procedure-steps,
.rst-content .nrv-formula-panel,
.rst-content .nrv-output-compare,
.rst-content .nrv-concept-callout,
.rst-content .nrv-output-note,
.rst-content .nrv-next-section-card,
.rst-content .nrv-transition-note,
.rst-content .nrv-capture-table-wrap,
.rst-content .nrv-article-pager {
  box-sizing: border-box;
  width: min(calc(100% - 2rem), 820px) !important;
  max-width: 820px !important;
  margin-right: 0 !important;
  margin-left: 2rem !important;
}

.rst-content .nrv-figure,
.rst-content .nrv-two-up,
.rst-content .nrv-three-up {
  width: calc(100% - 2rem) !important;
  margin-right: 0 !important;
  margin-left: 2rem !important;
}

/* Chapter 4 keeps its approved body position, so its visual blocks use only
   a small offset from that unindented reading column. */
.rst-content:has(h1[id="4-using-the-dvs-calibration-app"]) .nrv-chapter-switcher,
.rst-content:has(h1[id="4-using-the-dvs-calibration-app"]) .nrv-doc-note,
.rst-content:has(h1[id="4-using-the-dvs-calibration-app"]) .nrv-card-grid,
.rst-content:has(h1[id="4-using-the-dvs-calibration-app"]) .nrv-download-grid,
.rst-content:has(h1[id="4-using-the-dvs-calibration-app"]) .nrv-monitor-roles,
.rst-content:has(h1[id="4-using-the-dvs-calibration-app"]) .nrv-procedure-steps,
.rst-content:has(h1[id="4-using-the-dvs-calibration-app"]) .nrv-formula-panel,
.rst-content:has(h1[id="4-using-the-dvs-calibration-app"]) .nrv-output-compare,
.rst-content:has(h1[id="4-using-the-dvs-calibration-app"]) .nrv-concept-callout,
.rst-content:has(h1[id="4-using-the-dvs-calibration-app"]) .nrv-output-note,
.rst-content:has(h1[id="4-using-the-dvs-calibration-app"]) .nrv-next-section-card,
.rst-content:has(h1[id="4-using-the-dvs-calibration-app"]) .nrv-transition-note,
.rst-content:has(h1[id="4-using-the-dvs-calibration-app"]) .nrv-capture-table-wrap,
.rst-content:has(h1[id="4-using-the-dvs-calibration-app"]) .nrv-article-pager {
  width: min(calc(100% - 0.5rem), 820px) !important;
  margin-left: 0.5rem !important;
}

.rst-content:has(h1[id="4-using-the-dvs-calibration-app"]) .nrv-figure,
.rst-content:has(h1[id="4-using-the-dvs-calibration-app"]) .nrv-two-up,
.rst-content:has(h1[id="4-using-the-dvs-calibration-app"]) .nrv-three-up {
  width: calc(100% - 0.5rem) !important;
  margin-left: 0.5rem !important;
}

/* Measurement steps: compact numbered prose instead of large numbered tiles. */
.rst-content .nrv-procedure-steps {
  display: grid !important;
  gap: 0.38rem !important;
  padding: 0 !important;
  border: 0 !important;
  list-style: none !important;
}

.rst-content .nrv-procedure-steps li {
  display: grid !important;
  grid-template-columns: 1.45rem minmax(0, 1fr) !important;
  gap: 0.45rem !important;
  align-items: baseline !important;
  min-height: 0 !important;
  padding: 0.18rem 0 !important;
  border: 0 !important;
}

.rst-content .nrv-procedure-steps li > span {
  display: inline !important;
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #a70d2b !important;
  font-size: 0.9rem !important;
  font-weight: 800 !important;
  line-height: 1.65 !important;
  text-align: right !important;
}

.rst-content .nrv-procedure-steps li > span::after {
  content: ".";
}

.rst-content .nrv-procedure-steps p {
  margin: 0 !important;
  line-height: 1.65 !important;
}

@media (max-width: 760px) {
  .rst-content .nrv-language-switcher,
  .rst-content .nrv-chapter-switcher,
  .rst-content .nrv-doc-note,
  .rst-content .nrv-card-grid,
  .rst-content .nrv-download-grid,
  .rst-content .nrv-monitor-roles,
  .rst-content .nrv-procedure-steps,
  .rst-content .nrv-formula-panel,
  .rst-content .nrv-output-compare,
  .rst-content .nrv-concept-callout,
  .rst-content .nrv-output-note,
  .rst-content .nrv-next-section-card,
  .rst-content .nrv-transition-note,
  .rst-content .nrv-capture-table-wrap,
  .rst-content .nrv-article-pager,
  .rst-content .nrv-figure,
  .rst-content .nrv-two-up,
  .rst-content .nrv-three-up {
    width: 100% !important;
    max-width: none !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  .rst-content .nrv-language-switcher {
    justify-content: flex-start;
  }
}

/* This one small Chapter 4 example is centred after all shared alignment rules. */
.rst-content:has(h1[id="4-using-the-dvs-calibration-app"]) .nrv-sorting-samples-figure {
  width: min(calc(100% - 1rem), 360px) !important;
  max-width: 360px !important;
  margin-right: auto !important;
  margin-left: auto !important;
}

/* Calibration pages expose only the four chapter links in the left navigation.
   MkDocs still generates heading anchors for direct links within each chapter. */
.wy-menu-vertical li.toctree-l1.current > ul > li.toctree-l2.current > ul,
.wy-menu-vertical li.toctree-l2 > a .toctree-expand {
  display: none !important;
}

/* Chapter 2 figures: compact cards centred on the reading column.
   These rules intentionally override the older page-local !important styles. */
.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-two-up {
  align-items: start !important;
  gap: 0.7rem !important;
  margin-right: 0 !important;
  margin-left: clamp(1.5rem, calc(50% - 288px), 8.375rem) !important;
  padding: 0.7rem !important;
}

.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-figure {
  margin-right: 0 !important;
  margin-left: clamp(1.5rem, calc(50% - 248px), 10.875rem) !important;
}

.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-two-up > .figure-label {
  margin: -0.7rem -0.7rem 0 !important;
  padding: 0.62rem 0.78rem !important;
  font-size: 0.78rem !important;
  line-height: 1.35 !important;
}

.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-two-up > div:not(.figure-label) {
  align-self: start !important;
  padding: 0.55rem !important;
}

.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-two-up img {
  aspect-ratio: 16 / 9 !important;
  max-height: 150px !important;
}

.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-two-up span {
  min-height: 0 !important;
  padding: 0.52rem 0.15rem 0.08rem !important;
  font-size: 0.78rem !important;
  line-height: 1.35 !important;
  text-align: left !important;
}

.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-two-up figcaption {
  margin: 0 -0.7rem -0.7rem !important;
  padding: 0.68rem 0.78rem !important;
  font-size: 0.82rem !important;
  line-height: 1.45 !important;
}

/* The checkerboard/circle comparison needs enough detail to show unstable
   corner responses; keep the other Chapter 2 figures compact. */
.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-corner-comparison {
  width: min(calc(100% - 1.5rem), 820px) !important;
  max-width: 820px !important;
  margin-left: 1.5rem !important;
}

.rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-corner-comparison img {
  max-height: 220px !important;
}

@media (max-width: 760px) {
  .rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-two-up,
  .rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-figure {
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  .rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-two-up {
    gap: 0.65rem !important;
  }

  .rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-two-up img {
    max-height: 210px !important;
  }

  .rst-content .section > h1[id="2-nrv-dvs-calibration-method"] ~ .nrv-corner-comparison {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
  }
}
