/* Content tables on narrow screens (js/tables.js marks them up).
   .table-wrap  — every table: scrolls sideways inside its own frame instead of
                  widening the page.
   .table-stack — a plain grid with a header row: below 48em one card per row,
                  the first cell as the card's title, the others labelled with
                  their column header. */

.table-wrap {
    margin: 1.5rem 0;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-wrap > table { margin: 0; }

@media only all and (max-width: 47.938em) {
    .table-wrap > table:not(.table-stack) { min-width: 32rem; }
    .table-wrap > table:not(.table-stack) td,
    .table-wrap > table:not(.table-stack) th { min-width: 6rem; }

    #body table.table-stack,
    #body table.table-stack > tbody,
    #body table.table-stack > tbody > tr,
    #body table.table-stack > tbody > tr > td {
        display: block;
        width: 100%;
    }
    #body table.table-stack { border: 0; font-size: .9rem; }
    #body table.table-stack > thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
    #body table.table-stack > tbody > tr {
        margin: 0 0 .75rem;
        border: 1px solid rgb(var(--c-line));
        border-radius: var(--radius-card);
        background: rgb(var(--c-surface));
        overflow: hidden;
    }
    #body table.table-stack > tbody > tr > td {
        border: 0;
        border-top: 1px solid rgb(var(--c-line));
        padding: .5rem .85rem;
        overflow-wrap: anywhere;
    }
    #body table.table-stack > tbody > tr > td:first-child {
        border-top: 0;
        background: rgb(var(--c-raised));
        font-weight: 600;
    }
    #body table.table-stack > tbody > tr > td:empty { display: none; }
    #body table.table-stack > tbody > tr > td:not(:first-child)[data-label]:not([data-label=""])::before {
        content: attr(data-label);
        display: block;
        margin-bottom: .15rem;
        font-family: var(--font-mono);
        font-size: .68rem;
        font-weight: 400;
        letter-spacing: .06em;
        text-transform: uppercase;
        color: rgb(var(--c-fg-subtle));
    }
    #body table.table-stack > tbody > tr:hover td { background-color: inherit; }
    #body table.table-stack > tbody > tr:hover td:first-child { background: rgb(var(--c-raised)); }

    .retro-mode #body table.table-stack { border: 0 !important; }
    .retro-mode #body table.table-stack > tbody > tr {
        border: 2px solid #a8a8a8;
        border-radius: 0;
        background: transparent;
    }
    .retro-mode #body table.table-stack > tbody > tr > td,
    .retro-mode #body table.table-stack > tbody > tr:nth-child(even) > td {
        background-color: transparent !important;
    }
    .retro-mode #body table.table-stack > tbody > tr > td:first-child {
        background-color: #a8a8a8 !important;
        color: #000 !important;
        font-weight: normal;
    }
    .retro-mode #body table.table-stack > tbody > tr > td:first-child a,
    .retro-mode #body table.table-stack > tbody > tr > td:first-child code { color: #000 !important; }
    .retro-mode #body table.table-stack > tbody > tr > td::before { color: #ffff00 !important; }
}
