/*
 * Transitional compatibility for RVB pages that still contain Bootstrap 3
 * class names.  This file supplies only the stable constructions found in the
 * corpus; it is not a reimplementation of Bootstrap.
 */
@layer legacy-print {
  /* Preserve Bootstrap's responsive-image behavior for retained corpus markup. */
  .img-responsive { display: block; max-width: 100%; height: auto; }
  /*
   * Only grid variants confirmed in BOOTSTRAP_MIGRATION.md are kept here.
   * This is a migration bridge for old markup, not a new 12-column API.
   */
  .container {
    inline-size: min(calc(100% - 2 * var(--rvb-page-gutter)), 90rem);
    margin-inline: auto;
    padding-inline: var(--rvb-legacy-grid-gutter, .9375rem);
  }

  .container-fluid {
    inline-size: 100%;
    margin-inline: auto;
    padding-inline: var(--rvb-legacy-grid-gutter, .9375rem);
  }

  .row {
    display: flex;
    flex-wrap: wrap;
    min-inline-size: 0;
    margin-inline: calc(-1 * var(--rvb-legacy-grid-gutter, .9375rem));
  }

  .row > :where(
    .col-xs-2, .col-xs-3, .col-xs-6, .col-xs-8, .col-xs-9, .col-xs-12,
    .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-8, .col-sm-10, .col-sm-12,
    .col-md-3, .col-md-4, .col-md-6, .col-md-8, .col-md-9, .col-md-10, .col-md-12,
    .col-lg-4, .col-lg-6, .col-lg-8, .col-lg-9
  ) {
    box-sizing: border-box;
    flex: 0 0 100%;
    inline-size: 100%;
    min-inline-size: 0;
    padding-inline: var(--rvb-legacy-grid-gutter, .9375rem);
  }

  .row > .col-xs-2 { flex-basis: 16.666667%; inline-size: 16.666667%; }
  .row > .col-xs-3 { flex-basis: 25%; inline-size: 25%; }
  .row > .col-xs-6 { flex-basis: 50%; inline-size: 50%; }
  .row > .col-xs-8 { flex-basis: 66.666667%; inline-size: 66.666667%; }
  .row > .col-xs-9 { flex-basis: 75%; inline-size: 75%; }

  .row > .col-xs-offset-0 { margin-inline-start: 0; }

  @media (min-width: 48rem) {
    .row > .col-sm-2 { flex-basis: 16.666667%; inline-size: 16.666667%; }
    .row > .col-sm-3 { flex-basis: 25%; inline-size: 25%; }
    .row > .col-sm-4 { flex-basis: 33.333333%; inline-size: 33.333333%; }
    .row > .col-sm-5 { flex-basis: 41.666667%; inline-size: 41.666667%; }
    .row > .col-sm-6 { flex-basis: 50%; inline-size: 50%; }
    .row > .col-sm-8 { flex-basis: 66.666667%; inline-size: 66.666667%; }
    .row > .col-sm-10 { flex-basis: 83.333333%; inline-size: 83.333333%; }
    .row > .col-sm-offset-1 { margin-inline-start: 8.333333%; }
  }

  @media (min-width: 62rem) {
    .row > .col-md-3 { flex-basis: 25%; inline-size: 25%; }
    .row > .col-md-4 { flex-basis: 33.333333%; inline-size: 33.333333%; }
    .row > .col-md-6 { flex-basis: 50%; inline-size: 50%; }
    .row > .col-md-8 { flex-basis: 66.666667%; inline-size: 66.666667%; }
    .row > .col-md-9 { flex-basis: 75%; inline-size: 75%; }
    .row > .col-md-10 { flex-basis: 83.333333%; inline-size: 83.333333%; }
  }

  @media (min-width: 75rem) {
    .row > .col-lg-4 { flex-basis: 33.333333%; inline-size: 33.333333%; }
    .row > .col-lg-6 { flex-basis: 50%; inline-size: 50%; }
    .row > .col-lg-8 { flex-basis: 66.666667%; inline-size: 66.666667%; }
    .row > .col-lg-9 { flex-basis: 75%; inline-size: 75%; }
  }

  /* Old pagination/navigation markup. New pages use named RVB components. */
  .pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--rvb-space-2);
    margin-block: var(--rvb-space-4);
    padding-inline: 0;
    list-style: none;
  }

  .pager > li {
    display: block;
  }

  .pager > li > :where(a, span) {
    display: block;
    padding: .3125rem .875rem;
    color: var(--rvb-color-ink);
    text-decoration: none;
    background: var(--rvb-color-surface);
    border: var(--rvb-border-width) solid var(--rvb-color-line);
    border-radius: 999px;
  }

  .pager > li > a:hover {
    background: var(--rvb-color-control-hover);
  }

  .pager > li > a:focus-visible {
    outline: var(--rvb-focus-width) solid var(--rvb-color-focus);
    outline-offset: 2px;
  }

  .pager > li.disabled > :where(a, span) {
    color: var(--rvb-color-ink-muted);
    cursor: not-allowed;
    opacity: .55;
  }

  /* Legacy breadcrumb geometry; new markup uses .rvb-breadcrumb. */
  .breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .125rem 0;
    margin-block: calc(-1 * var(--rvb-space-2));
    padding-inline: 0;
    color: var(--rvb-color-ink-muted);
    font-size: .9em;
    list-style: none;
    background: var(--rvb-color-surface);
  }

  .breadcrumb > li {
    display: inline-flex;
    align-items: center;
  }

  .breadcrumb > li + li::before {
    padding-inline: .4375rem;
    color: var(--rvb-color-ink-muted);
    content: "/";
  }

  .breadcrumb li > :where(a, span) {
    padding: .3125rem .4375rem;
    color: inherit;
    text-decoration: none;
    background: var(--rvb-color-surface);
    border-radius: 999px;
  }

  .breadcrumb li > a:hover {
    text-decoration: none;
  }

  .breadcrumb li > a:focus-visible {
    outline: var(--rvb-focus-width) solid var(--rvb-color-focus);
    outline-offset: 2px;
  }

  .breadcrumb > .next {
    margin-inline-start: auto;
  }

  .breadcrumb > .previous {
    margin-inline-end: auto;
  }

  .breadcrumb > .disabled > :where(a, span) {
    cursor: not-allowed;
    color: var(--rvb-color-ink-muted);
  }

  .breadcrumb-brand li > a:hover { color: #fff; background: #ffa500; }
  .breadcrumb-18 li > a:hover { background: #b3ff99; }
  .breadcrumb-19 li > a:hover { background: #ffeb99; }
  .breadcrumb-20 li > a:hover { background: #ffad99; }
  .breadcrumb-prog li > a:hover { color: navy; background: #99ccff; }
  .breadcrumb-pt li > a:hover { color: #000; background: #ebd9e8; }

  /* Period rule surrounding historical breadcrumbs. */
  hr.color-18,
  hr.color-19,
  hr.color-20,
  hr.color-brand,
  hr.color-prog,
  hr.color-pt {
    box-sizing: border-box;
    display: block;
    block-size: 0;
    height: 0;
    margin-block: var(--rvb-space-3);
    border: 0;
    border-block-start: 2px solid transparent;
    background: transparent;
  }

  hr.color-18 { border-block-start-color: #b3ff99; }
  hr.color-19 { border-block-start-color: #ffeb99; }
  hr.color-20 { border-block-start-color: #ffad99; }
  hr.color-brand { border-block-start-color: #ffdb99; }
  hr.color-prog { border-block-start-color: #00f; }
  hr.color-pt { border-block-start-color: #8b008b; }

  /* Legacy Bootstrap disclosures. New pages use semantic disclosure markup. */
  .panel-group {
    margin-block: var(--rvb-space-4);
  }

  .panel {
    --rvb-legacy-panel-border: var(--rvb-color-line);
    --rvb-legacy-panel-heading: var(--rvb-color-control-hover);
    --rvb-legacy-panel-heading-ink: var(--rvb-color-ink);
    margin-block-end: var(--rvb-space-2);
    overflow: clip;
    background: var(--rvb-color-surface);
    border: var(--rvb-border-width) solid var(--rvb-legacy-panel-border);
    border-radius: var(--rvb-radius-sm);
  }

  .panel-brand {
    --rvb-legacy-panel-border: #ffa500;
    --rvb-legacy-panel-heading: #ffdb99;
  }

  .panel-18 { --rvb-legacy-panel-border: #008000; --rvb-legacy-panel-heading: #b3ff99; --rvb-legacy-panel-heading-ink: #008000; }
  .panel-19 { --rvb-legacy-panel-border: #998100; --rvb-legacy-panel-heading: #ffeb99; --rvb-legacy-panel-heading-ink: #765700; }
  .panel-20 { --rvb-legacy-panel-border: #e50000; --rvb-legacy-panel-heading: #ffb2b2; --rvb-legacy-panel-heading-ink: #e50000; }
  .panel-varia { --rvb-legacy-panel-border: #ffeb99; --rvb-legacy-panel-heading: #ccccff; --rvb-legacy-panel-heading-ink: #0000ff; }
  .panel-info { --rvb-legacy-panel-border: #bce8f1; --rvb-legacy-panel-heading: #d9edf7; --rvb-legacy-panel-heading-ink: #31708f; }

  .panel-heading {
    color: var(--rvb-legacy-panel-heading-ink);
    background: var(--rvb-legacy-panel-heading);
    border-block-end: var(--rvb-border-width) solid var(--rvb-legacy-panel-border);
  }

  .panel-title {
    margin: 0;
    color: inherit;
    font: inherit;
    font-weight: 700;
  }

  .panel-title > :where(a, button) {
    align-items: center;
    box-sizing: border-box;
    color: inherit;
    display: flex;
    inline-size: 100%;
    justify-content: space-between;
    min-block-size: 2.75rem;
    padding: var(--rvb-space-2) var(--rvb-space-3);
    text-align: start;
    text-decoration: none;
  }

  .rvb-js .panel-title > [data-toggle="collapse"]::after {
    border-block-end: .12rem solid currentColor;
    border-inline-end: .12rem solid currentColor;
    block-size: .42rem;
    content: "";
    inline-size: .42rem;
    margin-inline-start: var(--rvb-space-3);
    transform: rotate(45deg);
    transition: transform 160ms ease;
  }

  .rvb-js .panel-title > [data-toggle="collapse"][aria-expanded="true"]::after {
    margin-block-start: .3rem;
    transform: rotate(225deg);
  }

  .panel-body {
    padding: var(--rvb-space-3);
  }

  .panel-body > :first-child { margin-block-start: 0; }
  .panel-body > :last-child { margin-block-end: 0; }

  .rvb-js .panel-collapse.collapse:not(.in) {
    display: none;
  }

  /*
   * Historical `table-responsive` is retained only because its presence is
   * an explicit old-editorial request for overflow (mostly wide indexes).
   * New publication tables do not inherit horizontal scrolling.
   */
  .table-responsive {
    max-inline-size: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  table.table {
    border-collapse: collapse;
    inline-size: 100%;
    max-inline-size: 100%;
  }

  table.table :where(th, td) {
    padding: var(--rvb-space-2) var(--rvb-space-3);
    text-align: start;
    vertical-align: top;
  }

  table.table-bordered :where(th, td) {
    border: var(--rvb-border-width) solid var(--rvb-color-line);
  }

  table.table-borderless :where(th, td) {
    border: 0;
  }

  table.table-condensed :where(th, td) {
    padding: var(--rvb-space-1) var(--rvb-space-2);
  }

  table.table-hover > tbody > tr:hover > :where(th, td) {
    background: var(--rvb-color-control-hover);
  }
}

/* Historical Ivanov navigation: rvb.css gives the table 10em padding.
   Keep its existing colours and cell appearance while allowing narrow screens. */
.container table.vi-navtable { padding: 0; }
@media screen and (max-width: 767px) {
  table.vi-navtable, table.vi-navtable > tbody { display: block; }
  table.vi-navtable tr { display: flex; flex-wrap: wrap; border: 0; padding: 0; }
  table.vi-navtable td { flex: 1 1 9em; }
}



/* Approved legacy breadcrumb appearance; keep links clear of framing rules. */
.container .breadcrumb { margin-block: 0; padding-block: .3em; }
