/* ═══════════════════════════════════════════════════════════════
   DARK SOULS — LLM Benchmark Dashboard
   Praise the Sun. Prepare to compare.
   ═══════════════════════════════════════════════════════════════ */

:root {
    /* Abyss — deep background tones */
    --bg: #0c0a08;
    --bg-card: #141210;
    --bg-card-alt: #1a1714;
    --bg-hover: #1e1a16;
    --bg-input: #100e0c;

    /* Ash and Bone — text hierarchy */
    --text: #c8b89a;
    --text-muted: #8a7d6b;
    --text-dim: #5a5040;
    --text-heading: #e0d0b0;

    /* Bonfire — primary accent (the warm glow of rest) */
    --ember: #d4943c;
    --ember-dim: rgba(212, 148, 60, 0.12);
    --ember-glow: rgba(212, 148, 60, 0.3);

    /* Souls — score colors */
    --green: #8faa3c;
    --green-dim: rgba(143, 170, 60, 0.12);
    --yellow: #d4943c;
    --yellow-dim: rgba(212, 148, 60, 0.12);
    --red: #8c3030;
    --red-dim: rgba(140, 48, 48, 0.15);

    /* Stone and Iron — borders */
    --border: #2a2420;
    --border-strong: #3a322a;

    /* Spacing */
    --gap: 24px;
    --section-gap: 48px;

    /* Typography */
    --font-heading: 'Cinzel', 'Palatino Linotype', 'Book Antiqua', serif;
    --font-body: 'Crimson Text', 'Palatino Linotype', Georgia, serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Base ─── */
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    padding: 0;
    line-height: 1.5;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Subtle bonfire glow from top center */
    background-image:
        radial-gradient(ellipse at 50% 0%, rgba(212, 148, 60, 0.03) 0%, transparent 70%);
}

.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 var(--gap) var(--section-gap);
}

/* ─── Masthead ─── */
.masthead {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 48px 0 32px;
    margin-bottom: var(--section-gap);
    border-bottom: 1px solid var(--border-strong);
    position: relative;
}

/* Ornamental ember line with glow */
.masthead::before {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--ember) 20%,
        var(--ember) 80%,
        transparent 100%);
    box-shadow: 0 0 12px var(--ember-glow), 0 0 4px var(--ember-dim);
}

.masthead-title {
    flex: 1;
}

.masthead-title h1 {
    font-family: var(--font-heading);
    font-size: 34px;
    font-weight: 700;
    color: var(--text-heading);
    letter-spacing: 3px;
    text-transform: uppercase;
    line-height: 1.1;
    margin-bottom: 8px;
    text-shadow: 0 0 40px rgba(212, 148, 60, 0.15);
}

.masthead-title .subtitle {
    font-family: var(--font-body);
    font-size: 15px;
    font-style: italic;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.masthead-stats {
    display: flex;
    gap: 32px;
    align-items: flex-end;
}

.masthead-stat {
    text-align: right;
}

.masthead-stat .stat-value {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    color: var(--ember);
    line-height: 1;
    letter-spacing: 1px;
}

.masthead-stat .stat-label {
    font-family: var(--font-heading);
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 4px;
}

/* ─── Toolbar (Legend + Filters) ─── */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--gap);
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.legend {
    display: flex;
    gap: 20px;
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 0;
}

.filters {
    display: flex;
    gap: 4px;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--border-strong);
    padding: 6px 14px;
    font-size: 11px;
    font-family: var(--font-heading);
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.filter-btn:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

.filter-btn.active {
    background: var(--ember);
    border-color: var(--ember);
    color: var(--bg);
    font-weight: 700;
}

.filter-btn.active:hover {
    background: #c08535;
    border-color: #c08535;
}

.filter-separator {
    width: 1px;
    background: var(--border-strong);
    align-self: stretch;
    margin: 0 4px;
}

/* ─── Section Dividers ─── */
.section-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: var(--section-gap) 0 var(--gap);
    color: var(--text-dim);
    font-family: var(--font-heading);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
}

.section-divider .cross {
    font-size: 14px;
    color: var(--ember);
    font-weight: 300;
    opacity: 0.6;
}

/* ─── Cards — stone tablets ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: var(--gap);
    position: relative;
}

/* Corner ornaments */
.card::before,
.card::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-style: solid;
    opacity: 0.4;
}

.card::before {
    top: -1px;
    left: -1px;
    border-width: 1px 0 0 1px;
    border-color: var(--ember);
}

.card::after {
    bottom: -1px;
    right: -1px;
    border-width: 0 1px 1px 0;
    border-color: var(--ember);
}

