:root {
    /* Dark theme (default) */
    --primary-color: #8ab4f8; /* X.com’s soft blue */
    --primary-hover: #b8c7fa;
    --text-color: #d9d9d9;
    --background-color: #181818;
    --secondary-background: #252525;
    --border-color: #3a3a3a;
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-code: "Fira Code", monospace;
}

.theme-light {
    /* Light theme */
    --primary-color: #1da1f2; /* X.com’s brighter blue for light mode */
    --primary-hover: #55acee;
    --text-color: #333;
    --background-color: #f5f5f5; /* Light gray background */
    --secondary-background: #ffffff; /* White for cards and header */
    --border-color: #e0e0e0;
}

/* Reset and base styles */
body {
    font-family: var(--font-main);
    line-height: 1.6;
    color: var(--text-color);
    background: var(--background-color);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Single-column layout */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

/* Header */
.site-header {
    text-align: center;
    padding: 20px 0;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    position: relative;
}

.site-title {
    margin: 0;
    font-size: 1.8em;
    text-align: center;
}

.site-logo {
    margin: 0;
    text-align: center;
}

.site-description {
    margin: 10px 0 0;
    text-align: center;
}

/* Hamburger menu */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 3px;
    background: var(--text-color);
    margin: 5px 0;
    transition: all 0.3s ease;
}

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

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

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

/* Top navigation */
.main-navigation {
    width: 100%;
    background: var(--secondary-background);
    text-align: center;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.main-navigation.hide {
    transform: translateY(-100%);
}

.menu-container {
    transition: transform 0.3s ease;
    margin: 0 auto;
    max-width: 100%;
}

.main-navigation ul {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 10px 0;
    list-style: none;
}

.main-navigation li {
    margin: 0 10px;
}

.main-navigation a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 1em;
    transition: color 0.2s ease;
}

.main-navigation a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Theme toggle button */
.theme-toggle-wrapper {
    display: inline-flex;
    align-items: center;
    margin: 0 10px;
}

.theme-toggle {
    background: var(--secondary-background);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.theme-toggle .theme-icon {
    width: 16px;
    height: 16px;
    transition: fill 0.2s ease;
}

/* Posts */
.post {
    margin-bottom: 40px;
    background: var(--secondary-background);
    padding: 20px;
    border-radius: 8px;
}

.post-title {
    font-size: 1.8em;
    margin: 0 0 10px;
}

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

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

.post-meta {
    color: #dddddd;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.theme-light .post-meta {
    color: #222222;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.post-content {
    font-size: 1.1em;
}

.post-content a {
    color: var(--primary-color);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.post-content a:hover {
    text-decoration: underline;
    color: var(--primary-hover);
}

/* Featured image */
.post-featured-image {
    width: 100%;
    height: auto;
    object-fit: cover; /* Use cover for desktop to fill container */
    max-height: 400px; /* Limit height to prevent overly tall images */
    opacity: 0.8;
    margin-bottom: 20px;
    border-radius: 8px;
    display: block;
    aspect-ratio: 16 / 9; /* Set consistent aspect ratio to prevent CLS */
}

/* Comments Section */
.comments-area {
    margin-top: 2rem;
    padding: 20px;
    background: var(--secondary-background); /* Use secondary-background for consistency */
    border-radius: 8px;
    position: relative;
    box-sizing: border-box;
}

.theme-light .comments-area {
    background: var(--secondary-background);
}

/* Retaining the top border as a design element */
.comments-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    border-radius: 2px 2px 0 0;
}

.comments-title {
    font-size: 1.5em;
    color: var(--text-color);
    margin: 0.5rem 0 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color); /* Add a subtle separator */
}

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

.comment {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--secondary-background); /* Use secondary-background for consistency */
    border: 1px solid var(--border-color); /* Keep border around individual comments */
    border-radius: 8px;
    transition: box-shadow 0.3s ease, border-color 0.3s ease; /* Add transition for border */
}

