/* Gruvbox Blog CSS - Flat Design */

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

:root {
    --bg: #282828;
    --bg-soft: #32302f;
    --bg-hard: #1d2021;
    --fg: #ebdbb2;
    --fg-dim: #a89984;
    --red: #cc241d;
    --green: #98971a;
    --yellow: #d79921;
    --blue: #458588;
    --purple: #b16286;
    --aqua: #689d6a;
    --orange: #d65d0e;
    --gray: #928374;
}

body {
    font-family: "Source Code Pro", "Fira Code", Consolas, monospace;
    line-height: 1.6;
    color: var(--fg);
    background-color: var(--bg);
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    border-left: 2px solid var(--gray);
    border-right: 2px solid var(--gray);
}

/* Header */
header {
    background-color: var(--bg-hard);
    border: 2px solid var(--yellow);
    margin: 0.5rem 0 2rem;
    padding: 1rem;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: none;
    margin: 0;
    padding: 0;
}

nav h1 {
    font-size: 1.5rem;
    color: var(--yellow);
}

nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

nav h1 a {
    color: var(--yellow);
    text-decoration: none;
}

nav ul li a {
    color: var(--fg);
    text-decoration: none;
    padding: 0.5rem;
    border: 1px dashed var(--gray);
    background-color: var(--bg-soft);
}

nav h1 a:hover {
    color: var(--orange);
}

nav ul li a:hover {
    background-color: var(--blue);
    border-color: var(--blue);
    color: var(--bg);
}

/* General Base Styles */
/* Lists */
ul,
ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

/* Links */
a {
    color: var(--blue);
    text-decoration: none;
}

a:hover {
    color: var(--aqua);
}

/* Main Content */
main {
    margin-bottom: 2rem;
    flex: 1;
}

/* Home Page */
.home-container {
    display: grid;
    gap: 2rem;
}

.intro {
    background-color: var(--bg-soft);
    border: 2px solid var(--purple);
    padding: 2rem;
    text-align: center;
}

.intro h2 {
    color: var(--purple);
    margin-bottom: 1rem;
    font-size: 2rem;
}

.intro p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.intro a {
    color: var(--yellow);
    border-bottom: 1px dashed var(--yellow);
}

.intro a:hover {
    color: var(--orange);
    border-bottom-color: var(--orange);
}

.latest-posts {
    background-color: var(--bg-soft);
    border: 2px solid var(--green);
    padding: 2rem;
}

.latest-posts h3 {
    color: var(--green);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    border-bottom: 1px dashed var(--gray);
    padding-bottom: 0.5rem;
}

.view-all {
    margin-top: 1.5rem;
    text-align: center;
}

.view-all a {
    color: var(--aqua);
    font-weight: bold;
    border: 1px dashed var(--aqua);
    padding: 0.5rem 1rem;
    background-color: var(--bg);
}

.view-all a:hover {
    background-color: var(--aqua);
    color: var(--bg);
    border-color: var(--aqua);
}

/* Posts Container */
.posts-container {
    background-color: var(--bg-soft);
    border: 2px solid var(--green);
    padding: 2rem;
    margin-bottom: 2rem;
}

.posts-container h2 {
    color: var(--green);
    margin-bottom: 1rem;
    font-size: 1.8rem;
    border-bottom: 1px dashed var(--gray);
    padding-bottom: 0.5rem;
}

.posts-list {
    display: grid;
    gap: 1rem;
}

/* Post Items */
.post-item {
    background-color: var(--bg);
    border: 1px solid var(--gray);
    border-left: 4px solid var(--blue);
    padding: 1rem;
    transition: border-left-color 0.3s ease;
}

.post-item:hover {
    border-left-color: var(--yellow);
}

.post-item h3 {
    margin-bottom: 0.5rem;
}

