/* ============================================================
   Interactive Competency-Gaps plots (DeepSeek-R1-Distill-Llama-8B)
   Styled to match the static figure-cards: white rounded cards,
   Helvetica Neue, category color groupings preserved.
   ============================================================ */

.cg-plot,
.cg-grid,
.cg-group,
.cg-cell,
.cg-cell-title,
.cg-loading {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #111;
}

/* Single interactive plot inside a figure-card */
.cg-plot {
    width: 100%;
}
.cg-plot .js-plotly-plot,
.cg-cell .js-plotly-plot {
    width: 100% !important;
}

.cg-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    height: 320px;
    color: #888;
    font-size: 13px;
}
.cg-loading::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #1f77b4;
    animation: cg-pulse 1.6s ease-in-out infinite;
}
@keyframes cg-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(0.78); }
}

/* ---------- Per-benchmark grouped small-multiples ----------
   Mobile-first: groups stacked vertically, one plot per row.
   Desktop (>=820px): mirrors the original 2x5 figure — groups sit in a row,
   REASONING is a 2x2 block (--cg-cols:2), the others are single columns. */
.cg-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

/* One category band (REASONING / MATH / FACTUALITY / ETHICS & BIAS) */
.cg-group {
    border-radius: 14px;
    padding: 14px 14px 16px;
    /* tint set inline from the category color */
}
.cg-group-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.6px;
    margin: 2px 4px 12px;
    color: #2b2b2b;
}

/* Individual benchmark plot cards inside a group */
.cg-group-cells {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 820px) {
    .cg-grid {
        flex-direction: row;
        align-items: stretch;
        gap: 14px;
    }
    .cg-group {
        flex: var(--cg-cols, 1) 1 0;
        min-width: 0;
    }
    .cg-group-cells {
        grid-template-columns: repeat(var(--cg-cols, 1), 1fr);
    }
}
.cg-cell {
    background: #fff;
    border: 1.5px solid #dfe6e9;
    border-radius: 10px;
    padding: 10px 5px 6px;
    overflow: hidden;
}
.cg-cell-title {
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    margin: 2px 0 4px;
    line-height: 1.15;
    white-space: normal;
    overflow-wrap: anywhere;
}
.cg-cell-sub {
    font-size: 11px;
    font-weight: 400;
    color: #777;
    text-align: center;
    margin: 0 0 4px;
}

@media (max-width: 640px) {
    .cg-group-cells {
        grid-template-columns: 1fr;
    }
}

/* ---------- Qualitative example cards (iMessage-style, side by side) ---------- */
.cg-ex-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: stretch;
    width: 100%;
}
.cg-ex {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1.5px solid #dfe6e9;
    border-radius: 12px;
    padding: 20px 22px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: #1a1a1a;
}

/* Chat */
.cg-ex-chat {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 18px;
}
.cg-ex-turn {
    display: flex;
    flex-direction: column;
    max-width: 100%;
}
.cg-ex-turn-prompt { align-items: flex-end; }
.cg-ex-turn-resp { align-items: flex-start; }
.cg-ex-label {
    font-size: 12.5px;
    font-weight: 700;
    color: #111;
    margin-bottom: 6px;
}
.cg-ex-bubble {
    max-width: 86%;
    padding: 12px 15px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cg-ex-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.13);
}
.cg-ex-bubble-prompt {
    background: #0b93f6;
    color: #fff;
    border-bottom-right-radius: 5px;
}
.cg-ex-bubble-resp {
    background: #e9e9eb;
    color: #1a1a1a;
    border-bottom-left-radius: 5px;
}

/* Divider + footer. margin-top:auto anchors the divider + footer to the bottom
   of the (stretched, equal-height) card, so a shorter card gets whitespace
   between its last chat bubble and the divider. */
.cg-ex-divider {
    border: 0;
    border-top: 1.5px solid #e6e6e6;
    width: 100%;
    margin: auto 0 16px;
}
.cg-ex-meta {
    display: grid;
    grid-template-columns: minmax(92px, 0.8fr) 2.4fr;
    gap: 18px;
    align-items: start;
}
.cg-ex-meta-title {
    font-size: 15px;
    font-weight: 700;
    color: #111;
    margin-bottom: 10px;
}
.cg-ex-annot {
    display: flex;
    flex-direction: column;
}
.cg-ex-pill {
    border: 1.5px solid #d2d8dc;
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 12.5px;
    line-height: 1.4;
    text-align: center;
    margin-bottom: 10px;
}
.cg-ex-pill:last-child { margin-bottom: 0; }
.cg-ex-pill b { font-weight: 700; }
.cg-ex-pill-bad {
    border-color: #f0aaa3;
    background: #fdeeec;
    color: #d6453a;
}
.cg-ex-concept-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.cg-ex-concept {
    border: 1.5px solid #d2d8dc;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 12.5px;
    line-height: 1.4;
}
.cg-ex-concept b { font-weight: 700; }

/* Stack the two example cards at the same breakpoint the teaser/app pairs use. */
@media (max-width: 768px) {
    .cg-ex-row { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
    .cg-ex-meta { grid-template-columns: 1fr; gap: 14px; }
    .cg-ex-concept-grid { grid-template-columns: 1fr; }
    .cg-ex-bubble { max-width: 100%; }
}
