:root {
    --bg-color: #0f172a;
    --text-color: #e2e8f0;
    --accent-color: #38bdf8;
    /* Sky blue */
    --secondary-color: #94a3b8;
    --card-bg: #1e293b;
    --code-bg: #020617;
    --border-color: #334155;
    --font-main: 'Inter', 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
    --font-mono: 'Fira Code', 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', monospace;
    --container-width: 800px;
    --header-height: 80px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    /* Include emoji fonts for proper rendering */
    font-family: var(--font-main), "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
    line-height: 1.6;
    font-size: 20px;
    /* Larger, more readable */
}

/* Emoji support – ensure emoji characters inherit a font that contains them */
.emoji {
    font-family: var(--font-main), "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #7dd3fc;
    text-decoration: underline;
}

.container {
    max-width: 1200px;
    /* Increased max-width for large screens */
    width: 95%;
    /* Fluid width for mobile */
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.site-header {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    /* Removed border-bottom to fit the clean terminal look better */
}

/* Terminal Window Styling */
.terminal-window {
    background-color: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    margin-bottom: 3rem;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.terminal-window:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
}

.terminal-header {
    background-color: var(--bg-color);
    /* Darker header */
    padding: 12px 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.terminal-controls {
    display: flex;
    gap: 8px;
    margin-right: 15px;
}

.control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.close {
    background-color: #ff5f56;
}

.minimize {
    background-color: #ffbd2e;
}

.maximize {
    background-color: #27c93f;
}

.terminal-title {
    font-family: var(--font-mono);
    color: var(--secondary-color);
    font-size: 0.9rem;
    opacity: 0.8;
}

.terminal-body {
    padding: 40px;
    /* Generous padding */
}

@media (max-width: 768px) {
    .terminal-body {
        padding: 20px;
    }
}

.command-line {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: var(--accent-color);
    display: flex;
    align-items: center;
}

.prompt {
    color: #c084fc;
    /* Purple prompt like image */
    margin-right: 12px;
    font-weight: bold;
}

.cursor {
    display: inline-block;
    width: 10px;
    height: 1.2em;
    background-color: var(--accent-color);
    margin-left: 5px;
    animation: blink 1s step-end infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.logo a {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 2rem;
    /* Larger header text */
    color: var(--text-color);
    text-decoration: none;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 20px;
}

/* Generic list styling for content */
ul {
    padding-left: 1.5rem;
    /* Indent bullet points */
    margin-bottom: 1rem;
}

ol {
    padding-left: 1.5rem;
    /* Indent numbered lists */
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.5rem;
}

.main-nav a {
    color: var(--secondary-color);
    font-weight: 500;
    font-size: 1rem;
    text-decoration: none;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--accent-color);
}

/* Main Content */
.main-content {
    flex: 1;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-color);
    margin-bottom: 1rem;
    line-height: 1.3;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 2rem;
    margin-top: 2rem;
}

p {
    margin-bottom: 1.5rem;
}

/* Post List */
.post-list {
    list-style: none;
}

.post-item {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.post-item:last-child {
    border-bottom: none;
}

.post-item img,
.post-summary img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
    display: block;
}

.post-title {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.post-title a {
    color: var(--text-color);
    text-decoration: none;
}

.post-title a:hover {
    color: var(--accent-color);
}

.post-meta {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.post-summary {
    color: var(--secondary-color);
}

/* Single Post */
.post-header {
    margin-bottom: 2rem;
    text-align: center;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 2rem 0;
}

.post-content code {
    font-family: var(--font-mono);
    background-color: var(--card-bg);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
}

.post-content pre {
    background-color: var(--code-bg);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    color: #e2e8f0;
    /* Always light text for code blocks */
}

.post-content pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}

blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1.5rem;
    margin-left: 0;
    margin-bottom: 1.5rem;
    font-style: italic;
    color: var(--secondary-color);
}

/* Footer */
.site-footer {
    margin-top: 60px;
    padding: 40px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.social-icons {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.social-icons a {
    color: var(--secondary-color);
}

.social-icons a:hover {
    color: var(--accent-color);
}

/* Utilities */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background-color: var(--accent-color);
    color: var(--bg-color);
    border-radius: 4px;
    text-align: center;
}

.coffee-wisdom em {
    color: var(--secondary-color);
    font-size: 1.1rem;
}

/* 404 Error Page */
.error-page {
    max-width: 100%;
}

.error-page h1 {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 2rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.error-message {
    font-size: 1.1rem;
    line-height: 1.8;
}

.error-details {
    margin: 2rem 0;
}

.error-details pre {
    background-color: var(--code-bg);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
}

.error-details code {
    color: #fbbf24;
    font-family: var(--font-mono);
    font-size: 0.95rem;
}

.suggestions {
    list-style: none;
    margin: 1.5rem 0;
    padding-left: 0;
}

.suggestions li {
    margin-bottom: 1rem;
    padding-left: 2rem;
    position: relative;
}

.suggestions li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
}

.suggestions code {
    font-family: var(--font-mono);
    background-color: var(--card-bg);
    padding: 0.2em 0.6em;
    border-radius: 4px;
    margin-right: 0.5rem;
}

.coffee-wisdom {
    margin-top: 3rem;
    padding: 1.5rem;
    background-color: var(--card-bg);
    border-left: 4px solid var(--accent-color);
    border-radius: 4px;
    text-align: center;
}

/* Link Micro-animations */
a {
    transition: color 0.2s ease, border-color 0.2s ease;
}

.post-title a {
    transition: color 0.3s ease, transform 0.2s ease;
    display: inline-block;
}

.post-title a:hover {
    transform: translateX(5px);
}

/* Button Pulse Animation */
.btn {
    animation: subtle-pulse 3s ease-in-out infinite;
}

@keyframes subtle-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

.btn:hover {
    animation: none;
    transform: scale(1.05);
}

/* Typing Animation for Command Line */
.command-line {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Focus states for accessibility */
a:focus,
button:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Code Block Copy Button */
.code-block-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
}

.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 6px 12px;
    background-color: rgba(56, 189, 248, 0.1);
    border: 1px solid var(--accent-color);
    border-radius: 4px;
    color: var(--accent-color);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.code-copy-btn:hover {
    background-color: var(--accent-color);
    color: var(--bg-color);
    transform: scale(1.05);
}

.code-copy-btn.copied {
    background-color: #27c93f;
    border-color: #27c93f;
    color: white;
}

/* Table of Contents */
.toc-wrapper {
    background-color: var(--card-bg);
    border-left: 3px solid var(--accent-color);
    padding: 1.5rem;
    margin: 2rem 0 3rem 0;
    border-radius: 8px;
}

.toc-header {
    font-family: var(--font-mono);
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.toc-header .prompt {
    color: #c084fc;
    margin-right: 8px;
    font-weight: bold;
}

.table-of-contents ul {
    list-style: none;
    padding-left: 0;
}

.table-of-contents li {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.table-of-contents li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

.table-of-contents a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease, padding-left 0.2s ease;
    display: inline-block;
}

.table-of-contents a:hover {
    color: var(--accent-color);
    padding-left: 5px;
}

.table-of-contents ul ul {
    margin-top: 0.5rem;
    padding-left: 1.5rem;
}

/* Related Posts */
.related-posts {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.related-posts h3 {
    font-family: var(--font-mono);
    color: var(--accent-color);
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
}

.related-posts .prompt {
    color: #c084fc;
    margin-right: 8px;
}

.related-list {
    list-style: none;
    padding: 0;
}

.related-item {
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: var(--card-bg);
    border-radius: 6px;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.related-item:hover {
    border-left-color: var(--accent-color);
    background-color: var(--bg-color);
    transform: translateX(5px);
}

.related-item a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
}

.related-title {
    font-weight: 600;
    flex: 1;
}

.related-date {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--secondary-color);
}

/* Post Meta Separators */
.post-meta .separator {
    margin: 0 0.5rem;
    color: var(--secondary-color);
}

.post-meta .reading-time {
    color: var(--accent-color);
    font-weight: 500;
}

/* Reading Progress Bar */
#reading-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 9999;
}

#reading-progress {
    width: 0%;
    height: 100%;
    background: var(--accent-color);
    transition: width 0.1s ease;
    box-shadow: 0 0 10px var(--accent-color);
}

/* Dark Mode Variables (Default) */
:root {
    --bg-color: #0f172a;
    --text-color: #e2e8f0;
    --accent-color: #38bdf8;
    --secondary-color: #94a3b8;
    --card-bg: #1e293b;
    --code-bg: #020617;
    --border-color: #334155;
}

/* Light Mode Variables */
[data-theme="light"] {
    --bg-color: #f8fafc;
    --text-color: #0f172a;
    --accent-color: #0284c7;
    --secondary-color: #475569;
    --card-bg: #ffffff;
    --code-bg: #0f172a;
    /* Keep code blocks dark for Monokai compatibility */
    --border-color: #cbd5e1;
}

/* Theme Toggle Button */
#theme-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s ease;
}

