/* BBH Sans Bogle Font */
@font-face {
    font-family: 'BBH Sans Bogle';
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url(https://cdn.jsdelivr.net/fontsource/fonts/bbh-sans-bogle@latest/latin-400-normal.woff2) format('woff2'), url(https://cdn.jsdelivr.net/fontsource/fonts/bbh-sans-bogle@latest/latin-400-normal.woff) format('woff');
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #fff;
    --bg-light: #f8f9fa;
    --border-color: #dee2e6;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 8px rgba(0,0,0,0.15);
}

body {
    font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "kern" 1, "liga" 1;
    word-break: keep-all;
    word-wrap: break-word;
    font-variation-settings: "wght" 400;
}

/* Font weight variations for Pretendard Variable */
strong, b {
    font-variation-settings: "wght" 600;
}

h1, h2, h3, h4, h5, h6 {
    font-variation-settings: "wght" 700;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.site-header {
    background-color: var(--primary-color);
    color: white;
    padding: 20px 0;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 15px;
}

.site-branding .logo-link {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.site-branding .site-logo {
    height: 50px;
    width: auto;
    transition: transform 0.3s ease;
}

.site-branding .site-logo:hover {
    transform: scale(1.05);
}

.site-branding .branding-text {
    display: flex;
    flex-direction: column;
}

.site-branding .site-title {
    font-family: 'BBH Sans Bogle', sans-serif;
    font-size: 28px;
    font-weight: 400;
    color: white;
    text-decoration: none;
    display: block;
}

.site-branding .site-description {
    font-size: 14px;
    color: rgba(255,255,255,0.8);
    margin-top: 5px;
}

.main-navigation .nav-menu {
    list-style: none;
    display: flex;
    gap: 20px;
}

.main-navigation .nav-menu a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.main-navigation .nav-menu a:hover {
    background-color: rgba(255,255,255,0.1);
}

/* Hamburger Menu */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.hamburger-menu span {
    width: 30px;
    height: 3px;
    background: white;
    border-radius: 10px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.hamburger-menu.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Search Styles */
.search-container {
    position: relative;
    margin-top: 20px;
}

#search-input {
    width: 100%;
    padding: 12px 20px;
    font-size: 16px;
    border: none;
    border-radius: 25px;
    outline: none;
}

#search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-height: 500px;
    overflow-y: auto;
    margin-top: 10px;
    z-index: 1000;
}

.search-result-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item h3 {
    font-size: 18px;
    margin-bottom: 5px;
}

.search-result-item h3 a {
    color: var(--secondary-color);
    text-decoration: none;
}

.search-result-item h3 a:hover {
    text-decoration: underline;
}

.search-result-date {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 5px;
}

.search-result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 5px 0;
}

.search-result-excerpt {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 8px;
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-light);
}

mark {
    background-color: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Main Content */
.main-content {
    padding: 40px 0;
    min-height: calc(100vh - 300px);
}

/* Home Page Styles */
.welcome-section {
    text-align: center;
    padding: 60px 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 12px;
    margin-bottom: 40px;
}

.welcome-section h1 {
    font-size: 42px;
    margin-bottom: 15px;
}

.welcome-text {
    font-size: 20px;
    margin-bottom: 10px;
}

.welcome-subtitle {
    font-size: 16px;
    opacity: 0.9;
}

.recent-posts {
    margin-bottom: 40px;
}

.recent-posts h2 {
    font-size: 32px;
    margin-bottom: 30px;
    color: var(--primary-color);
}

/* Post List Styles */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.post-item {
    background: var(--bg-light);
    padding: 25px;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
    transition: transform 0.3s, box-shadow 0.3s;
}

.post-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.post-item-title {
    font-size: 24px;
    margin-bottom: 10px;
}

.post-item-title a {
    color: var(--primary-color);
    text-decoration: none;
}

.post-item-title a:hover {
    color: var(--secondary-color);
}

.post-item-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-light);
}

.post-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background-color: var(--secondary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    text-decoration: none;
    font-size: 13px;
    transition: background-color 0.3s;
}

.tag:hover {
    background-color: var(--primary-color);
}

.post-item-excerpt {
    font-size: 15px;
    color: var(--text-light);
    line-height: 1.6;
}

