/* ============================================================
   Gemini Latency Benchmark Dashboard
   Premium dark-mode design with glassmorphism
   ============================================================ */

:root {
    /* Color palette */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(20, 20, 35, 0.8);
    --bg-card-hover: rgba(30, 30, 50, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(99, 102, 241, 0.3);

    --text-primary: #e8e8f0;
    --text-secondary: #8888a0;
    --text-muted: #55556a;
    --text-accent: #a5b4fc;

    --accent-indigo: #6366f1;
    --accent-violet: #8b5cf6;
    --accent-cyan: #22d3ee;
    --accent-emerald: #34d399;
    --accent-amber: #fbbf24;
    --accent-rose: #fb7185;
    --accent-orange: #f97316;

    --gradient-hero: linear-gradient(135deg, #6366f1 0%, #8b5cf6 30%, #22d3ee 100%);
    --gradient-card: linear-gradient(145deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.04));

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-indigo);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}

/* ── Layout ── */
.container {
    max-width: 1360px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section {
    padding: 5rem 0;
    position: relative;
}

.section-dark {
    background: var(--bg-secondary);
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-icon {
    font-size: 1.5rem;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 2.5rem;
}

/* ── Hero ── */
.hero {
    position: relative;
    padding: 6rem 2rem 5rem;
    text-align: center;
    overflow: hidden;
    min-height: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% 20%, rgba(99, 102, 241, 0.15), transparent),
        radial-gradient(ellipse 60% 50% at 30% 80%, rgba(139, 92, 246, 0.08), transparent),
        radial-gradient(ellipse 50% 40% at 80% 70%, rgba(34, 211, 238, 0.06), transparent);
    animation: heroPulse 8s ease-in-out infinite alternate;
}

@keyframes heroPulse {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-block;
    padding: 0.4rem 1.2rem;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--accent-indigo);
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.25rem;
    letter-spacing: -0.03em;
}

.gradient-text {
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 640px;
    margin: 0 auto 2.5rem;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    flex-wrap: wrap;
}

.hero-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.hero-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.hero-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

/* ── Claims Grid ── */
.claims-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 1.5rem;
}

.claim-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    backdrop-filter: blur(20px);
    transition: all var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.claim-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-hero);
    opacity: 0;
    transition: opacity var(--transition-smooth);
}

.claim-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.claim-card:hover::before {
    opacity: 1;
}

.claim-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.claim-author {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-indigo);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.claim-verdict {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.claim-verdict.confirmed {
    background: rgba(34, 211, 238, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(34, 211, 238, 0.3);
}

.claim-verdict.partial {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-amber);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.claim-verdict.refuted {
    background: rgba(251, 113, 133, 0.15);
    color: var(--accent-rose);
    border: 1px solid rgba(251, 113, 133, 0.3);
}

.claim-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.claim-evidence {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.evidence-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.9rem;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.evidence-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.evidence-value {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Charts ── */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    backdrop-filter: blur(20px);
    transition: all var(--transition-smooth);
}

.chart-card:hover {
    border-color: var(--border-glow);
}

.chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.chart-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.chart-wrapper {
    position: relative;
    height: 320px;
}

/* ── Data Table ── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.data-table td {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    white-space: nowrap;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: rgba(99, 102, 241, 0.04);
}

.metric-label {
    font-family: var(--font-sans);
    font-weight: 500;
    color: var(--text-secondary);
}

.best-value {
    color: var(--accent-emerald);
    font-weight: 600;
}

.worst-value {
    color: var(--accent-rose);
}

/* ── Filter Bar ── */
.filter-bar {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-select {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.filter-select:hover {
    border-color: var(--accent-indigo);
}

.filter-select:focus,
.filter-checkbox input:focus {
    border-color: var(--accent-indigo);
    outline: 2px solid var(--accent-indigo);
    outline-offset: 2px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.filter-checkbox input {
    accent-color: var(--accent-indigo);
    cursor: pointer;
}

/* ── Runs Grid ── */
.runs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.runs-grid::-webkit-scrollbar {
    width: 6px;
}

.runs-grid::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 3px;
}

.run-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.1rem;
    font-size: 0.82rem;
    transition: all var(--transition-fast);
}

.run-card:hover {
    border-color: var(--border-glow);
}

.run-card.failed {
    border-color: rgba(251, 113, 133, 0.3);
}

.run-card.timeout {
    border-color: rgba(251, 191, 36, 0.3);
}

.run-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.run-strategy {
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--accent-indigo);
}

.run-status {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
}

.run-status.success {
    background: rgba(52, 211, 153, 0.15);
    color: var(--accent-emerald);
}

.run-status.fail {
    background: rgba(251, 113, 133, 0.15);
    color: var(--accent-rose);
}

.run-word {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.run-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.run-metric {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
}

.run-metric-label {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.run-metric-value {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
}

/* ── Strategy Explainer ── */
.strategy-explainer {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}

.strategy-diagram {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    flex-wrap: wrap;
    justify-content: center;
}

.stage-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    min-width: 180px;
    text-align: center;
    transition: all var(--transition-smooth);
}

.stage-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-3px);
}

.stage-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-indigo);
    margin-bottom: 0.5rem;
}

.stage-card h4 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.stage-card p {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.stage-config {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
    flex-wrap: wrap;
}

.config-tag {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.tag-temp {
    background: rgba(34, 211, 238, 0.15);
    color: var(--accent-cyan);
}

.tag-think {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-violet);
}

.tag-zero {
    background: rgba(52, 211, 153, 0.15) !important;
    color: var(--accent-emerald) !important;
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.stage-arrow {
    font-size: 1.5rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    padding-top: 2rem;
}

.parallel-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px dashed rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-md);
    position: relative;
}

.parallel-group .stage-card {
    min-width: 160px;
}

.parallel-group .stage-arrow {
    padding-top: 0;
    justify-content: center;
}

.parallel-group > div:not(.parallel-label) {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.parallel-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent-amber);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: center;
}

.strategy-results {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
}

.strategy-results h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--accent-emerald);
}

.result-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.result-metric:last-child {
    border-bottom: none;
}

.result-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.result-value {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
}

/* ── Footer ── */
.footer {
    padding: 3rem 2rem;
    text-align: center;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-sub {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    color: var(--text-muted);
    opacity: 0.7;
}

/* ── Loading ── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    gap: 1rem;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-indigo);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.empty-state p {
    max-width: 500px;
    margin: 0 auto;
}

.empty-state code {
    display: block;
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.2rem;
    }

    .hero-stats {
        gap: 1.5rem;
    }

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

    .section {
        padding: 3rem 0;
    }

    .container {
        padding: 0 1rem;
    }
    
    .strategy-diagram {
        flex-direction: column;
        align-items: center;
    }

    .stage-arrow {
        transform: rotate(90deg);
        padding-top: 0;
    }

    .parallel-group > div:not(.parallel-label) {
        flex-direction: column;
        align-items: center;
    }
}

/* heroPulse (8s infinite) and spin (0.8s infinite) run forever with no user
   control; WCAG 2.2.2 requires a way to pause/stop motion that lasts longer
   than 5s. Collapsing to a near-instant single frame is the standard fix. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
