/* Trace viewer styles — complements styles.css */

.traces-section {
    padding: 2rem 0 4rem;
}

.traces-section .section-header {
    margin-bottom: 2rem;
}

.traces-subtitle {
    color: #555;
    font-size: 0.95rem;
    margin-bottom: 2.5rem;
}

/* Persona sections */
.trace-persona-section {
    margin-bottom: 3rem;
}

.trace-persona-heading {
    margin-bottom: 1rem;
}

.trace-persona-tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    text-transform: uppercase;
    font-weight: 500;
    display: inline-block;
}

/* Skill groups */
.trace-skill-group {
    margin-bottom: 2rem;
    border: var(--border-width) solid var(--text-color);
    padding: 1.5rem 2rem;
    background-color: var(--bg-color);
}

.trace-skill-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.trace-skill-header h3 {
    font-size: 1.1rem;
    margin-bottom: 0;
}

/* Timeline grid — one row per scenario, one column per version */
.timeline-grid {
    display: grid;
    row-gap: 0;
}

/* Top-left empty cell */
.tl-corner {
    /* empty */
}

/* Version labels — header row at top */
.tl-version {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: #bbb;
    text-align: center;
    padding-bottom: 8px;
    border-left: 1px solid #f0f0f0;
}

/* Scenario label — left column */
.tl-label {
    position: relative;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: #666;
    padding: 0 1rem 18px 0;
    display: flex;
    align-items: flex-end;
    line-height: 1.2;
}

/* Baseline on label cell */
.tl-label::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 17px;
    border-top: 1px solid #e0e0e0;
    pointer-events: none;
}

/* Data cell — bars above baseline, scores below */
.tl-cell {
    display: flex;
    flex-direction: column;
    border-left: 1px solid #f0f0f0;
    position: relative;
}

/* Baseline on data cell — aligned with label baseline */
.tl-cell::after {
    content: '';
    position: absolute;
    left: -1px;
    right: 0;
    bottom: 17px;
    border-top: 1px solid #e0e0e0;
    pointer-events: none;
}

/* Bar area — bars grow upward from baseline */
.tl-bar-area {
    height: 48px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    padding: 0 12px;
}

.tl-bar {
    width: 20px;
    min-height: 2px;
    border-radius: 2px 2px 0 0;
    cursor: pointer;
    transition: opacity 0.15s;
}

.tl-bar:hover {
    opacity: 0.7;
}

/* Score area — sits below the baseline */
.tl-score-area {
    height: 18px;
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 3px 12px 0;
}

.tl-bar-score {
    width: 20px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 500;
}

/* Score colors */
.score-high { color: #16a34a; }
.score-mid  { color: #d97706; }
.score-low  { color: #dc2626; }

/* No data state */
.traces-empty {
    font-family: var(--font-mono);
    color: #999;
    text-align: center;
    padding: 4rem 0;
}

/* Detail overlay */
.detail-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 200;
    justify-content: center;
    align-items: start;
    padding: 3rem 2rem;
}

.detail-overlay.open { display: flex; }

.detail-panel {
    background: var(--bg-color);
    border: var(--border-width) solid var(--text-color);
    max-width: 900px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2rem;
}

.detail-panel h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.detail-close {
    float: right;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    font-family: var(--font-primary);
}

.detail-close:hover { color: var(--text-color); }

.detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.25rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

.detail-meta dt {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #999;
}

.detail-meta dd {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Criterion results */
.detail-section {
    margin-bottom: 1.5rem;
}

.detail-section h4 {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.25rem;
    color: #666;
}

.criterion {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

.criterion-tag {
    font-family: var(--font-mono);
    font-weight: 500;
    min-width: 5rem;
    text-transform: uppercase;
    font-size: 0.7rem;
    padding-top: 0.15rem;
}

.criterion-tag.pass,
.criterion-tag.strong,
.criterion-tag.clear { color: #16a34a; }

.criterion-tag.fail,
.criterion-tag.weak,
.criterion-tag.violation { color: #dc2626; }

.criterion-tag.adequate { color: #d97706; }

.criterion-body b { font-weight: 600; }

/* Conversation turns */
.conversation { font-size: 0.85rem; }

.conv-turn {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    border: 1px solid #eee;
}

.conv-turn.user { border-left: 3px solid var(--accent-blue); }
.conv-turn.assistant { border-left: 3px solid var(--accent-green); }

.conv-role {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.7rem;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
    color: #888;
}

.conv-content { white-space: pre-wrap; line-height: 1.5; }

.detail-section ul {
    margin-left: 1.25rem;
    font-size: 0.85rem;
    color: #555;
}

.detail-section li { margin-bottom: 0.25rem; }

/* Highlight for deep-linked skill group */
.trace-skill-group.highlighted {
    box-shadow: 4px 4px 0px rgba(0,0,0,1);
}

@media (max-width: 768px) {
    .trace-skill-group {
        padding: 1rem;
    }

    .tl-label {
        font-size: 0.7rem;
    }

    .detail-panel {
        margin: 1rem;
        padding: 1.5rem;
    }
}
