/* Othrs Tables front end. Everything is under .othrs-table-wrap / .othrs-table / .ot-*, takes its font and colours from the theme,
   and uses grey tints that work on light and dark backgrounds. Restyle per table with .othrs-table-<id> or #othrs-table-<id>. */

.othrs-table-wrap {
  --ot-border: rgba(127, 127, 127, .35);
  --ot-head-bg: rgba(127, 127, 127, .14);
  --ot-head-fg: inherit;
  --ot-stripe: rgba(127, 127, 127, .07);
  --ot-hover: rgba(127, 127, 127, .15);
  --ot-pad: .6em .75em;
  margin: 0 0 1.5em;
  max-width: 100%;
  scroll-margin-top: 5em;
}
.othrs-table-wrap [hidden] { display: none !important; }
.ot-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.othrs-table-note { padding: .5em .75em; border: 1px dashed rgba(127, 127, 127, .6); font-size: .9em; }

.ot-title { margin: 0 0 .4em; }
.ot-desc { margin: 0 0 .8em; }

/* toolbar: filter + search, right aligned */
.ot-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .5em; margin: 0 0 .6em; }
.ot-tools label { margin: 0; display: block; max-width: 100%; }
.othrs-table-wrap .ot-q,
.othrs-table-wrap .ot-f { font: inherit; line-height: 1.4; color: inherit; background-color: transparent; border: 1px solid var(--ot-border); border-radius: 4px; padding: .4em .6em; margin: 0; width: 15em; max-width: 100%; height: auto; min-height: 0; box-sizing: border-box; box-shadow: none; }
.othrs-table-wrap .ot-f { width: auto; max-width: 22em; }
.othrs-table-wrap .ot-f option { color: #222; background: #fff; }

/* table */
.ot-scroll { max-width: 100%; }
.ot-m-scroll .ot-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.othrs-table { width: 100%; max-width: 100%; margin: 0; border-collapse: collapse; border-spacing: 0; table-layout: auto; font: inherit; color: inherit; }
.othrs-table th,
.othrs-table td { padding: var(--ot-pad); border: 0; border-bottom: 1px solid var(--ot-border); text-align: left; vertical-align: top; overflow-wrap: break-word; word-break: normal; }
.othrs-table thead th { background: var(--ot-head-bg); color: var(--ot-head-fg); font-weight: 600; vertical-align: bottom; border-bottom-width: 2px; }
.othrs-table .ot-left { text-align: left; }
.othrs-table .ot-center { text-align: center; }
.othrs-table .ot-right { text-align: right; }
.ot-striped .othrs-table tr.ot-alt > td { background: var(--ot-stripe); }
.ot-hover .othrs-table tr.ot-r:hover > td { background: var(--ot-hover); }
.ot-bordered .othrs-table th,
.ot-bordered .othrs-table td { border: 1px solid var(--ot-border); }
.ot-compact { --ot-pad: .3em .5em; }
.ot-sticky .othrs-table thead th { position: sticky; top: var(--ot-sticky-top, 0px); z-index: 2; background-image: linear-gradient(var(--ot-head-bg), var(--ot-head-bg)); background-color: Canvas; }
.admin-bar .ot-sticky .othrs-table thead th { top: calc(var(--ot-sticky-top, 0px) + 32px); }
.othrs-table .ot-empty td { text-align: center; padding: 1.2em .75em; opacity: .8; }
.othrs-table .ot-img { display: block; max-width: 100%; height: auto; }
.othrs-table .ot-link { overflow-wrap: anywhere; }
.othrs-table .ot-btn { display: inline-block; padding: .3em .85em; border: 1px solid currentColor; border-radius: 4px; font-weight: 600; line-height: 1.35; text-decoration: none; overflow-wrap: normal; white-space: nowrap; }
.othrs-table .ot-btn:hover,
.othrs-table .ot-btn:focus-visible { background: var(--ot-hover); text-decoration: none; }

/* sortable header: a button that looks like the header text, with a pair of arrows (shape, not colour, shows the direction) */
.othrs-table .ot-sort { -webkit-appearance: none; appearance: none; display: inline-flex; align-items: center; gap: .4em; width: auto; min-width: 0; min-height: 0; height: auto; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; font: inherit; font-weight: inherit; line-height: inherit; letter-spacing: inherit; text-transform: inherit; text-align: inherit; text-decoration: none; color: inherit; cursor: pointer; }
.othrs-table .ot-sort:hover,
.othrs-table .ot-sort:focus { background: none; color: inherit; }
.othrs-table .ot-sort:focus-visible,
.othrs-table-wrap .ot-pg:focus-visible,
.othrs-table-wrap .ot-toggle:focus-visible,
.othrs-table-wrap .ot-csv:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.ot-arrow { position: relative; flex: none; width: .6em; height: 1em; }
.ot-arrow::before,
.ot-arrow::after { content: ""; position: absolute; left: 0; border: .3em solid transparent; opacity: .35; }
.ot-arrow::before { top: -.12em; border-bottom-color: currentColor; }
.ot-arrow::after { bottom: -.12em; border-top-color: currentColor; }
.othrs-table th[aria-sort="ascending"] .ot-arrow::before,
.othrs-table th[aria-sort="descending"] .ot-arrow::after { opacity: 1; }
.othrs-table th[aria-sort="ascending"] .ot-arrow::after,
.othrs-table th[aria-sort="descending"] .ot-arrow::before { opacity: .12; }

/* detail rows: a round +/- button in the first cell opens the folded columns under the row */
.othrs-table-wrap .ot-toggle { -webkit-appearance: none; appearance: none; display: none; position: relative; flex: none; float: left; width: 1.25em; height: 1.25em; min-width: 0; min-height: 0; margin: .12em .55em 0 0; padding: 0; border: 1px solid currentColor; border-radius: 50%; background: none; box-shadow: none; color: inherit; font: inherit; line-height: 1; cursor: pointer; opacity: .75; }
.othrs-table-wrap .ot-toggle:hover { opacity: 1; background: none; color: inherit; }
.ot-toggle::before,
.ot-toggle::after { content: ""; position: absolute; left: 50%; top: 50%; width: .6em; height: 2px; margin: -1px 0 0 -.3em; background: currentColor; }
.ot-toggle::after { transform: rotate(90deg); }
.ot-toggle[aria-expanded="true"]::after { display: none; }
.othrs-table .ot-detail > td { padding: .7em .9em .9em; background: var(--ot-stripe); }
.ot-dl { display: grid; grid-template-columns: fit-content(35%) 1fr; gap: .4em 1.2em; margin: 0; padding: 0; }
.ot-dl dt { margin: 0; padding: 0; font-weight: 600; }
.ot-dl dd { margin: 0; padding: 0; min-width: 0; }
.ot-dl dd > :first-child { margin-top: 0; }
.ot-dl dd > :last-child { margin-bottom: 0; }

/* footer: "Showing 1-20 of 57" and the page buttons */
.ot-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5em 1em; margin: .7em 0 0; font-size: .9em; }
.ot-pos-left .ot-foot { flex-direction: row-reverse; }
.ot-pos-center .ot-foot { flex-direction: column; }
.ot-pages { display: flex; flex-wrap: wrap; align-items: center; gap: .25em; }
.othrs-table-wrap .ot-pg,
.othrs-table-wrap .ot-csv { -webkit-appearance: none; appearance: none; min-width: 2.2em; min-height: 0; height: auto; width: auto; margin: 0; padding: .25em .6em; border: 1px solid var(--ot-border); border-radius: 4px; background: none; box-shadow: none; color: inherit; font: inherit; font-size: 1em; line-height: 1.4; text-align: center; text-decoration: none; text-transform: none; letter-spacing: normal; cursor: pointer; }
.othrs-table-wrap .ot-pg:hover,
.othrs-table-wrap .ot-csv:hover { background: var(--ot-hover); color: inherit; }
.othrs-table-wrap .ot-pg[aria-current] { font-weight: 700; border-color: currentColor; background: var(--ot-hover); cursor: default; }
.othrs-table-wrap .ot-pg[disabled] { opacity: .4; cursor: default; background: none; }
.ot-gap { padding: 0 .2em; opacity: .6; }
.ot-export { display: flex; justify-content: flex-end; margin: .7em 0 0; font-size: .9em; }
.othrs-table-wrap .ot-csv { padding: .35em .9em; }