#theme-toggle:hover {
    color: var(--accent-color);
}

/* CLI Search */
.search-container {
    position: relative;
    margin-bottom: 2rem;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.8rem 1rem;
    font-family: var(--font-mono);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input-wrapper:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.search-prompt {
    color: #27c93f;
    /* Green prompt for search */
    margin-right: 10px;
    font-weight: bold;
}

.search-command {
    color: var(--secondary-color);
    margin-right: 10px;
}

#cli-search-input {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: var(--font-mono);
    font-size: 1rem;
    width: 100%;
    outline: none;
}

#cli-search-input::placeholder {
    color: var(--secondary-color);
    opacity: 0.5;
}

#search-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-top: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: none;
    overflow: hidden;
}

.search-item {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background-color: rgba(56, 189, 248, 0.1);
}

.search-item a {
    display: block;
    color: var(--text-color);
    text-decoration: none;
    font-family: var(--font-mono);
}

.search-item .prompt {
    color: var(--accent-color);
    margin-right: 8px;
}

/* Tag Pills */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    justify-content: center;
    /* Center the tags */
}

.tag-pill {
    display: inline-block;
    padding: 0.4rem 1rem;
    background-color: var(--accent-color);
    color: var(--bg-color);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.tag-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(56, 189, 248, 0.3);
}

/* Light mode tag pills */
[data-theme="light"] .tag-pill {
    background-color: var(--accent-color);
    color: white;
}