/* AI Tool Radar: article navigation and comparison tables.
 * Scoped to plugin markup; no parent-theme files or page overflow overrides.
 */

.aitr-toc,
.aitr-table-scroll,
.aitr-repo-meta {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
}

.aitr-toc {
    margin-block: 1.5rem 2rem;
    padding: 1rem 1.25rem;
    border: 1px solid #d6d9dd;
    border-radius: 0.5rem;
    background: #f7f8f9;
    color: #242a31;
    font-size: 0.95rem;
    line-height: 1.6;
}

.aitr-toc > summary {
    cursor: pointer;
    font-weight: 650;
    padding-block: 0.25rem;
    overflow-wrap: anywhere;
}

.aitr-toc > summary::marker {
    color: #4b5563;
}

.aitr-toc[open] > summary {
    margin-bottom: 0.75rem;
}

.aitr-toc nav > ol {
    margin: 0;
    padding-inline-start: 1.5rem;
}

.aitr-toc li {
    padding-inline-start: 0.15rem;
    margin-block: 0.35rem;
    overflow-wrap: anywhere;
}

.aitr-toc li.aitr-toc-h3 {
    margin-inline-start: 1rem;
    font-size: 0.92em;
}

.aitr-toc a {
    color: #17538c;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

.aitr-toc a:hover {
    color: #0e365c;
    text-decoration-thickness: 2px;
}

.aitr-anchor {
    scroll-margin-block-start: 6rem;
    overflow-wrap: anywhere;
}

/* Keep the Gutenberg figure from becoming a second scroll container. */
body.single-post .wp-block-table:has(.aitr-table-scroll) {
    max-width: 100%;
    min-width: 0;
    overflow: visible;
}

.aitr-table-hint {
    margin-block: 0.5rem;
    font-size: 0.8rem;
    line-height: 1.5;
    color: #505862;
}

.aitr-table-scroll {
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    border: 1px solid #d6d9dd;
    border-radius: 0.5rem;
    background: #fff;
    scrollbar-width: auto;
}

.aitr-table-scroll > table {
    width: 100%;
    min-width: 38.75rem;
    max-width: none;
    margin: 0;
    border: 0;
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: auto;
    background: #fff;
    color: #242a31;
    font-size: 0.9rem;
    line-height: 1.55;
}

.aitr-table-scroll th,
.aitr-table-scroll td {
    padding: 0.8rem 0.9rem;
    border: 0;
    border-bottom: 1px solid #e0e3e7;
    text-align: start;
    vertical-align: top;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
}

.aitr-table-scroll thead th {
    background: #242a31;
    color: #fff;
    border-bottom-color: #242a31;
    font-weight: 650;
}

.aitr-table-scroll tbody th {
    font-weight: 650;
}

.aitr-table-scroll tbody tr:nth-child(even) > td,
.aitr-table-scroll tbody tr:nth-child(even) > th {
    background: #f5f7f9;
}

.aitr-table-scroll tbody tr:last-child > td,
.aitr-table-scroll tbody tr:last-child > th {
    border-bottom: 0;
}

.aitr-table-scroll td > a {
    color: #17538c;
    overflow-wrap: anywhere;
    text-underline-offset: 0.16em;
}

.aitr-repo-meta {
    margin-top: 0.55rem;
    padding-top: 0.5rem;
    border-top: 1px solid #d6d9dd;
    color: #505862;
    font-size: 0.78rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.aitr-repo-meta > span {
    display: block;
}

.aitr-repo-stats {
    color: #333c48;
    font-weight: 600;
}

.aitr-repo-checked {
    margin-top: 0.2rem;
    font-size: 0.95em;
}

.aitr-toc summary:focus-visible,
.aitr-toc a:focus-visible,
.aitr-table-scroll:focus-visible,
.aitr-table-scroll a:focus-visible {
    outline: 3px solid #1968ae;
    outline-offset: 3px;
    border-radius: 2px;
}

body.single-post .wp-block-post-content pre,
body.single-post .wp-block-code {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    border: 1px solid #384251;
    border-radius: 0.5rem;
    background: #18212c;
    color: #edf2f7;
    font-size: 0.875rem;
    line-height: 1.65;
    tab-size: 4;
}

body.single-post .wp-block-post-content pre code,
body.single-post .wp-block-code code {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: inherit;
    line-height: inherit;
    white-space: pre;
    overflow-wrap: normal;
    word-break: normal;
}

@media (max-width: 48rem) {
    .aitr-toc {
        padding: 0.85rem 1rem;
        font-size: 0.9rem;
    }

    .aitr-toc a {
        display: inline-block;
        padding-block: 0.2rem;
    }

    .aitr-table-scroll > table {
        font-size: 0.875rem;
    }

    .aitr-table-scroll th,
    .aitr-table-scroll td {
        padding: 0.7rem 0.75rem;
    }

    .aitr-repo-meta {
        font-size: 0.8125rem;
    }
}

@media (max-width: 23.4375rem) {
    .aitr-toc {
        padding-inline: 0.75rem;
    }

    .aitr-toc nav > ol {
        padding-inline-start: 1.2rem;
    }

    .aitr-toc li.aitr-toc-h3 {
        margin-inline-start: 0.65rem;
    }
}

@media (forced-colors: active) {
    .aitr-toc,
    .aitr-table-scroll,
    .aitr-repo-meta {
        border-color: CanvasText;
    }
}
