/* ==========================================================================
   1. CORE RESET & MINIMALIST VARIABLES
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --sidebar-w: 260px;
    --header-h: 56px;
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Minimalist Technical Palette */
    --clr-bg: #ffffff;
    --clr-text-main: #1a1a1a;
    --clr-text-muted: #64748b;
    --clr-border: #e2e8f0;
    --clr-border-dark: #0f172a;
    --clr-hover: #f8fafc;
    --clr-accent: #2563eb;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    color: var(--clr-text-main);
    background-color: var(--clr-bg);
    line-height: 1.625;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   2. TYPOGRAPHY SYSTEM
   ========================================================================== */
h1, h2, h3, h4 {
    color: var(--clr-text-main);
    font-weight: 700;
    line-height: 1.2;
    margin-top: 0;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}
h1 { font-size: 2.25rem; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; }

p, ul, ol, video, img, .table-container {
    margin-bottom: 1.5rem;
}

ul { padding-left: 1.25rem; }
li { margin-bottom: 0.25rem; }

a {
    color: var(--clr-accent);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover {
    color: var(--clr-border-dark);
    text-decoration: underline;
}

.meta-text {
    font-size: 0.875rem;
    color: var(--clr-text-muted);
    margin-bottom: 1rem;
}

/* Fluid Asset Constraints */
img, video {
    max-width: 100%;
    height: auto;
    display: block;
    border: 1px solid var(--clr-border);
}

.ctrl-btn {
    padding: 8px 14px;
    background: var(--clr-bg);
    border: 1px solid var(--clr-border-dark);
    color: var(--clr-text-main);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}
.ctrl-btn:hover {
    background: var(--clr-hover);
}

/* ==========================================================================
   3. MINIMALIST BLOG INDEX TABLE DESIGN
   ========================================================================== */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--clr-border);
    background: var(--clr-bg);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9375rem;
}

th {
    background-color: var(--clr-hover);
    color: var(--clr-text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px;
    border-bottom: 2px solid var(--clr-border);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--clr-border);
    white-space: nowrap;
}

tr:last-child td {
    border-bottom: none;
}

/* Smooth Row Highlights */
tr:hover td {
    background-color: var(--clr-hover);
}

/* Button-style Action Columns */
.action-links {
    display: flex;
    gap: 8px;
}

.action-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid var(--clr-border);
    color: var(--clr-text-main);
    background: var(--clr-bg);
    transition: all 0.15s ease;
}

.action-links a.read-btn {
    border-color: var(--clr-border-dark);
    background: var(--clr-border-dark);
    color: var(--clr-bg);
}
.action-links a.read-btn:hover {
    background: #334155;
    border-color: #334155;
}

.action-links a.down-btn:hover {
    background: var(--clr-hover);
    border-color: var(--clr-text-main);
}

/* ==========================================================================
   4. DESKTOP VIEWPORT LAYOUT
   ========================================================================== */
.mobile-header, .nav-overlay, .mobile-only {
    display: none;
}

.main-sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    position: fixed;
    top: 0; left: 0;
    background: var(--clr-bg);
    border-right: 1px solid var(--clr-border);
    padding: 40px 24px;
    z-index: 100;
    /* Keeps the sidebar layout clean without inline HTML styles */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--clr-border);
    padding-top: 20px;
}

.sidebar-header {
    margin-bottom: 40px;
}

.sidebar-header strong {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.main-sidebar ul {
    list-style: none;
    padding-left: 0;
}

.main-sidebar li {
    margin-bottom: 12px;
}

.main-sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--clr-text-muted);
    font-weight: 500;
    font-size: 0.9375rem;
    text-decoration: none;
    padding: 8px 0;
}

.main-sidebar a:hover, 
.main-sidebar li.active a {
    color: var(--clr-text-main);
}

.content-viewport {
    margin-left: var(--sidebar-w);
    padding: 60px 50px;
    max-width: 1000px;
}

/* ==========================================================================
   5. MOBILE DRAW BREAKPOINT
   ========================================================================== */
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: fixed;
        top: 0; left: 0; right: 0;
        height: var(--header-h);
        padding: 0 20px;
        background: var(--clr-bg);
        border-bottom: 1px solid var(--clr-border);
        z-index: 90;
    }
    
    .mobile-header strong {
        font-size: 1.125rem;
        font-weight: 700;
    }

    .mobile-only {
        display: block;
    }

    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 30px;
    }

    .content-viewport {
        margin-left: 0;
        padding: calc(var(--header-h) + 24px) 20px 40px 20px;
    }

    .main-sidebar {
        left: -280px;
        width: 260px;
        z-index: 110;
        transition: left 0.2s cubic-bezier(0, 0, 0.2, 1);
        padding: 24px 20px;
    }

    .main-sidebar.is-open {
        left: 0;
    }

    .nav-overlay.is-open {
        display: block;
        position: fixed;
        top: 0; left: 0; width: 100vw; height: 100vh;
        background: rgba(15, 23, 42, 0.3);
        backdrop-filter: blur(2px);
        z-index: 105;
    }
}


