/* HK v1.1.20: readable post tables on mobile (stacked cards for 3+ columns) */

.gh-content .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.gh-content table:not(.gist table) {
    display: table;
    width: 100%;
    max-width: none;
    overflow: visible;
}

.gh-content table:not(.gist table) td,
.gh-content table:not(.gist table) th {
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: manual;
    white-space: normal;
}

@media (max-width: 700px) {
    .gh-content table.hk-stack:not(.gist table) {
        display: block;
        width: 100%;
        min-width: 0 !important;
        overflow: visible;
        border: 0;
        background: none !important;
    }

    .gh-content table.hk-stack:not(.gist table) thead,
    .gh-content table.hk-stack:not(.gist table) tr.hk-stack-head {
        display: none;
    }

    .gh-content table.hk-stack:not(.gist table) tbody {
        display: block;
    }

    .gh-content table.hk-stack:not(.gist table) tbody tr,
    .gh-content table.hk-stack:not(.gist table) > tr:not(.hk-stack-head) {
        display: block;
        margin: 0 0 12px;
        padding: 12px 14px;
        border: 1px solid var(--color-light-gray);
        border-radius: 12px;
        background: var(--color-lighter-gray);
    }

    .gh-content table.hk-stack:not(.gist table) tbody tr:last-child,
    .gh-content table.hk-stack:not(.gist table) > tr:not(.hk-stack-head):last-child {
        margin-bottom: 0;
    }

    .gh-content table.hk-stack:not(.gist table) td {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: baseline;
        gap: 4px 16px;
        min-width: 0 !important;
        margin: 0;
        padding: 8px 0;
        border: 0;
        border-top: 1px solid var(--color-light-gray);
        background: none !important;
        font-weight: 400;
        white-space: normal;
        word-break: normal;
        overflow-wrap: break-word;
    }

    .gh-content table.hk-stack:not(.gist table) td:first-child {
        display: block;
        border-top: 0;
        padding-top: 0;
        padding-bottom: 10px;
        font-weight: 700;
        color: var(--color-darker-gray);
    }

    .gh-content table.hk-stack:not(.gist table) td:first-child::before {
        content: none;
    }

    .gh-content table.hk-stack:not(.gist table) td:not(:first-child)::before {
        content: attr(data-label);
        font-weight: 700;
        flex: 1 1 10em;
        color: var(--color-darker-gray);
    }
}

/* HK v1.1.24: product-name affiliate links in buying-guide tables have no underline */

.gh-content a.hk-name-link,
.gh-content .table-wrap a.hk-name-link,
html[data-theme="dark"] .gh-content a.hk-name-link,
html[data-theme="dark"] .gh-content .table-wrap a.hk-name-link {
    color: inherit;
    font-weight: inherit;
    text-decoration: none;
    cursor: pointer;
}

.gh-content a.hk-name-link:hover,
.gh-content a.hk-name-link:focus-visible,
.gh-content .table-wrap a.hk-name-link:hover,
.gh-content .table-wrap a.hk-name-link:focus-visible,
html[data-theme="dark"] .gh-content a.hk-name-link:hover,
html[data-theme="dark"] .gh-content a.hk-name-link:focus-visible,
html[data-theme="dark"] .gh-content .table-wrap a.hk-name-link:hover,
html[data-theme="dark"] .gh-content .table-wrap a.hk-name-link:focus-visible {
    color: var(--ghost-accent-color, #2563eb);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.gh-content a.hk-name-link:focus-visible,
.gh-content .table-wrap a.hk-name-link:focus-visible,
html[data-theme="dark"] .gh-content a.hk-name-link:focus-visible,
html[data-theme="dark"] .gh-content .table-wrap a.hk-name-link:focus-visible {
    outline: 2px solid var(--ghost-accent-color, #2563eb);
    outline-offset: 2px;
}
