/*
   * Semantic table primitives for RVB publications.  A table describes a
   * relation between cells; its visual treatment is selected independently.
   */
  .publication-table {
    border-collapse: collapse;
    inline-size: 100%;
    margin-block: var(--rvb-space-4);
  }

  .publication-table :where(th, td) {
    padding: var(--rvb-space-2) var(--rvb-space-3);
    text-align: start;
    vertical-align: top;
    border: 0;
  }

  .publication-table :where(th) {
    font-weight: 600;
  }

  .publication-table--ruled :where(th, td) {
    border-block-end: var(--rvb-border-width) solid var(--rvb-color-line);
  }

  .publication-table--bordered :where(th, td) {
    border: var(--rvb-border-width) solid var(--rvb-color-line);
  }

  .publication-table--compact :where(th, td) {
    padding: var(--rvb-space-1) var(--rvb-space-2);
  }

  .publication-table--fixed {
    table-layout: fixed;
  }

  /* Six-column electronic indexes retain readable column widths on phones. */
  .publication-table--verse-index { min-inline-size: 42em; table-layout: fixed; }
  .publication-table--verse-index col:nth-child(1) { inline-size: 7%; }
  .publication-table--verse-index col:nth-child(2) { inline-size: 43%; }
  .publication-table--verse-index th:first-child { white-space: nowrap; }
  .publication-table--verse-index col:nth-child(3) { inline-size: 10%; }
  .publication-table--verse-index col:nth-child(4) { inline-size: 20%; }
  .publication-table--verse-index col:nth-child(5),
  .publication-table--verse-index col:nth-child(6) { inline-size: 10%; }
  @media print { .publication-table--verse-index { min-inline-size: 0; } }
  .publication-table--parallel-text { min-inline-size: 36em; table-layout: fixed; }
  .publication-table--parallel-text col:nth-child(1),
  .publication-table--parallel-text col:nth-child(3) { inline-size: 45%; }
  .publication-table--parallel-text col:nth-child(2) { inline-size: 10%; }
  @media print { .publication-table--parallel-text { min-inline-size: 0; } }

  .publication-table--hover > tbody > tr:hover > :where(th, td) {
    background: var(--rvb-color-control-hover);
  }

  .publication-table__locator,
  .publication-table__page,
  .publication-table__number {
    inline-size: var(--rvb-table-locator-width, 5.5rem);
    text-align: center !important;
    white-space: nowrap;
  }

  .publication-table__title {
    overflow-wrap: anywhere;
  }

  /* A neutral wrapper does not introduce scrolling by itself. */
  .publication-table-wrap {
    max-inline-size: 100%;
  }

  /*
   * Explicit exception for data that cannot be reflowed without losing its
   * tabular relation (for example, some word-form indexes).
   */
  .publication-table-wrap--scroll {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  .publication-table-wrap:focus-visible {
    outline: var(--rvb-focus-width) solid var(--rvb-color-focus);
    outline-offset: 2px;
  }

  @media (max-width: 44rem) {
    .publication-table {
      --rvb-table-locator-width: 3.25rem;
    }

    .publication-table :where(th, td) {
      padding-inline: var(--rvb-space-2);
    }
  }

  @media (prefers-reduced-motion: no-preference) {
    .publication-table--hover > tbody > tr > :where(th, td) {
      transition: background-color 120ms ease;
    }
  }

  @media print {
    .publication-table tr {
      break-inside: avoid;
    }

    .publication-table-wrap--scroll {
      overflow: visible;
    }

    .publication-table--hover > tbody > tr:hover > :where(th, td) {
      background: transparent;
    }
  }

/* Contents keep one set of column widths across printed page breaks and sections. */
.publication-table--contents { --rvb-table-locator-width: 3.5em; }
/* Колонцифры оглавлений с выравниванием по правому краю. */
.publication-table--page-right .publication-table__page { text-align: right !important; }
.publication-table--section { margin-block: 1.5em; }
@media (max-width: 44rem) {
  .publication-table--contents { --rvb-table-locator-width: 2.5em; }
}

/* Preserve the existing edition-table appearance without obsolete attributes. */
.publication-table--legacy-frame { border: 1px outset currentColor; }
.publication-table--edition-index { width: 80%; margin-inline: auto; border-spacing: 1px; }
.rvb-page-shell .table-responsive:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
@media print { .rvb-page-shell .table-responsive { overflow: visible; } }

/* Text indentation belongs to .toc-content; table rows add no paragraph margins. */
.publication-table .toc-content { margin-block: 0; }

/* Contents in legacy tables: hanging wraps and a separate nesting offset. */
.table td.toc-content,
.publication-table td.toc-content {
  padding-inline-start: 1.8em;
  text-indent: -1.8em;
  text-align: left;
}
.table td.toc-content.toc-indent-2,
.publication-table td.toc-content.toc-indent-2 {
  padding-inline-start: 3.8em;
  text-indent: -1.8em;
}
