/* Neural Operator × Physics-Integration Knowledge Base — light theme */

:root {
    --primary: #2563eb;
    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #18181b;
    --text-body: #475569;
    --text-muted: #64748b;
    --text-faint: #94a3b8;
    --border: #e2e8f0;
    --hover-bg: #f1f5f9;
    --shadow: 0 4px 6px -1px rgb(15 23 42 / 0.05), 0 2px 4px -2px rgb(15 23 42 / 0.05);
    --sidebar-shadow: -4px 0 24px rgb(15 23 42 / 0.08);
    --overlay-bg: rgb(15 23 42 / 0.3);
    --content-width: 860px;
    --matrix-width: 590px;

    --strong-border: #86efac;
    --single-border: #fcd34d;
    --open-border: #cbd5e1;
    --special-border: #c4b5fd;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: Inter, system-ui, -apple-system, sans-serif;
    background: var(--body-bg);
    color: var(--text-primary);
    line-height: 1.6;
    padding: 3rem 1rem;
}

.container { max-width: var(--content-width); margin: 0 auto; padding: 0 1rem; }

.header { text-align: center; margin-bottom: 2rem; }
.header h1 { font-size: 2.25rem; font-weight: 600; letter-spacing: -0.025em; margin-bottom: 0.5rem; }
.header p { font-size: 1.05rem; color: var(--text-muted); }

.tab-nav {
    display: flex;
    gap: 0.25rem;
    max-width: 520px;
    margin: 1.5rem auto 2rem;
    padding: 0.35rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
}
.tab-btn {
    flex: 1;
    padding: 0.55rem 1rem;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { background: var(--primary); color: var(--card-bg); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.global-keywords {
    max-width: var(--content-width);
    margin: 0 auto 2.5rem;
    padding: 1rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
}
.global-kw-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.timeline { position: relative; max-width: var(--content-width); margin: 0 auto; }
.timeline::before {
    content: "";
    position: absolute;
    left: 31px;
    top: 50px;
    bottom: 50px;
    width: 3px;
    background: var(--border);
}
.timeline-node { position: relative; margin-bottom: 2.75rem; }
.timeline-dot {
    position: absolute;
    left: 19px;
    width: 26px;
    height: 26px;
    background: var(--card-bg);
    border: 3px solid var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 0 4px var(--body-bg);
    z-index: 10;
}
.node-content {
    margin-left: 60px;
    padding: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
}
.section-header { font-size: 1.05rem; font-weight: 600; margin-bottom: 1rem; }
.period-badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    margin-right: 0.75rem;
    background: var(--text-primary);
    color: var(--card-bg);
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.node-description { color: var(--text-body); font-size: 0.93rem; line-height: 1.65; margin-bottom: 1.25rem; }

.node-content > div:not(.timeline-dot) { margin-bottom: 1.25rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.node-content > div:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }

.paper-title { font-weight: 600; margin-bottom: 0.2rem; }
.paper-link { color: var(--primary); text-decoration: none; font-size: 0.85rem; font-weight: 500; }
.paper-link:hover { text-decoration: underline; }
.paper-desc { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.3rem; line-height: 1.5; }
.paper-keywords { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.35rem; }
.paper-keywords .keyword {
    padding: 0.1rem 0.45rem;
    background: var(--hover-bg);
    border: 1px solid var(--border);
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-body);
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 0.15s;
}
.paper-keywords .keyword:hover { border-color: var(--primary); }
.paper-keywords .keyword.active { background: var(--primary); border-color: var(--primary); color: var(--card-bg); }

.paper-header { display: flex; align-items: baseline; gap: 0.4rem; }
.paper-detail-btn {
    padding: 0.15rem 0.45rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.7rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.paper-detail-btn:hover { color: var(--primary); border-color: var(--primary); }

.matrix-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    width: 90vw;
    max-width: 90vw;
    margin: 0 calc(50% - 45vw) 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
}
.legend-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-body); }
.legend-dot { width: 16px; height: 16px; border-radius: 3px; background: var(--card-bg); border: 1px solid var(--border); border-left-width: 4px; }
.dot-strong { border-left-color: var(--strong-border); }
.dot-single { border-left-color: var(--single-border); }
.dot-open { border-left-color: var(--open-border); }
.dot-special { border-left-color: var(--special-border); }

