:root {
    --che-blue: #0066CC;
    --che-dark: #0052A3;
    --che-light: #EFF6FF;
    --che-red: #E63946;
    --gray-900: #111827;
    --gray-800: #1F2937;
    --gray-700: #374151;
    --gray-600: #4B5563;
    --gray-500: #6B7280;
    --gray-400: #9CA3AF;
    --gray-300: #D1D5DB;
    --gray-200: #E5E7EB;
    --gray-100: #F3F4F6;
    --gray-50: #F9FAFB;
    --bg-white: #FFFFFF;
}

/* Typography & Content */
.prose-custom p { margin-bottom: 1.5em; line-height: 1.8; color: var(--gray-700); }
.prose-custom h2 { margin-top: 2em; margin-bottom: 0.8em; font-size: 1.5rem; font-weight: 600; color: var(--gray-900); padding-left: 1rem; border-left: 4px solid var(--che-blue); }
.prose-custom h3 { margin-top: 1.5em; margin-bottom: 0.6em; font-size: 1.25rem; font-weight: 500; color: var(--gray-900); padding-left: 0.75rem; border-left: 3px solid var(--che-blue); }
.prose-custom img { max-width: 100%; height: auto; border-radius: 8px; margin: 1em 0; transition: box-shadow 0.3s ease; }
.prose-custom img:hover { box-shadow: 0 10px 25px rgba(0, 102, 204, 0.15); }
.prose-custom ul, .prose-custom ol { padding-left: 1.5em; margin-bottom: 1em; }
.prose-custom li { margin-bottom: 0.5em; }
.prose-custom table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.prose-custom th, .prose-custom td { border: 1px solid var(--gray-200); padding: 0.5em; text-align: left; }
.prose-custom th { background-color: var(--gray-50); font-weight: 600; }

/* Interactive Elements */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] summary ~ * { animation: sweep 0.2s ease-in-out; }
@keyframes sweep { 0% {opacity: 0; transform: translateY(-5px)} 100% {opacity: 1; transform: translateY(0)} }

/* Layout & Components */
.drawer-open { overflow: hidden; }
#mobile-menu { transition: transform 0.3s ease-in-out; }
.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background-color: var(--gray-200); border-radius: 20px; }
.custom-scrollbar:hover::-webkit-scrollbar-thumb { background-color: var(--gray-300); }

/* Premium Visuals */
.glass-bg { background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.glass-sidebar { background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

/* Category Cards */
.category-card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.category-card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0, 102, 204, 0.12); border-color: var(--che-blue); }

/* Article Cards */
.article-card { transition: all 0.2s ease; border: 1px solid var(--gray-200); }
.article-card:hover { border-color: var(--che-blue); box-shadow: 0 4px 12px rgba(0, 102, 204, 0.1); }

/* Nav Enhancements */
.nav-item-arrow::after { content: ''; display: inline-block; width: 0; height: 0; margin-left: 4px; vertical-align: middle; border-top: 4px solid var(--gray-400); border-right: 3px solid transparent; border-left: 3px solid transparent; }
.group:hover .nav-item-arrow::after { border-top-color: var(--che-blue); }

/* Pagination Styles */
.pagination-wrapper {
    padding: 24px 0 16px;
    border-top: 1px solid var(--gray-200);
    margin-top: 8px;
}

.pagination-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    background-color: #fff;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.pagination-btn:hover:not(.disabled) {
    color: var(--che-blue);
    background-color: var(--che-light);
    border-color: var(--che-blue);
}

.pagination-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.pagination-btn.active {
    color: #fff;
    background-color: var(--che-blue);
    border-color: var(--che-blue);
}

.pagination-btn.disabled {
    color: var(--gray-400);
    background-color: var(--gray-100);
    border-color: var(--gray-200);
    cursor: not-allowed;
}

.pagination-btn.page-num {
    min-width: 36px;
    padding: 0 8px;
}

.pagination-btn.first-last {
    padding: 0 12px;
    font-size: 12px;
}

.pagination-btn i {
    font-size: 11px;
}

.pagination-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 36px;
    color: var(--gray-400);
    font-size: 14px;
}

.pagination-pages {
    margin: 0 4px;
}

/* Per Page Selector Styles */
.per-page-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.per-page-dropdown {
    position: relative;
}

.per-page-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 56px;
    min-width: unset;
    padding: 8px 4px 8px 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    background-color: #fff;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.per-page-trigger:hover {
    border-color: var(--che-blue);
    color: var(--che-blue);
}

