/* Shared styles for all pages (templates/base.html and the pages extending it) */

:root {
    --navy: #002147;
    --navy-dark: #001631;
    --blue: #003E74;
    --ink: #1f2933;
    --muted: #5f6b7a;
    --line: #dde3ea;
    --ground: #f3f5f8;
    --card: #ffffff;
    --subtle: #fafbfc;
    --warn-bg: #fff8e6;
    --warn-line: #e8b84a;
    --warn-ink: #6b4a00;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background-color: var(--ground);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

/* ---------- Header ---------- */

.site-header {
    background-color: var(--navy);
    color: #fff;
}

.site-header .inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 22px 24px 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 32px;
}

.eyebrow {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #a9bcd6;
}

.site-header h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.session-info {
    margin: 0;
    font-size: 12.5px;
    color: #c3d0e2;
    text-align: right;
}

.session-info span { display: block; }

.session-info code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    color: #e3eaf4;
}

/* ---------- Navigation ---------- */

.topnav {
    background-color: var(--navy-dark);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.topnav .inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 12px;
    display: flex;
    flex-wrap: wrap;
}

.topnav a {
    display: block;
    padding: 13px 12px 11px;
    color: #d5deea;
    font-size: 14.5px;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}

.topnav a:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.06);
}

.topnav a.active {
    color: #fff;
    border-bottom-color: #6fa8dc;
}

.topnav .ext { font-size: 0.8em; opacity: 0.7; margin-left: 3px; }

/* ---------- Main content ---------- */

main {
    flex: 1;
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 28px 24px 48px;
}

main > * + * { margin-top: 24px; }

.narrow {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.notice {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 14px 18px;
    background-color: var(--warn-bg);
    border: 1px solid #f3dca0;
    border-left: 4px solid var(--warn-line);
    border-radius: 6px;
    color: var(--warn-ink);
}

.notice-icon {
    flex: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: var(--warn-line);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    line-height: 22px;
    text-align: center;
}

.notice p { margin: 0; }
.notice strong { color: #4d3500; }

.card {
    background-color: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.04);
    scroll-margin-top: 16px;
}

.card-header {
    padding: 22px 26px 18px;
    border-bottom: 1px solid var(--line);
}

.card-header h2 {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 600;
    color: var(--blue);
}

.card-header p {
    margin: 0;
    max-width: 860px;
    color: var(--muted);
}

.prediction-callout {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 860px;
    margin-top: 14px;
    padding: 12px 16px;
    background: #eef4fb;
    border-left: 4px solid var(--blue);
    border-radius: 6px;
}

.prediction-label {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.prediction-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--blue);
}

.prediction-sub {
    font-size: 18px;
    font-weight: 600;
}

.prediction-method {
    font-size: 13px;
    color: var(--muted);
}

.card-header .figure-label {
    margin: 0 0 4px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.card-body { padding: 24px 26px 26px; }

.card-footer {
    padding: 14px 26px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    color: var(--muted);
}

.card-footer a { color: var(--blue); }

/* ---------- Long-form text ---------- */

.prose h2 {
    margin: 30px 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--blue);
}

.prose h2:first-child { margin-top: 0; }

.prose h3 {
    margin: 20px 0 6px;
    font-size: 15px;
    font-weight: 600;
}

.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 22px; }
.prose li { margin-bottom: 4px; }
.prose a { color: var(--blue); }
.prose sup a { text-decoration: none; font-size: 11px; }

.references {
    font-size: 13.5px;
    color: var(--muted);
}

.references li { margin-bottom: 8px; }

.button {
    display: inline-block;
    padding: 9px 16px;
    border-radius: 6px;
    background-color: var(--navy);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.button:hover { background-color: var(--blue); }

.button.secondary {
    background-color: #fff;
    color: var(--blue);
    border: 1px solid var(--line);
}

.button.secondary:hover { border-color: var(--blue); }

.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background-color: #e8eef6;
    color: var(--blue);
    font-size: 12.5px;
    font-weight: 500;
}