.card h2 {
    font-family: var(--font-heading);
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2.5px;
    margin-bottom: 16px;
    font-weight: 600;
}

/* ─── Grid ─── */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--gap);
    margin-bottom: var(--gap);
}

/* ─── Tables ─── */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-dim);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 10px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-strong);
    z-index: 1;
}

td {
    padding: 10px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

tr {
    transition: background 0.15s ease;
}

tr:hover {
    background: var(--bg-hover);
}

tr:hover .model-name {
    transform: translateX(2px);
}

/* ─── Model Names ─── */
.model-name {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-heading);
    white-space: nowrap;
    display: inline-block;
    transition: transform 0.15s ease;
    letter-spacing: 0.5px;
}

/* ─── Rank Numbers ─── */
.rank {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--ember);
    margin-right: 12px;
    min-width: 28px;
    display: inline-block;
    text-align: right;
}

.rank-1 {
    color: var(--ember);
    text-shadow: 0 0 10px var(--ember-glow);
}
.rank-2 { color: #9a9080; }
.rank-3 { color: #706050; }

/* ─── Score Bars ─── */
.score-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.score {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 14px;
    min-width: 52px;
    text-align: right;
}

.score-high { color: var(--green); }
.score-mid { color: var(--yellow); }
.score-low { color: var(--red); }

.score-cell .bar-container {
    flex: 1;
}

.bar-container {
    background: rgba(42, 36, 32, 0.6);
    height: 6px;
    width: 100%;
    position: relative;
    overflow: visible;
}

.bar {
    height: 6px;
    position: relative;
    transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.bar-high {
    background: linear-gradient(90deg, #6a8a2c, var(--green));
    box-shadow: 0 0 8px var(--green-dim);
}

.bar-mid {
    background: linear-gradient(90deg, #b07828, var(--yellow));
    box-shadow: 0 0 8px var(--yellow-dim);
}

.bar-low {
    background: linear-gradient(90deg, #6c2020, var(--red));
    box-shadow: 0 0 8px var(--red-dim);
}

/* Needle marker */
.bar::after {
    content: '';
    position: absolute;
    right: -1px;
    top: -3px;
    width: 2px;
    height: 12px;
    background: inherit;
    opacity: 0.8;
}

/* ─── Tags ─── */
.moe-tag, .dense-tag, .open-tag, .proprietary-tag {
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font-heading);
    letter-spacing: 1px;
    text-transform: uppercase;
    display: inline-block;
}

.moe-tag {
    border: 1px solid rgba(90, 130, 180, 0.3);
    background: rgba(90, 130, 180, 0.08);
    color: #7a9ab8;
}

.dense-tag {
    border: 1px solid rgba(160, 130, 90, 0.3);
    background: rgba(160, 130, 90, 0.08);
    color: #b0a080;
}

.open-tag {
    border: 1px solid rgba(143, 170, 60, 0.3);
    background: rgba(143, 170, 60, 0.08);
    color: var(--green);
}

.proprietary-tag {
    border: 1px solid rgba(140, 48, 48, 0.3);
    background: rgba(140, 48, 48, 0.08);
    color: var(--red);
}

/* ─── Reasoning ─── */
.reasoning-yes {
    font-family: var(--font-mono);
    color: var(--ember);
    font-weight: 600;
    font-size: 12px;
}

.reasoning-no {
    color: var(--text-dim);
    font-size: 12px;
}

/* ─── Parameters ─── */
.params {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.params-total {
    font-weight: 600;
    color: var(--text);
}

.params-active {
    color: var(--green);
}

/* ─── Coverage ─── */
.coverage {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--green);
}

.coverage-partial {
    color: var(--yellow);
    font-weight: 600;
}

/* ─── Status (Pass/Fail) ─── */
.status {
    display: inline-block;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pass {
    background: rgba(143, 170, 60, 0.12);
    color: var(--green);
    border: 1px solid rgba(143, 170, 60, 0.3);
}

.fail {
    background: rgba(140, 48, 48, 0.12);
    color: var(--red);
    border: 1px solid rgba(140, 48, 48, 0.3);
}

.partial {
    background: var(--yellow-dim);
    color: var(--yellow);
    border: 1px solid rgba(212, 148, 60, 0.3);
}

/* ─── Category Table Heatmap ─── */
.category-table td:first-child {
    font-weight: 500;
}

.category-table td {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 13px;
    text-align: center;
}

.category-table td:first-child {
    text-align: left;
}

.heatmap-high {
    background: var(--green-dim);
    color: var(--green);
}

.heatmap-mid {
    background: var(--yellow-dim);
    color: var(--yellow);
}

.heatmap-low {
    background: var(--red-dim);
    color: var(--red);
}

/* ─── Critical Questions Table ─── */
#critical-header th small {
    display: block;
    font-weight: 400;
    color: var(--text-dim);
    margin-top: 2px;
    text-transform: none;
    letter-spacing: 0;
    font-size: 9px;
    font-family: var(--font-body);
}

.critical-note {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 12px;
    font-family: var(--font-mono);
}

/* ─── Strengths / Weaknesses ─── */
.sw-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sw-list li {
    position: relative;
    padding-left: 16px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-muted);
}

.sw-list li::before {
    content: '\2014';
    position: absolute;
    left: 0;
    color: var(--text-dim);
}

/* ─── Critical Section Wrapper ─── */
.critical-section.hidden-section,
.example-questions-divider.hidden-section,
.example-questions-section.hidden-section {
    display: none;
}

/* ─── Example Questions ─── */
.example-question {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.example-question:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.example-question:first-child {
    padding-top: 0;
}

.example-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.example-id {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--ember);
    letter-spacing: 1px;
}

.example-category {
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 2px 8px;
    border: 1px solid var(--border);
}

.example-difficulty {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 2px 8px;
}

.difficulty-easy {
    color: var(--green);
    border: 1px solid rgba(143, 170, 60, 0.3);
    background: rgba(143, 170, 60, 0.08);
}

.difficulty-medium {
    color: var(--yellow);
    border: 1px solid rgba(212, 148, 60, 0.3);
    background: rgba(212, 148, 60, 0.08);
}

.difficulty-hard {
    color: var(--red);
    border: 1px solid rgba(140, 48, 48, 0.3);
    background: rgba(140, 48, 48, 0.08);
}

.example-text {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 6px;
}

.example-answer {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.example-answer strong {
    color: var(--text-dim);
    font-weight: 600;
    font-family: var(--font-heading);
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ─── Footer ─── */
.footer {
    text-align: center;
    color: var(--text-dim);
    font-size: 11px;
    font-family: var(--font-heading);
    margin-top: var(--section-gap);
    padding-top: 16px;
    border-top: 1px solid var(--border);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* ─── Highlight Row ─── */
.highlight-row {
    background: var(--bg-hover);
}

/* ─── Hidden Rows (filter) ─── */
tr.hidden {
    display: none;
}

/* ─── Percentage in cells ─── */
.pct {
    font-family: var(--font-mono);
    font-weight: 600;
}

/* ─── Animate Sections ─── */
[data-animate] {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

[data-animate].visible {
    opacity: 1;
    transform: translateY(0);
}

/* ─── Score Bar Animation ─── */
.bar[data-width] {
    width: 0;
}

/* ─── Filter Transition ─── */
tr {
    transition: opacity 0.25s ease, background 0.15s ease;
}

tr.filter-hidden {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    visibility: hidden;
}

/* ─── Custom Scrollbar ─── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* ─── Table Overflow ─── */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .masthead {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .masthead-stats {
        align-items: flex-start;
    }

    .masthead-stat {
        text-align: left;
    }

    .toolbar {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 16px;
    }

    .masthead-title h1 {
        font-size: 22px;
        letter-spacing: 2px;
    }

    .section-divider {
        margin: 32px 0 16px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px 32px;
    }

    .filters {
        flex-wrap: wrap;
    }

    .rank {
        font-size: 16px;
        margin-right: 8px;
    }
}

/* ─── Print ─── */
@media print {
    :root {
        --bg: #ffffff;
        --bg-card: #ffffff;
        --bg-card-alt: #f8f8f8;
        --bg-hover: #f0f0f0;
        --text: #1a1a1a;
        --text-muted: #666666;
        --text-dim: #999999;
        --text-heading: #000000;
        --ember: #9a6a20;
        --border: #dddddd;
        --border-strong: #cccccc;
        --green: #5a7a20;
        --red: #8c3030;
        --yellow: #9a6a20;
    }

    body {
        padding: 20px;
        background-image: none;
    }

    .masthead::before {
        display: none;
    }

    .card::before, .card::after {
        display: none;
    }

    .card {
        border-color: #ddd;
        break-inside: avoid;
    }

    [data-animate] {
        opacity: 1 !important;
        transform: none !important;
    }

    .bar {
        box-shadow: none;
    }

    .filter-btn {
        display: none;
    }

    tr.hidden, tr.filter-hidden {
        display: table-row !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: static !important;
    }
}