.per-page-trigger:focus {
    outline: none;
    border-color: var(--che-blue);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.per-page-trigger i {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.per-page-dropdown.open .per-page-trigger i {
    transform: rotate(180deg);
}

.per-page-dropdown.open .per-page-trigger {
    border-color: var(--che-blue);
    color: var(--che-blue);
}

.per-page-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    min-width: 100px;
    background-color: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 4px;
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s ease;
}

.per-page-dropdown.open .per-page-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.per-page-option {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--gray-700);
    text-align: center;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.per-page-option:hover {
    background-color: var(--che-light);
    color: var(--che-blue);
}

.per-page-option.active {
    background-color: var(--che-light);
    color: var(--che-blue);
    font-weight: 500;
}

@media (max-width: 640px) {
    .pagination-wrapper {
        padding: 16px 0;
        gap: 12px;
    }
    
    .per-page-selector {
        order: 2;
        width: 100%;
        justify-content: center;
    }
    
    .pagination-container {
        order: 1;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .pagination-btn {
        min-width: 32px;
        height: 32px;
        font-size: 13px;
        padding: 0 6px;
    }
    
    .pagination-btn.page-num {
        min-width: 32px;
        padding: 0 4px;
    }
    
    .pagination-dots {
        min-width: 24px;
        height: 32px;
        font-size: 12px;
    }
    
    .per-page-trigger {
        width: 52px;
        min-width: unset;
        padding: 6px 2px 6px 6px;
        font-size: 13px;
        gap: 2px;
    }
}

/* Search Result Styles */
.search-result-highlight {
    background-color: #FEF08A;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 500;
}

.search-result-card {
    transition: all 0.2s ease;
    border: 1px solid var(--gray-200);
}

.search-result-card:hover {
    border-color: var(--che-blue);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.1);
}

.search-empty-icon {
    font-size: 48px;
    color: var(--gray-300);
}

.search-keyword {
    color: var(--che-blue);
    font-weight: 600;
}

.search-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.search-result-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

@media (max-width: 640px) {
    .search-result-card {
        padding: 12px;
    }

    .search-result-card h3 {
        font-size: 1rem;
    }
}

/* ========================================
   Markdown Rendering Styles
   ======================================== */

/* Headings */
.prose-custom .md-heading {
    position: relative;
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    scroll-margin-top: 100px;
    display: flex;
    align-items: center;
    line-height: 1.4;
}

.prose-custom .md-heading:first-child {
    margin-top: 0;
}

.prose-custom .md-heading .heading-anchor {
    opacity: 0;
    margin-left: 0.75rem;
    color: var(--gray-400);
    font-size: 0.7em;
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.prose-custom .md-heading:hover .heading-anchor {
    opacity: 1;
    color: var(--che-blue);
}

.prose-custom h1.md-heading { font-size: 2.25rem; border-bottom: 1px solid var(--gray-200); padding-bottom: 0.75rem; margin-bottom: 2rem; }
.prose-custom h2.md-heading { font-size: 1.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--gray-100); }
.prose-custom h3.md-heading { font-size: 1.5rem; }
.prose-custom h4.md-heading { font-size: 1.25rem; }
.prose-custom h5.md-heading { font-size: 1.125rem; }
.prose-custom h6.md-heading { font-size: 1rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.05em; }

.prose-custom h2 { border-left: none; padding-left: 0; }

/* Paragraphs */
.prose-custom .md-paragraph {
    margin-bottom: 1.5rem;
    line-height: 1.8;
    color: var(--gray-700);
    font-size: 1.0625rem;
}

/* Links */
.prose-custom .md-link {
    color: var(--che-blue);
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 102, 204, 0.2);
    transition: all 0.2s ease;
    font-weight: 500;
}

.prose-custom .md-link:hover {
    border-bottom-color: var(--che-blue);
    background-color: rgba(0, 102, 204, 0.05);
}

.prose-custom .md-link[rel="external"]::after {
    content: "\f08e";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.75em;
    margin-left: 4px;
    color: var(--gray-400);
    display: inline-block;
}

/* Images */
.prose-custom .md-image {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 2rem 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: block;
}

