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

:root {
    --primary: #1a56db;
    --primary-light: #e8f0fe;
    --primary-dark: #0f3a8e;
    --accent: #7c3aed;
    --text: #1f2937;
    --text-secondary: #4b5563;
    --bg: #ffffff;
    --bg-alt: #f8fafc;
    --border: #e5e7eb;
    --gold: #d97706;
    --green: #059669;
    --human: #0891b2;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    font-size: 16px;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== Hero ===== */
.hero {
    text-align: center;
    padding: 80px 24px 60px;
    background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 50%, #f0fdfa 100%);
    border-bottom: 1px solid var(--border);
}

.hero .title {
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--primary-dark);
    margin-bottom: 24px;
    line-height: 1.4;
}

.title-name {
    background: linear-gradient(135deg, #3b82f6, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.highlight {
    color: var(--primary);
    font-weight: 500;
}

.authors {
    margin-bottom: 10px;
    font-size: 1.05rem;
    line-height: 1.8;
}

.author a {
    color: var(--text);
    font-weight: 500;
}

.author a:hover {
    color: var(--primary);
}

.affiliations {
    font-size: 0.92rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.affiliations span {
    margin: 0 10px;
}

.equal-contrib {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.links {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #fff;
    background: var(--primary);
    transition: background 0.2s, transform 0.15s;
    text-decoration: none;
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    text-decoration: none;
}

.btn i {
    font-size: 1rem;
}

/* ===== Sections ===== */
.section {
    padding: 64px 24px;
}

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

.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 12px;
    color: var(--text);
}

.section-description {
    text-align: center;
    color: var(--text-secondary);
    max-width: 720px;
    margin: 0 auto 36px;
    font-size: 1.05rem;
}

/* ===== Abstract ===== */
.abstract-text {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-secondary);
    max-width: 820px;
    margin: 0 auto 16px;
    text-align: justify;
}

/* ===== Features Grid ===== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 32px;
}

.feature-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    text-align: center;
    transition: box-shadow 0.2s, transform 0.2s;
}

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

.feature-icon {
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 14px;
}

.feature-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== Figure ===== */
.figure-container {
    text-align: center;
    margin-top: 24px;
}

.figure-img {
    max-width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.figure-caption {
    font-size: 0.92rem;
    color: var(--text-secondary);
    margin-top: 16px;
    line-height: 1.6;
    text-align: left;
}

/* ===== Tables ===== */
.table-wrapper {
    overflow-x: auto;
    margin: 24px 0 12px;
}

.table-caption {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: left;
    margin: 8px 0 0;
    line-height: 1.5;
}

/* Comparison Table */
.comparison-table,
.results-table,
.human-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.comparison-table th,
.results-table th,
.human-table th {
    background: var(--primary);
    color: white;
    padding: 10px 14px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.comparison-table td,
.results-table td,
.human-table td {
    padding: 9px 14px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.comparison-table td:first-child,
.results-table td:first-child,
.human-table td:first-child {
    text-align: left;
    font-weight: 500;
}

.comparison-table tbody tr:hover,
.human-table tbody tr:hover {
    background: #f1f5f9;
}

/* No row hover for grouped results table — cell backgrounds handle it */

.check {
    color: var(--green);
    font-weight: 700;
    font-size: 1.1rem;
}

.cross {
    color: #dc2626;
    font-weight: 700;
    font-size: 1.1rem;
}

.highlight-row {
    background: var(--primary-light) !important;
    font-weight: 600;
}

.highlight-row td {
    border-bottom: 2px solid var(--primary);
}

.separator td {
    padding: 0;
    border-bottom: 2px solid var(--border);
}


.results-table sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Column group backgrounds for results table */
.grouped-table .col-model {
    background: #5b9aff !important;
}

.grouped-table .group-nosearch {
    background: #3b7cf5;
}

.grouped-table .group-native {
    background: #1a56db;
}

.grouped-table .group-agentic {
    background: #0f3a8e;
}

.grouped-table .sub-header th {
    font-size: 0.8rem;
    border-top: 1px solid rgba(255,255,255,0.3);
}

.grouped-table tbody td:first-child {
    background: #f8fbff !important;
}

.grouped-table .col-nosearch {
    background: #e8f0fe !important;
}

.grouped-table .col-native {
    background: #d6e4f7 !important;
}

.grouped-table .col-agentic {
    background: #c9daf0 !important;
}

/* Group separators — vertical borders between settings */
.grouped-table thead th.group-native,
.grouped-table thead th.group-agentic {
    border-left: 2px solid rgba(255,255,255,0.4);
}

/* Apply left border on the first td of each native/agentic group via nth-child */
/* Columns: 1=Model, 2=NoSearch Acc, 3=Native Acc, 4=Native #SQ, 5=Native #P, 6=Agentic Acc, 7=Agentic #SQ, 8=Agentic #P */
.grouped-table tbody td:nth-child(2) {
    border-left: 2px solid var(--border);
}
.grouped-table tbody td:nth-child(3) {
    border-left: 2px solid var(--border);
}
.grouped-table tbody td:nth-child(6) {
    border-left: 2px solid var(--border);
}

/* ===== Subsections ===== */
.subsection-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 24px;
    margin-bottom: 8px;
}

.subsection-description {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 4px;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 40px 0 32px;
}

/* ===== Settings Grid ===== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 20px 0 32px;
}

.setting-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    background: var(--bg-alt);
}

.setting-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--primary-dark);
}

.setting-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ===== Stats Cards ===== */
.results-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
    margin-top: 24px;
}

.stat-card {
    text-align: center;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 16px;
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ===== Decomposition Chart ===== */
.decomposition-chart {
    max-width: 700px;
    margin: 32px auto;
}

.decomp-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.decomp-label {
    width: 160px;
    font-size: 0.88rem;
    font-weight: 500;
    text-align: right;
    padding-right: 16px;
    flex-shrink: 0;
}

.decomp-bar-container {
    flex: 1;
    background: #f1f5f9;
    border-radius: 6px;
    height: 32px;
    position: relative;
}

.decomp-bar {
    height: 100%;
    border-radius: 6px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: white;
    font-size: 0.82rem;
    font-weight: 600;
    min-width: 52px;
    transition: width 0.6s ease;
}

.bar-gold {
    background: var(--gold);
}

.bar-ceiling {
    background: var(--accent);
}

.bar-human {
    background: var(--human);
}

/* ===== Decomposition Table ===== */
.decomp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    max-width: 700px;
    margin: 24px auto 12px;
}

.decomp-table th {
    background: var(--primary);
    color: white;
    padding: 10px 14px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.decomp-table td {
    padding: 9px 14px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.decomp-table td:first-child {
    text-align: left;
    font-weight: 500;
}

.decomp-table sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.decomp-group-1 td {
    background: #f8fbff;
}

.decomp-group-2 td {
    background: #eaf1fb;
}

.decomp-group-3 td {
    background: #dce8f7;
}

/* ===== Insight Boxes ===== */
.decomp-insight {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    max-width: 700px;
    margin: 32px auto 0;
}

.insight-box {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    background: var(--bg);
    text-align: center;
}

.insight-header {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.insight-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.insight-box p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ===== Findings Grid ===== */
.findings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.finding-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    background: var(--bg-alt);
}

.finding-icon {
    font-size: 1.3rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.finding-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.finding-card p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* Full human table column groups */
.full-human-table thead th {
    font-size: 0.8rem;
}

/* Vertical borders between column groups: after System(1), Performance(2-4), Search Effort(5-7), Modality(8-10) */
.full-human-table td:nth-child(1),
.full-human-table td:nth-child(4),
.full-human-table td:nth-child(7),
.full-human-table td:nth-child(10) {
    border-right: 2px solid var(--border);
}

.full-human-table thead tr.group-header th:nth-child(1),
.full-human-table thead tr.group-header th:nth-child(2),
.full-human-table thead tr.group-header th:nth-child(3),
.full-human-table thead tr.group-header th:nth-child(4) {
    border-right: 2px solid rgba(255,255,255,0.4);
}

.full-human-table thead tr.sub-header th:nth-child(3),
.full-human-table thead tr.sub-header th:nth-child(6),
.full-human-table thead tr.sub-header th:nth-child(9) {
    border-right: 2px solid rgba(255,255,255,0.4);
}

@media (max-width: 768px) {
    .findings-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Human Error Analysis ===== */
.error-analysis-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
    align-items: center;
    margin-top: 24px;
}

.error-chart {
    text-align: center;
}

.pie-chart {
    width: 240px;
    height: 240px;
}

.pie-legend {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
    padding-left: 30px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.error-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.error-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-alt);
}

.error-card-header {
    display: flex;
    align-items: last baseline;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: nowrap;
}

.error-card-header h4 {
    line-height: 1.3;
}

.error-card-pct {
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
}

.error-card h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.error-card p {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.error-takeaway {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 24px;
    padding: 16px 20px;
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
    border-radius: 0 8px 8px 0;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .error-analysis-layout {
        grid-template-columns: 1fr;
    }

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

    .pie-legend {
        align-items: center;
        padding-left: 0;
    }
}

/* ===== Citation ===== */
.citation-box {
    background: #1e293b;
    border-radius: var(--radius);
    padding: 24px;
    max-width: 100%;
    margin: 24px auto 0;
    position: relative;
}

.citation-box pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.citation-box code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: #e2e8f0;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #cbd5e1;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 32px 24px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.88rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hero .title {
        font-size: 2.8rem;
    }

    .hero .subtitle {
        font-size: 1.05rem;
    }

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

    .results-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .decomp-label {
        width: 120px;
        font-size: 0.8rem;
    }

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

    .authors {
        font-size: 0.95rem;
    }
}

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

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

    .section {
        padding: 40px 16px;
    }
}
