/* --- THEME VARIABLES (Mirrored from main.css) --- */
:root {
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --bg-color: #F8F9FA;
    --text-color: #212529;
    --heading-color: #111;
    --accent-color: #0056b3;
    --border-color: #dee2e6;
    --surface-bg: #FFFFFF;
    --text-muted: #6c757d;
    --bibtex-text-color: #1A1D20;
}

body.dark-mode {
    --bg-color: #121212;
    --text-color: #E0E0E0;
    --heading-color: #FFFFFF;
    --accent-color: #00AFFF;
    --border-color: #2F2F2F;
    --surface-bg: #1E1E1E;
    --text-muted: #A0A0A0;
    --tag-bg: #2F2F2F;
    --tag-color: #A0A0A0;
    --bibtex-text-color: #C0C0C0;
}

/* --- MODERN CSS RESET --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --- BASE & LAYOUT --- */
body {
    font-family: var(--font-primary);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.7;
    font-size: 17px;
    padding: 2rem;
}

.project-container {
    max-width: 800px;
    margin: 2rem auto;
}

/* --- HEADER & NAVIGATION --- */
.project-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 2rem;
    margin-bottom: 2rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}
.back-link:hover {
    text-decoration: underline;
}

.project-header h1 {
    font-size: 2.8rem;
    line-height: 1.2;
    color: var(--heading-color);
    margin-bottom: 1rem;
}

.author-list {
    font-style: italic;
    color: var(--text-muted);
}

.header-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
    justify-content: center;
}

.header-links a {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.header-links a:hover {
    background-color: var(--accent-color);
    color: var(--bg-color);
}

/* --- ARTICLE CONTENT --- */
.project-content h2 {
    font-size: 1.8rem;
    color: var(--heading-color);
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.project-content p {
    margin-bottom: 1.5rem;
}

.project-content a {
    color: var(--accent-color);
    text-decoration: underline;
}

.project-content strong, .project-content b {
    font-weight: 600;
}

.project-content pre code {
    font-size: 0.85em; /* Smaller font for BibTeX */
    line-height: 1.4;
    display: block;
    padding: 1em;
    background-color: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow-x: auto; /* For long lines */
    margin-bottom: 1.5rem;
    color: var(--bibtex-text-color);
}

.bibtex-section {
    margin-bottom: 2rem; /* Space below the entire BibTeX section */
}

.bibtex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem; /* Space between header and pre code */
}

.bibtex-header h3 {
    margin-bottom: 0; /* Remove default h3 margin */
}

.copy-button a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9em;
    transition: color 0.2s ease;
}

.copy-button a:hover {
    color: var(--accent-color);
}

/* --- TABLE OF CONTENTS --- */
.table-of-contents {
    background-color: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.table-of-contents h4 {
    font-size: 1.2rem;
    color: var(--heading-color);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.table-of-contents ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.table-of-contents li {
    margin-bottom: 0.5rem;
}

.table-of-contents li a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.table-of-contents li a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.table-of-contents .toc-level-2 {
    padding-left: 1.5rem; /* Indent for h3 items */
    font-size: 0.95em;
}

/* --- IMAGES & FIGURES --- */
.project-content figure {
    margin: 2.5rem 0;
    text-align: center;
}

.project-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.project-content figcaption {
    margin-top: 0.75rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

/* --- UTILITIES --- */
.has-white-bg {
    background-color: #FFFFFF;
}

/* --- THEME TOGGLE (LIGHTSWITCH) --- */
.lightswitch-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: fixed;
    top: 20px; /* Adjust as needed */
    right: 20px; /* Adjust as needed */
    z-index: 1000; /* Ensure it's above other content */
    background-color: var(--surface-bg);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
}

.lightbulb-icon {
    font-size: 1.1rem;
    color: var(--accent-color);
    transition: color 0.3s ease;
}

body.dark-mode .lightbulb-icon {
    color: var(--tag-color);
}

.lightswitch {
    cursor: pointer;
}

.lightswitch-input {
    display: none;
}

.lightswitch-plate {
    width: 26px;
    height: 42px;
    background-color: var(--tag-bg);
    border: 1px solid var(--border-color);
    border-radius: 21px;
    position: relative;
    transition: background-color 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.lightswitch-switch {
    width: 16px;
    height: 16px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 50%;
    position: absolute;
    top: 4px;
    left: 4px;
    transition: transform 0.2s ease-out;
}

.lightswitch-input:checked + .lightswitch-plate .lightswitch-switch {
    transform: translateY(16px);
}

body.dark-mode .lightswitch-plate {
    background-color: #111;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

body.dark-mode .lightswitch-switch {
    background-color: var(--tag-color);
    border-color: #000;
}

/* --- CONTACT US SECTION --- */
.project-content ul.contact-list {
    list-style: none;
    padding: 0;
    margin-top: 1.5rem;
    background-color: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.project-content ul.contact-list li {
    margin-bottom: 1rem;
    line-height: 1.4;
}

.project-content ul.contact-list li:last-child {
    margin-bottom: 0; /* Remove margin from the last item */
}

.project-content ul.contact-list strong {
    color: var(--heading-color);
    font-size: 1.05em;
}

.project-content ul.contact-list br {
    display: none; /* Hide the <br> for better spacing with flex */
}

.project-content ul.contact-list li {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.project-content ul.contact-list li span.email-obfuscated,
.project-content ul.contact-list li a {
    font-size: 0.95em;
    color: var(--text-muted);
    text-decoration: none;
}

.project-content ul.contact-list li a:hover {
    text-decoration: underline;
}