:root {
    --bg: #eee; 
    --fg: #111; 
    --meta: #2c2c2c; 
    --preview: #424242;
    --link: #34495e;
    --link-active: #1abc9c;
    --header: #066451;
    --green-text-shadow: 0 0 20px #29f2ca82;
}

@media (prefers-color-scheme: dark) {
    :root:not(.light) {
        --bg: #111; 
        --fg: #eee; 
        --meta: #cccccc; 
        --preview: #bdbdbd;
        --link-active: #34495e;
        --link: #1abc9c;
        --header: #00d1a7;
        --green-text-shadow: 0 0 20px #20ab8f82;
    }
}

html.dark {
    --bg: #111; 
    --fg: #eee; 
    --meta: #cccccc; 
    --preview: #bdbdbd;
    --link-active: #34495e;
    --link: #1abc9c;
    --header: #00d1a7;
    --green-text-shadow: 0 0 20px #20ab8f82;
}

html.light {
    --bg: #eee; 
    --fg: #111; 
    --meta: #2c2c2c; 
    --preview: #424242;
    --link: #34495e;
    --link-active: #1abc9c;
    --header: #066451;
    --green-text-shadow: 0 0 20px #29f2ca82;
}

body {
    font-family: monospace;
    font-size: 9.5pt;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.5;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Typography Extensions */
h1, h2, h3, h4, h5, h6 {
    color: var(--fg);
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: bold;
    overflow-wrap: break-word;
    word-break: break-word;
}
h1 { font-size: 1.9em; }
h2 { font-size: 1.6em; }
h3 { font-size: 1.3em; }

p {
    margin-bottom: 1em;
    overflow-wrap: break-word;
}

/* Links Customization */
a {
    color: var(--link);
    text-decoration: none;
    border-bottom: 1px dashed transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
    overflow-wrap: break-word;
    word-break: break-all;
}

a:hover {
    color: var(--link-active);
    border-bottom: 1px dotted var(--link-active);
}

a:active {
    color: var(--link-active);
}

a[href^="http"]:not([href*="localhost"])::after {
    content: " ↗";
    font-size: 0.8em;
    opacity: 0.7;
}

/* List Customization */
ul, ol {
    margin-bottom: 1em;
    padding-left: 20px;
}

li {
    margin-bottom: 0.4em;
}

ul {
    list-style-type: square;
}

ol {
    list-style-type: decimal;
}

ul ul, ol ol, ul ol, ol ul {
    margin-top: 0.4em;
    margin-bottom: 0;
}

/* Inline Code & Code Blocks */
code {
    font-family: monospace;
    background: var(--meta);
    color: var(--bg);
    padding: 2px 4px;
    font-size: 0.9em;
    overflow-wrap: break-word;
    word-break: break-word;
}

pre {
    background: var(--meta);
    color: var(--bg);
    padding: 10px;
    overflow-x: auto;
    margin-bottom: 15px;
    border: 1px solid var(--preview);
    max-width: 100%;
    white-space: pre;
    word-wrap: normal;
}

pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: inherit;
    overflow-wrap: normal;
    word-break: normal;
}

/* Blockquotes */
blockquote {
    border-left: 3px solid var(--link);
    padding-left: 12px;
    margin: 15px 0;
    color: var(--preview);
    font-style: italic;
}

/* Tables & Mobile Responsiveness */
.table-container {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 15px;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 6px 8px;
    text-align: left;
    border: 1px solid var(--preview);
}

th {
    background: var(--meta);
    color: var(--bg);
}

hr {
    margin: 15px 0;
    border: 0;
    border-bottom: 1px dashed var(--preview);
}

footer {
    text-align: center;
    color: var(--bg);
    background-color: var(--fg);
    height: 40px;
    padding: 10px;
}

/* Base Structural Layout Containers */
.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.image-wrapper {
    display: block;
    margin: 20px 0;
    padding: 5px;
    background: var(--bg);
}

