/* CSS Variables for Theme */
:root {
    --bg-app: #ffffff;
    --bg-panel: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.85);

    --text-primary: #0f172a;
    /* Slate 900 */
    --text-secondary: #334155;
    /* Slate 700 */
    --text-tertiary: #64748b;
    /* Slate 500 - Cooler, premium gray */

    --accent-link: #2563eb;
    --bg-selection: #f8fafc;
    --bg-hover: #f1f5f9;

    --brand-anthropic: #cc8b6e;
    --brand-openai: #5da88b;
    --brand-google: #6b8cd4;
    --brand-meta: #6b7ab8;
    --brand-deepseek: #8c82ce;
    --brand-generic: #94a3b8;
    --brand-xai: #1a1a1a;
    --brand-mistral: #f97316;
    --brand-moonshot: #6366f1;

    --bar-bg: #e2e8f0;
    --border-major: rgba(0, 0, 0, 0.08);
    /* Transparent black for better blending */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;

    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-data: 'JetBrains Mono', 'Menlo', 'Monaco', monospace;

    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


/* Layout */
.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header */
header {
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-major);
    flex-wrap: wrap;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 50;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
    width: calc(100% + 32px);
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.header-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header-nav {
    display: flex;
    gap: 24px;
}

.header-nav a {
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    transition: color var(--transition-fast);
}

.header-nav a:hover {
    color: var(--text-primary);
}

.header-nav a.active {
    color: var(--text-primary);
    border-bottom: 1px solid var(--text-primary);
}

.logo a {
    color: inherit;
    text-decoration: none;
}

/* Content Wrapper */
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 0;
    gap: 0;
}

/* Hero Section */
#hero-section {
    width: 100%;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-major);
    margin-bottom: 12px;
}

.hero-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 16px;
}

/* Hero Graph */
.hero-graph-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.hero-bar-group {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 12px;
    padding: 4px 0;
    border-radius: 4px;
    transition: background-color var(--transition-fast);
}

.hero-bar-group:hover {
    background-color: var(--bg-hover);
}

.hero-bar-label {
    width: 140px;
    min-width: 140px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-bar-track {
    flex: 1;
    background: #f1f5f9;
    height: 12px;
    overflow: hidden;
    border-radius: 6px;
}

.hero-bar-fill {
    height: 100%;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    border-radius: 6px;
}

.hero-bar-value {
    width: 45px;
    min-width: 45px;
    font-family: var(--font-data);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
}

/* Brand Colors */
.hero-bar-fill.anthropic,
.mini-bar.anthropic {
    background: var(--brand-anthropic);
}

.hero-bar-fill.openai,
.mini-bar.openai {
    background: var(--brand-openai);
}

.hero-bar-fill.google,
.mini-bar.google {
    background: var(--brand-google);
}

.hero-bar-fill.meta,
.mini-bar.meta {
    background: var(--brand-meta);
}

.hero-bar-fill.deepseek,
.mini-bar.deepseek {
    background: var(--brand-deepseek);
}

.hero-bar-fill.generic,
.mini-bar.generic {
    background: var(--brand-generic);
}

.hero-bar-fill.xai,
.mini-bar.xai {
    background: var(--brand-xai);
}

.hero-bar-fill.mistral,
.mini-bar.mistral {
    background: var(--brand-mistral);
}

.hero-bar-fill.moonshot,
.mini-bar.moonshot {
    background: var(--brand-moonshot);
}

/* Main Dashboard */
main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Grid Table */
.grid-table {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.grid-header-row {
    display: none;
}

.grid-row {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-major);
    gap: 12px;
    transition: transform 0.2s ease, background-color 0.15s ease, box-shadow 0.2s ease;
    border-radius: 8px;
    margin-bottom: 2px;
}

.grid-row:hover {
    background-color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: transparent;
    z-index: 10;
}

.cell-model {
    display: flex;
    gap: 10px;
    align-items: center;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.provider-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-tertiary);
}

.provider-logo svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.cell-model .rank {
    color: var(--text-tertiary);
    font-size: 12px;
    font-family: var(--font-data);
    min-width: 20px;
    opacity: 0.7;
}

