/* ============================================================
   cbdc.study — Academic Research Platform Styles
   Colors: Paper #faf9f7, Text #2c2c2c, Heading #1a1a1a,
           Margin #e8e5e0, Accent #b91c1c, Link #1e40af,
           Rule #d4d0ca, Highlight #fef3c7, Footer #6b6560
   Fonts: Spectral, Source Sans 3, Inconsolata
   ============================================================ */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Spectral', Georgia, 'Times New Roman', serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.85;
    color: #2c2c2c;
    background-color: #faf9f7;
    counter-reset: section;
}

/* --- Journal Header / Hero --- */
#journal-header {
    background-color: #faf9f7;
    padding: 4rem 2rem 2rem;
    text-align: center;
}

.header-inner {
    max-width: 720px;
    margin: 0 auto;
}

.journal-title {
    font-family: 'Spectral', Georgia, serif;
    font-weight: 700;
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    color: #1a1a1a;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.journal-subtitle {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    color: #6b6560;
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

.journal-meta {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 0.9rem;
    color: #6b6560;
    margin-bottom: 1.5rem;
}

.meta-divider {
    margin: 0 0.5em;
    color: #d4d0ca;
}

.header-rule {
    border: none;
    border-top: 1px solid #d4d0ca;
    margin: 0 auto 1.5rem;
    max-width: 480px;
}

/* --- Table of Contents --- */
.table-of-contents {
    text-align: left;
    max-width: 520px;
    margin: 0 auto;
}

.toc-heading {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6b6560;
    margin-bottom: 0.75rem;
}

/* Prevent TOC heading from triggering CSS counter */
.toc-heading::before {
    counter-increment: none;
    content: none;
}

.toc-list {
    list-style: decimal;
    padding-left: 1.5em;
    font-family: 'Spectral', Georgia, serif;
    font-size: 0.95rem;
    line-height: 1.8;
}

.toc-list li {
    padding-left: 0.25em;
    color: #2c2c2c;
}

.toc-list a {
    color: #1e40af;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.toc-list a:hover {
    border-bottom-color: #1e40af;
}

/* --- Section Rules (decorative dividers) --- */
.section-rule {
    border: none;
    border-top: 1px solid #d4d0ca;
    max-width: 720px;
    margin: 0 auto;
    position: relative;
}

.rule-ornament {
    display: block;
    width: 6px;
    height: 6px;
    background-color: #d4d0ca;
    transform: rotate(45deg);
    margin: -3.5px auto 0;
}

/* --- Main Content --- */
#content {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* --- Abstract --- */
.abstract {
    max-width: 720px;
    margin: 2rem auto;
}

.abstract-heading {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6b6560;
    margin-bottom: 0.75rem;
}

/* Prevent abstract heading from triggering CSS counter */
.abstract-heading::before {
    counter-increment: none;
    content: none;
}

.abstract p {
    font-style: italic;
    color: #2c2c2c;
    padding-left: 2rem;
    border-left: 3px solid #d4d0ca;
    text-align: justify;
    hyphens: auto;
}

/* --- Paper Sections (CSS Grid with Margin Notes) --- */
.paper-section {
    margin: 2rem auto;
    max-width: 960px;
}

.section-content {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 2rem;
}

.main-column {
    max-width: 720px;
    text-align: justify;
    hyphens: auto;
}

/* --- Section Headings with CSS Counter Numbers --- */
.paper-section h2 {
    font-family: 'Spectral', Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: #1a1a1a;
    margin-bottom: 1rem;
    line-height: 1.3;
    text-align: left;
    position: relative;
    padding-left: 3.5rem;
}

.paper-section h2::before {
    counter-increment: section;
    content: counter(section);
    font-family: 'Spectral', Georgia, serif;
    font-weight: 700;
    font-size: clamp(3rem, 6vw, 5rem);
    color: #b91c1c;
    position: absolute;
    left: 0;
    top: -0.15em;
    line-height: 1;
    opacity: 0.9;
}

/* --- Subsection Headings --- */
.paper-section h3 {
    font-family: 'Spectral', Georgia, serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: #1a1a1a;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    text-align: left;
}

/* --- Paragraphs --- */
.main-column p {
    margin-bottom: 1rem;
}

/* --- Margin Notes Column --- */
.margin-column {
    grid-column: 2;
    padding-top: 3.5rem;
}

.margin-note {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 0.8rem;
    line-height: 1.5;
    font-weight: 400;
    color: #2c2c2c;
    background-color: #e8e5e0;
    padding: 8px 12px;
    border-left: 3px solid #b91c1c;
    border-radius: 0 4px 4px 0;
    margin-bottom: 1rem;
}

.margin-note strong {
    font-weight: 600;
    color: #1a1a1a;
}

/* --- Citations --- */
.citation {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 0.75rem;
    color: #1e40af;
    cursor: pointer;
    text-decoration: none;
    position: relative;
}

.citation:hover {
    color: #b91c1c;
}

/* --- Citation Tooltip --- */
.citation-tooltip {
    position: fixed;
    max-width: 400px;
    background-color: #faf9f7;
    color: #2c2c2c;
    border: 1px solid #d4d0ca;
    border-left: 3px solid #1e40af;
    padding: 10px 14px;
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 0.8rem;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    pointer-events: none;
    border-radius: 2px;
}

/* --- Lists --- */
.numbered-list {
    padding-left: 1.5em;
    margin-bottom: 1rem;
}

.numbered-list li {
    margin-bottom: 0.5rem;
}

.dash-list {
    list-style: none;
    padding-left: 1.5em;
    margin-bottom: 1rem;
}

.dash-list li {
    margin-bottom: 0.3rem;
    position: relative;
}

.dash-list li::before {
    content: '\2014';
    position: absolute;
    left: -1.5em;
    color: #6b6560;
}

/* --- Data Tables --- */
.data-table-container {
    margin: 1.5rem 0;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 0.85rem;
    line-height: 1.5;
}

.data-table caption {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    text-align: left;
    color: #6b6560;
    margin-bottom: 0.5rem;
    font-style: italic;
}

.data-table thead th {
    background-color: #e8e5e0;
    color: #1a1a1a;
    font-weight: 600;
    text-align: left;
    padding: 8px 12px;
    border-bottom: 2px solid #d4d0ca;
}

.data-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid #d4d0ca;
    color: #2c2c2c;
}

