/* ==========================================================================
   Base & Layout Settings
   ========================================================================== */

/* Modern system font stack with fallback to sans-serif */
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #111111;
    background-color: #ffffff;
    display: flex; /* Sidebar and main content side-by-side on desktop */
    min-height: 100vh;
}

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */

header {
    background-color: #111111;
    color: #ffffff;
    width: 220px;
    height: 100vh; /* Full viewport height on desktop */
    padding: 35px 25px;
    display: flex;
    flex-direction: column;
    gap: 40px;

    /* Sticky sidebar positioning */
    position: sticky;
    top: 0;
    align-self: flex-start;
    box-sizing: border-box; 
}

.logo {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Vertical menu layout */
nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

nav a {
    color: #cccccc;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.15s ease-in-out;
}

/* Hover and Active State for Navigation */
nav a:hover,
nav a:visited:hover {
    color: #0066ff !important;
}

nav a.active {
    color: #0066ff;
    font-weight: 600;
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */

main {
    flex-grow: 1;
    padding: 40px 60px;
    max-width: 90ch; /* Optimal line length for desktop readability */
    margin: 0 auto;
    box-sizing: border-box;
}

/* Typography & Headings */
h1, h2, h3 {
    text-align: left; /* Left-aligned headings flow better with body copy */
    color: #000000;
    margin-top: 0;
}

h1 {
    font-size: 2em;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eaeaea;
}

h2 {
    font-size: 1.4em;
    margin-top: 28px;
    margin-bottom: 10px;
}

p, li {
    line-height: 1.6;
    font-size: 16px;
}

/* Main Content Links */
main a {
    color: #0066ff;
    text-decoration: underline;
}

main a:hover {
    color: #0044cc;
}

main a:visited {
    color: #551a8b;
}

main a:visited:hover {
    color: #0044cc;
}

/* ==========================================================================
   Project & Post Layouts
   ========================================================================== */

.projects-list {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-top: 20px;
}

.project {
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.project h2 {
    margin-bottom: 6px;
}

/* Clean Q&A Block Layout */
.qa-list {
    margin: 0;
    padding: 0;
}

.qa-list dt {
    font-weight: bold;
    margin-top: 24px;
    color: #0066ff;
}

.qa-list dd {
    margin: 4px 0 0 0;
    line-height: 1.6;
}

/* Post Metadata & Details */
.post-header {
    border-bottom: 2px solid #eaeaea;
    padding-bottom: 20px;
}

.post-date {
    color: #666666;
    font-size: 0.9em;
    margin-top: -5px; 
}

.post-intro {
    font-size: 1.1em;
    font-style: italic;
    color: #333333;
}

.post-content {
    margin-top: 30px; 
}

.post-content p {
    margin-bottom: 18px; 
}

/* Code styling */
code {
    background-color: #f4f4f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
    font-size: 0.9em;
}

/* ==========================================================================
   Mobile Responsiveness (Screens under 768px wide)
   ========================================================================== */

@media (max-width: 768px) {
    body {
        flex-direction: column; /* Stack header on top of main content */
    }

    header {
        width: 100%;
        height: auto;
        position: relative; /* Unstick from top on mobile */
        padding: 20px;
        gap: 15px;
    }

    nav ul {
        flex-direction: row; /* Lay out menu links horizontally on phone */
        flex-wrap: wrap;
        gap: 15px;
    }

    main {
        padding: 25px 20px;
        max-width: 100%;
    }
}
