/* ==========================================================================
   Chat Control & STRIDE-B Research: Interactive Simulator & Components
   ========================================================================== */

/* -------------------------------------------------------------------------- */
/* Chat Control & STRIDE-B Research Components                               */
/* -------------------------------------------------------------------------- */

#tw-text {
    display: inline-block;
    min-height: 1.2em;
}

.pillar-badge {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 0.4rem;
}

.math-block {
    overflow: visible;
    margin: 0.75rem 0;
}

.math-block .katex-display {
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.math-block .katex-display::-webkit-scrollbar {
    display: none;
}

.math-block.math-wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: 0.65rem 0.35em;
    margin: 1.25rem 0;
}

.math-block.math-wrap .math-seg {
    display: inline-block;
    white-space: nowrap;
}

@media (min-width: 46rem) {
    .math-block.math-wrap {
        width: calc(100% + 6rem);
        margin-inline: -3rem;
    }
}

@media (max-width: 520px) {
    .math-block .katex {
        font-size: 0.9em;
    }
}

.framework-callout-box {
    margin: 2rem 0;
    border: 1px solid var(--rule);
    border-left: 3px solid var(--accent);
    background: color-mix(in srgb, var(--code-bg) 45%, var(--paper));
    border-radius: 4px;
    padding: 1.25rem 1.5rem;
}

.callout-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.callout-tag {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--accent);
}

.pico-list {
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.stride-matrix-wrap {
    margin: 2.25rem 0;
    border: 1px solid var(--rule);
    border-radius: 6px;
    overflow: hidden;
    background: var(--paper);
}

.stride-matrix-title {
    font-family: var(--font-mono);
    font-size: 0.78125rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--rule);
    background: color-mix(in srgb, var(--code-bg) 35%, var(--paper));
}

.prose .stride-table {
    display: table;
    overflow-x: visible;
    table-layout: fixed;
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: 0.84375rem;
    text-align: left;
}

.prose .stride-table th,
.prose .stride-table td {
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--rule);
    vertical-align: top;
    text-align: left;
    overflow-wrap: break-word;
    word-break: normal;
}

.prose .stride-table th {
    font-family: var(--font-mono);
    font-size: 0.71875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    background: color-mix(in srgb, var(--code-bg) 20%, var(--paper));
}

.prose .stride-table tbody tr:last-child td {
    border-bottom: none;
}

.stride-b-row {
    background: color-mix(in srgb, var(--accent) 8%, var(--paper));
    font-weight: 500;
}

.stride-b-row td:first-child {
    color: var(--accent);
}

.prose .stride-core-table th:nth-child(1),
.prose .stride-core-table td:nth-child(1) {
    width: 22%;
}

.prose .stride-core-table th:nth-child(2),
.prose .stride-core-table td:nth-child(2) {
    width: 32%;
}

.prose .stride-core-table th:nth-child(3),
.prose .stride-core-table td:nth-child(3) {
    width: 46%;
}

.prose .sensitivity-table th,
.prose .sensitivity-table td {
    padding: 0.6rem 0.55rem;
    font-size: 0.78125rem;
}

.prose .sensitivity-table th {
    font-size: 0.6875rem;
    letter-spacing: 0.03em;
}

.prose .sensitivity-table .col-regime {
    width: 34%;
}

.prose .sensitivity-table .col-rates {
    width: 19%;
}

.prose .sensitivity-table .col-tp {
    width: 12%;
}

.prose .sensitivity-table .col-fp {
    width: 17%;
}

.prose .sensitivity-table .col-ppv {
    width: 18%;
}

.prose .sensitivity-table .num-cell {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.prose .sensitivity-table .cell-sub {
    display: block;
    font-size: 0.71875rem;
    color: var(--muted);
    margin-top: 0.15rem;
}

.prose .benchmarks-table th,
.prose .benchmarks-table td {
    padding: 0.65rem 0.75rem;
    font-size: 0.8125rem;
}

.prose .benchmarks-table th:nth-child(1),
.prose .benchmarks-table td:nth-child(1) {
    width: 31%;
}

.prose .benchmarks-table th:nth-child(2),
.prose .benchmarks-table td:nth-child(2) {
    width: 32%;
}

.prose .benchmarks-table th:nth-child(3),
.prose .benchmarks-table td:nth-child(3) {
    width: 37%;
}

.matrix-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.matrix-scroll::-webkit-scrollbar {
    display: none;
}

@media (max-width: 600px) {
    .prose .stride-core-table,
    .prose .stride-core-table tbody,
    .prose .stride-core-table tr,
    .prose .stride-core-table td,
    .prose .benchmarks-table,
    .prose .benchmarks-table tbody,
    .prose .benchmarks-table tr,
    .prose .benchmarks-table td {
        display: block;
        width: 100%;
    }

    .prose .stride-core-table thead,
    .prose .benchmarks-table thead {
        display: none;
    }

    .prose .stride-core-table tr,
    .prose .benchmarks-table tr {
        padding: 0.65rem 0.9rem;
        border-bottom: 1px solid var(--rule);
    }

    .prose .stride-core-table tbody tr:last-child,
    .prose .benchmarks-table tbody tr:last-child {
        border-bottom: none;
    }

    .prose .stride-core-table th,
    .prose .stride-core-table td,
    .prose .stride-core-table td:nth-child(n),
    .prose .benchmarks-table th,
    .prose .benchmarks-table td,
    .prose .benchmarks-table td:nth-child(n) {
        width: 100%;
        padding: 0.3rem 0;
        border-bottom: none;
    }

    .prose .stride-core-table td::before,
    .prose .benchmarks-table td::before {
        content: attr(data-label);
        display: block;
        font-family: var(--font-mono);
        font-size: 0.6875rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--muted);
        margin-bottom: 0.1rem;
    }

    .prose .sensitivity-table {
        display: table;
        width: 100%;
        min-width: 33rem;
    }

    .prose .sensitivity-table .num-cell {
        white-space: nowrap;
    }
}