.prose-custom .md-image:hover {
    transform: scale(1.01);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Lists */
.prose-custom .md-list {
    margin: 1.5rem 0;
    padding-left: 1.75rem;
}

.prose-custom .md-list-unordered { list-style-type: disc; }
.prose-custom .md-list-ordered { list-style-type: decimal; }

.prose-custom .md-list-item {
    margin-bottom: 0.75rem;
    line-height: 1.7;
    color: var(--gray-700);
}

.prose-custom .md-list-item::marker {
    color: var(--che-blue);
    font-weight: 700;
}

/* Blockquote */
.prose-custom .md-blockquote {
    margin: 2rem 0;
    padding: 1.25rem 1.75rem;
    border-left: 4px solid var(--che-blue);
    background-color: var(--gray-50);
    border-radius: 0 12px 12px 0;
    color: var(--gray-600);
    font-style: italic;
    box-shadow: inset 0 2px 4px 0 rgba(0,0,0,0.02);
}

.prose-custom .md-blockquote p {
    margin-bottom: 0;
}

/* Tables */
.prose-custom .md-table-wrapper {
    margin: 2.5rem 0;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.prose-custom .md-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    font-size: 0.9375rem;
}

.prose-custom .md-table th {
    background-color: #F8FAFC;
    color: var(--gray-900);
    font-weight: 600;
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.prose-custom .md-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

.prose-custom .md-table tr:hover td {
    background-color: #F8FAFC;
}

/* Code Blocks */
.prose-custom .md-code-block {
    margin: 2rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    background-color: #1f2937;
}

.prose-custom .md-code-block pre {
    margin: 0 !important;
    padding: 1.5rem !important;
    background-color: transparent !important;
}

/* Inline Code */
.prose-custom .md-inline-code {
    background-color: #F1F5F9;
    color: #0F172A;
    padding: 0.25em 0.5em;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    border: 1px solid #E2E8F0;
    font-weight: 500;
}

/* Table of Contents (Sidebar) */
.toc-list {
    border-left: 2px solid #E2E8F0;
    padding-left: 0;
    margin-left: 0.5rem;
}

.toc-item {
    list-style: none;
}

.toc-item a {
    display: block;
    padding: 0.25rem 0 0.25rem 1.25rem; /* Reduced padding for compact view */
    font-size: 0.875rem;
    color: var(--gray-500);
    text-decoration: none;
    border-left: 2px solid transparent;
    margin-left: -2px;
    transition: all 0.2s ease;
}

.toc-item a:hover {
    color: var(--che-blue);
    border-left-color: var(--che-blue);
    background-color: rgba(0, 102, 204, 0.05);
}

.toc-item.active > a {
    color: var(--che-blue);
    font-weight: 600;
    border-left-color: var(--che-blue);
    background-color: rgba(0, 102, 204, 0.08);
}

.toc-level-2 a { padding-left: 2rem; }
.toc-level-3 a { padding-left: 2.75rem; font-size: 0.8125rem; }
.toc-level-4 a { padding-left: 3.5rem; font-size: 0.8rem; }
.toc-level-5 a { padding-left: 4.25rem; font-size: 0.8rem; }
.toc-level-6 a { padding-left: 5rem; font-size: 0.8rem; }

/* Content Toggle Buttons - Refined */
.content-toggle-container {
    background-color: #F1F5F9;
    padding: 4px;
    border-radius: 10px;
    display: inline-flex;
    border: 1px solid #E2E8F0;
}

.content-toggle-btn {
    border: none;
    background: transparent;
    color: var(--gray-500);
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.content-toggle-btn.active {
    background-color: #fff !important;
    color: var(--che-blue) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    ring: 0 !important;
}

.content-toggle-btn:hover:not(.active) {
    color: var(--gray-900);
    background-color: rgba(255,255,255,0.5);
}

/* Pygments Syntax Highlighting Overrides */
.codehilite { background: transparent !important; }
.codehilite .hll { background-color: #374151 }
.codehilite .c { color: #9ca3af; font-style: italic } /* Comment */
.codehilite .err { color: #f87171 } /* Error */
.codehilite .k { color: #93c5fd; font-weight: bold } /* Keyword */
.codehilite .o { color: #e5e7eb } /* Operator */
.codehilite .ch { color: #9ca3af; font-style: italic }
.codehilite .cm { color: #9ca3af; font-style: italic }
.codehilite .cp { color: #9ca3af; font-weight: bold }
.codehilite .cpf { color: #9ca3af; font-style: italic }
.codehilite .c1 { color: #9ca3af; font-style: italic }
.codehilite .cs { color: #9ca3af; font-style: italic }
.codehilite .gd { color: #f87171 }
.codehilite .ge { font-style: italic }
.codehilite .gr { color: #f87171 }
.codehilite .gh { color: #e5e7eb; font-weight: bold }
.codehilite .gi { color: #4ade80 }
.codehilite .go { color: #9ca3af }
.codehilite .gp { color: #9ca3af; font-weight: bold }
.codehilite .gs { font-weight: bold }
.codehilite .gu { color: #e5e7eb; font-weight: bold }
.codehilite .gt { color: #f87171 }
.codehilite .kc { color: #93c5fd; font-weight: bold }
.codehilite .kd { color: #93c5fd; font-weight: bold }
.codehilite .kn { color: #93c5fd; font-weight: bold }
.codehilite .kp { color: #93c5fd; font-weight: bold }
.codehilite .kr { color: #93c5fd; font-weight: bold }
.codehilite .kt { color: #93c5fd; font-weight: bold }
.codehilite .m { color: #f472b6; font-weight: bold }
.codehilite .s { color: #86efac }
.codehilite .na { color: #fcd34d }
.codehilite .nb { color: #e5e7eb }
.codehilite .nc { color: #fcd34d; font-weight: bold }
.codehilite .no { color: #fcd34d }
.codehilite .nd { color: #fcd34d; font-weight: bold }
.codehilite .ni { color: #e5e7eb }
.codehilite .ne { color: #fcd34d; font-weight: bold }
.codehilite .nf { color: #86efac; font-weight: bold }
.codehilite .nl { color: #e5e7eb }
.codehilite .nn { color: #e5e7eb }
.codehilite .nx { color: #e5e7eb }
.codehilite .py { color: #e5e7eb }
.codehilite .nt { color: #f87171 }
.codehilite .nv { color: #e5e7eb }
.codehilite .ow { color: #93c5fd; font-weight: bold }
.codehilite .w { color: #e5e7eb }
.codehilite .mb { color: #f472b6; font-weight: bold }
.codehilite .mf { color: #f472b6; font-weight: bold }
.codehilite .mh { color: #f472b6; font-weight: bold }
.codehilite .mi { color: #f472b6; font-weight: bold }
.codehilite .mo { color: #f472b6; font-weight: bold }
.codehilite .sa { color: #86efac }
.codehilite .sb { color: #86efac }
.codehilite .sc { color: #86efac }
.codehilite .dl { color: #86efac }
.codehilite .sd { color: #86efac; font-style: italic }
.codehilite .s2 { color: #86efac }
.codehilite .se { color: #fcd34d }
.codehilite .sh { color: #86efac }
.codehilite .si { color: #fcd34d }
.codehilite .sx { color: #86efac }
.codehilite .sr { color: #c084fc }
.codehilite .s1 { color: #86efac }
.codehilite .ss { color: #86efac }
.codehilite .bp { color: #e5e7eb }
.codehilite .fm { color: #86efac; font-weight: bold }
.codehilite .vc { color: #e5e7eb }
.codehilite .vg { color: #e5e7eb }
.codehilite .vi { color: #e5e7eb }
.codehilite .vm { color: #e5e7eb }
.codehilite .il { color: #f472b6; font-weight: bold }

/* ========================================
   Homepage About Content Styles
   ======================================== */

.about-content {
    font-size: 0.9375rem;
    line-height: 1.8;
}

/* About section container spacing */
section.mt-16:has(.about-content) {
    margin-top: 4rem !important;
}

/* First heading as main title */
.about-content h1.md-heading {
    font-size: 1.75rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--che-blue);
    color: var(--gray-900);
}

/* Section headings */
.about-content h2.md-heading {
    font-size: 1.25rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-left: 0.75rem;
    border-left: 3px solid var(--che-blue);
    border-bottom: none;
    padding-bottom: 0;
    background: linear-gradient(to right, rgba(0, 102, 204, 0.05), transparent);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    border-radius: 0 6px 6px 0;
}

/* Paragraphs */
.about-content .md-paragraph {
    font-size: 0.9375rem;
    margin-bottom: 1rem;
    color: var(--gray-600);
}

/* Lists - more compact */
.about-content .md-list {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.about-content .md-list-item {
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
    color: var(--gray-600);
}

/* Horizontal rules as section dividers */
.about-content hr {
    border: none;
    height: 1px;
    background: linear-gradient(to right, var(--gray-200), transparent);
    margin: 2rem 0;
}

/* Bold text highlight */
.about-content strong {
    color: var(--gray-800);
    font-weight: 600;
}

/* Timeline-style for development history */
.about-content h2.md-heading:has(+ .md-list) + .md-list .md-list-item {
    position: relative;
    padding-left: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .about-content h1.md-heading {
        font-size: 1.5rem;
    }

    .about-content h2.md-heading {
        font-size: 1.125rem;
    }

    .about-content .md-paragraph,
    .about-content .md-list-item {
        font-size: 0.875rem;
    }
}