.cell-model .name {
    flex: 1;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
}

.cell-score {
    font-family: var(--font-data);
    font-weight: 700;
    color: var(--text-primary);
    font-size: 15px;
}

/* Category cells - mobile layout */
.category-scores {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.cell-cat-val {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: var(--bg-selection);
    border-radius: 6px;
}

.cat-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cat-value {
    font-family: var(--font-data);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.mini-bar-container {
    height: 4px;
    background: #e2e8f0;
    overflow: hidden;
    margin-top: 4px;
    border-radius: 2px;
}

.mini-bar {
    height: 100%;
    background: var(--text-tertiary);
}

/* Desktop styles */
@media (min-width: 768px) {
    .container {
        padding: 0 24px;
    }

    /* Adjust header sticky width for padding change */
    header {
        margin: 0 -24px;
        padding-left: 24px;
        padding-right: 24px;
        width: calc(100% + 48px);
    }

    .logo {
        font-size: 20px;
    }

    .hero-bar-label {
        width: 180px;
        min-width: 180px;
        font-size: 14px;
    }

    .hero-bar-value {
        width: 50px;
        min-width: 50px;
    }

    .grid-header-row {
        display: grid;
        grid-template-columns: 280px repeat(4, 1fr);
        gap: 16px;
        padding: 0 16px 12px 16px;
        border-bottom: 1px solid var(--border-major);
        font-weight: 700;
        font-size: 11px;
        color: var(--text-tertiary);
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .grid-header-row .cell-score {
        display: none;
    }

    .grid-row {
        display: grid;
        grid-template-columns: 280px repeat(4, 1fr);
        gap: 16px;
        flex-direction: row;
        padding: 10px 16px;
        align-items: center;
        margin: 0 -16px 2px -16px;
    }

    .cell-model {
        display: flex;
        gap: 10px;
        align-items: center;
    }

    .cell-model .cell-score {
        margin-left: auto;
        font-size: 14px;
    }

    .category-scores {
        display: contents;
    }

    .cell-cat-val {
        padding: 0;
        background: transparent;
        border-radius: 0;
    }

    .cat-label {
        display: none;
    }

    .cat-value {
        font-size: 14px;
    }
}

/* Small phones */
@media (max-width: 400px) {
    .container {
        padding: 0 12px;
    }

    header {
        margin: 0 -12px;
        padding-left: 12px;
        padding-right: 12px;
        width: calc(100% + 24px);
    }

    .hero-bar-label {
        width: 100px;
        min-width: 100px;
        font-size: 12px;
    }

    .hero-bar-value {
        font-size: 12px;
    }

    .cell-model {
        font-size: 14px;
    }

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

/* Utilities */
.text-mono {
    font-family: var(--font-data);
}

.bold {
    font-weight: 600;
}

/* Cell headers */
.cell-cat {
    display: flex;
    flex-direction: column;
}

.cat-name {
    font-weight: 600;
    color: var(--text-tertiary);
}


.cat-desc {
    font-size: 9px;
    color: #999;
}

/* --- Documentation / Sub-page Content Styles --- */

/* Typography for content pages - HYPER DENSE */
main h1 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: -0.01em;
}

main h2 {
    font-size: 13px;
    font-family: var(--font-heading);
    /* Switch to heading font for cleanliness */
    font-weight: 700;
    margin: 0 0 6px 0;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

main p,
main li {
    font-size: 14px;
    /* Increased slightly for readability */
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 4px;
    max-width: 680px;
    /* Limit line length for readability */
}

main ul {
    margin-bottom: 6px;
    padding-left: 20px;
    max-width: 680px;
}

main li strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Components */
.intro {
    font-size: 15px;
    /* Larger intro text */
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
    max-width: 720px;
    border-bottom: 1px solid var(--border-major);
    padding-bottom: 10px;
}

section {
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-major);
    padding-bottom: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

@media (max-width: 768px) {
    section {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Grouped info for grid layout */
.section-info {
    display: flex;
    flex-direction: column;
}

.category-tag {
    display: inline-block;
    font-family: var(--font-data);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    margin-bottom: 12px;
    background: var(--bg-selection);
    padding: 4px 8px;
    border-radius: 4px;
    align-self: start;
}

.example {
    background: var(--bg-selection);
    border: 1px solid var(--border-major);
    padding: 12px;
    margin: 0;
    border-radius: 6px;
    max-width: none;
    box-shadow: var(--shadow-sm);
}

.example-label {
    display: none;
}

.example p {
    font-size: 13px;
    color: var(--text-primary);
    margin: 0;
    font-style: normal;
    font-family: var(--font-data);
    line-height: 1.5;
}

.code-block {
    background: #0f172a;
    /* Darker slate */
    border-radius: 6px;
    padding: 12px;
    margin: 0;
    overflow-x: auto;
    max-width: none;
    border: 1px solid var(--border-major);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.code-block pre {
    font-family: var(--font-data);
    font-size: 13px;
    line-height: 1.5;
    color: #cbd5e1;
    /* Lighter text for contrast */
    margin: 0;
    white-space: pre-wrap;
}

/* Metrics Grid - Dense */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 0;
    max-width: 720px;
}

.metric {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 12px;
    background: var(--bg-panel);
    border-radius: 6px;
    border: 1px solid var(--border-major);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.metric:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.metric-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Footer for doc pages */
footer {
    padding: 12px 0;
    border-top: 1px solid var(--border-major);
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 16px;
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color var(--transition-fast);
}

footer a:hover {
    color: var(--text-primary);
    border-bottom: 1px solid var(--text-primary);
}

/* --- Examples Page Specifics --- */

.section-divider {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    margin-top: 48px;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-major);
    /* Softer divider */
}

.example-card {
    margin-bottom: 20px;
    padding: 20px;
    border: 1px solid var(--border-major);
    border-radius: 8px;
    background: var(--bg-app);
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 32px;
    align-items: start;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.example-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

@media (max-width: 900px) {
    .example-card {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* Target left column (all except code-block) */
.example-card> :not(.code-block) {
    grid-column: 1;
}

/* Target right column (code-block) */
.example-card>.code-block {
    grid-column: 2;
    grid-row: 1 / 10;
    margin: 0;
}

@media (max-width: 900px) {
    .example-card>.code-block {
        grid-column: 1;
        grid-row: auto;
    }
}

.example-card.success {
    border-left: 4px solid #22c55e;
}

.example-card.failure {
    border-left: 4px solid #ef4444;
}

.example-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.status {
    font-family: var(--font-data);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status.pass {
    background: #dcfce7;
    color: #166534;
}

.status.fail {
    background: #fee2e2;
    color: #991b1b;
}

.task-id {
    font-family: var(--font-data);
    font-size: 12px;
    color: var(--text-tertiary);
    /* Softer ID color */
    font-weight: 600;
}

.example-header .category {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-selection);
    padding: 2px 6px;
    border-radius: 3px;
}

.task-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-style: normal;
    line-height: 1.5;
}

.result {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--bg-selection);
    border-radius: 6px;
    border: 1px solid var(--border-major);
}

.result .label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 11px;
    text-transform: uppercase;
    margin-right: 6px;
    letter-spacing: 0.05em;
}

.result .label:not(:first-child) {
    margin-left: 16px;
}

.tolerance {
    font-size: 11px;
    color: var(--text-tertiary);
}

.error-value {
    color: #dc2626;
    font-weight: 600;
    font-family: var(--font-data);
    font-size: 12px;
}

.failure-analysis {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fef2f2;
    border-radius: 6px;
    font-size: 13px;
    color: #991b1b;
    line-height: 1.5;
    border: 1px solid #fecaca;
}

.failure-analysis strong {
    color: #7f1d1d;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 4px;
}

.failure-analysis code {
    font-family: var(--font-data);
    font-size: 12px;
    background: rgba(255, 255, 255, 0.5);
    padding: 2px 5px;
    border-radius: 3px;
}

.takeaways {
    background: var(--bg-selection);
    padding: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-major);
    box-shadow: var(--shadow-sm);
}

.takeaways h2 {
    margin-top: 0;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.takeaways ul {
    margin: 0;
    max-width: none;
}