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

:root {
    --bg: #fafafa;
    --bg-white: #ffffff;
    --text: #333333;
    --text-secondary: #555555;
    --text-muted: #888888;
    --accent: #5364ff;
    --accent-dark: #4150e0;
    --border: #e5e5e5;
    --border-light: #f0f0f0;
    --code-bg: #f5f5f5;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --radius: 8px;
    --radius-lg: 12px;
    --font: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --max-width: 980px;
    --narrow-width: 720px;
    --transition: 0.2s ease;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

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

.container.narrow, .narrow {
    max-width: var(--narrow-width);
    margin-left: auto;
    margin-right: auto;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Top Video Banner — show full native dimensions ===== */
.top-video-banner {
    width: 100%;
    background: #111;
    line-height: 0;   /* remove inline-block gap */
    overflow: hidden;
}

.top-video-banner video {
    width: 100%;
    height: auto;    /* maintain native aspect ratio, no cropping */
    display: block;
    object-fit: fill; /* keep all pixels, no cover cropping */
}

/* ===== Hero ===== */
.hero {
    text-align: center;
    padding: 56px 24px 36px;
}

.paper-title {
    font-size: clamp(1.8rem, 4.5vw, 2.8rem);
    font-weight: 800;
    line-height: 1.2;
    color: var(--text);
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.title-accent { color: var(--accent); }

.authors {
    margin-bottom: 12px;
    font-size: 1.05rem;
}

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

.affiliations {
    margin-top: 12px;
    font-size: 1.05rem;
    color: var(--text-secondary);
}

.notes {
    margin-top: 6px;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ===== Pill Buttons ===== */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #363636;
    color: white;
    border-radius: 50px;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: var(--font);
    text-decoration: none;
    transition: background var(--transition);
}

.pill-btn:hover { background: #555; text-decoration: none; color: white; }
.pill-btn i { font-size: 1rem; }

/* ===== TL;DR ===== */
.tldr-box {
    max-width: var(--narrow-width);
    margin: 0 auto;
    padding: 14px 22px;
    background: #eef2ff;
    border-radius: var(--radius);
    font-size: 0.92rem;
    line-height: 1.65;
    color: #3b4a6b;
    border-left: 4px solid var(--accent);
}

.tldr-box strong { color: var(--accent-dark); }

/* ===== Sections ===== */
.section { padding: 48px 0; }
.section-tight { padding: 32px 0; }

.section-title {
    text-align: center;
    font-size: 1.65rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
    letter-spacing: -0.3px;
}

.subsection { margin-top: 44px; }

.subsection-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text);
    letter-spacing: -0.2px;
}

.section-divider {
    max-width: var(--max-width);
    margin: 0 auto;
    border: none;
    border-top: 1px solid var(--border);
}

.body-text {
    font-size: 0.96rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.body-text.centered {
    text-align: center;
    max-width: var(--narrow-width);
    margin-left: auto;
    margin-right: auto;
}

.body-text strong { color: var(--text); font-weight: 600; }
.body-text em { font-style: italic; }

/* ===== Main Video (with controls) ===== */
.main-video-wrapper {
    width: 100%;
    background: #111;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

.main-video-wrapper video {
    width: 100%;
    display: block;
    max-height: 560px;
    object-fit: contain;
}

/* ===== Auto-play scroll videos (gif-style wrappers) ===== */
.auto-video-wrapper {
    width: 100%;
    background: #111;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.auto-video-wrapper video {
    width: 100%;
    display: block;
}

/* ===== Side-by-side layout ===== */
.side-by-side {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    margin-top: 20px;
}

.side-figure {
    flex: 1;
    min-width: 0;
}

.side-figure img {
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    display: block;
}

.side-text {
    flex: 1;
    min-width: 0;
}

.side-table {
    flex: 1;
    min-width: 0;
}

/* ===== Figure blocks ===== */
.figure-block {
    margin: 20px auto;
}

.figure-block img {
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.figure-caption {
    margin-top: 10px;
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.55;
    text-align: center;
    padding: 0 16px;
}

.figure-caption strong { color: var(--text-secondary); }

/* ===== Insight Pills (BN/LN) ===== */
.insight-pills {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.insight-pill {
    background: #eef2ff;
    border-left: 3px solid var(--accent);
    border-radius: 4px;
    padding: 8px 14px;
    font-size: 0.86rem;
    color: #3b4a6b;
    font-weight: 500;
}

/* ===== Augmentation List ===== */
.aug-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.aug-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.aug-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
    margin-top: 2px;
}

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

.aug-item p {
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--text-secondary);
    margin: 0;
}

/* ===== Method Cards ===== */
.method-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.method-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    transition: box-shadow var(--transition);
}

.method-card:hover { box-shadow: var(--shadow-md); }

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

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

/* ===== Tables ===== */
.table-block {
    margin: 24px auto;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table-title {
    padding: 13px 20px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.table-subtitle {
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--text-muted);
}

.table-scroll { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

thead { background: #f8f9fb; }

th {
    padding: 10px 12px;
    text-align: center;
    font-weight: 600;
    font-size: 0.79rem;
    color: var(--text-muted);
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

th:first-child { text-align: left; }

td {
    padding: 9px 12px;
    text-align: center;
    border-top: 1px solid var(--border-light);
    color: var(--text-secondary);
    white-space: nowrap;
}

td:first-child {
    text-align: left;
    font-weight: 500;
    color: var(--text);
    white-space: normal;
    min-width: 130px;
}

tbody tr:hover { background: #fafbfd; }

.best-row { background: #f0f4ff !important; }
.best-row td { color: var(--accent-dark); font-weight: 600; }
.best-row td:first-child { color: var(--accent-dark); }

.best-cell {
    color: var(--accent-dark) !important;
    font-weight: 700 !important;
}

/* ===== Video Grids ===== */
.video-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-top: 12px;
}

/* 3-column standalone grid — ManiSkill2 videos, real-world 6 videos */
.video-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 12px;
}

/* 3-column compact — used inside side-by-side */
.video-grid-3-compact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    flex: 1;
    min-width: 0;
}

/* Equal-height side-by-side — stretches children to match tallest */
.side-stretch {
    align-items: stretch !important;
}

.side-stretch .side-figure {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.side-stretch .side-figure img {
    flex: 1;
    min-height: 0;
    object-fit: contain;
    width: 100%;
}

.side-stretch .side-table {
    display: flex;
    flex-direction: column;
}

.side-stretch .side-table .table-block {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.side-stretch .side-table .table-scroll {
    flex: 1;
}

.video-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.video-card:hover { box-shadow: var(--shadow-md); }

.video-wrapper {
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    overflow: hidden;
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-label {
    padding: 8px 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

.video-label strong { color: var(--text); }
.success-rate { color: var(--accent); font-weight: 700; }

/* ===== BibTeX ===== */
.bibtex-block {
    position: relative;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.bibtex-block pre {
    padding: 20px 24px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.65;
    color: var(--text-secondary);
    overflow-x: auto;
    margin: 0;
    white-space: pre;
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
}

.copy-btn:hover { background: var(--border-light); color: var(--text); }
.copy-btn.copied { background: #eef7ee; color: #2e7d32; border-color: #c8e6c9; }

/* ===== Footer ===== */
.footer {
    padding: 28px 0;
    text-align: center;
    border-top: 1px solid var(--border);
}

.footer p { font-size: 0.82rem; color: var(--text-muted); }
.footer a { color: var(--accent); }

/* ===== Responsive ===== */
@media (max-width: 860px) {
    .video-grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }
    .video-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    .side-by-side {
        flex-direction: column;
    }
    .side-figure,
    .side-text,
    .side-table,
    .video-grid-3-compact {
        width: 100%;
        flex: unset;
    }
    .method-grid {
        grid-template-columns: 1fr;
    }
    .side-stretch {
        align-items: flex-start !important;
    }
}

@media (max-width: 600px) {
    .hero { padding: 36px 16px 28px; }
    .video-grid-5 {
        grid-template-columns: repeat(2, 1fr);
    }
    .video-grid-3 {
        grid-template-columns: 1fr 1fr;
    }
    .video-grid-3-compact {
        grid-template-columns: 1fr 1fr;
    }
    .action-buttons { flex-direction: column; align-items: center; }
    .pill-btn { width: 190px; justify-content: center; }
    th, td { padding: 8px 9px; }
}

@media (max-width: 420px) {
    .video-grid-3 {
        grid-template-columns: 1fr;
    }
}