#matrix-container {
    width: 90vw;
    max-width: 90vw;
    margin: 0 calc(50% - 45vw);
    padding: 0;
    overflow-x: auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
}
table.matrix-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 3px;
    font-size: 0.7rem;
}
table.matrix-table th,
table.matrix-table td {
    padding: 5px 6px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    overflow-wrap: break-word;
}
table.matrix-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 8px 5px;
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border);
    font-weight: 600;
    line-height: 1.2;
}
table.matrix-table thead th strong { font-size: 0.8rem; letter-spacing: 0.02em; }
table.matrix-table thead th .col-name {
    display: block;
    margin-top: 2px;
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.62rem;
}
table.matrix-table thead th.corner {
    width: 90px;
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-align: center;
}
table.matrix-table tbody th {
    position: sticky;
    left: 0;
    z-index: 4;
    width: 90px;
    min-width: 90px;
    max-width: 90px;
    padding: 6px 5px;
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border);
    font-size: 0.68rem;
    font-weight: 600;
}
table.matrix-table tbody th strong { font-size: 0.72rem; letter-spacing: 0.02em; }
table.matrix-table tbody th .row-sub {
    display: block;
    margin-top: 2px;
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.6rem;
    line-height: 1.3;
}
table.matrix-table td { cursor: pointer; transition: background 0.15s; }
table.matrix-table td:hover { background: var(--hover-bg); }
table.matrix-table td.cell-strong { border-left: 3px solid var(--strong-border); }
table.matrix-table td.cell-single { border-left: 3px solid var(--single-border); }
table.matrix-table td.cell-open { color: var(--text-muted) !important; cursor: default; }
table.matrix-table td.cell-open:hover { background: var(--card-bg); }
table.matrix-table td.cell-special { border-left: 3px solid var(--special-border); }
table.matrix-table td .cell-symbol { display: block; margin-bottom: 2px; font-size: 0.68rem; font-weight: 600; color: var(--primary); }
table.matrix-table td.cell-open .cell-symbol { color: var(--text-muted); }
table.matrix-table td .cell-papers { display: block; font-size: 0.62rem; color: var(--text-body); line-height: 1.3; }

/* Axis-summary is now only used inside .about-section__body (see rule below). */
.axis-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.axis-table th, .axis-table td { padding: 5px 8px; border: 1px solid var(--border); text-align: left; }
.axis-table th { background: transparent; color: var(--text-primary); font-weight: 600; }

.about-section {
    width: 90vw;
    max-width: 90vw;
    margin: 0 calc(50% - 45vw) 1.75rem;
    padding: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.about-section__header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.95rem 1.5rem;
    background: transparent;
    border: 0;
    border-radius: 0;
    text-align: left;
    font: inherit;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s;
}
.about-section__header:hover { background: var(--hover-bg); }
.about-section__header:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}
.about-section__chevron {
    display: inline-block;
    width: 1em;
    font-size: 0.85rem;
    color: var(--primary);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.about-section--collapsible[data-collapsed="false"] .about-section__chevron {
    transform: rotate(90deg);
}
.about-section__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}
.about-section__hint {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-faint);
    font-weight: 500;
    letter-spacing: 0.02em;
}
.about-section--collapsible[data-collapsed="false"] .about-section__hint::after {
    content: " — click to collapse";
}
.about-section--collapsible[data-collapsed="true"] .about-section__hint::after {
    content: "";
}
.about-section__body {
    padding: 0.25rem 1.5rem 1.25rem;
    border-top: 1px solid var(--border);
}
.about-section__body h3 { margin-top: 1rem; margin-bottom: 0.6rem; font-size: 1rem; font-weight: 600; }
.about-section__body h3:first-child { margin-top: 1.1rem; }
.about-section__body p, .about-section__body ul { color: var(--text-body); font-size: 0.92rem; line-height: 1.65; }
.about-section__body ul { margin-left: 1.4rem; }
.about-section__body li { margin-bottom: 0.3rem; }
.about-section__body code { padding: 0.15em 0.4em; background: var(--hover-bg); color: var(--primary); border-radius: 4px; font-size: 0.85em; }
.about-section__body a { color: var(--primary); text-decoration: none; }
.about-section__body a:hover { text-decoration: underline; }
.about-section__footnote {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px dashed var(--border);
    color: var(--text-muted) !important;
    font-size: 0.85rem !important;
    font-style: italic;
}

