/* Fonts */
body {
    font-family: sans-serif;
}
code {
    font-family: "Lucida Console", Monaco, monospace;
    font-size: 85%;
}

/* Light Theme */
body.light-theme {
    background-color: #f8f9fa;
    color: #343a40;
}
body.light-theme main * {
    background: #f8f9fa;
    color: #343a40;
}
body.light-theme .article-meta {
    color: #495057;
}
body.light-theme a {
    color: #007bff;
}
body.light-theme code,
body.light-theme pre,
body.light-theme blockquote,
body.light-theme table thead,
body.light-theme table tfoot,
body.light-theme table tr:nth-child(even) {
    background: #e9ecef;
    color: #343a40;
}
body.light-theme pre {
    border: 1px solid #dee2e6;
    box-shadow: none;
}
body.light-theme blockquote {
    border-left: 5px solid #adb5bd;
}
body.light-theme hr {
    border-color: #dee2e6;
}
body.light-theme .menu button {
    background: #e9ecef;
    color: #343a40;
    border: 1px solid #ced4da;
}
body.light-theme #checkbox-description {
    color: #007bff;
    background: #e9ecef;
    border: 1px solid #ced4da;
}

/* Dark Theme (Default) */
body {
    max-width: 800px;
    margin: 40px auto;
    padding: 2em;
    line-height: 1.6;
    background-color: #212529;
    color: #dee2e6;
}

a {
    color: #bb86fc;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* Header, Navigation */
.nav-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5em 1em;
    position: sticky;
    top: 0;
    background-color: #212529;
    z-index: 1000;
    transition: top 0.3s;
}
body.light-theme .nav-top {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

/* Hamburger Button */
.hamburger-button {
    display: none;
    background: none;
    border: none;
    font-size: 1.4em;
    cursor: pointer;
    color: #dee2e6;
    padding: 0.2em 0.5em;
}
body.light-theme .hamburger-button {
    color: #343a40;
}

/* Navigation Links */
.nav-links {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-item {
    display: inline-block;
}
.menu-item a {
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 5px;
    transition: background-color 0.2s ease;
    background-color: #343a40;
    color: #dee2e6;
}
.menu-item a:hover {
    background-color: #495057;
    text-decoration: none;
}
body.light-theme .menu-item a {
    background-color: #e9ecef;
    color: #343a40;
}
body.light-theme .menu-item a:hover {
    background-color: #ced4da;
}

/* Theme Toggle */
.theme-toggle label {
    display: inline-block;
    text-decoration: none;
    background: #343a40;
    border: 1px solid #6c757d;
    padding: 6px 10px;
    color: #dee2e6;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-radius: 5px;
    font-size: 0.9em;
}
.theme-toggle label:hover {
    background-color: #495057;
    color: #f8f9fa;
}
body.light-theme .theme-toggle label {
    background: #e9ecef;
    color: #343a40;
    border: 1px solid #adb5bd;
}
body.light-theme .theme-toggle label:hover {
    background-color: #ced4da;
    color: #212529;
}
.theme-toggle input[type="checkbox"] {
    display: none;
}

/* Content */
.article-meta {
    margin: 1.5em 0;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 0.9em;
    text-align: center;
    color: #adb5bd;
}

.title {
    font-size: 1.8em;
    margin-bottom: 0.5em;
    color: #f8f9fa;
}
body.light-theme .title {
    color: #212529;
}

main {
    hyphens: auto;
}

/* Buttons (Back buttons, etc.) */
button {
    background: #343a40;
    border: 1px solid #6c757d;
    padding: 6px 10px;
    color: #dee2e6;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    border-radius: 5px;
    font-size: 0.9em;
    font-family: inherit;
}
button:hover {
    background-color: #495057;
    color: #f8f9fa;
    transform: scale(1.05);
    box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.3);
}
body.light-theme button {
    background: #f8f9fa;
    color: #007bff;
    border: 1px solid #dee2e6;
}
body.light-theme button:hover {
    background-color: #e9ecef;
    color: #0056b3;
    box-shadow: 0 0 8px 3px rgba(108, 117, 125, 0.15);
}

/* Footer */
footer {
    margin-top: 3em;
    padding-top: 1.5em;
    border-top: 1px solid #495057;
    font-size: 0.9em;
    color: #adb5bd;
    text-align: center;
}
body.light-theme footer {
    border-top: 1px solid #dee2e6;
    color: #6c757d;
}
footer a {
    color: inherit;
}
footer a:hover {
    color: #bb86fc;
}
body.light-theme footer a:hover {
    color: #007bff;
}

/* Code Blocks */
pre {
    border: 1px solid #495057;
    box-shadow: none;
    padding: 1.2em;
    overflow-x: auto;
    border-radius: 5px;
    background-color: #2c3034;
    margin: 1.5em 0;
}
pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}
code {
    background-color: rgba(110, 118, 129, 0.2);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 85%;
}

/* Blockquotes */
blockquote {
    background: #2c3034;
    border-left: 5px solid #bb86fc;
    padding: 1em 1.5em;
    margin: 1.5em 0;
    color: #ced4da;
    font-style: italic;
}

/* Tables */
table {
    width: 100%;
    margin: 1.5em 0;
    border-collapse: collapse;
    border: 1px solid #495057;
}
table thead th {
    border-bottom: 2px solid #6c757d;
    background-color: #343a40;
    color: #f8f9fa;
    text-align: left;
}
th, td {
    padding: 10px 12px;
    border: 1px solid #495057;
    text-align: left;
}
tr:nth-child(even) {
    background-color: #2c3034;
}
thead, tfoot {
    background: none;
}

/* Large screens */
@media (min-width: 1000px) {
    body {
        max-width: 1000px;
    }
}

/* Desktop Navigation Alignment */
@media (min-width: 769px) {
    .nav-top {
        justify-content: center;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding: 1em;
        margin: 20px auto;
    }
    .hamburger-button {
        display: block;
    }
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #2c3034;
        flex-direction: column;
        align-items: center;
        padding: 1em 0;
        border-bottom: 1px solid #495057;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        gap: 10px;
    }
    body.light-theme .nav-links {
        background-color: #f8f9fa;
        border-bottom: 1px solid #dee2e6;
    }
    .nav-links.active {
        display: flex;
    }
    .menu-item {
        width: 100%;
        text-align: center;
    }
    .menu-item a {
        display: block;
        padding: 10px 15px;
        background-color: transparent;
        color: #dee2e6;
    }
    body.light-theme .menu-item a {
        background-color: transparent;
        color: #343a40;
    }
    .menu-item a:hover {
        background-color: #495057;
    }
    body.light-theme .menu-item a:hover {
        background-color: #e9ecef;
    }
    .theme-toggle {
        margin-top: 10px;
        width: auto;
    }
    .title {
        font-size: 1.5em;
    }
    pre, blockquote, table {
        margin: 1em 0;
    }
    th, td {
        padding: 8px 10px;
    }
    h1 { font-size: 1.6em; }
    h2 { font-size: 1.4em; }
    h3 { font-size: 1.2em; }
}