.tag.warn {
    background-color: var(--warn-bg);
    border: 1px solid #f3dca0;
    color: var(--warn-ink);
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 11.5px;
}

/* ---------- Paper ---------- */

.citation {
    border-left: 4px solid var(--blue);
    padding: 2px 0 2px 20px;
}

.citation .paper-title {
    margin: 12px 0 10px;
    font-size: 19px;
    font-weight: 600;
    line-height: 1.4;
}

.citation .authors { margin: 0 0 8px; color: var(--muted); }
.citation .venue { margin: 0; }

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

/* ---------- Team ---------- */

.affiliations {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.person {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background-color: var(--subtle);
}

.person.lead {
    border-color: #b8cde6;
    background-color: #f2f7fd;
}

.avatar {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-bottom: 12px;
    border-radius: 50%;
    background-color: var(--navy);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.person h3 { margin: 0 0 2px; font-size: 15.5px; }
.person .role { margin: 0 0 10px; color: var(--muted); font-size: 13.5px; }
.person a { color: var(--blue); font-size: 13.5px; overflow-wrap: anywhere; }

/* ---------- Legend ---------- */

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 36px;
    padding: 14px 26px;
    background-color: var(--subtle);
    border-bottom: 1px solid var(--line);
    font-size: 13.5px;
}

.legend-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
}

.legend-title {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.swatch-line {
    width: 22px;
    height: 0;
    border-top: 3px solid;
}

.swatch-dash {
    width: 22px;
    height: 0;
    border-top: 2px dashed #000;
}

/* ---------- Charts ---------- */

.chart-scroll {
    overflow-x: auto;
    padding: 20px 26px 26px;
}

.vis.vega-embed {
    display: block;
    width: max-content;
    margin: 0 auto;
}

.chart-status {
    padding: 60px 0;
    text-align: center;
    color: var(--muted);
}

.chart-error {
    padding: 16px 18px;
    border: 1px solid #f1b5b5;
    border-radius: 6px;
    background-color: #fdf1f1;
    color: #8a1c1c;
}

.chart-error p { margin: 0; }

/* ---------- Paper results ---------- */

.toc {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.toc a {
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background-color: #fff;
    color: var(--blue);
    font-size: 13px;
    text-decoration: none;
}

.toc a:hover { border-color: var(--blue); }

.glossary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px 36px;
    margin: 0;
}

.glossary dt { font-weight: 600; }
.glossary dd { margin: 3px 0 0; color: var(--muted); font-size: 14px; }

.figure-notes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px 40px;
    padding: 22px 26px 24px;
    border-top: 1px solid var(--line);
    background-color: var(--subtle);
    border-radius: 0 0 8px 8px;
}

.figure-notes h3 {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
}

.figure-notes ul { margin: 0; padding-left: 18px; }
.figure-notes li { margin-bottom: 7px; }
.figure-notes li:last-child { margin-bottom: 0; }

/* ---------- Welcome / error ---------- */

.splash {
    padding: 56px 26px;
    text-align: center;
}

.splash h2 { margin: 0 0 8px; font-size: 22px; color: var(--blue); }
.splash p { margin: 0 auto 8px; max-width: 520px; color: var(--muted); }
.splash .actions { justify-content: center; }

.splash .code {
    margin: 0 auto 6px;
    font-size: 56px;
    font-weight: 700;
    line-height: 1;
    color: #c9d4e2;
}

.spinner {
    width: 38px;
    height: 38px;
    margin: 0 auto 22px;
    border: 3px solid var(--line);
    border-top-color: var(--navy);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Footer ---------- */

.site-footer {
    background-color: var(--navy);
    color: #c3d0e2;
    font-size: 13px;
}

.site-footer .inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 24px;
}

@media (max-width: 640px) {
    .session-info { text-align: left; }
    .site-header h1 { font-size: 22px; }
    main { padding: 20px 16px 36px; }
    .card-header, .card-body, .legend, .chart-scroll, .card-footer, .figure-notes { padding-left: 16px; padding-right: 16px; }
    .figure-notes { grid-template-columns: 1fr; }
}