.theme-light .comment {
    background: var(--secondary-background);
}

article.comment {
	margin-bottom: 0.2rem;
}

li.comment.even.depth-2 {
	margin-bottom: 0rem;
}

.comment:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); /* Slightly more prominent shadow on hover */
    border-color: var(--primary-color); /* Highlight border on hover */
}

.comment-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.comment-author {
    display: flex;
    align-items: center;
    font-weight: bold;
    color: var(--text-color);
}

.comment-author .avatar {
    border-radius: 50%;
    margin-right: 0.75rem;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color); /* Subtle border for avatar */
}

.comment-author-name {
    margin-right: 0.5rem;
	font-style: normal;
}

.comment-author .fn {
    color: var(--primary-color);
    text-decoration: none;
}

.comment-author .fn:hover {
    color: var(--primary-hover);
    text-decoration: underline; /* Add underline on hover for names */
}

.comment-metadata .timestamp {
    font-size: 0.9em;
    color: #a0a0a0;
}

.theme-light .comment-metadata .timestamp {
    color: #666;
}

.comment-metadata a {
    color: inherit;
    text-decoration: none;
}

.comment-metadata a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.comment-content {
    color: var(--text-color);
    font-size: 1em;
    line-height: 1.6;
}

.comment-content p {
    margin: 0 0 0.5rem;
}

.comment-content a {
    color: var(--primary-color);
    text-decoration: underline; /* Ensure links in content are underlined */
}

.comment-awaiting-moderation {
    font-style: italic;
    color: #a0a0a0;
}

.theme-light .comment-awaiting-moderation {
    color: #666;
}

.comment-actions {
    display: flex;
    gap: 1rem;
    font-size: 0.9em;
    margin-top: 0.5rem; /* Add some space above actions */
}

.comment-actions a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.comment-actions a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Comment Form */
.comment-respond {
    margin-top: 2.5rem; /* Increased margin for better separation */
    padding: 20px; /* Consistent padding */
    background: var(--secondary-background); /* Use secondary-background for consistency */
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.theme-light .comment-respond {
    background: var(--secondary-background);
}

/* Retaining the top border as a design element */
.comment-respond::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    border-radius: 2px 2px 0 0;
}

.comment-reply-title {
    font-size: 1.4em; /* Slightly larger title for form */
    color: var(--text-color);
    margin: 0 0 1rem; /* More space below title */
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color); /* Separator for form title */
}

.comment-form p {
    margin-bottom: 0.3rem; /* Return to original compact margin */
    padding: 0; /* Ensure no padding */
}

