/* Base resets and variables */
:root {
    /* Default (Light Mode) */
    --bg-color: #ffffff;
    --text-color: #111111;
    --link-color: #005bb5;
    --meta-color: #666666;
    --font-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

/* System Default (Dark Mode) - applied automatically if the user's OS is dark */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-color: #1a1a1a; 
        --text-color: #e4e4e4;
        --link-color: #66b3ff;
        --meta-color: #a0a0a0;
    }
}

/* Explicit Dark Mode - applied when toggled ON manually */
:root[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e4e4e4;
    --link-color: #66b3ff;
    --meta-color: #a0a0a0;
}

/* Explicit Light Mode - applied when toggled OFF manually while OS is dark */
:root[data-theme="light"] {
    --bg-color: #ffffff;
    --text-color: #111111;
    --link-color: #005bb5;
    --meta-color: #666666;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-system);
    line-height: 1.6;
    font-size: 18px;
    margin: 0;
    padding: 0;
}

/* Layout */
.site-wrapper {
    max-width: 650px; 
    margin: 0 auto;
    padding: 2rem 1rem;
}

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

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

a:hover {
    text-decoration: underline;
}

/* Header */
.site-header {
    border-bottom: 2px solid var(--text-color);
    padding-bottom: 1rem;
    margin-bottom: 3rem;
}

.site-title {
    font-size: 2rem;
    margin: 0 0 0.5rem 0;
}

.site-title a {
    color: var(--text-color);
}

.site-description {
    color: var(--meta-color);
    margin: 0 0 1rem 0;
    font-size: 1rem;
}

.site-nav {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--text-color); /* Makes the SVG inherit your text color */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.theme-toggle:hover {
    color: var(--link-color);
}

/* SVG Theme Icon Logic */
.icon-moon {
    display: none; /* Hidden in light mode by default */
}

/* When explicitly in dark mode, hide sun, show moon */
:root[data-theme="dark"] .icon-sun {
    display: none;
}
:root[data-theme="dark"] .icon-moon {
    display: block;
}

/* When system is in dark mode (and no explicit light override), hide sun, show moon */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .icon-sun {
        display: none;
    }
    :root:not([data-theme="light"]) .icon-moon {
        display: block;
    }
}

/* Posts */
.post-card {
    margin-bottom: 4rem;
}

.post-header {
    margin-bottom: 1.5rem;
}

.post-date {
    display: block;
    color: var(--meta-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.post-title {
    margin: 0;
    font-size: 1.5rem;
}

.post-content p {
    margin-bottom: 1.5rem;
}

.post-content blockquote {
    border-left: 4px solid var(--meta-color);
    margin: 1.5rem 0;
    padding-left: 1rem;
    color: var(--meta-color);
    font-style: italic;
}

/* Linked List Permalink Styling */
.permalink {
    color: var(--meta-color);
    font-weight: 400;
    font-size: 0.9em;
    margin-left: 0.5rem;
    text-decoration: none;
    display: inline-block;
}

.permalink:hover {
    color: var(--link-color);
    text-decoration: none;
}

/* Navigation Styling (Strips bullets and makes horizontal) */
.nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between; /* This pushes the nav left and the button right */
    margin-top: 1rem;
}

/* Footer Layout */
.site-footer {
    border-top: 1px solid var(--meta-color);
    margin-top: 4rem;
    padding-top: 2rem;
    font-size: 0.85rem;
    color: var(--meta-color);
    display: flex;
    justify-content: space-between; /* Pushes copyright left, socials right */
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Secondary Nav Styling */
.footer-social-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.footer-social-nav .nav {
    gap: 1rem;
}

.footer-social-nav .nav a,
.rss-link {
    color: var(--meta-color);
    display: flex;
    align-items: center;
    transition: color 0.2s ease;
}

.footer-social-nav .nav a:hover,
.rss-link:hover {
    color: var(--link-color);
}

/* Ghost Koenig Editor formatting classes */
.kg-width-wide {
    width: 100%;
    max-width: 800px; /* Allows image to be slightly wider than the 650px text column */
    margin: 2rem auto;
}

.kg-width-full {
    width: 100vw;
    max-width: 100vw;
    margin: 2rem calc(50% - 50vw); /* Forces the image to break out of the container to the screen edges */
}

/* Ensure standard images within posts are responsive */
figure.kg-card {
    margin: 2rem 0;
}

figure.kg-card img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Page Feature Image */
.page-feature-image {
    margin: 2rem 0;
}
.page-feature-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Author Bio Styling */
.post-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--meta-color);
}

.author-bio {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.author-profile-image {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
}

.author-details {
    flex: 1;
}

.author-name {
    margin: 0 0 0.25rem 0;
    font-size: 1.2rem;
}

.author-description {
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
    color: var(--meta-color);
    line-height: 1.4;
}

.author-links {
    font-size: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Ensure the links inherit the meta color until hovered */
.author-links a {
    color: var(--meta-color);
}

.author-links a:hover {
    color: var(--link-color);
}

/* Mobile responsiveness for the author bio */
@media (max-width: 500px) {
    .author-bio {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* 404 Error Page */
.error-wrapper {
    text-align: center;
    padding: 6rem 1rem;
}

.error-code {
    font-size: 5rem;
    margin: 0 0 1rem 0;
    line-height: 1;
    color: var(--meta-color);
    letter-spacing: -0.05em;
}

.error-message {
    font-size: 1.2rem;
    margin: 0 0 2rem 0;
    color: var(--text-color);
}

.error-link {
    font-weight: 600;
    text-decoration: none;
    color: var(--link-color);
}

.error-link:hover {
    text-decoration: underline;
}