:root {
    --bg-color:           #000000;
    --text-color:         #ffffff;
    --highlight-yellow:   #fff800;
    --highlight-green:    #00ff00;
    --highlight-red:      #ff0000;
    --highlight-pink:     #ffc0cb;
    --highlight-blue:     #b0e2ff;
    --highlight-grey:     #778899;
    --highlight-purple:   #aa00ff;
    --muted-grey:         #696969;
    --font-mono: 'Iosevka', monospace;
}

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

/* --- Header & Animations --- */
.terminal-header {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: var(--bg-color);
    border-bottom: 1px dashed var(--muted-grey);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    box-sizing: border-box;
    z-index: 1000;
}

.prompt {
    font-size: 1.4rem;
    font-weight: bold;
    justify-content: flex-start;
    display: flex;
}

.user-host { color: var(--muted-grey); }
.path { color: var(--highlight-green); margin-right: 0.5rem;}

.typed {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    vertical-align: bottom;
    /* "man page" is 8 characters. Steps match the character count */
    animation: typing 1s steps(8, end) forwards;
    width: 0;
}

.cursor {
    color: var(--text-color);
    animation: blink 1s step-end infinite;
    margin-left: 2px;
}

@keyframes typing {
    from { width: 0; }
    to { width: 8ch; }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- Navigation --- */
.terminal-nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}

.terminal-nav a {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.2rem 0.5rem;
    transition: all 0.1s;
    font-size: 1.4rem
}

.terminal-nav a:hover {
    font-weight: bold;
    background-color: var(--highlight-green);
    color: var(--bg-color);
}

/* --- Main Content --- */
.terminal-container {
    margin: 80px auto 0 auto; /* The 'auto' on the left and right strictly centers the block */
    padding: 2rem;
    width: 90%; /* Dynamically expands to fill 90% of whatever screen it is on */
    max-width: 1800px; /* Raises the absolute ceiling for large monitors */
    box-sizing: border-box; 
}

.list-item {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column; /* Stacks Date, Path, and Tags vertically */
    align-items: flex-start; /* Aligns them cleanly to the left edge of the centered column */
    gap: 0.2rem; /* The small space between the date, path, and tags */
    margin-bottom: 2.5rem; /* The break line between each post */
}
.list-item .date { color: var(--muted-grey); margin-right: 1rem; font-size: 1.2rem; }
.list-item .post-link { color: var(--highlight-yellow); text-decoration: none; font-size: 1.5rem; }
.list-item .post-link:hover { text-decoration: underline; }
.list-item .tags { color: var(--highlight-pink); font-size: 1.2rem; }

/* --- Pygments Markdown / Code Rendering (Glow Engine logic) --- */
.glow-code {
    white-space: pre-wrap;
    word-break: break-word;
}

.glow-code img { max-width: 100%; height: auto; border: 1px solid var(--muted-grey); }