.image-wrapper img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
}

.image-wrapper .caption {
    display: block;
    font-size: 0.9em;
    color: var(--meta);
    margin-top: 6px;
    padding: 0 4px;
    border-top: 1px dashed var(--preview);
    padding-top: 4px;
}

.navbar {
    margin: 15px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    border: 1px solid var(--preview);
}

.nav-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 0;
    padding: 0;
    list-style-type: none;
}

.nav-menu li {
    margin-bottom: 0;
    list-style-type: none;
}

.nav-link {
    display: block;
    color: var(--fg);
    text-decoration: none;
    font-size: 13px;
    padding: 2px 5px;
    transition: background-color 0.3s ease;
}

.nav-link:hover {
    background-color: var(--link-active);
    border-bottom: none;
    color: var(--link);
}

.welcome-header {
    font-size: 2rem;
    font-weight: bolder;
    color: var(--header);
    letter-spacing: -1px;
    word-spacing: -0.4ch;
    text-shadow: var(--green-text-shadow);
}

.sidebar-scroll {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    
    /* Adds a tiny bit of breathing room inside the scrolling boundary */
    padding-right: 5px; 
    
    /* Standard browser scrollbar hint */
    scrollbar-width: thin; 
}

/* Base Layout (Mobile first: stacked vertically) */
.main-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.sidebar {
    width: 100%;
    padding: 15px;
    border: 1px dashed var(--preview);
}

.sidebar-menu {
    list-style-type: none;
    padding-left: 0;
}

.content-area {
    width: 100%;
}

.sidebar-scroll a[href^="http"]:not([href*="localhost"])::after {
    text-decoration: none;
    content: "";
}

.sidebar-scroll a[href^="http"]:not([href*="localhost"])::after:hover {
    text-decoration: none;
    content: "";
}

/* Changelog Page Specific Styling */
.changelog-entry {
    margin-bottom: 30px;
    padding-bottom: 20px;
    /* Uses your existing dashed line variable for that classic 90s partition */
    border-bottom: 1px dashed var(--preview); 
}

.changelog-entry:last-of-type {
    border-bottom: none; /* Removes the bottom border on the oldest entry */
}

.meta-date {
    /* Uses your site's metadata color variable */
    color: var(--meta); 
    font-size: 0.9em;
    font-style: italic;
    margin-top: -5px;
    margin-bottom: 15px;
}

@media screen and (min-width: 480px) {
  .container {
    flex-direction: column; /* Switch to a side-by-side layout */
    max-width: 100%;
  }

  footer {
    max-width: 100%;
  }
}

/* Tablet screens and up */
@media screen and (min-width: 768px) {
  .container {
    flex-direction: column; /* Switch to a side-by-side layout */
    max-width: 100%;
  }

    .main-layout {
        flex-direction: row; /* Fixed the column bug to allow side-by-side layout */
        align-items: flex-start;
    }

    .sidebar {
        width: 250px; /* Fixed width for sidebar on larger screens */
        flex-shrink: 0;
        position: sticky;
        top: 20px; /* Keeps sidebar visible while scrolling content */
    }

    .content-area {
        flex-grow: 1;
    }

    .sidebar-scroll a[href^="http"]:not([href*="localhost"])::after {
        text-decoration: none;
        content: "";
    }

  footer {
    max-width: 100%;
  }
}

@media screen and (min-width: 1200px) {
    body {
        max-width: 700px;
        margin: 0 auto;
    }

    .container {
        flex-direction: column; /* Switch to a side-by-side layout */
        max-width: 100%;
    }

    .main-layout {
        flex-direction: row;
        align-items: flex-start;
    }

    .sidebar {
        position: sticky;
    }

    .sidebar-scroll a[href^="http"]:not([href*="localhost"])::after {
        text-decoration: none;
        content: "";
    }

  footer {
    max-width: 100%;
  }
}