/* With JavaScript: fold the detail columns and show page 1 only. "scripting" is read before the script loads, so nothing jumps;
   browsers that do not know that query get the same rules from the .ot-js class a moment later. Without JavaScript every row and
   column shows and the controls are hidden. */
@media (scripting: enabled) {
  .othrs-table-wrap .othrs-table .ot-c-detail { display: none; }
  .othrs-table-wrap .othrs-table tr.ot-p { display: none; }
  .othrs-table-wrap.ot-has-detail .ot-toggle { display: block; }
}
.othrs-table-wrap.ot-js .othrs-table .ot-c-detail { display: none; }
.othrs-table-wrap.ot-js.ot-has-detail .ot-toggle { display: block; }
@media (scripting: none) {
  .ot-tools, .ot-foot, .ot-export { display: none; }
}

/* narrow screens */
@media (max-width: 640px) {
  .ot-tools { justify-content: stretch; }
  .ot-tools label { flex: 1 1 10em; }
  .othrs-table-wrap .ot-q,
  .othrs-table-wrap .ot-f { width: 100%; max-width: 100%; }
  .ot-foot { justify-content: center; }
  .ot-dl { grid-template-columns: 1fr; gap: .1em 0; }
  .ot-dl dd { margin-bottom: .5em; }

  /* stack: each row is a card */
  .ot-m-stack .othrs-table,
  .ot-m-stack .othrs-table tbody { display: block; }
  .ot-m-stack .othrs-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
  .ot-m-stack .othrs-table tr { display: block; margin: 0 0 .75em; padding: .3em 0; border: 1px solid var(--ot-border); border-radius: 6px; }
  .ot-m-stack .othrs-table td { display: block; width: auto !important; padding: .3em .75em; border: 0; text-align: left; }
  .ot-m-stack .othrs-table td:empty { display: none; }
  .ot-m-stack.ot-labels .othrs-table td[data-label]::before { content: attr(data-label); display: block; margin: 0 0 .1em; font-size: .8em; font-weight: 600; opacity: .7; }
  .ot-m-stack.ot-labels .othrs-table .ot-detail td::before { content: none; }
  .ot-m-stack.ot-striped .othrs-table tr.ot-alt { background: var(--ot-stripe); }
  .ot-m-stack.ot-striped .othrs-table tr.ot-alt > td { background: none; }
  .ot-m-stack .othrs-table tr.ot-detail { margin-top: -.75em; border-top: 0; border-radius: 0 0 6px 6px; }
  .ot-m-stack .othrs-table tr.ot-open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .ot-m-stack .othrs-table .ot-empty { border: 0; }
  .ot-m-stack .othrs-table .ot-toggle { float: right; margin: 0 0 0 .5em; }

  /* not stacked: "desktop" columns fold into the detail row */
  .othrs-table-wrap.ot-js:not(.ot-m-stack) .othrs-table .ot-c-desktop { display: none; }
  .othrs-table-wrap.ot-js.ot-has-desktop:not(.ot-m-stack) .ot-toggle { display: block; }
}
@media (scripting: enabled) and (max-width: 640px) {
  .othrs-table-wrap:not(.ot-m-stack) .othrs-table .ot-c-desktop { display: none; }
  .othrs-table-wrap.ot-has-desktop:not(.ot-m-stack) .ot-toggle { display: block; }
}

/* paper: the whole table, no controls */
@media print {
  .ot-tools, .ot-foot, .ot-export, .othrs-table-wrap .ot-toggle { display: none !important; }
  .othrs-table-wrap .othrs-table tr.ot-r, .othrs-table-wrap .othrs-table tr.ot-r[hidden] { display: table-row !important; }
  .othrs-table-wrap .othrs-table .ot-c-detail, .othrs-table-wrap .othrs-table .ot-c-desktop { display: table-cell !important; }
  .othrs-table-wrap .othrs-table tr.ot-detail { display: none !important; }
  .ot-sticky .othrs-table thead th { position: static; }
}
