/* ===== BASE STYLES ===== */
:root {
    color-scheme: dark;
    --background-color: #1a1a1a;
    --nav-background: #1a1a1a;
    --text-color: #fff;
    --accent-color: #333;
    --search-bg: #222;
    --search-input-bg: #333;
    --search-button-bg: #555;
}

/* Theme variations */
[data-theme="light"] {
    --background-color: #f5f5f5;
    --nav-background: #f5f5f5;
    --text-color: #333;
    --accent-color: #ddd;
    --search-bg: #e0e0e0;
    --search-input-bg: #fff;
    --search-button-bg: #ccc;
    color-scheme: light;
}

/* Basic reset and typography */
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: system-ui, sans-serif;
    line-height: 1.5;
    font-size: 1em;
    background-color: var(--background-color);
    word-break: break-word;
    color: var(--text-color);
}

/* ===== LAYOUT CONTAINERS ===== */
main {
    max-width: 90ch;
    margin: 2em auto 0;
    padding: 0 1em;
    box-sizing: border-box;
    flex-grow: 1;
    word-wrap: break-word;
}

footer {
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    background-color: rgba(17, 17, 17, 0.1);
    margin-top: 2em;
    padding: 1.5em 1em;
    border-top: 1px solid var(--accent-color);
}

.footer-content {
    max-width: 90ch;
    margin: 0 auto;
}

.footer-content p {
    margin: 0 0 0.75em;
    opacity: 0.8;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25em;
}

.footer-links a {
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.85;
}

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

/* ===== ACCESSIBILITY ===== */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 1100;
    padding: 0.75em 1.25em;
    background-color: var(--search-input-bg);
    color: var(--text-color);
    text-decoration: none;
    border: 1px solid var(--accent-color);
    border-radius: 0 0 4px 0;
}

.skip-link:focus {
    left: 0;
}

.rss-link {
    display: inline-flex;
    align-items: center;
}

:focus-visible {
    outline: 2px solid var(--text-color);
    outline-offset: 2px;
}

/* ===== ERROR PAGES ===== */
.error-page {
    text-align: center;
    padding: 3em 1em;
}

.error-page h1 {
    font-size: 5rem;
    margin: 0 0 0.25em;
    text-decoration: none;
}

.error-page p {
    margin: 0 auto 1.5em;
    max-width: 50ch;
    opacity: 0.9;
}

/* ===== NAVIGATION ===== */
header {
    background-color: var(--nav-background);
    border-bottom: 1px solid var(--accent-color);
    width: 100%;
    padding: 0.5em 0;
    color: var(--text-color);
    box-sizing: border-box;
}

.navbar {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 1rem;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.nav-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
}

.nav-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: #ccc;
    text-decoration: underline;
}

/* Hamburger menu */
.hamburger-container {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background-color: transparent;
}

.hamburger {
    display: none;
    cursor: pointer;
    background: none;
    border: 0;
    padding: 0;
}

.bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: var(--text-color);
    transition: all 0.3s ease;
}

/* ===== SEARCH FORM ===== */
#search-form {
    display: flex;
    align-items: center;
    background-color: var(--search-bg);
    border-radius: 4px;
    overflow: hidden;
}

#search-form input[type="text"] {
    background-color: var(--search-input-bg);
    color: var(--text-color);
    border: none;
    padding: 0.5em 1em;
    width: 180px;
    transition: width 0.3s ease;
}

#search-form input[type="text"]:focus {
    width: 200px;
    outline: none;
}

#search-form button {
    background-color: var(--search-button-bg);
    color: var(--text-color);
    border: none;
    padding: 0.5em 1em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#search-form button svg {
    width: 16px;
    height: 16px;
}

/* ===== TYPOGRAPHY ===== */
h1 {
    text-decoration: underline;
}

/* ===== POST STYLES ===== */
.post-list h2 {
    margin: 0;
}

.post-list a,
.post-item-header a,
.post-description a {
    color: var(--text-color);
    text-decoration: none;
}

.post-item-header a:hover,
.post-description a:hover {
    text-decoration: underline;
}

.post-description p {
    margin: 0.5em 0;
}

/* ===== COMMENTS ===== */
.comments {
    margin-top: 2em;
    padding: 1em;
    background-color: var(--search-bg);
    border-radius: 8px;
}

.comments h2 {
    margin-top: 0;
    font-size: 1.5em;
    color: var(--text-color);
}

.comment {
    margin-top: 1em;
    padding: 1em;
    background-color: var(--search-input-bg);
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    color: var(--text-color);
}

.comment p {
    margin: 0.5em 0;
    font-size: 0.95em;
    line-height: 1.4;
}

.comment strong {
    color: var(--text-color);
}

.subcomments {
    margin-top: 1em;
    padding-left: 1em;
    border-left: 2px solid rgba(255, 255, 255, 0.5);
}

.subcomment {
    margin-top: 1em;
    padding: 0.5em;
    background-color: var(--search-button-bg);
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    color: var(--text-color);
}

.subcomment p {
    margin: 0.4em 0;
    font-size: 0.9em;
    line-height: 1.4;
}

.subcomment strong {
    color: var(--text-color);
}

