/* ===== 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;

    /* Memory-type accents */
    --entity: #3b82f6;
    --entity-bg: #eff6ff;
    --event: #10b981;
    --event-bg: #ecfdf5;
    --behavior: #a855f7;
    --behavior-bg: #faf5ff;

    --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: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

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

a:hover {
    text-decoration: underline;
}

/* ===== Hero ===== */
/* tighten the gap between the hero block and the first (teaser) section */
#overview {
    padding-top: 12px;
}
#overview .figure-container {
    margin-top: 0;
}

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

.hero .title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--primary-dark);
    margin-bottom: 24px;
    line-height: 1.35;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

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

.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;
}

.btn.btn-ghost {
    background: #1f2937;
}
.btn.btn-ghost:hover { background: #0b1220; }

.btn.btn-hf {
    background: #ff9d00;
    color: #1f2937;
}
.btn.btn-hf:hover { background: #e08800; }

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

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

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

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

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

.abstract-text strong {
    color: var(--text);
}

/* ===== 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;
    max-width: 940px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== Figure 1 teaser (in-page rebuild) ===== */
.fig1 {
    position: relative;
    max-width: 1040px;
    margin: 0 auto;
    padding: 4px 0 8px;
}

.fig1-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.fig1-top {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 32px;          /* compact; connector routing keeps the lines clear of the bubbles */
}
.fig1-bottom {
    display: flex;
    justify-content: center;
    margin-top: 32px;             /* behavior box pulled up — less dead space below the timeline */
}

.fig1-bubble {
    position: relative;
    z-index: 2;
    flex: 1;
    text-align: left;
    border-radius: 14px;
    padding: 12px 16px 14px;
    font-size: 0.82rem;
    line-height: 1.45;
    box-shadow: var(--shadow);
}
.fig1-bottom .fig1-bubble { flex: 0 1 660px; }

.fig1-bubble .bub-tag {
    display: inline-block;
    font-weight: 700;
    font-size: 0.86rem;
    margin-bottom: 4px;
}
.fig1-bubble .bub-time {
    font-size: 0.74rem;
    color: var(--text-secondary);
    margin: 0 0 4px;
}
.fig1-bubble .bub-q { margin: 0 0 6px; }
.fig1-bubble .bub-opts { margin: 0; color: var(--text-secondary); }
.fig1-bubble .bub-ans { font-weight: 700; }

.bubble-event { background: var(--event-bg); border: 1px solid var(--event); }
.bubble-event .bub-tag, .bubble-event .bub-ans { color: var(--event); }
.bubble-entity { background: var(--entity-bg); border: 1px solid var(--entity); }
.bubble-entity .bub-tag, .bubble-entity .bub-ans { color: var(--entity); }
.bubble-behavior { background: var(--behavior-bg); border: 1px solid var(--behavior); }
.bubble-behavior .bub-tag, .bubble-behavior .bub-ans { color: var(--behavior); }

.fig1-rail { position: relative; z-index: 2; }

/* Timeline split into per-day segments; "Day N" centered under its frame(s). */
.fig1-days {
    display: flex;
    align-items: stretch;
}
.fig1-day {
    flex: var(--n, 1) 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.fig1-day + .fig1-day {
    border-left: 1px dashed #b9c2cd;          /* the day boundary */
}
.fig1-day-frames {
    display: flex;
    gap: 6px;
    padding: 0 6px;                            /* keep frames clear of the boundary line */
    flex: 1;
    align-items: flex-start;
}
.fig1-day-label {
    margin-top: 8px;
    padding-top: 7px;
    border-top: 2px solid var(--border);      /* adjacent labels butt together → one timeline rule */
    text-align: center;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.fig1-frame {
    margin: 0;
    flex: 1 1 0;
    min-width: 0;
}
.fig1-frame img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: block;
}
.fig1-frame figcaption {
    margin-top: 4px;
    font-size: 0.64rem;
    line-height: 1.2;
    text-align: center;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.fig1-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 28px;
    margin-top: 20px;
    padding: 10px 16px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

@media (max-width: 760px) {
    .fig1-top { flex-direction: column; gap: 14px; margin-bottom: 18px; }
    .fig1-bottom { margin-top: 18px; }
    .fig1-bottom .fig1-bubble { flex: 1; }
    .fig1-days {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 6px;
        -webkit-overflow-scrolling: touch;
    }
    .fig1-day { flex: 0 0 auto; }
    .fig1-day-frames { gap: 6px; }
    .fig1-frame { flex: 0 0 26vw; }
    .fig1-day-label { font-size: 0.68rem; }
}

/* ===== 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 auto 0;
    line-height: 1.55;
    max-width: 940px;
}

.results-table,
.comparison-table,
.simple-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

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

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

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

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

.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);
}

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

/* ===== Main results table (Table 1) ===== */
.main-results-table {
    font-size: 0.86rem;
}

.main-results-table th,
.main-results-table td {
    padding: 7px 10px;
}

.main-results-table thead tr:first-child th {
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}

.main-results-table .group-row td {
    background: #e5e7eb;
    color: var(--text-secondary);
    font-weight: 700;
    text-align: left;
    padding: 7px 14px;
    border-top: 2px solid #cbd2da;
    border-bottom: 1px solid #cbd2da;
}

.main-results-table .group-row:hover td {
    background: #e5e7eb;
}

.main-results-table u {
    text-decoration-thickness: 1.5px;
    text-underline-offset: 2px;
}

/* ===== Comparison block ===== */
.comparison-grid {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: 32px;
    align-items: center;
    margin-top: 12px;
}

.comparison-grid .figure-container {
    margin-top: 0;
}

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

/* ===== Tasks (memory types) ===== */
.task-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 32px;
}

.memory-card {
    border: 1px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 22px 22px 18px;
    background: var(--bg);
    transition: box-shadow 0.2s, transform 0.2s;
}

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

.memory-card.entity { border-top-color: var(--entity); }
.memory-card.entity .memory-icon { color: var(--entity); }
.memory-card.entity .memory-tag { background: var(--entity-bg); color: var(--entity); }

.memory-card.event { border-top-color: var(--event); }
.memory-card.event .memory-icon { color: var(--event); }
.memory-card.event .memory-tag { background: var(--event-bg); color: var(--event); }

.memory-card.behavior { border-top-color: var(--behavior); }
.memory-card.behavior .memory-icon { color: var(--behavior); }
.memory-card.behavior .memory-tag { background: var(--behavior-bg); color: var(--behavior); }

.memory-icon {
    font-size: 1.6rem;
    margin-bottom: 10px;
}

.memory-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.memory-card > p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.subtask-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.subtask {
    padding: 10px 12px;
    background: var(--bg-alt);
    border-radius: 8px;
    font-size: 0.85rem;
}

.subtask strong {
    display: block;
    font-size: 0.92rem;
    color: var(--text);
    margin-bottom: 2px;
}

.memory-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

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

/* ===== Pipeline ===== */
.pipeline-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin: 28px 0 12px;
}

.pipeline-step {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 16px;
    background: var(--bg);
    text-align: left;
    position: relative;
}

.pipeline-step .step-num {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: white;
    background: var(--primary);
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 10px;
}

.pipeline-step:nth-child(1) .step-num { background: #3b82f6; }
.pipeline-step:nth-child(2) .step-num { background: #10b981; }
.pipeline-step:nth-child(3) .step-num { background: #d97706; }
.pipeline-step:nth-child(4) .step-num { background: #a855f7; }

.pipeline-step h4 {
    font-size: 0.98rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}

.pipeline-step p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.pipeline-bottom {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 36px;
    align-items: center;
    margin-top: 36px;
}

.pipeline-bottom .figure-container { margin-top: 0; }

.pipeline-stats h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.pipeline-stats ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pipeline-stats li {
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.92rem;
}

.pipeline-stats li strong {
    color: var(--primary);
    font-weight: 700;
}

@media (max-width: 900px) {
    .pipeline-grid {
        grid-template-columns: 1fr 1fr;
    }
    .pipeline-bottom {
        grid-template-columns: 1fr;
    }
}

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

/* ===== 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);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 16px;
}

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

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

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

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

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

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

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

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

.finding-card.entity { border-left: 4px solid var(--entity); }
.finding-card.event { border-left: 4px solid var(--event); }
.finding-card.behavior { border-left: 4px solid var(--behavior); }

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

.finding-card.entity .finding-icon { color: var(--entity); }
.finding-card.event .finding-icon { color: var(--event); }
.finding-card.behavior .finding-icon { color: var(--behavior); }

.finding-card h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

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

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

/* ===== Ablation pair ===== */
.ablation-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin-top: 16px;
    align-items: start;
}

.ablation-pair .table-block { min-width: 0; }

@media (max-width: 900px) {
    .ablation-pair {
        grid-template-columns: 1fr;
    }
}

/* ===== 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: 1.4rem;
    }

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

    .authors {
        font-size: 0.95rem;
    }

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

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

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