
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --background-color: #f8f9fa;
    --text-color: #333;
    --sidebar-width: 280px;
}

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

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.7;
    color: var(--text-color);
    background-color: var(--background-color);
}

.container { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--primary-color);
    color: white;
    padding: 20px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.nav-header h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.nav-list { list-style: none; }
.nav-item { margin-bottom: 8px; }
.nav-item a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.9rem;
    display: block;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}
.nav-item a:hover, .nav-item a.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* Expandable navigation with subsections */
.nav-item.has-children .nav-section-header,
.nav-item.no-children .nav-section-header {
    display: flex;
    align-items: flex-start;
}
.nav-item.has-children .nav-section-header a,
.nav-item.no-children .nav-section-header a {
    flex: 1;
}
.expand-toggle,
.expand-placeholder {
    width: 8px;
    min-width: 8px;
    padding: 5px 2px 5px 0;
    flex-shrink: 0;
    font-size: 0.65rem;
    line-height: 1;
    text-align: center;
}
.expand-toggle {
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: transform 0.2s;
    user-select: none;
}
.expand-toggle:hover {
    color: white;
}
.nav-item.has-children.expanded .expand-toggle {
    transform: rotate(90deg);
}
.nav-subsections {
    list-style: none;
    padding-left: 10px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    margin: 0;
}
.nav-item.has-children.expanded .nav-subsections {
    max-height: 1000px;
}
.nav-subitem {
    margin: 2px 0;
}
.nav-subitem a {
    font-size: 0.8rem;
    padding: 2px 6px;
    color: rgba(255,255,255,0.6);
}
.nav-subitem a:hover {
    color: white;
    background: rgba(255,255,255,0.05);
}

.home-link {
    display: block;
    color: #ffffff;
    text-decoration: none;
    font-size: 1rem;
    padding: 12px 10px;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    font-weight: 500;
}
.home-link:hover { 
    color: white; 
    background: rgba(255,255,255,0.2);
}

.pdf-link {
    display: block;
    color: #ffffff;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 10px;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    background: rgba(100,149,237,0.3);
    border-radius: 4px;
}
.pdf-link:hover { 
    color: white; 
    background: rgba(100,149,237,0.5);
}

.content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 40px 60px;
    max-width: 900px;
}

article h1 { font-size: 2rem; margin-bottom: 10px; color: var(--primary-color); }
article h2 { font-size: 1.5rem; margin: 40px 0 20px; color: var(--primary-color); }
article h3 { font-size: 1.25rem; margin: 30px 0 15px; color: var(--primary-color); }
article h4 { font-size: 1.1rem; margin: 25px 0 12px; color: var(--primary-color); }
article p { margin-bottom: 1.2em; text-align: justify; }

.doi-link {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0;
    margin-bottom: 30px;
}
.doi-link a {
    color: #666;
    text-decoration: none;
}
.doi-link a:hover {
    text-decoration: underline;
}

.figure {
    margin: 30px auto;
    text-align: center;
    width: 66.67%;
}
.figure img {
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}
.figure figcaption {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.9rem;
    color: #555;
    margin-top: 12px;
    text-align: left;
    line-height: 1.5;
    padding: 0 10px;
}

.figure-full-width {
    width: 100%;
}

.citation {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.95em;
}
.citation:hover { text-decoration: underline; }

.ref {
    color: var(--secondary-color);
    text-decoration: none;
}
.ref:hover { text-decoration: underline; }

.math.display {
    margin: 20px 0;
    overflow-x: auto;
}

.page-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 60px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}
.page-nav a { color: var(--secondary-color); text-decoration: none; }
.page-nav a:hover { text-decoration: underline; }
.page-nav .home-nav { text-align: center; }

.bibliography { margin-top: 20px; }
.bib-entry {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 4px;
    border-left: 3px solid var(--secondary-color);
}
.bib-key {
    font-weight: bold;
    color: var(--secondary-color);
    display: block;
    margin-bottom: 8px;
    font-size: 1rem;
}
.bib-content { font-size: 0.95rem; line-height: 1.6; }
.bib-authors-full { color: #333; margin-bottom: 4px; }
.bib-title { margin: 4px 0; color: #222; }
.bib-pub { color: #555; font-style: italic; margin: 4px 0; }
.bib-links { margin-top: 8px; }
.bib-link {
    display: inline-block;
    margin-right: 8px;
    padding: 2px 8px;
    background: var(--secondary-color);
    color: white;
    border-radius: 3px;
    font-size: 0.8rem;
    text-decoration: none;
}
.bib-link:hover { background: #2980b9; }
.bib-isbn { font-size: 0.85rem; color: #666; }
.math-inline { font-style: italic; }

@media (max-width: 900px) {
    .sidebar { position: relative; width: 100%; height: auto; }
    .content { margin-left: 0; padding: 20px; }
    .container { flex-direction: column; }
}

/* Comments section */
.comments-section {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}
.comments-section h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}