/* Axis-summary nested inside the about-section body */
.about-section__body .axis-summary {
    width: 100%;
    max-width: 100%;
    margin: 1.1rem 0 0;
}
.about-section__body .axis-summary h3 {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.sidebar-overlay, .kw-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active, .kw-overlay.active { opacity: 1; pointer-events: auto; }

#sidebar, #kw-sidebar {
    position: fixed;
    top: 0;
    width: 600px;
    max-width: 90vw;
    height: 100vh;
    background: var(--card-bg);
    border: 0 solid var(--border);
    box-shadow: var(--sidebar-shadow);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#sidebar { right: 0; border-left-width: 1px; }
#kw-sidebar { left: 0; border-right-width: 1px; transform: translateX(-100%); }
#sidebar.open { transform: translateX(0); }
#kw-sidebar.open { transform: translateX(0); }

.sidebar-header, .kw-sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-title { margin: 0; padding-right: 0.5rem; font-size: 1.05rem; font-weight: 600; color: var(--text-primary); line-height: 1.4; }
.sidebar-link { display: block; margin-top: 0.35rem; color: var(--primary); font-size: 0.85rem; font-weight: 500; word-break: break-all; text-decoration: none; }
.sidebar-link:hover { text-decoration: underline; }
.kw-sidebar-subtitle { display: block; margin-top: 0.25rem; color: var(--text-muted); font-size: 0.8rem; }
.sidebar-close {
    padding: 0;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}
.sidebar-close:hover { color: var(--text-primary); }

#sidebar-content, #kw-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}
.sidebar-placeholder { color: var(--text-faint); font-size: 0.875rem; font-style: italic; }

#sidebar-content h1 { margin: 1rem 0 0.5rem; font-size: 1.15rem; }
#sidebar-content h2 { margin: 1rem 0 0.5rem; font-size: 1.05rem; }
#sidebar-content h3, #kw-sidebar-content h3 { margin: 1rem 0 0.4rem; font-size: 0.95rem; font-weight: 600; }
#sidebar-content p, #kw-sidebar-content p { margin: 0.5rem 0; color: var(--text-body); font-size: 0.875rem; line-height: 1.65; }
#sidebar-content ul, #sidebar-content ol, #kw-sidebar-content ul, #kw-sidebar-content ol { margin: 0.4rem 0; padding-left: 1.4rem; font-size: 0.875rem; color: var(--text-body); line-height: 1.65; }
#sidebar-content li, #kw-sidebar-content li { margin-bottom: 0.25rem; }
#sidebar-content strong, #kw-sidebar-content strong { color: var(--text-primary); }
#sidebar-content code, #kw-sidebar-content code { padding: 0.15em 0.4em; background: var(--hover-bg); color: var(--primary); border-radius: 4px; font-size: 0.8rem; }
#sidebar-content a, #kw-sidebar-content a { color: var(--primary); text-decoration: none; }
#sidebar-content a:hover, #kw-sidebar-content a:hover { text-decoration: underline; }
#sidebar-content hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

#sidebar-content .faq-q, #kw-sidebar-content .faq-q {
    margin: 1.25rem 0 0.5rem;
    padding: 0.55rem 0.85rem;
    background: var(--body-bg);
    border-left: 3px solid var(--primary);
    border-radius: 0 4px 4px 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}
#sidebar-content .faq-a, #kw-sidebar-content .faq-a { margin: 0; padding: 0.25rem 0; }

@media (max-width: 768px) {
    body { padding: 1rem; }
    .header h1 { font-size: 1.5rem; }
    .header p { font-size: 0.95rem; }
    .tab-nav { flex-direction: column; max-width: 100%; }
    .timeline::before { left: 18px; }
    .timeline-dot { left: 6px; }
    .node-content { margin-left: 45px; padding: 1.1rem; }
    .about-section { width: 100%; max-width: 100%; margin: 0 0 1.75rem; }
    .matrix-legend { width: 100%; max-width: 100%; margin: 0 0 1.5rem; }
    #matrix-container { width: 100%; max-width: 100%; margin: 0; }
    .matrix-table { font-size: 0.7rem; }
    table.matrix-table th, table.matrix-table td { padding: 6px; }
    #sidebar, #kw-sidebar { width: 100vw; max-width: 100vw; }
}