.data-table tbody tr:hover {
    background-color: #fef3c7;
}

.data-numeric {
    font-family: 'Inconsolata', monospace;
    text-align: right;
}

.table-note {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 0.75rem;
    color: #6b6560;
    font-style: italic;
    margin-top: 0.5rem;
}

/* --- Highlighted Text --- */
mark, .highlight {
    background-color: #fef3c7;
    padding: 0 2px;
}

/* --- Links --- */
a {
    color: #1e40af;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

a:hover {
    border-bottom-color: #1e40af;
}

/* --- References / Bibliography --- */
.references-section {
    max-width: 720px;
    margin: 2rem auto 3rem;
}

.references-heading {
    font-family: 'Spectral', Georgia, serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #1a1a1a;
    margin-bottom: 1rem;
    text-align: left;
}

/* Prevent references heading from triggering CSS counter */
.references-heading::before {
    counter-increment: none;
    content: none;
}

.bibliography {
    list-style: none;
    padding: 0;
}

.bibliography li {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #2c2c2c;
    padding-left: 2em;
    text-indent: -2em;
    margin-bottom: 0.75rem;
    text-align: left;
}

.bibliography li::before {
    content: '[' counter(list-item) '] ';
    font-weight: 600;
    color: #1e40af;
}

.bibliography li em {
    font-style: italic;
}

.bibliography li.ref-highlighted {
    background-color: #fef3c7;
    margin-left: -0.5rem;
    padding-right: 0.5rem;
    padding-top: 2px;
    padding-bottom: 2px;
    border-radius: 2px;
    transition: background-color 0.3s;
}

/* --- Footer --- */
#journal-footer {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 2rem 3rem;
}

.footer-rule {
    border: none;
    border-top: 1px solid #d4d0ca;
    margin-bottom: 1.5rem;
}

.footer-content {
    text-align: center;
}

.footer-text {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 0.8rem;
    color: #6b6560;
    margin-bottom: 0.3rem;
    line-height: 1.5;
}

.footer-copyright {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 0.75rem;
    color: #6b6560;
    margin-top: 0.5rem;
}

/* --- Mobile Responsive (below 1024px) --- */
@media (max-width: 1024px) {
    #content {
        max-width: 720px;
    }

    .section-content {
        display: block;
    }

    .margin-column {
        padding-top: 0;
        margin-top: 1.5rem;
    }

    .margin-note {
        margin-bottom: 0.75rem;
    }

    .paper-section h2 {
        padding-left: 2.5rem;
    }

    .paper-section h2::before {
        font-size: clamp(2rem, 5vw, 3.5rem);
    }
}

@media (max-width: 640px) {
    #journal-header {
        padding: 2rem 1rem 1.5rem;
    }

    #content {
        padding: 0 1rem;
    }

    .main-column {
        text-align: left;
        hyphens: none;
    }

    .paper-section h2 {
        font-size: 1.3rem;
        padding-left: 2rem;
    }

    .paper-section h2::before {
        font-size: 2rem;
    }

    .abstract p {
        padding-left: 1rem;
    }

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

    .data-table thead th,
    .data-table tbody td {
        padding: 6px 8px;
    }

    #journal-footer {
        padding: 0 1rem 2rem;
    }
}