/* Quick Links */
.quick-links {
    margin-top: 40px;
}

.quick-links h2 {
    font-size: 32px;
    margin-bottom: 30px;
    color: var(--primary-color);
}

.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.quick-link-card {
    background: var(--bg-light);
    padding: 30px;
    border-radius: 8px;
    text-decoration: none;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 2px solid transparent;
}

.quick-link-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--secondary-color);
}

.quick-link-card h3 {
    font-size: 24px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.quick-link-card p {
    color: var(--text-light);
    font-size: 14px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state h2 {
    font-size: 28px;
    color: var(--text-light);
    margin-bottom: 15px;
}

.empty-state p {
    color: var(--text-light);
    font-size: 16px;
    margin-bottom: 10px;
}

/* Post Page Styles */
.post {
    max-width: 800px;
    margin: 0 auto;
}

.post-header {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.post-title {
    font-size: 36px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-light);
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.post-content {
    font-size: 18px;
    line-height: 1.9;
    letter-spacing: 0.02em;
    word-break: keep-all;
    word-wrap: break-word;
    text-rendering: optimizeLegibility;
}

.post-content h2 {
    font-size: 30px;
    font-weight: 700;
    margin-top: 48px;
    margin-bottom: 24px;
    padding-bottom: 12px;
    color: var(--primary-color);
    line-height: 1.4;
    letter-spacing: -0.02em;
    border-bottom: 1px solid var(--border-color);
}

.post-content h3 {
    font-size: 24px;
    font-weight: 600;
    margin-top: 36px;
    margin-bottom: 18px;
    color: var(--primary-color);
    line-height: 1.5;
    letter-spacing: -0.01em;
}

.post-content h4 {
    font-size: 20px;
    font-weight: 600;
    margin-top: 28px;
    margin-bottom: 14px;
    color: var(--primary-color);
    line-height: 1.6;
}

.post-content h5 {
    font-size: 18px;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--text-color);
    line-height: 1.6;
}

.post-content p {
    margin-bottom: 24px;
    line-height: 1.9;
}

.post-content ul, .post-content ol {
    margin-left: 32px;
    margin-bottom: 24px;
    line-height: 1.8;
}

.post-content li {
    margin-bottom: 12px;
    line-height: 1.8;
}

.post-content li > p {
    margin-bottom: 12px;
}

.post-content ul ul,
.post-content ul ol,
.post-content ol ul,
.post-content ol ol {
    margin-top: 8px;
    margin-bottom: 8px;
}

.post-content dl {
    margin-bottom: 24px;
}

.post-content dt {
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 16px;
    margin-bottom: 8px;
}

.post-content dd {
    margin-left: 24px;
    margin-bottom: 16px;
    line-height: 1.8;
}

.post-content code {
    background-color: var(--bg-light);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: "Pretendard Variable", "D2Coding", "SF Mono", "Monaco", "Cascadia Code", "Fira Code", "Consolas", "Courier New", monospace;
    font-size: 0.88em;
    color: #d63384;
    border: 1px solid #e1e4e8;
}

.post-content pre {
    background-color: var(--bg-light);
    padding: 24px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 28px;
    line-height: 1.6;
    border: 1px solid var(--border-color);
}

.post-content pre code {
    background: none;
    padding: 0;
    color: var(--text-color);
    border: none;
    font-size: 0.92em;
}

.post-content blockquote {
    border-left: 5px solid var(--secondary-color);
    padding: 16px 24px;
    margin: 28px 0;
    background-color: var(--bg-light);
    border-radius: 4px;
    color: var(--text-light);
    font-style: italic;
    line-height: 1.8;
}

.post-content blockquote p:last-child {
    margin-bottom: 0;
}

.post-content a {
    color: var(--secondary-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-bottom-color 0.2s ease;
}

.post-content a:hover {
    border-bottom-color: var(--secondary-color);
}

.post-content img {
    max-width: 100%;
    height: auto;
    margin: 24px 0;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 28px 0;
    font-size: 16px;
    line-height: 1.6;
}

.post-content table th,
.post-content table td {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.post-content table th {
    background-color: var(--bg-light);
    font-weight: 600;
    color: var(--primary-color);
}

.post-content table tr:nth-child(even) {
    background-color: var(--bg-light);
}

.post-content table tr:hover {
    background-color: #f0f2f5;
}

.post-content hr {
    border: none;
    border-top: 2px solid var(--border-color);
    margin: 40px 0;
}

.post-content strong {
    font-weight: 600;
    color: var(--text-color);
}

.post-content em {
    font-style: italic;
}

.roadmap-notice {
    background-color: #fff3cd;
    padding: 15px 20px;
    border-radius: 8px;
    margin-top: 30px;
    border-left: 4px solid #ffc107;
}

.post-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid var(--border-color);
}

.post-navigation a {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 16px;
}

.post-navigation a:hover {
    text-decoration: underline;
}

/* Post TOC (Table of Contents) Minimap */
.post-wrapper {
    display: flex;
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.post-wrapper .post {
    flex: 1;
    max-width: 800px;
    min-width: 0; /* Prevent flex item overflow */
}

.post-toc-sidebar {
    width: 250px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    align-self: flex-start;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 20px 0;
}

.toc-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 16px;
    padding: 0 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.toc-content {
    font-size: 13px;
    line-height: 1.6;
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc-item {
    margin: 0;
    padding: 0;
}

.toc-link {
    display: block;
    padding: 6px 16px;
    color: var(--text-light);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.toc-link:hover {
    color: var(--secondary-color);
    background-color: rgba(52, 152, 219, 0.05);
}

.toc-link.active {
    color: var(--secondary-color);
    border-left-color: var(--secondary-color);
    background-color: rgba(52, 152, 219, 0.08);
    font-weight: 500;
}

/* Heading level indentation */
.toc-h2 .toc-link {
    padding-left: 16px;
}

.toc-h3 .toc-link {
    padding-left: 32px;
    font-size: 12px;
}

/* Scrollbar styling for TOC */
.post-toc-sidebar::-webkit-scrollbar {
    width: 4px;
}

.post-toc-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.post-toc-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.post-toc-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Responsive: Hide TOC on smaller screens */
@media (max-width: 1200px) {
    .post-wrapper {
        display: block;
    }

    .post-toc-sidebar {
        display: none;
    }

    .post-wrapper .post {
        max-width: 800px;
        margin: 0 auto;
    }
}

/* Tags Page Styles */
.tags-page {
    max-width: 1000px;
    margin: 0 auto;
}

.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.page-header h1 {
    font-size: 36px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.page-header p {
    font-size: 16px;
    color: var(--text-light);
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 60px;
    padding: 30px;
    background: var(--bg-light);
    border-radius: 12px;
}

.tag-cloud-item {
    background-color: var(--secondary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    transition: transform 0.3s, background-color 0.3s;
}

.tag-cloud-item:hover {
    transform: scale(1.1);
    background-color: var(--primary-color);
}

.tag-count {
    opacity: 0.8;
    font-size: 0.9em;
}

.tags-list h2 {
    font-size: 28px;
    color: var(--primary-color);
    margin-bottom: 30px;
}

.tag-section {
    margin-bottom: 40px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: 8px;
}

.tag-section h3 {
    font-size: 24px;
    margin-bottom: 15px;
}

.tag-section h3 a {
    color: var(--primary-color);
    text-decoration: none;
}

.tag-section h3 a:hover {
    color: var(--secondary-color);
}

.post-list {
    list-style: none;
}

.post-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.post-list li:last-child {
    border-bottom: none;
}

.post-list a {
    color: var(--text-color);
    text-decoration: none;
    flex: 1;
}

.post-list a:hover {
    color: var(--secondary-color);
}

.post-date {
    color: var(--text-light);
    font-size: 14px;
}

/* Tag Page Styles */
.tag-page {
    max-width: 1000px;
    margin: 0 auto;
}

.tag-description {
    font-size: 16px;
    color: var(--text-light);
}

.back-to-tags {
    margin-top: 40px;
    text-align: center;
}

.back-to-tags a {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 16px;
}

.back-to-tags a:hover {
    text-decoration: underline;
}

/* Categories Page Styles */
.categories-page {
    max-width: 1000px;
    margin: 0 auto;
}

.category-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 60px;
    padding: 30px;
    background: var(--bg-light);
    border-radius: 12px;
}

.category-cloud-item {
    background-color: var(--accent-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    transition: transform 0.3s, background-color 0.3s;
}

.category-cloud-item:hover {
    transform: scale(1.1);
    background-color: var(--primary-color);
}

.category-count {
    opacity: 0.8;
    font-size: 0.9em;
}

.categories-list h2 {
    font-size: 28px;
    color: var(--primary-color);
    margin-bottom: 30px;
}

.category-section {
    margin-bottom: 40px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: 8px;
}

.category-section h3 {
    font-size: 24px;
    margin-bottom: 15px;
}

.category-section h3 a {
    color: var(--primary-color);
    text-decoration: none;
}

.category-section h3 a:hover {
    color: var(--secondary-color);
}

/* Category Page Styles */
.category-page {
    max-width: 1000px;
    margin: 0 auto;
}

.category-description {
    font-size: 16px;
    color: var(--text-light);
}

.back-to-categories {
    margin-top: 40px;
    text-align: center;
}

.back-to-categories a {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 16px;
}

.back-to-categories a:hover {
    text-decoration: underline;
}

/* Series Styles */
.series-page {
    max-width: 1000px;
    margin: 0 auto;
}

.series-description {
    font-size: 16px;
    color: var(--text-light);
}

/* Series Info in Post Header */
.series-info {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border-left: 4px solid #6f42c1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.series-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 15px;
}

.series-badge a {
    color: #6f42c1;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.series-badge a:hover {
    color: #5a32a3;
    text-decoration: underline;
}

.series-position {
    display: inline-block;
    background-color: #6f42c1;
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

/* Series Navigation Links */
.series-navigation {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(111, 66, 193, 0.2);
}

.series-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 10px 15px;
    background-color: white;
    border: 1px solid rgba(111, 66, 193, 0.3);
    border-radius: 8px;
    color: #6f42c1;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.series-nav-link:hover {
    background-color: #6f42c1;
    color: white;
    transform: translateX(5px);
    box-shadow: 0 2px 6px rgba(111, 66, 193, 0.3);
}

.series-nav-link.series-prev:hover {
    transform: translateX(-5px);
}

/* Series List and Section Styles */
.series-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.series-section {
    margin-bottom: 40px;
    padding: 25px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 12px;
    border-left: 4px solid #6f42c1;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.series-section:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(111, 66, 193, 0.15);
}

.series-section h2 {
    font-size: 26px;
    margin-bottom: 20px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.series-section h2 a {
    color: #6f42c1;
    text-decoration: none;
    transition: color 0.2s ease;
}

.series-section h2 a:hover {
    color: #5a32a3;
}

.series-count {
    background-color: #6f42c1;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: 500;
}

/* Back to Series Button */
.back-to-series {
    margin-top: 50px;
    text-align: center;
}

.back-to-series a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 30px;
    background: linear-gradient(135deg, #6f42c1 0%, #5a32a3 100%);
    color: white;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    border-radius: 25px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(111, 66, 193, 0.3);
}

.back-to-series a:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(111, 66, 193, 0.4);
    background: linear-gradient(135deg, #5a32a3 0%, #6f42c1 100%);
}

/* Category Tree View Styles */
.category-tree {
    max-width: 1000px;
    margin: 0 auto;
}

.tree-node {
    margin-bottom: 15px;
    border-left: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.tree-node:hover {
    border-left-color: var(--secondary-color);
}

.tree-node-header {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: var(--bg-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 10px;
}

.tree-node-header:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.tree-chevron {
    font-size: 12px;
    color: var(--text-light);
    transition: transform 0.3s ease;
    min-width: 15px;
}

.tree-node.collapsed .tree-chevron {
    transform: rotate(-90deg);
}

.tree-icon {
    font-size: 20px;
    min-width: 24px;
}

.tree-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    flex: 1;
}

.tree-label:hover {
    color: var(--secondary-color);
}

.tree-count {
    background-color: var(--accent-color);
    color: white;
    padding: 3px 12px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: 500;
}

.tree-children {
    margin-left: 30px;
    margin-top: 10px;
    padding-left: 20px;
    border-left: 2px solid #dee2e6;
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 1;
}

.tree-node.collapsed .tree-children {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.leaf-node {
    margin-bottom: 10px;
}

.leaf-node .tree-node-header {
    background: white;
    border: 1px solid #dee2e6;
}

.leaf-node .tree-node-header:hover {
    border-color: var(--secondary-color);
    background: #f8f9fa;
}

.leaf-node .tree-icon {
    font-size: 18px;
}

.leaf-node .tree-label {
    font-size: 16px;
    font-weight: 500;
}

.standalone-node .tree-node-header {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #dee2e6;
}

.standalone-node .tree-node-header:hover {
    border-color: var(--secondary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.tree-posts {
    list-style: none;
    margin: 10px 0 0 0;
    padding: 15px;
    background: #fafbfc;
    border-radius: 6px;
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease;
    opacity: 1;
}

.tree-node.collapsed .tree-posts {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.tree-posts li {
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tree-posts li:last-child {
    border-bottom: none;
}

.tree-posts li a {
    color: var(--text-color);
    text-decoration: none;
    flex: 1;
    transition: color 0.2s ease;
}

.tree-posts li a:hover {
    color: var(--secondary-color);
}

.tree-posts .post-date {
    color: var(--text-light);
    font-size: 14px;
    margin-left: 15px;
}

.parent-node > .tree-node-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #34495e 100%);
    color: white;
    font-size: 20px;
    padding: 15px 20px;
}

.parent-node > .tree-node-header .tree-label {
    color: white;
    font-size: 20px;
}

.parent-node > .tree-node-header .tree-chevron {
    color: rgba(255, 255, 255, 0.8);
}

.parent-node > .tree-node-header:hover {
    background: linear-gradient(135deg, #34495e 0%, var(--primary-color) 100%);
    transform: translateX(3px);
}

/* CV Page Styles */
.cv-wrapper {
    display: flex;
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.cv-wrapper .cv-page {
    flex: 1;
    max-width: 800px;
    min-width: 0;
}

.cv-toc-sidebar {
    width: 250px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    align-self: flex-start;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 20px 0;
}

/* Responsive: Hide TOC on smaller screens */
@media (max-width: 1200px) {
    .cv-wrapper {
        display: block;
    }

    .cv-toc-sidebar {
        display: none;
    }

    .cv-wrapper .cv-page {
        max-width: 800px;
        margin: 0 auto;
    }
}

.cv-page {
    max-width: 800px;
    margin: 0 auto;
}

.cv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
    text-align: left;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.cv-header-text {
    flex: 1;
}

.cv-header-image {
    flex-shrink: 0;
}

.cv-profile-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}

.cv-header h1 {
    font-size: 40px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.cv-subtitle {
    font-size: 18px;
    color: var(--text-light);
}

.cv-content {
    font-size: 16px;
    line-height: 1.8;
}

.cv-logo-container {
    text-align: center;
    margin-bottom: 30px;
}

.cv-logo {
    width: 100px;
    height: auto;
    display: inline-block;
}

.cv-content h2 {
    font-size: 28px;
    color: var(--primary-color);
    margin-top: 40px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.cv-content h3 {
    font-size: 22px;
    color: var(--primary-color);
    margin-top: 30px;
    margin-bottom: 15px;
}

.cv-content ul {
    list-style-position: inside;
    margin-left: 20px;
}

.cv-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 28px 0;
    font-size: 16px;
    line-height: 1.6;
}

.cv-content table th,
.cv-content table td {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.cv-content table th {
    background-color: var(--bg-light);
    font-weight: 600;
    color: var(--primary-color);
}

.cv-content table tr:nth-child(even) {
    background-color: var(--bg-light);
}

.cv-content table tr:hover {
    background-color: #f0f2f5;
}

.cv-footer {
    margin-top: 60px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
    text-align: center;
    color: var(--text-light);
}

/* Footer Styles */
.site-footer {
    background-color: var(--primary-color);
    color: white;
    padding: 40px 0 20px;
    margin-top: 60px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
}

.footer-info p {
    margin-bottom: 10px;
    opacity: 0.9;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: white;
    text-decoration: none;
    opacity: 0.9;
}

.footer-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.2);
    opacity: 0.8;
}

.footer-bottom a {
    color: white;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap;
        gap: 15px;
    }

    .site-branding {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }

    .site-branding .branding-text {
        overflow: hidden;
    }

    .site-branding .site-logo {
        height: 40px;
    }

    .site-branding .site-title {
        font-size: 20px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .site-branding .site-description {
        display: none;
    }

    /* Show hamburger menu on mobile */
    .hamburger-menu {
        display: flex;
        flex-shrink: 0;
    }

    /* Hide navigation by default on mobile */
    .main-navigation {
        display: none;
        order: 3;
        width: 100%;
        margin-top: 20px;
    }

    .main-navigation.active {
        display: block;
    }

    .main-navigation .nav-menu {
        flex-direction: column;
        gap: 0;
        background-color: rgba(0, 0, 0, 0.2);
        border-radius: 8px;
        overflow: hidden;
    }

    .main-navigation .nav-menu li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .main-navigation .nav-menu li:last-child {
        border-bottom: none;
    }

    .main-navigation .nav-menu a {
        display: block;
        padding: 15px 20px;
        border-radius: 0;
    }

    .cv-logo {
        width: 80px;
    }

    .cv-header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .cv-profile-image {
        width: 100px;
        height: 100px;
    }

    .welcome-section h1 {
        font-size: 32px;
    }

    .post-title {
        font-size: 28px;
    }

    .footer-content {
        flex-direction: column;
        gap: 20px;
    }

    .quick-links-grid {
        grid-template-columns: 1fr;
    }

    .post-navigation {
        flex-direction: column;
        gap: 15px;
    }

    /* Ensure tags wrap properly on mobile */
    .post-item-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .tag {
        font-size: 12px;
        padding: 3px 10px;
        white-space: nowrap;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Series styles on mobile */
    .series-info {
        padding: 15px;
    }

    .series-badge {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        font-size: 14px;
    }

    .series-nav-link {
        font-size: 13px;
        padding: 8px 12px;
    }

    .series-section {
        padding: 15px;
    }

    .series-section h2 {
        font-size: 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .back-to-series a {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* Mermaid Diagram Styles */
.mermaid {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2em 0;
    padding: 1em;
    background-color: var(--bg-light);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    min-height: 400px; /* Increased minimum height for better visibility */
}

/* Ensure mermaid diagrams are responsive */
.mermaid svg {
    max-width: 100%;
    height: auto !important; /* Allow SVG to grow with content */
    min-height: 350px; /* Minimum height for SVG */
    background-color: transparent !important; /* Fix black background issue */
}

/* Fix svg-pan-zoom overlay background */
.mermaid svg > g,
.mermaid svg > g > g {
    background-color: transparent !important;
}

/* Center align mermaid diagrams */
.post-content .mermaid {
    text-align: center;
}

/* Mermaid Zoom Container */
.mermaid-zoom-container {
    position: relative;
    margin: 2em 0;
    border-radius: 8px;
    overflow: hidden;
}

.mermaid-zoom-container .mermaid {
    margin: 0;
    cursor: grab;
    user-select: none;
    border-radius: 0 0 8px 8px;
    border-top: none;
    background-color: white !important; /* Ensure white background for zoom container */
}

.mermaid-zoom-container .mermaid:active {
    cursor: grabbing;
}

/* Interactive Badge */
.mermaid-interactive-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    user-select: none;
    transition: all 0.3s ease;
}

.mermaid-interactive-badge:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

/* Reset Button */
.mermaid-reset-btn {
    position: absolute;
    top: 50px;
    right: 10px;
    background: white;
    border: 2px solid var(--secondary-color);
    color: var(--secondary-color);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mermaid-reset-btn:hover {
    background: var(--secondary-color);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.mermaid-reset-btn:active {
    transform: scale(0.98);
}

/* svg-pan-zoom Control Icons Customization */
.svg-pan-zoom-control {
    cursor: pointer;
    fill: white;
    stroke: var(--secondary-color);
    stroke-width: 1px;
}

.svg-pan-zoom-control:hover {
    fill: var(--secondary-color);
}

.svg-pan-zoom-control-background {
    fill: white;
    opacity: 0.95;
    stroke: var(--border-color);
    stroke-width: 1px;
}

.svg-pan-zoom-control-element {
    fill: var(--secondary-color);
}

.svg-pan-zoom-control-element:hover {
    fill: var(--accent-color);
}

/* Ensure svg-pan-zoom controls are visible and styled */
.svg-pan-zoom-control-background {
    rx: 4;
    ry: 4;
}

/* Mobile-specific styles for static diagrams (no zoom) */
.mermaid-mobile {
    overflow-x: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    cursor: default !important;
}

.mermaid-mobile svg {
    cursor: default !important;
    user-select: none;
}

/* Tablet and mobile: disable zoom interface */
/* Using hover:none to detect true touch devices (not desktop with touchscreen) */
@media (hover: none) and (pointer: coarse) {
    /* Hide zoom controls on mobile/tablet */
    .mermaid-zoom-container .mermaid-interactive-badge,
    .mermaid-zoom-container .mermaid-reset-btn,
    .svg-pan-zoom-control {
        display: none !important;
    }

    /* Ensure diagrams are scrollable */
    .mermaid {
        overflow-x: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Remove grab cursor on mobile */
    .mermaid-zoom-container .mermaid {
        cursor: default !important;
    }
}

/* Additional fallback for older mobile browsers */
@media (max-width: 768px) {
    .mermaid-zoom-container .mermaid-interactive-badge,
    .mermaid-zoom-container .mermaid-reset-btn,
    .svg-pan-zoom-control {
        display: none !important;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .mermaid-interactive-badge {
        font-size: 11px;
        padding: 6px 12px;
    }

    .mermaid-reset-btn {
        top: 45px;
        right: 8px;
        padding: 6px 12px;
        font-size: 12px;
    }

    .mermaid-zoom-container .mermaid {
        padding: 0.5em;
    }

    /* Adjust svg-pan-zoom controls for mobile */
    .svg-pan-zoom-control {
        transform: scale(0.9);
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .mermaid-zoom-container .mermaid {
        cursor: default;
    }

    .mermaid-reset-btn {
        padding: 10px 16px;
        font-size: 14px;
    }
}

/* Dark mode support (if you add dark mode in the future) */
@media (prefers-color-scheme: dark) {
    .mermaid-zoom-container .mermaid {
        background-color: #1e1e1e;
        border-color: #444;
    }

    .mermaid-reset-btn {
        background: #2d2d2d;
        color: var(--secondary-color);
        border-color: var(--secondary-color);
    }

    .mermaid-reset-btn:hover {
        background: var(--secondary-color);
        color: white;
    }

    .svg-pan-zoom-control-background {
        fill: #2d2d2d;
        stroke: #444;
    }
}

/* Animation for zoom interactions */
@keyframes zoomPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(52, 152, 219, 0);
    }
}

.mermaid-zoom-container:active {
    animation: zoomPulse 0.6s ease-out;
}

/* Post Summary Box */
.post-summary-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 4px solid var(--secondary-color);
    border-radius: 8px;
    padding: 2em;
    margin: 2em 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.post-summary-box h3 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 1.5em;
    font-size: 1.5em;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5em;
}

.post-summary-box h4 {
    color: var(--secondary-color);
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    font-size: 1.2em;
}

.post-summary-box ul {
    margin-left: 1.5em;
    line-height: 1.8;
}

.post-summary-box li {
    margin-bottom: 0.5em;
}

.post-summary-box strong {
    color: var(--primary-color);
}

.post-summary-box ol {
    margin-left: 1.5em;
    line-height: 1.8;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .post-summary-box {
        padding: 1.5em;
        margin: 1.5em 0;
    }

    .post-summary-box h3 {
        font-size: 1.3em;
    }

    .post-summary-box h4 {
        font-size: 1.1em;
    }
}

/* Syntax Highlighting (Rouge) */
.highlight {
    background-color: #f6f8fa;
    border-radius: 8px;
    padding: 24px;
    margin: 28px 0;
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

.highlight pre {
    margin: 0;
    padding: 0;
    background: none;
    border: none;
}

.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #6a737d; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #d73a49; font-weight: bold } /* Keyword */
.highlight .o { color: #d73a49; font-weight: bold } /* Operator */
.highlight .cm { color: #6a737d; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #d73a49; font-weight: bold } /* Comment.Preproc */
.highlight .c1 { color: #6a737d; font-style: italic } /* Comment.Single */
.highlight .cs { color: #6a737d; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { color: #000000; font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #999999 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #aaaaaa } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #005cc5; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #d73a49; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #d73a49; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #d73a49; font-weight: bold } /* Keyword.Pseudo */
.highlight .kr { color: #d73a49; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #6f42c1; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #005cc5 } /* Literal.Number */
.highlight .s { color: #032f62 } /* Literal.String */
.highlight .na { color: #005cc5 } /* Name.Attribute */
.highlight .nb { color: #005cc5 } /* Name.Builtin */
.highlight .nc { color: #6f42c1; font-weight: bold } /* Name.Class */
.highlight .no { color: #005cc5 } /* Name.Constant */
.highlight .nd { color: #6f42c1; font-weight: bold } /* Name.Decorator */
.highlight .ni { color: #800080 } /* Name.Entity */
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #6f42c1; font-weight: bold } /* Name.Function */
.highlight .nl { color: #990000; font-weight: bold } /* Name.Label */
.highlight .nn { color: #555555 } /* Name.Namespace */
.highlight .nt { color: #22863a } /* Name.Tag */
.highlight .nv { color: #e36209 } /* Name.Variable */
.highlight .ow { color: #d73a49; font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #005cc5 } /* Literal.Number.Float */
.highlight .mh { color: #005cc5 } /* Literal.Number.Hex */
.highlight .mi { color: #005cc5 } /* Literal.Number.Integer */
.highlight .mo { color: #005cc5 } /* Literal.Number.Oct */
.highlight .sb { color: #032f62 } /* Literal.String.Backtick */
.highlight .sc { color: #032f62 } /* Literal.String.Char */
.highlight .sd { color: #032f62 } /* Literal.String.Doc */
.highlight .s2 { color: #032f62 } /* Literal.String.Double */
.highlight .se { color: #005cc5 } /* Literal.String.Escape */
.highlight .sh { color: #032f62 } /* Literal.String.Heredoc */
.highlight .si { color: #005cc5 } /* Literal.String.Interpol */
.highlight .sx { color: #032f62 } /* Literal.String.Other */
.highlight .sr { color: #032f62 } /* Literal.String.Regex */
.highlight .s1 { color: #032f62 } /* Literal.String.Single */
.highlight .ss { color: #005cc5 } /* Literal.String.Symbol */
.highlight .bp { color: #005cc5 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #e36209 } /* Name.Variable.Class */
.highlight .vg { color: #e36209 } /* Name.Variable.Global */
.highlight .vi { color: #e36209 } /* Name.Variable.Instance */
.highlight .il { color: #005cc5 } /* Literal.Number.Integer.Long */

/* Language-specific highlighting improvements */
.highlight .language-python .nf { color: #6f42c1 } /* Python function names */
.highlight .language-python .nb { color: #005cc5 } /* Python builtins */
.highlight .language-python .kn { color: #d73a49 } /* Python import keyword */
.highlight .language-python .nn { color: #6f42c1 } /* Python module names */

.highlight .language-javascript .nx { color: #24292e } /* JavaScript identifiers */
.highlight .language-javascript .kd { color: #d73a49 } /* JavaScript var/let/const */
.highlight .language-javascript .k { color: #d73a49 } /* JavaScript keywords */
.highlight .language-javascript .nf { color: #6f42c1 } /* JavaScript function names */

.highlight .language-typescript .nx { color: #24292e } /* TypeScript identifiers */
.highlight .language-typescript .kd { color: #d73a49 } /* TypeScript var/let/const */
.highlight .language-typescript .k { color: #d73a49 } /* TypeScript keywords */
.highlight .language-typescript .nf { color: #6f42c1 } /* TypeScript function names */
.highlight .language-typescript .kt { color: #6f42c1 } /* TypeScript types */

/* Line numbers for code blocks */
.highlight .lineno {
    color: #6a737d;
    padding-right: 1em;
    user-select: none;
}

/* Code block titles/captions */
.highlight .code-header {
    background-color: #e1e4e8;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-color);
    font-weight: 600;
    border-radius: 8px 8px 0 0;
}