.comment-form input,
.comment-form textarea {
    width: 100%;
    max-width: 100%;
    padding: 0.3rem; /* Return to original compact padding */
    margin-bottom: 0.3rem; /* Return to original compact margin */
    background: color-mix(in srgb, #252525 80%, #303030); /* Kept original compact background */
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
    font-family: var(--font-main);
    font-size: 0.8em; /* Return to original compact font-size */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.theme-light .comment-form input,
.theme-light .comment-form textarea {
    background: color-mix(in srgb, #ffffff 80%, #f0f0f0);
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2); /* Subtle focus ring */
}

.comment-form textarea {
    resize: vertical;
    min-height: 60px; /* Return to original compact min-height */
}

.comment-form-author-email {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem; /* Return to original compact gap */
    margin-bottom: 0.3rem; /* Return to original compact margin */
}

.comment-form-author,
.comment-form-email {
    flex: 1;
    min-width: 100px; /* Return to original min-width */
}

.comment-form-url {
    margin-bottom: 0.3rem; /* Return to original compact margin */
}

.comment-form .form-submit {
    margin-bottom: 0; /* Return to original margin */
    margin-top: 1rem; /* Added a small top margin for separation */
}

.comment-form .submit-button {
    background: var(--primary-color); /* Use primary color for button background */
    color: #000000;
    border: none;
    padding: 12px 25px; /* More generous padding */
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s ease, transform 0.1s ease;
    width: 100%;
    font-family: var(--font-main);
    font-size: 1em; /* Larger font size for button */
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-light .comment-form .submit-button {
    background: var(--primary-color);
    color: #ffffff;
}

.comment-form .submit-button:hover {
    background: var(--primary-hover); /* Lighter hover state */
}

.theme-light .comment-form .submit-button:hover {
    background: var(--primary-hover);
}

.comment-form .submit-button:active {
    transform: translateY(1px);
}

.comment-form .submit-button:focus {
    outline: 2px solid var(--primary-hover); /* Focus outline with primary hover color */
    outline-offset: 3px;
}

/* Pagination for comments */
.comment-navigation {
    margin-top: 1.5rem;
    text-align: center;
}

.page-numbers {
    display: inline-block;
    padding: 0.5rem 0.8rem;
    margin: 0 0.2rem;
    background-color: var(--secondary-background);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.page-numbers.current,
.page-numbers:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}


/* General links */
a {
    color: var(--primary-color);
    text-decoration: underline;
}

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

.site-title a {
    text-decoration: none;
}

.site-title a:hover {
    text-decoration: none;
}

.post-title {
    text-decoration: none;
}

.post-title a:hover {
    text-decoration: none;
}

/* Responsive design */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    .site-title {
        font-size: 1.5em;
    }

    .hamburger {
        display: block;
    }

    .main-navigation {
        position: relative;
        background: transparent;
        width: 100%;
    }

    .menu-container {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--secondary-background);
        transform: translateX(-100%);
        z-index: 1000;
    }

    .menu-container.active {
        display: block;
        transform: translateX(0);
    }

    .main-navigation ul {
        flex-direction: column;
        align-items: stretch;
        padding: 0;
        margin: 8px 0;
    }

    .main-navigation li {
        margin: 0;
        padding: 0;
        width: 100%;
        text-align: center;
    }

    .main-navigation a {
        display: block;
        padding: 8px 0;
        font-size: 1.1em;
        white-space: nowrap;
        line-height: 0.5em;
    }

    .theme-toggle-wrapper {
        display: block;
        position: absolute;
        top: 50%;
        right: 20px;
        transform: translateY(-50%);
        margin: 0;
        padding: 0;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
        padding: 10px;
    }

    .theme-toggle .theme-icon {
        width: 20px;
        height: 20px;
    }

    .post-featured-image {
        object-fit: contain; /* Use contain for mobile to prevent cropping */
        max-height: 50vh;
        min-height: 200px;
        aspect-ratio: 16 / 9; /* Maintain consistent aspect ratio on mobile */
    }

    .comments-area,
    .comment-respond {
        padding: 1rem;
    }

    .comments-title {
        font-size: 1.3em;
    }

    .comment {
        padding: 0.75rem;
    }

    .comment-author .avatar {
        width: 32px;
        height: 32px;
    }

    .comment-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .comment-form-author-email {
        flex-direction: column;
        gap: 0.3rem; /* Adjusted for mobile */
    }

    .comment-form-author,
    .comment-form-email {
        min-width: 100%;
    }

    .comment-form input,
    .comment-form textarea {
        font-size: 0.75em; /* Slightly smaller font for mobile inputs */
        padding: 0.6rem;
    }

    .comment-form textarea {
        min-height: 80px; /* Adjusted minimum height for mobile */
    }

    .comment-form .submit-button {
        padding: 8px 16px;
        font-size: 0.85em;
    }
}

.comment-form-comment {
    margin: 0;
    padding: 0;
}

.comment-form-author {
    margin: 0;
    padding: 0;
}

.comment-form-email {
    margin: 0;
    padding: 0;
}

.comment-form-url {
    margin: 0;
    padding: 0;
}

.taxonomy-description {
    background: var(--secondary-background);
    padding: 1px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary-color);
}