/* ===== AUTHOR LIST ===== */
.author-list {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
    padding: 10px;
    border-radius: 8px;
}

.author-item {
    flex: 1 1 calc(33.333% - 40px);
    padding: 15px;
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease-in-out;
    background-color: var(--search-bg);
}

.author-item:hover {
    transform: translateY(-5px);
}

.author-item h3 {
    margin: 0 0 10px;
    font-size: 1.2em;
}

.author-item a {
    text-decoration: none;
    color: var(--text-color);
}

text-decoration: none;
}

.author-item a:hover {
    text-decoration: underline;
}

.author-list p {
    width: 100%;
    text-align: center;
    font-size: 1.2em;
}

/* ===== PAGINATION ===== */
.pagination {
    text-align: right;
    margin: 20px 0;
}

.step-links {
    display: inline-block;
}

.pagination a {
    margin: 0 5px;
    text-decoration: none;
    color: var(--text-color);
}

.pagination a:hover {
    text-decoration: underline;
}

.pagination .current {
    margin: 0 5px;
    font-weight: bold;
}

/* ===== POST NAVIGATION ===== */
.post-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1em;
    margin: 1.5em 0;
}

.post-navigation a {
    color: var(--text-color);
    text-decoration: none;
}

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

.post-nav-prev,
.post-nav-next {
    flex: 1 1 0;
    min-width: 0;
}

.post-nav-next {
    text-align: right;
}

.post-nav-all {
    flex: 0 0 auto;
    text-align: center;
    opacity: 0.8;
}

@media (max-width: 768px) {
    .post-navigation {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
    }

    .post-nav-next {
        text-align: left;
    }
}

.padded-bottom {
    padding-bottom: 1em;
}

/* ===== RESPONSIVE STYLES ===== */
@media (max-width: 768px) {

    /* Show hamburger menu on mobile */
    .hamburger {
        display: block;
        z-index: 1000;
    }

    /* Hamburger animation */
    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

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

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

    /* Mobile navigation menu */
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 0;
        flex-direction: column;
        background-color: var(--nav-background);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
        padding: 3rem 0 1rem;
        z-index: 999;
        border-bottom: 1px solid var(--accent-color);
    }

    .nav-menu.active {
        left: 0;
    }

    /* Mobile navigation links */
    .nav-links {
        flex-direction: column;
        width: 100%;
    }

    .nav-link {
        padding: 0.5rem 0;
        display: block;
    }

    /* Mobile search form */
    .home-search {
        width: 100%;
        padding: 0 1rem;
        margin-top: 1rem;
    }

    #search-form {
        width: 100%;
    }

    #search-form input[type="text"] {
        width: 100%;
    }

    /* Author items on mobile */
    .author-item {
        flex: 1 1 100%;
    }
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.theme-toggle:hover {
    transform: rotate(30deg);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

/* Enhanced Team Member Styling */
.author-link {
    display: block;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.2s ease;
}

.author-link:hover {
    transform: translateY(-5px);
    text-decoration: none;
}

.author-name {
    font-size: 1.4em;
    font-weight: 700;
    margin-bottom: 0.3em;
    color: var(--text-color);
}

.author-job-title {
    font-size: 0.9em;
    color: #888;
    font-style: italic;
}

.author-item {
    transition: box-shadow 0.3s ease;
}

.author-item:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Table of Contents Styling */
.table-of-contents {
    background-color: var(--search-bg);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-left: 4px solid var(--accent-color);
    position: static;
    /* Prevent stickiness */
}

.table-of-contents h2 {
    margin-top: 0;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

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

.toc-item {
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.toc-item a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.toc-item a:hover {
    text-decoration: underline;
}

.toc-level-1 {
    font-weight: bold;
}

.toc-level-2 {
    padding-left: 1.5rem;
    font-size: 0.95em;
}

.toc-level-3 {
    padding-left: 3rem;
    font-size: 0.9em;
    color: var(--text-color);
    opacity: 0.8;
}

/* Post content styling */
.post-content {
    line-height: 1.6;
}

.post-content h1,
.post-content h2,
.post-content h3 {
    margin-top: 2rem;
    scroll-margin-top: 2rem;
    /* For smooth scrolling to anchors */
}

.post-content h1 {
    font-size: 1.8rem;
}

.post-content h2 {
    font-size: 1.5rem;
}

.post-content h3 {
    font-size: 1.3rem;
}

/* Permalink style */
.headerlink {
    opacity: 0;
    font-size: 0.8em;
    margin-left: 0.5em;
    transition: opacity 0.2s ease;
}

.post-content h1:hover .headerlink,
.post-content h2:hover .headerlink,
.post-content h3:hover .headerlink {
    opacity: 0.5;
}

.post-content h1 .headerlink:hover,
.post-content h2 .headerlink:hover,
.post-content h3 .headerlink:hover {
    opacity: 1;
}

/* Active TOC item */
.active-toc-item {
    color: #4a9eff !important;
    font-weight: bold;
}

/* Make TOC sticky on larger screens */
@media (min-width: 992px) {
    .table-of-contents {
        position: static;
        /* Override sticky positioning */
        max-height: none;
        /* Remove max height */
        overflow-y: visible;
        /* Remove scroll */
    }
}