/* ==========================================================================
   6. AUTO-RESPONSIVE RAW BLOG POST INHERITANCE SYSTEM (EXPANDED)
   ========================================================================== */
.blog-post {
    margin-bottom: 5rem;
    border-bottom: 1px solid var(--clr-border);
    padding-bottom: 4rem;
}

.blog-post:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Metadata Block */
.blog-post .post-meta {
    font-size: 0.875rem;
    color: var(--clr-text-muted);
    margin-bottom: 2.5rem;
    display: block;
    letter-spacing: 0.02em;
}

/* --- Typographic Ladder Hierarchy --- */
.blog-post h1, .blog-post h2, .blog-post h3, 
.blog-post h4, .blog-post h5, .blog-post h6 {
    color: var(--clr-text-main);
    line-height: 1.25;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}
.blog-post h1 { font-size: 2rem; }
.blog-post h2 { font-size: 1.65rem; }
.blog-post h3 { font-size: 1.35rem; }
.blog-post h4 { font-size: 1.15rem; }
.blog-post h5, .blog-post h6 { font-size: 1rem; color: var(--clr-text-muted); }

/* Elements adjacent to headings reset their top margin */
.blog-post * + h1, .blog-post * + h2, .blog-post * + h3,
.blog-post * + h4, .blog-post * + h5, .blog-post * + h6 {
    margin-top: 2.5rem;
}

/* Core Paragraphs & Formatting */
.blog-post p {
    margin-bottom: 1.5rem;
    font-size: 1.0625rem;
    color: var(--clr-text-main);
    word-break: break-word;
}

.blog-post a {
    color: var(--clr-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.blog-post a:hover {
    color: var(--clr-text-main);
}

/* Text Highlights & Modifiers */
.blog-post strong, .blog-post b {
    font-weight: 600;
    color: var(--clr-text-main);
}

.blog-post em, .blog-post i {
    font-style: italic;
}

.blog-post mark {
    background-color: #fef08a; /* Soft minimalist amber tint */
    color: #1e293b;
    padding: 1px 4px;
}

/* Content Divider Line */
.blog-post hr {
    border: none;
    border-top: 1px solid var(--clr-border);
    margin: 3rem 0;
}

/* --- Lists System --- */
.blog-post ul, .blog-post ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}
.blog-post ul { list-style-type: square; }
.blog-post ol { list-style-type: decimal; }
.blog-post li {
    margin-bottom: 0.5rem;
    font-size: 1.0625rem;
}
.blog-post li::marker {
    color: var(--clr-text-muted);
}

/* --- UI Controls & Data Tables --- */
/* Keyboard input tag for technical shortcuts */
.blog-post kbd {
    font-family: monospace;
    font-size: 0.8125rem;
    background: var(--clr-bg);
    border: 1px solid var(--clr-border-dark);
    border-bottom-width: 3px;
    border-radius: 3px;
    padding: 2px 5px;
    color: var(--clr-text-main);
    display: inline-block;
    line-height: 1;
}

/* Standalone Raw Content Tables */
.blog-post table {
    display: block; /* Forces block containment to handle auto horizontal scrolls */
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
    margin-bottom: 2rem;
    border: 1px solid var(--clr-border);
    font-size: 0.9375rem;
}
.blog-post th, .blog-post td {
    padding: 12px 14px;
    border: 1px solid var(--clr-border);
    text-align: left;
}
.blog-post th {
    background: var(--clr-hover);
    font-weight: 600;
    color: var(--clr-text-muted);
}
.blog-post tr:nth-child(even) {
    background: #fafafa;
}

/* --- Structural Media Elements (Fixed & Fluid) --- */
.blog-post img,
.blog-post video {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2.5rem 0;
    border: 1px solid var(--clr-border);
    background-color: var(--clr-hover);
}

/* Captions generated from the alt text field automatically */
.blog-post img[alt]::after {
    content: attr(alt);
    display: block;
    font-size: 0.8125rem;
    color: var(--clr-text-muted);
    margin-top: 0.625rem;
    text-align: center;
    font-style: normal;
}

.blog-post iframe {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    display: block;
    margin: 2.5rem 0;
    border: none;
}

/* Blockquotes / Editorial Breaks */
.blog-post blockquote {
    margin: 2.5rem 0;
    padding: 0.5rem 0 0.5rem 1.5rem;
    border-left: 3px solid var(--clr-border-dark);
    font-style: italic;
    color: var(--clr-text-muted);
}
.blog-post blockquote p:last-child {
    margin-bottom: 0;
}

/* --- Code Blocks & Technical Terminal Elements --- */
.blog-post code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875rem;
    background: var(--clr-hover);
    padding: 2px 5px;
    border: 1px solid var(--clr-border);
    color: #e11d48; /* Slight color emphasis for inline strings */
}

.blog-post pre {
    background: var(--clr-hover);
    padding: 20px;
    border: 1px solid var(--clr-border);
    overflow-x: auto;
    margin-bottom: 1.5rem;
}
.blog-post pre code {
    padding: 0;
    background: none;
    border: none;
    color: var(--clr-text-main); /* Resets to clear dark layout formatting blocks */
    font-size: 0.875rem;
}