.proof-verdict-box {
    margin: 2rem 0;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--rule);
    border-left: 3px solid var(--accent-red, #dc2626);
    background: color-mix(in srgb, var(--code-bg) 50%, var(--paper));
    border-radius: 4px;
}

.verdict-label {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-red, #dc2626);
    margin-bottom: 0.25rem;
}

.verdict-statement {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.proof-verdict-box p {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--muted);
}

/* Bayes Lab Interactive Simulator */
.bayes-lab-widget {
    margin: 2.5rem 0;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: color-mix(in srgb, var(--code-bg) 30%, var(--paper));
    padding: 1.5rem;
}

.bayes-lab-header {
    margin-bottom: 1.5rem;
}

.lab-pill {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.bayes-lab-header h3 {
    margin: 0 0 0.4rem;
    font-size: 1.125rem;
}

.bayes-lab-header p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--muted);
    text-align: left;
}

.bayes-controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.control-group label {
    font-family: var(--font-mono);
    font-size: 0.78125rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.slider-display {
    color: var(--accent);
    font-weight: 600;
    text-align: right;
}

.lab-slider {
    width: 100%;
    cursor: pointer;
    accent-color: var(--accent);
}

.control-hint {
    font-size: 0.71875rem;
    color: var(--muted);
}

.bayes-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

@media (max-width: 420px) {
    .bayes-metrics-grid {
        grid-template-columns: 1fr;
    }
}

.metric-card {
    padding: 0.85rem;
    border: 1px solid var(--rule);
    border-radius: 4px;
    background: var(--paper);
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.15rem;
    font-weight: 700;
    font-family: var(--font-mono);
    line-height: 1.2;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.alert-card .metric-value {
    color: var(--accent-red, #ef4444);
}

.valid-card .metric-value {
    color: var(--accent-green, #10b981);
}

.ppv-card .metric-value {
    color: var(--accent);
}

.dos-card .metric-value {
    color: #d97706;
}

[data-theme="dark"] .dos-card .metric-value {
    color: #f59e0b;
}

.metric-sub {
    font-size: 0.71875rem;
    color: var(--muted);
    line-height: 1.3;
}

.lab-status-banner {
    padding: 0.85rem 1rem;
    border-radius: 4px;
    font-size: 0.84375rem;
    line-height: 1.45;
    border-left: 3px solid transparent;
}

.status-critical {
    background: color-mix(in srgb, #ef4444 12%, var(--paper));
    border-left-color: #ef4444;
    color: var(--ink);
}

.status-severe {
    background: color-mix(in srgb, #f59e0b 12%, var(--paper));
    border-left-color: #f59e0b;
    color: var(--ink);
}

.status-moderate {
    background: color-mix(in srgb, var(--accent) 12%, var(--paper));
    border-left-color: var(--accent);
    color: var(--ink);
}

/* Policy Recommendations Box */
.policy-recs-box {
    margin: 2rem 0;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--paper);
    overflow: hidden;
}

.rec-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--rule);
    font-size: 0.90625rem;
    line-height: 1.5;
}

.rec-item:last-child {
    border-bottom: none;
}

.rec-num {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent);
    flex-shrink: 0;
    padding-top: 0.1rem;
}

.analysis-ordered-list {
    padding-left: 1.25rem;
    line-height: 1.6;
    margin: 1.25rem 0;
}

.analysis-ordered-list li {
    margin-bottom: 0.75rem;
}

/* Citation Jump Flash */
.flash-target {
    background-color: color-mix(in srgb, #a3e635 25%, var(--paper));
    outline: 1px solid #a3e635;
    border-radius: 3px;
}

/* Social Share & Link Preview Widget */
.share-section-widget {
    margin: 3.5rem 0 2rem;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: color-mix(in srgb, var(--code-bg) 40%, var(--paper));
    padding: 1.5rem;
}

.share-widget-title {
    font-family: var(--font-mono);
    font-size: 0.78125rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.share-widget-title-sep {
    opacity: 0.6;
}

.share-preview-card {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 0.875rem;
    margin-bottom: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.share-preview-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
    color: inherit;
}

.prose img.share-card-thumb {
    width: 140px;
    height: 78px;
    margin: 0;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--rule);
    flex-shrink: 0;
}

.share-card-info {
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

.share-card-domain {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
}

.share-card-heading {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 0 0 6px;
    color: var(--ink);
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    overflow-wrap: break-word;
    word-break: break-word;
}

.share-card-desc {
    font-size: 0.8125rem;
    color: var(--muted);
    line-height: 1.4;
    margin: 0;
    text-align: left;
    white-space: normal;
    overflow: visible;
    display: block;
    overflow-wrap: break-word;
    word-break: break-word;
}

.share-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.share-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    border: 1px solid var(--rule);
    border-radius: 4px;
    background: var(--paper);
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.share-action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, var(--paper));
}

.share-toast {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-green);
    margin-left: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.share-toast.show {
    opacity: 1;
}

@media (max-width: 580px) {
    .share-section-widget {
        padding: 1rem;
    }

    .share-widget-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }

    .share-widget-title-sep {
        display: none;
    }

    .share-preview-card {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .prose img.share-card-thumb {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        max-height: 180px;
    }
}