.post-item h3 a {
    color: var(--blue);
    text-decoration: none;
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.post-item h3 a:hover {
    color: var(--yellow);
    text-decoration: underline;
}

.post-item h4 a {
    color: var(--blue);
    text-decoration: none;
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.post-item h4 a:hover {
    color: var(--yellow);
    text-decoration: underline;
}

.post-meta {
    color: var(--fg-dim);
    font-size: 0.9rem;
    font-style: italic;
}

/* Individual Post */
.post {
    background-color: var(--bg-soft);
    border: 2px solid var(--blue);
    padding: 2rem;
    margin-bottom: 2rem;
}

.post-header {
    margin-bottom: 2rem;
    border: none;
    border-left: 4px solid var(--purple);
    padding: 1rem;
}

.post-header h2 {
    color: var(--purple);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.post-content {
    margin-bottom: 2rem;
    line-height: 1.7;
    font-size: 1.05rem;
}

.post-content h1 {
    color: var(--green);
    margin: 2.5rem 0 1.5rem;
    border-left: 4px solid var(--green);
    padding: 0.75rem 0 0.75rem 1rem;
    background-color: var(--bg-soft);
    border-top: 1px dashed var(--green);
    border-bottom: 1px dashed var(--green);
    font-size: 1.8rem;
    font-weight: bold;
}

.post-content h2 {
    color: var(--orange);
    margin: 2rem 0 1.25rem;
    border-left: 4px solid var(--orange);
    padding: 0.5rem 0 0.5rem 1rem;
    background-color: var(--bg-soft);
    border-bottom: 1px dashed var(--orange);
    font-size: 1.5rem;
    font-weight: bold;
}

.post-content h3 {
    color: var(--purple);
    margin: 1.75rem 0 1rem;
    border-left: 3px solid var(--purple);
    padding-left: 0.75rem;
    font-size: 1.3rem;
    font-weight: bold;
}

.post-content h4,
.post-content h5,
.post-content h6 {
    color: var(--yellow);
    margin: 1.5rem 0 1rem;
    border-left: 3px solid var(--yellow);
    padding-left: 0.5rem;
    font-weight: bold;
}

.post-content p {
    margin-bottom: 1.5rem;
    text-align: justify;
}

/* Improve spacing for paragraphs after headings */
.post-content h1 + p,
.post-content h2 + p,
.post-content h3 + p {
    margin-top: 1rem;
}

/* Better spacing for lists */
.post-content ul,
.post-content ol {
    margin: 1.5rem 0;
    padding-left: 2.5rem;
}

.post-content li {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

/* Improve nested list spacing */
.post-content ul ul,
.post-content ol ol,
.post-content ul ol,
.post-content ol ul {
    margin: 0.5rem 0;
}

.post-content pre {
    background-color: var(--bg-hard);
    color: var(--fg);
    padding: 1rem;
    border: 1px solid var(--gray);
    border-left: 4px solid var(--green);
    overflow-x: auto;
    margin: 1rem 0;
    font-family: "Source Code Pro", "Fira Code", Consolas, monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

.post-content code {
    background-color: var(--bg-hard);
    color: var(--orange);
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--gray);
    border-radius: 3px;
    font-family: "Source Code Pro", "Fira Code", Consolas, monospace;
    font-size: 0.95rem;
    font-weight: 500;
}

.post-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--fg);
    font-family: "Source Code Pro", "Fira Code", Consolas, monospace;
    border-radius: 0;
}

.post-content code.verbatim {
    font-family: "Source Code Pro", "Fira Code", Consolas, monospace;
    background-color: var(--bg-soft);
    color: var(--yellow);
    padding: 0.1rem 0.1rem;
    border: 1px solid var(--gray);
    border-radius: 3px;
    font-size: 0.95rem;
    font-weight: 500;
}

.post-content blockquote {
    border-left: 4px solid var(--yellow);
    background-color: var(--bg-soft);
    padding: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--fg-dim);
    position: relative;
    border-top: 1px dashed var(--yellow);
    border-bottom: 1px dashed var(--yellow);
}

/* Add subtle quote marks */
.post-content blockquote::before {
    content: '"';
    position: absolute;
    top: 0.5rem;
    left: 0.75rem;
    font-size: 2rem;
    color: var(--yellow);
    opacity: 0.5;
    line-height: 1;
}

.post-content blockquote p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.post-content blockquote p:last-of-type {
    margin-bottom: 0;
}

/* Citation styling */
cite {
    display: block;
    text-align: right;
    margin-top: 0.5rem;
    font-style: normal;
    font-size: 0.85rem;
    color: var(--gray);
}

cite a {
    color: var(--aqua);
    text-decoration: none;
    border-bottom: 1px dashed var(--aqua);
    transition:
        color 0.3s ease,
        border-bottom-color 0.3s ease;
}

cite a:hover {
    color: var(--yellow);
    border-bottom-color: var(--yellow);
}

/* Citations in blockquotes */
blockquote cite {
    border-top: 1px dashed var(--gray);
    padding-top: 0.5rem;
    margin-top: 1rem;
}

/* Citations after code blocks */
.sourceCode + cite {
    margin-top: 0;
    margin-bottom: 1rem;
    background-color: var(--bg-hard);
    border: 1px solid var(--gray);
    border-top: none;
    border-left: 4px solid var(--green);
    padding: 0.5rem 1rem;
    font-family: "Source Code Pro", "Fira Code", Consolas, monospace;
    font-size: 0.8rem;
    text-align: right;
}

.sourceCode + cite a {
    color: var(--green);
    text-decoration: none;
    border-bottom: 1px dashed var(--green);
    font-weight: bold;
}

.sourceCode + cite a:hover {
    color: var(--aqua);
    border-bottom-color: var(--aqua);
}

/* Custom Scrollbar Styling - Gruvbox themed */
/* For Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-hard);
    border: 1px solid var(--gray);
}

::-webkit-scrollbar-thumb {
    background: var(--gray);
    border: 1px solid var(--fg);
    border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--yellow);
}

::-webkit-scrollbar-thumb:active {
    background: var(--orange);
}

::-webkit-scrollbar-corner {
    background: var(--bg-hard);
}

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--gray) var(--bg-hard);
}

/* Specific styling for code blocks with horizontal scroll */
.sourceCode pre {
    scrollbar-width: thin;
    scrollbar-color: var(--green) var(--bg-hard);
}

.sourceCode pre::-webkit-scrollbar-thumb {
    background: var(--green);
    border: 1px solid var(--fg);
}

.sourceCode pre::-webkit-scrollbar-thumb:hover {
    background: var(--aqua);
}

/* Drop Cap Styling */
.drop-cap {
    font-family: "Source Code Pro", "Fira Code", Consolas, monospace;
    font-weight: bold;
    font-style: normal;
    line-height: 1;
    position: relative;
    top: -0.125rem;
    display: inline-block;
    float: left;
    margin-right: 0.75rem;
    margin-bottom: 1rem;
    margin-top: 0.25rem;
    padding: 0.5rem 0.75rem;

    /* Clear float to prevent bleeding */
    clear: left;

    /* Size and positioning */
    font-size: 3rem;
    width: 4rem;
    height: 4rem;

    /* Typography */
    text-align: center;
    vertical-align: middle;
    text-decoration: none;
    letter-spacing: 0.1rem;
    text-transform: uppercase;

    /* Gruvbox styling */
    border: 0.15rem solid var(--fg);
    border-radius: 0;
    outline: 0;

    /* Stripe pattern - Gruvbox themed */
    color: var(--bg);
    background: repeating-linear-gradient(
        -45deg,
        var(--red),
        var(--red) 0.25rem,
        var(--orange) 0.25rem,
        var(--orange) 0.5rem,
        var(--yellow) 0.5rem,
        var(--yellow) 0.75rem,
        var(--green) 0.75rem,
        var(--green) 1rem
    );

    /* Ensure text is visible */
    -webkit-text-fill-color: var(--bg);
    text-shadow:
        1px 1px 0 var(--fg),
        -1px -1px 0 var(--fg),
        1px -1px 0 var(--fg),
        -1px 1px 0 var(--fg);

    /* Interaction */
    user-select: none;
    cursor: default;
}

/* Alternative single-color drop caps */
.drop-cap.red {
    background: var(--red);
}

.drop-cap.green {
    background: var(--green);
}

.drop-cap.yellow {
    background: var(--yellow);
}

.drop-cap.blue {
    background: var(--blue);
}

.drop-cap.purple {
    background: var(--purple);
}

.drop-cap.aqua {
    background: var(--aqua);
}

.drop-cap.orange {
    background: var(--orange);
}

/* Ensure proper spacing after drop cap elements */
.post-content .drop-cap + p {
    margin-bottom: 2rem;
}

.post-content .drop-cap + p + blockquote {
    clear: left;
    margin-top: 2rem;
}

/* More general fallback - clear any element that comes after drop cap paragraph */
.post-content p + blockquote {
    clear: both;
}

.post-footer {
    border: 2px dashed var(--gray);
    padding-top: 1rem;
}

.post-footer a {
    color: var(--aqua);
    text-decoration: none;
    border-bottom: 1px dashed var(--aqua);
}

.post-item:hover h3 a,
.post-item:hover h4 a {
    color: var(--yellow);
}

.post-footer a:hover {
    color: var(--yellow);
    border-bottom-color: var(--yellow);
}

/* Footer */
footer {
    background-color: var(--bg-hard);
    color: var(--fg-dim);
    text-align: center;
    padding: 1rem 0;
    border: 2px dashed var(--gray);
    margin: 2rem 0 0.5rem;
}

li {
    margin-bottom: 0.5rem;
}

/* Syntax Highlighting */
.sourceCode {
    background-color: var(--bg-hard);
    border: 1px solid var(--gray);
    border-left: 4px solid var(--green);
    margin: 1rem 0;
    overflow-x: auto;
}

/* Remove bottom margin when followed by citation */
.sourceCode:has(+ cite) {
    margin-bottom: 0;
}

.sourceCode pre {
    margin: 0;
    padding: 1rem;
    background: none;
    border: none;
}

.sourceCode code {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
}

/* Syntax highlighting token styles - Gruvbox themed */
.sourceCode .kw {
    color: var(--red);
    font-weight: bold;
} /* Keywords */
.sourceCode .dt {
    color: var(--yellow);
} /* Data types */
.sourceCode .dv {
    color: var(--purple);
} /* Decimal values */
.sourceCode .bn {
    color: var(--purple);
} /* BaseN */
.sourceCode .fl {
    color: var(--purple);
} /* Float */
.sourceCode .ch {
    color: var(--green);
} /* Char */
.sourceCode .st {
    color: var(--green);
} /* String */
.sourceCode .co {
    color: var(--gray);
    font-style: italic;
} /* Comment */
.sourceCode .ot {
    color: var(--red);
} /* Other */
.sourceCode .al {
    color: var(--red);
    font-weight: bold;
} /* Alert */
.sourceCode .fu {
    color: var(--aqua);
} /* Function */
.sourceCode .er {
    color: var(--red);
    font-weight: bold;
} /* Error */
.sourceCode .wa {
    color: var(--orange);
    font-style: italic;
} /* Warning */
.sourceCode .cn {
    color: var(--orange);
} /* Constant */
.sourceCode .sc {
    color: var(--green);
} /* SpecialChar */
.sourceCode .vs {
    color: var(--green);
} /* VerbatimString */
.sourceCode .ss {
    color: var(--green);
} /* SpecialString */
.sourceCode .im {
    color: var(--blue);
} /* Import */
.sourceCode .va {
    color: var(--fg);
} /* Variable */
.sourceCode .cf {
    color: var(--red);
    font-weight: bold;
} /* ControlFlow */
.sourceCode .op {
    color: var(--orange);
} /* Operator */
.sourceCode .bu {
    color: var(--yellow);
} /* BuiltIn */
.sourceCode .ex {
    color: var(--aqua);
} /* Extension */
.sourceCode .pp {
    color: var(--orange);
} /* Preprocessor */
.sourceCode .at {
    color: var(--yellow);
} /* Attribute */
.sourceCode .do {
    color: var(--gray);
    font-style: italic;
} /* Documentation */
.sourceCode .an {
    color: var(--gray);
    font-style: italic;
} /* Annotation */
.sourceCode .cv {
    color: var(--gray);
    font-style: italic;
} /* CommentVar */
.sourceCode .in {
    color: var(--gray);
    font-style: italic;
} /* Information */

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background-color: var(--bg);
    border: 1px solid var(--gray);
}

th,
td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px dashed var(--gray);
}

th {
    background-color: var(--bg-soft);
    color: var(--yellow);
    font-weight: bold;
}

/* Responsive Design */
@media (width <= 768px) {
    body {
        padding: 0 0.5rem;
        max-width: 100%;
    }

    nav {
        flex-direction: column;
        text-align: center;
    }

    nav ul {
        justify-content: center;
    }

    .posts-container,
    .post {
        padding: 1rem;
    }

    .post-header h2 {
        font-size: 1.5rem;
    }

    .post-content h1 {
        font-size: 1.8rem;
    }

    .post-content h2 {
        font-size: 1.5rem;
    }

    nav ul li a {
        padding: 0.4rem;
        font-size: 0.9rem;
    }
}

@media (width <= 480px) {
    .posts-container,
    .post {
        padding: 0.75rem;
    }

    .post-content pre {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    table {
        font-size: 0.9rem;
    }

    th,
    td {
        padding: 0.5rem;
    }
}
