/* cbdc.study - Education Scholarly Layout */
/* Palette: #ffffff, #2d2d2d, #1a56db, #6b7280, #e5e7eb, #fef3c7, #f9fafb */

:root {
    --paper: #ffffff;
    --text: #2d2d2d;
    --blue: #1a56db;
    --footnote: #6b7280;
    --border: #e5e7eb;
    --highlight: #fef3c7;
    --stripe: #f9fafb;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--paper);
    color: var(--text);
    font-family: 'Merriweather', Georgia, serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.8;
}

/* =====================================================
   ACCENT BAR
   ===================================================== */
.accent-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--blue);
    z-index: 200;
}

/* =====================================================
   STICKY TABLE OF CONTENTS
   ===================================================== */
.toc {
    position: fixed;
    top: 80px;
    right: 2rem;
    width: 180px;
    z-index: 50;
    opacity: 0;
    transform: translateX(10px);
    animation: tocReveal 0.6s ease 0.8s forwards;
}

@keyframes tocReveal {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toc-heading {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--footnote);
    margin-bottom: 0.75rem;
}

.toc-link {
    display: block;
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 0.75rem;
    color: var(--footnote);
    text-decoration: none;
    padding: 0.3rem 0;
    padding-left: 0.75rem;
    border-left: 2px solid var(--border);
    margin-bottom: 0.1rem;
    transition: color 0.3s ease, border-color 0.3s ease, font-weight 0.3s ease;
}

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

.toc-link.active {
    color: var(--blue);
    border-left-color: var(--blue);
    font-weight: 600;
}

/* =====================================================
   TITLE PAGE / HEADER
   ===================================================== */
.title-page {
    max-width: 680px;
    margin: 0 auto;
    padding: 6rem 2rem 3rem;
    text-align: center;
}

.institution {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--blue);
    margin-bottom: 2rem;
    opacity: 0;
    animation: fadeUp 0.6s ease 0.2s forwards;
}

.paper-title {
    font-family: 'Merriweather', Georgia, serif;
    font-weight: 900;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    line-height: 1.35;
    color: var(--text);
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeUp 0.6s ease 0.4s forwards;
}

.authors {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    color: var(--footnote);
    margin-bottom: 0.5rem;
    opacity: 0;
    animation: fadeUp 0.6s ease 0.5s forwards;
}

.date {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 0.8rem;
    color: var(--footnote);
    margin-bottom: 2rem;
    opacity: 0;
    animation: fadeUp 0.6s ease 0.55s forwards;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.abstract-block {
    text-align: left;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-bottom: 1.5rem;
}

.label-sc {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--footnote);
    margin-bottom: 0.5rem;
}

.abstract-text {
    font-style: italic;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text);
}

.keywords {
    text-align: left;
}

.keywords-list {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 0.85rem;
    color: var(--footnote);
}

/* =====================================================
   ARTICLE BODY
   ===================================================== */
.article-body {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
    position: relative;
}

.paper-section {
    margin-bottom: 3rem;
    position: relative;
}

.section-heading {
    font-family: 'Merriweather', Georgia, serif;
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text);
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.section-num {
    color: var(--blue);
    font-weight: 700;
    margin-right: 0.5rem;
}

.subsection-heading {
    font-family: 'Merriweather', Georgia, serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    margin: 2rem 0 1rem;
    line-height: 1.4;
}

.body-text {
    margin-bottom: 1rem;
}

.body-text em {
    font-style: italic;
}

.highlight {
    background: var(--highlight);
    padding: 0 0.2em;
}

/* =====================================================
   CITATIONS
   ===================================================== */
.cite {
    color: var(--blue);
    cursor: default;
    position: relative;
    font-size: 0.7em;
    vertical-align: super;
    line-height: 0;
}

.cite-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--paper);
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    font-size: 13px;
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    color: var(--text);
    width: 300px;
    line-height: 1.45;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 100;
    white-space: normal;
    vertical-align: baseline;
    font-weight: 400;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.cite-tooltip.visible {
    opacity: 1;
}

/* =====================================================
   MARGIN NOTES / FOOTNOTES
   ===================================================== */
