/* Shared styles for portfolio site */
:root {
    /* Light theme colors */
    --bg-color: white;
    --text-color: black;
    --text-light: #666;
    --text-bright: black;
    --border-color: black;
    --code-bg: #f5f5f5;
    --link-color: #0066cc;
    --link-hover-bg: black;
    --link-hover-color: white;
}

[data-theme="dark"] {
    /* Dark theme colors */
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --text-light: #999;
    --text-bright: #f5f5f5;
    --border-color: #444;
    --code-bg: #2a2a2a;
    --link-color: #66b3ff;
    --link-hover-bg: #f5f5f5;
    --link-hover-color: #1a1a1a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Lora', Georgia, serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 15px;
    max-width: 850px;
    margin: 0 auto;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header styles */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.site-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--text-bright);
    text-decoration: none;
}

.site-title:hover {
    text-decoration: underline;
}

.nav-links {
    display: flex;
    gap: 15px;
    align-items: center;
}

.nav-links a, .theme-toggle {
    color: var(--text-color);
    text-decoration: none;
    padding: 6px 10px;
    transition: all 0.2s ease;
    font-size: 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.nav-links a:hover, .theme-toggle:hover {
    background: var(--link-hover-bg);
    color: var(--link-hover-color);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

/* Main content styles - Wikipedia-like layout */
.content-wrapper {
    position: relative;
    margin-top: 20px;
}

.content {
    max-width: 850px;
    margin: 0 auto;
    padding: 0 10px;
    position: relative;
}

.toc-sidebar {
    position: absolute;
    left: calc(-260px - 20px);
    top: 0;
    width: 240px;
    height: fit-content;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    z-index: 10;
}

.toc-sidebar.sticky {
    position: fixed;
    top: 20px;
    /* Left position will be set dynamically by JavaScript */
}

.toc-sidebar:empty {
    display: none;
}

.project-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
}

.project-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(36px, 5vw, 48px);
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-bright);
}

.project-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--text-light);
}

.project-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    background: transparent;
    color: var(--text-color);
    padding: 3px 8px;
    font-size: 12px;
}

/* Article content styles */
.article-content {
    font-size: 17px;
    line-height: 1.8;
    text-align: justify;
    text-align-last: left;
    hyphens: auto;
    hyphenate-limit-chars: 6 3 3;
    hyphenate-limit-lines: 2;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 700;
    margin: 30px 0 15px 0;
    color: var(--text-bright);
}

.article-content h1 { font-size: 36px; }
.article-content h2 { font-size: 30px; }
.article-content h3 { font-size: 24px; }
.article-content h4 { font-size: 20px; }

.article-content p {
    margin: 0 0 20px 0;
}

.article-content a {
    color: var(--link-color);
    text-decoration: underline;
}

.article-content a:hover {
    text-decoration: none;
}

.article-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 30px auto;
}

.article-content code {
    background: var(--code-bg);
    padding: 2px 6px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 14px;
}

.article-content pre {
    background: var(--code-bg);
    padding: 15px;
    overflow-x: auto;
    margin: 20px 0;
}

.article-content pre code {
    background: none;
    padding: 0;
}

.article-content blockquote {
    border-left: 3px solid var(--border-color);
    padding-left: 20px;
    margin: 20px 0;
    font-style: italic;
    color: var(--text-light);
}

.article-content ul,
.article-content ol {
    margin: 0 0 20px 30px;
}

.article-content li {
    margin-bottom: 8px;
}

.article-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 30px 0;
}

/* Footer */
.footer {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 14px;
    color: var(--text-light);
}

.footer a {
    color: var(--text-light);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Table of Contents */
.toc {
    background: transparent;
    border: 1px solid;
    border-color: black;
    padding: 15px;
}

[data-theme="dark"] .toc {
    border-color: white;
}

.toc-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: var(--text-bright);
}

.toc-title a {
    color: inherit;
    text-decoration: none;
}

.toc-title a:hover {
    text-decoration: underline;
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc-list ul {
    list-style: none;
    margin: 2px 0 2px 8px;
    padding: 0;
}

.toc-list li {
    margin: 3px 0;
}

/* Add bullet-style dashes for subheaders */
.toc-list .toc-level-2::before,
.toc-list .toc-level-3::before,
.toc-list .toc-level-4::before,
.toc-list .toc-level-5::before,
.toc-list .toc-level-6::before {
    content: '–';
    position: absolute;
    left: -12px;
}

.toc-list .toc-level-2,
.toc-list .toc-level-3,
.toc-list .toc-level-4,
.toc-list .toc-level-5,
.toc-list .toc-level-6 {
    position: relative;
}

.toc-list a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
    display: block;
    padding: 2px 0;
}

.toc-list a:hover {
    color: var(--link-color);
    text-decoration: underline;
}

/* Highlight current section in TOC */
.toc-list a.active {
    color: var(--link-color);
    font-weight: 600;
}

/* Admonition/Callout Styles */
.admonition {
    background: transparent;
    border: 1px solid black;
    padding: 0;
    margin: 20px 0;
    overflow: hidden;
}

[data-theme="dark"] .admonition {
    border-color: white;
}

.admonition summary {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    font-weight: normal;
    gap: 10px;
}

.admonition-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.admonition-title {
    flex-grow: 1;
}

.admonition-fold {
    transition: transform 0.2s;
    font-size: 12px;
}

details[open] .admonition-fold {
    transform: rotate(90deg);
}

.admonition > div,
.admonition > p {
    padding: 0 15px 15px 15px;
}

.admonition > div > :first-child,
.admonition > p:first-of-type {
    margin-top: 0;
}

.admonition > div > :last-child,
.admonition > p:last-of-type {
    margin-bottom: 0;
}



/* Collapsible admonitions */
details.admonition {
    cursor: pointer;
}

details.admonition summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

details.admonition summary::-webkit-details-marker {
    display: none;
}

/* Arrow indicator for collapsible admonitions */
details.admonition summary::before {
    content: '▶ ';
    transition: transform 0.2s;
    font-size: 12px;
    display: inline-block;
    margin-right: 5px;
}

details.admonition[open] summary::before {
    transform: rotate(90deg);
}

/* Mobile responsiveness */
@media (max-width: 1400px) {
    .toc-sidebar,
    .toc-sidebar.sticky {
        position: relative;
        left: auto;
        top: auto;
        width: 100%;
        margin: 30px 0;
        max-width: none;
        padding: 0;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .project-meta {
        justify-content: center;
    }
    
    .article-content {
        font-size: 16px;
    }
    
    .toc {
        padding: 12px;
    }
    
    .toc-title {
        font-size: 18px;
    }
    
    .toc-list a {
        font-size: 13px;
    }
}