@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap");

:root {
    --primary: #2563eb;
}

body {
    font-family:
        "Inter",
        system-ui,
        -apple-system,
        sans-serif;
    background-color: #f8fafc;
    margin: 0;
    padding: 3rem 1rem;
    line-height: 1.6;
}

.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 1rem;
}

.header {
    text-align: center;
    margin-bottom: 3.5rem;
}

.header h1 {
    font-size: 2.25rem;
    font-weight: 600;
    color: #18181b;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.025em;
}

.header p {
    font-size: 1.125rem;
    color: #64748b;
    margin: 0;
}

.timeline {
    position: relative;
    max-width: 860px;
    margin: 0 auto;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 31px;
    top: 50px;
    bottom: 50px;
    width: 3px;
    background: #e2e8f0;
}

.timeline-node {
    position: relative;
    margin-bottom: 2.75rem;
}

.timeline-dot {
    position: absolute;
    left: 19px;
    width: 26px;
    height: 26px;
    background: white;
    border: 3px solid #2563eb;
    border-radius: 50%;
    z-index: 10;
    box-shadow: 0 0 0 4px #f1f5f9;
}

.node-content {
    margin-left: 60px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow:
        0 4px 6px -1px rgb(15 23 42 / 0.05),
        0 2px 4px -2px rgb(15 23 42 / 0.05);
}

.section-header {
    font-size: 1.05rem;
    font-weight: 600;
    color: #18181b;
    margin: 0 0 1rem 0;
}

.period-badge {
    display: inline-block;
    background: #18181b;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    margin-right: 0.75rem;
    letter-spacing: 0.5px;
}

.paper-title {
    font-weight: 600;
    color: #18181b;
    margin-bottom: 0.15rem;
}

.paper-link {
    color: #2563eb;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.paper-link:hover {
    text-decoration: underline;
}

.paper-desc {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
    line-height: 1.4;
}

.paper-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.35rem;
}

.paper-keywords .keyword {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 500;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    padding: 0.1rem 0.45rem;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.paper-keywords .keyword:hover {
    background: #e0ecff;
    border-color: #93b4f5;
}

.paper-keywords .keyword.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.node-description {
    color: #475569;
    font-size: 0.9375rem;
    line-height: 1.65;
    margin-bottom: 1.25rem;
}

.footer {
    text-align: center;
    margin-top: 3rem;
    color: #64748b;
    font-size: 0.875rem;
}

/* ===== Right Sidebar ===== */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.3);
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

#sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 600px;
    max-width: 90vw;
    height: 100vh;
    background: #fff;
    border-left: 1px solid #e2e8f0;
    box-shadow: -4px 0 24px rgb(15 23 42 / 0.08);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #18181b;
    margin: 0;
    line-height: 1.4;
    padding-right: 0.5rem;
}

.sidebar-link {
    display: block;
    color: #2563eb;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 0.35rem;
}

.sidebar-link:hover {
    text-decoration: underline;
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}

.sidebar-close:hover {
    color: #18181b;
}

#sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.sidebar-placeholder {
    color: #94a3b8;
    font-size: 0.875rem;
    font-style: italic;
}

/* ===== Per-paper detail button ===== */

.paper-header {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}

.paper-detail-btn {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    line-height: 1;
    transition: color 0.15s, border-color 0.15s;
}

.paper-detail-btn:hover {
    color: #2563eb;
    border-color: #2563eb;
}

#sidebar-content h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #18181b;
    margin: 1rem 0 0.4rem;
}

#sidebar-content p {
    margin: 0.5rem 0;
    color: #475569;
    font-size: 0.875rem;
    line-height: 1.6;
}

#sidebar-content ul,
#sidebar-content ol {
    margin: 0.4rem 0;
    padding-left: 1.4rem;
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.6;
}

#sidebar-content strong {
    color: #18181b;
}

#sidebar-content code {
    background: #f1f5f9;
    padding: 0.15em 0.35em;
    border-radius: 4px;
    font-size: 0.8rem;
}

#sidebar-content .faq-q {
    background: #f8fafc;
    border-left: 3px solid #2563eb;
    padding: 0.5rem 0.75rem;
    margin: 1.25rem 0 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #18181b;
}

#sidebar-content .faq-a {
    margin: 0;
    padding: 0;
}

/* ===== Left Keyword Sidebar ===== */

.kw-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.3);
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.kw-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

#kw-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 600px;
    max-width: 90vw;
    height: 100vh;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    box-shadow: 4px 0 24px rgb(15 23 42 / 0.08);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#kw-sidebar.open {
    transform: translateX(0);
}

.kw-sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.kw-sidebar-subtitle {
    display: block;
    color: #64748b;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

#kw-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

#kw-sidebar-content h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #18181b;
    margin: 1rem 0 0.4rem;
}

#kw-sidebar-content p {
    margin: 0.5rem 0;
    color: #475569;
    font-size: 0.875rem;
    line-height: 1.6;
}

#kw-sidebar-content strong {
    color: #18181b;
}

#kw-sidebar-content code {
    background: #f1f5f9;
    padding: 0.15em 0.35em;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* ===== Global Keyword Bubbles ===== */

.global-keywords {
    max-width: 860px;
    margin: 0 auto 2.5rem;
    padding: 1rem 1.25rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow:
        0 4px 6px -1px rgb(15 23 42 / 0.05),
        0 2px 4px -2px rgb(15 23 42 / 0.05);
}

.global-kw-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}