.margin-note {
    position: absolute;
    left: -230px;
    width: 200px;
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 0.75rem;
    color: var(--footnote);
    line-height: 1.5;
}

.mn-num {
    font-weight: 600;
    color: var(--blue);
    display: block;
    margin-bottom: 0.2rem;
}

.mn-text {
    display: block;
}

/* =====================================================
   FIGURE FRAMES
   ===================================================== */
.figure-frame {
    border: 1px solid var(--border);
    padding: 1.25rem;
    margin: 2rem 0;
}

.figure-label {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 1rem;
}

figcaption {
    font-style: italic;
    font-size: 0.8rem;
    color: var(--footnote);
    margin-top: 0.75rem;
    line-height: 1.5;
    font-family: 'Merriweather', Georgia, serif;
}

/* =====================================================
   DATA TABLES
   ===================================================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 0.85rem;
}

.data-table th {
    text-align: left;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid var(--border);
    color: var(--text);
    font-size: 0.8rem;
    white-space: nowrap;
}

.data-table td {
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.data-table tbody tr:nth-child(even) {
    background: var(--stripe);
}

.mono {
    font-family: 'IBM Plex Mono', 'Consolas', monospace;
    font-size: 0.8rem;
}

/* =====================================================
   BAR CHARTS
   ===================================================== */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chart-label {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 0.8rem;
    width: 120px;
    flex-shrink: 0;
    text-align: right;
    color: var(--text);
}

.chart-bar {
    height: 18px;
    background: var(--blue);
    border-radius: 2px;
    width: 0;
    transition: width 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.bar-secondary {
    background: rgba(26, 86, 219, 0.4);
}

.bar-risk-high {
    background: #dc2626;
}

.bar-risk-med {
    background: #f59e0b;
}

.bar-risk-low {
    background: #16a34a;
}

.chart-val {
    font-family: 'IBM Plex Mono', 'Consolas', monospace;
    font-size: 0.75rem;
    color: var(--footnote);
    flex-shrink: 0;
    min-width: 60px;
}

/* =====================================================
   CITE BLOCK
   ===================================================== */
.cite-block {
    border: 1px solid var(--border);
    padding: 1.25rem;
    margin: 2rem 0;
    background: var(--stripe);
}

.cite-text {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.6;
}

/* =====================================================
   REFERENCES
   ===================================================== */
.refs-section {
    border-top: 1px solid var(--border);
    padding-top: 2rem;
}

.ref-list {
    padding-left: 2rem;
}

.ref-item {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 0.75rem;
    text-indent: -2rem;
}

/* =====================================================
   FOOTER
   ===================================================== */
.page-footer {
    max-width: 680px;
    margin: 0 auto;
    padding: 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-text {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 0.75rem;
    color: var(--footnote);
    letter-spacing: 0.02em;
}

/* =====================================================
   ANIMATIONS
   ===================================================== */
.fade-in {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.margin-note.fade-in {
    transform: translateX(-15px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.margin-note.fade-in.visible {
    transform: translateX(0);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1100px) {
    .toc {
        right: 1rem;
        width: 150px;
    }
}

@media (max-width: 1000px) {
    .toc {
        display: none;
    }

    .margin-note {
        position: static;
        left: auto;
        width: auto;
        border-left: 3px solid var(--border);
        padding-left: 0.75rem;
        margin: 1rem 0;
    }

    .margin-note.fade-in {
        transform: translateY(12px);
    }

    .margin-note.fade-in.visible {
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    body {
        font-size: 16px;
    }

    .title-page,
    .article-body {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .paper-title {
        font-size: 1.4rem;
    }

    .section-heading {
        font-size: 1.15rem;
    }

    .chart-label {
        width: 90px;
        font-size: 0.7rem;
    }

    .data-table {
        font-size: 0.78rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.35rem 0.5rem;
    }

    .page-footer {
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 480px) {
    .title-page {
        padding-top: 4rem;
    }

    .chart-label {
        width: 70px;
        font-size: 0.65rem;
    }

    .chart-val {
        font-size: 0.65rem;
        min-width: 40px;
    }
}