/* Pygments Class Mapping to constraints */
.glow-code .hll { background-color: #222; }
.glow-code .gp { color: var(--highlight-pink); font-weight: bold; font-size: 1.4em; } /* Page Headings */
.glow-code .gh { color: var(--highlight-green); font-weight: bold; font-size: 1.5em; } /* Headings */
.glow-code .gu { color: var(--highlight-yellow); font-weight: bold; font-size: 1.4em; } /* Subheadings */
.glow-code .h3-heading { /* Custom Third-Level Heading */
    color: var(--highlight-pink) !important;
    font-weight: bold;
    font-size: 1.2em;
}
.glow-code .ge { font-style: italic; color: var(--highlight-yellow); } /* Emphasis */
.glow-code .gs { font-weight: bold; color: var(--highlight-green); } /* Strong */
.glow-code .c, .glow-code .c1, .glow-code .cm { color: var(--muted-grey); } /* Comments */
.glow-code .k, .glow-code .kc, .glow-code .kd { color: var(--highlight-purple); font-weight: bold; } /* Keywords */
.glow-code .s, .glow-code .s1, .glow-code .s2 { color: var(--highlight-blue); } /* Strings */
.glow-code .nc, .glow-code .nf { color: var(--highlight-green); } /* Classes / Functions */
.glow-code .o, .glow-code .p { color: var(--text-color); } /* Punctuation */
.glow-code .m, .glow-code .mi, .glow-code .mf { color: var(--highlight-grey); } /* Numbers */
/* Pygments C Syntax Targeting */

/* Data types (int, char, void, etc.) */
.glow-code .kt { color: var(--text-color) !important; font-weight: bold; }

/* Preprocessor directives (#include, #define) */
.glow-code .cp { color: var(--highlight-grey) !important; }

/* The actual file included (<stdio.h>, "myheader.h") */
.glow-code .cpf { color: var(--muted-grey) !important; }

/* Standard Bold */
.glow-code strong {
    color: var(--highlight-yellow) !important;
}

/* Standard Italics */
.glow-code em {
    color: var(--highlight-grey) !important;
}

/* Bold + Italics combined */
.glow-code strong em, .glow-code em strong {
    color: var(--highlight-red) !important;
}

/* --- Post Typography --- */
/* Doubles the base font size specifically for the markdown post content */
.post-content {
    font-size: 1.5rem; 
}

/* --- Nested Code Blocks --- */
/* Creates the distinct grey square around actual code snippets */
.nested-code {
    border: 2px solid var(--muted-grey);
    background-color: #0a0a0a; /* Just slightly lighter than pure black */
    padding: 1rem;
    margin: 1.5rem 0;
    display: block;
    overflow-x: auto; /* Adds a scrollbar if the C or Bash lines get too long */
}

/* Ruthlessly enforce line-wrapping on the Pygments <pre> tags */
.post-content pre, .glow-code pre, .nested-code pre {
    white-space: pre-wrap !important; 
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    max-width: 100%;
    margin: 0; /* strips out default browser margins that can cause slight overflow */
}

/* Ensure images also never break out of the container bounds */
.glow-code img {
    max-width: 100%;
    height: auto;
}

/* --- Inline Code & Links --- */

/* Force inline-block so the grey border actually renders */
.glow-code span.inline-code {
    border: 1px solid var(--muted-grey) !important;
    background-color: #0a0a0a !important;
    padding: 0.1rem 0.3rem !important;
    color: var(--highlight-blue) !important;
    font-family: var(--font-mono) !important;
    white-space: nowrap !important;
    display: inline-block !important; 
    line-height: 1.2 !important; /* Keeps the rectangle from stretching the paragraph too tall */
}

/* Nuke the default browser blue and enforce the terminal green */
.glow-code a.markdown-link {
    color: var(--highlight-green) !important;
    text-decoration: none !important;
    font-weight: bold !important;
    cursor: pointer !important;
    display: inline-block !important;
}

.glow-code a.markdown-link:hover {
    background-color: var(--highlight-green) !important;
    color: var(--bg-color) !important;
}

/* Mid-Post Journal Entries */
.journal-entry-header {
    margin: 3rem 0 1.5rem 0; /* Creates a solid gap before the new journal entry starts */
    padding-left: 1rem;
    border-left: 3px solid var(--highlight-pink); /* A neat visual indicator that a new entry began */
    font-family: var(--font-mono);
    font-size: 1.05rem;
}

/* --- Post Meta Header --- */
.post-meta-header {
    text-align: left;
    font-size: 1.1rem; /* Keeps the heading small and clean */
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--muted-grey);
    font-family: var(--font-mono);
}

.meta-line { margin: 0.2rem 0; }

/* Change these colors to whatever highlight you prefer */
.meta-key { color: var(--muted-grey); font-weight: bold; }
.meta-value { color: var(--text-color); }

/* --- Footer --- */
.terminal-footer {
    text-align: center;
    color: var(--muted-grey);
    font-size: 0.9rem;
    padding: 2rem 0;
    margin-top: 4rem;
    border-top: 1px dashed var(--muted-grey);
}

.terminal-footer a {
    color: var(--muted-grey);
    text-decoration: underline;
}

.terminal-footer a:hover {
    color: var(--highlight-green);
    background-color: transparent;
}

/* --- Page Headers & Dividers --- */
.page-header {
    margin-bottom: 2rem;
    text-align: left;
}

.intro-content {
    margin-bottom: 2rem;
}

.terminal-divider {
    border: 0;
    border-bottom: 1px dashed var(--muted-grey);
    margin: 2rem 0 3rem 0;
}

