/* Custom Wiki-Style CSS */

:root {
    --sidebar-bg: #f8f9fa;
    --sidebar-border: #dee2e6;
    --link-color: #0d6efd;
    --link-hover: #0a58ca;
    --active-bg: #e7f1ff;
    --text-primary: #212529;
    --text-muted: #6c757d;
    --warning-bg: #fff3cd;
    --warning-border: #ffc107;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Mobile Header Bar */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 65px;
    background-color: var(--sidebar-bg);
    border-bottom: 1px solid var(--sidebar-border);
    display: none;
    align-items: center;
    padding: 0 1rem;
    z-index: 1002;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mobile-site-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    margin-left: 1rem;
    flex: 1;
}

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

.mobile-site-title a:hover {
    color: var(--link-hover);
    text-decoration: none;
}

/* Hamburger Menu Toggle Button */
.sidebar-toggle {
    position: relative;
    width: 45px;
    height: 45px;
    padding: 0;
    border: none;
    background-color: #fff;
    border-radius: 6px;
    cursor: pointer;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background-color: #e2e6ea;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.sidebar-toggle .bar {
    width: 25px;
    height: 3px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.sidebar-toggle.active .bar:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.sidebar-toggle.active .bar:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
}

.sidebar-toggle.active .bar:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    display: none;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 25%;
    z-index: 100;
    padding: 0;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
    overflow-y: auto;
    background-color: var(--sidebar-bg);
    transition: transform 0.3s ease;
}

.sidebar-header h5 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.sidebar-header h5 a {
    color: var(--text-primary) !important;
}

.sidebar-header h5 a:hover {
    color: var(--link-hover) !important;
}

.sidebar .nav-link {
    font-weight: 500;
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.sidebar .nav-link:hover {
    color: var(--link-hover);
    background-color: rgba(0, 0, 0, 0.025);
}

.sidebar .nav-link.active {
    color: var(--link-color);
    background-color: var(--active-bg);
    border-left-color: var(--link-color);
}

.sidebar .nav-link span {
    display: inline-block;
}

.nav-divider {
    border-bottom: 1px solid var(--sidebar-border);
}

/* Main Content Area */
main {
    margin-top: 0;
    margin-left: 25%;
    width: 75%;
}

.content-wrapper {
    max-width: 1000px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.25;
}

h1 {
    font-size: 2.5rem;
    border-bottom: 2px solid var(--sidebar-border);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 2rem;
    border-bottom: 1px solid var(--sidebar-border);
    padding-bottom: 0.3rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

/* Links */
a {
    color: var(--link-color);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Blockquotes (Warnings) */
blockquote {
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-left: 4px solid var(--warning-border);
    background-color: var(--warning-bg);
    font-weight: 500;
}

blockquote p {
    margin-bottom: 0;
}

blockquote strong {
    color: #856404;
}

/* Lists */
ul, ol {
    padding-left: 2rem;
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.5rem;
}

/* Code */
code {
    padding: 0.2em 0.4em;
    font-size: 85%;
    background-color: rgba(27, 31, 35, 0.05);
    border-radius: 3px;
}

pre {
    padding: 1rem;
    background-color: #f6f8fa;
    border-radius: 6px;
    overflow-x: auto;
}

pre code {
    padding: 0;
    background-color: transparent;
}

/* Tables */
table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

table th,
table td {
    padding: 0.75rem;
    border: 1px solid var(--sidebar-border);
}

table thead th {
    background-color: var(--sidebar-bg);
    font-weight: 600;
}

table tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.025);
}

/* Footer */
.footer {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Post Styles */
.post-header {
    border-bottom: 1px solid var(--sidebar-border);
}

.post-title {
    margin-bottom: 0.5rem;
}

.post-meta {
    font-size: 0.9rem;
}

/* Responsive Design */

/* Large Desktops (1200px and up) */
@media (min-width: 1200px) {
    .content-wrapper {
        max-width: 1200px;
    }
}

/* Show toggle button and enable collapsible sidebar below 992px */
@media (max-width: 991.98px) {
    .mobile-header {
        display: flex;
    }

    .sidebar-toggle {
        display: flex;
    }

    .sidebar-overlay {
        display: block;
    }

    .sidebar {
        width: 280px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        top: 65px;
        height: calc(100% - 65px);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
    }

    main {
        margin-left: 0;
        width: 100%;
        padding-top: 5rem;
    }
}

/* Tablets and Small Desktops (768px to 991px) */
@media (max-width: 991.98px) and (min-width: 768px) {
    .sidebar .nav-link {
        font-size: 0.9rem;
        padding: 0.4rem 0.75rem;
    }

    .content-wrapper {
        max-width: 100%;
    }
}

/* Tablets (768px to 991px) - Adjust content */
@media (max-width: 991.98px) and (min-width: 768px) {
    h1 {
        font-size: 2.25rem;
    }

    h2 {
        font-size: 1.85rem;
    }

    blockquote {
        padding: 0.875rem 1.25rem;
    }
}

/* Mobile Devices (below 768px) */
@media (max-width: 767.98px) {
    body {
        font-size: 15px;
    }

    .sidebar {
        width: 260px;
    }

    .sidebar .position-sticky {
        position: relative !important;
    }

    .sidebar-header h5 {
        font-size: 1.1rem;
    }

    .sidebar-header p {
        font-size: 0.85rem;
    }

    .content-wrapper {
        max-width: 100%;
    }

    h1 {
        font-size: 1.85rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1.1rem;
    }

    blockquote {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    table {
        font-size: 0.9rem;
    }

    table th,
    table td {
        padding: 0.5rem;
    }
}

/* Small Mobile Devices (below 576px) */
@media (max-width: 575.98px) {
    body {
        font-size: 14px;
    }

    .sidebar .nav-link {
        padding: 0.4rem 0.75rem;
        font-size: 0.9rem;
    }

    h1 {
        font-size: 1.65rem;
    }

    h2 {
        font-size: 1.35rem;
    }

    h3 {
        font-size: 1.15rem;
    }

    blockquote {
        padding: 0.65rem 0.85rem;
        font-size: 0.9rem;
        margin: 1rem 0;
    }

    ul, ol {
        padding-left: 1.5rem;
    }

    pre {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
}

/* Landscape Mode for Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        position: relative;
        width: 100%;
        max-height: none;
    }

    main {
        margin-left: 0;
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .sidebar {
        display: none;
    }

    main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .content-wrapper {
        max-width: 100%;
    }

    a {
        text-decoration: underline;
    }

    .footer {
        border-top: 1px solid #000;
    }
}