/* --- Post List --- */
.post-list-container {
    display: flex;
    flex-direction: column;
    align-items: felx-start; 
    gap: 0.3rem; /* Tightly packs the list items vertically */
}

.list-item {
    width: 100%;
    max-width: 800px; /* Constrains the list width so it doesn't stretch too far */
    display: flex;
    justify-content: flex-start;
    align-items: baseline;
    gap: 1rem; /* Controls horizontal space between date, link, and tags */
    font-size: 1rem;
}

.list-item .date {
    color: var(--muted-grey);
    min-width: 120px; /* Forces dates to take up the same space, aligning the links perfectly */
    margin: 0;
}

/* --- Media (Images & Video) --- */
.media-container {
    margin: 2rem 0;
    text-align: center;
    display: block;
    max-width: 100%; /* Hard boundary for the container */
    overflow: hidden; /* The silver bullet: strictly forbids anything from spilling out */
    box-sizing: border-box;
}

.post-media {
    max-width: 100% !important; /* Force media to respect the container */
    height: auto !important;
    border: 1px dashed var(--muted-grey);
    padding: 0.5rem;
    background-color: var(--bg-color);
    box-sizing: border-box !important; /* Keeps the padding inside the width calculation */
}

/* Force the video player to conform strictly */
video.post-media {
    width: 100% !important; 
}

.image-caption {
    display: block;
    margin-top: 0.5rem;
    color: var(--muted-grey);
    font-size: 0.85em;
    font-family: var(--font-mono);
}

/* =========================================
   Responsive Design (Tablets & Phones) 
   ========================================= */

/* Tablets (iPad) */
@media screen and (max-width: 1024px) {
    .terminal-container {
        width: 95%; /* Use almost all screen space */
        padding: 1rem;
    }
    .post-content {
        font-size: 1.4rem; /* Scale down the massive font slightly */
    }
}

/* Mobile Phones */
@media screen and (max-width: 768px) {
    .terminal-header {
        flex-direction: column; /* Stack the prompt and nav vertically */
        padding: 1rem;
        position: static; /* Unfixes the header so it scrolls away naturally */
        border-bottom: 2px solid var(--muted-grey);
    }

    .prompt {
	width: 22ch; 
        margin: 0 auto; /* Centers the fixed-width box on the screen */
        text-align: left; /* Ensures the text types left-to-right inside the box */
        align-self: center;
    }

    .page-header {
        text-align: flex-start;
        white-space: nowrap;
        width: 100%;
        overflow: hidden; /* Prevents invisible overflow from causing a horizontal scrollbar */
    }
    
    /* Dynamically scale the heading text based on screen width */
    .page-header .gh {
        /* clamp(minimum_size, preferred_dynamic_size, maximum_size) */
        font-size: clamp(0.6rem, 4.5vw, 1.4rem) !important; 
    }
    
    /* Force the nav onto one line by shrinking the font and padding */
    .terminal-nav ul {
        flex-wrap: nowrap; /* Strictly forbids wrapping to a second line */
        justify-content: center;
        margin-top: 1rem;
        gap: 0.5rem; /* Tighter gap between links */
    }
    
    .terminal-nav a {
        font-size: 1.2rem; /* Smaller text for mobile */
        padding: 0.2rem;
    }
    
    .terminal-container {
        margin-top: 20px; /* Adjust since header is no longer fixed */
    }
    
    .post-content {
        font-size: 1.1rem; /* Much smaller base font for mobile readability */
    }
    
    .glow-code .gh { font-size: 1.3em; } /* Scale down heading tags */
    
    .nested-code {
        padding: 0.5rem;
        font-size: 1rem; /* Keep code blocks compact */
    }

    /* Strictly confine video players on mobile */
    video.post-media {
        max-height: 40vh !important; 
        object-fit: contain !important; 
    }

    .image-caption {
	font-size: 0.85rem;
    }

    .error-container {
        text-align: flex-start;
	padding-left: 1rem;
    }

    .error-container .glow-code {
        text-align: left;
    }

    .list-item  { font-size: 1rem; }
    .list-item .date { font-size: 1rem; }
    .list-item .post-link { font-size: 1rem; }
    .list-item .post-link:hover { font-size: 1rem; }
    .list-item .tags { font-size: 1rem; }
}
