/* ==========================================================================
   1. DESIGN TOKENS (Variaveis)
   ========================================================================== */
:root {
    /* Light Theme (Default) */
    --bg: #ffffff;
    --text: #2d3436;
    --text-muted: #636e72;
    --border: #edf2f7;
    --link: #0066cc;
    --link-hover: #004499;
    --tag-bg: #f1f5f9;
    --tag-hover: #e2e8f0;
    /*  */
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-soft: rgba(124, 58, 237, 0.12);

    /* Fundo Fixo para Código (Não muda com o tema) */
    --code-fixed-bg: #1a1d22;
    --code-fixed-text: #e2e8f0;
    --code-inline-bg: #f1f5f9;
    --code-font:
        "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo,
        Monaco, Consolas, monospace;

    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1115;
        --text: #e2e8f0;
        --text-muted: #94a3b8;
        --border: #2d3436;
        --link: #60a5fa;
        --link-hover: #93c5fd;
        --tag-bg: #1e293b;
        --tag-hover: #334155;
        --code-inline-bg: #1e293b;
        /*  */
        --accent: #8b5cf6;
        --accent-hover: #a78bfa;
        --accent-soft: rgba(139, 92, 246, 0.18);
    }
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto,
        sans-serif;
    line-height: 1.75; /* Ritmo vertical para leitura longa[cite: 1] */
    color: var(--text);
    background: var(--bg);
    max-width: 760px; /* Largura ideal para legibilidade[cite: 1] */
    margin: 0 auto;
    padding: 0 24px;
    transition:
        background-color 0.3s ease,
        color 0.3s ease;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   3. TYPOGRAPHY (Markdown & Saga)
   ========================================================================== */
p,
ul,
ol,
pre,
blockquote {
    margin-bottom: 1.5rem;
}

h1,
h2,
h3,
h4 {
    color: var(--text);
    line-height: 1.3;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

h1 {
    font-size: 2.5rem;
    letter-spacing: -0.02em;
    margin-top: 0;
}
h2 {
    font-size: 1.75rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.3rem;
}
h3 {
    font-size: 1.4rem;
}

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

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

blockquote {
    border-left: 4px solid var(--link);
    padding: 0.5rem 0 0.5rem 1.5rem;
    color: var(--text-muted);
    font-style: italic;
    background: var(--tag-bg);
    border-radius: 0 8px 8px 0;
}

/* ==========================================================================
   4. LISTS (Customizada para .page e article)
   ========================================================================== */

/* Listas Não Ordenadas (Bullets) */
.page ul:not(.tags),
article ul:not(.tags) {
    list-style: none;
    padding-left: 0;
}

.page ul:not(.tags) li,
article ul:not(.tags) li {
    position: relative;
    padding-left: 1.5rem;
    /*margin-bottom: 0.75rem;*/
}

.page ul:not(.tags) li::before,
article ul:not(.tags) li::before {
    content: "•";
    color: var(--accent);
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Listas Ordenadas (Numeradas) */
.page ol,
article ol {
    counter-reset: custom-counter;
    list-style: none;
    padding-left: 0;
}

.page ol li,
article ol li {
    counter-increment: custom-counter;
    position: relative;
    padding-left: 40px;
    margin-bottom: 1rem;
}

.page ol li::before,
article ol li::before {
    content: counter(custom-counter);
    position: absolute;
    left: 0;
    top: 4px;
    width: 24px;
    height: 24px;
    background: var(--link);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   5. TAGS (Saga Specific)
   ========================================================================== */
ul.tags {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-left: 0;
    margin-bottom: 2rem;
}

ul.tags li {
    margin-bottom: 0;
    padding-left: 0;
}

ul.tags li::marker {
    content: none;
}

ul.tags li a {
    display: inline-block;
    background: var(--tag-bg);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

ul.tags li a:hover {
    background: var(--tag-hover);
    color: var(--text);
    text-decoration: none;
    transform: translateY(-1px);
}

/* ==========================================================================
   6. CODE & PRISMJS (Fixed Background)
   ========================================================================== */

/* Inline Code */
:not(pre) > code {
    background: var(--code-inline-bg);
    padding: 0.2em 0.4em;
    border-radius: 6px;
    font-size: 0.85em;
    font-family: var(--code-font);
}

/* Blocos de Código */
pre {
    padding: 1.25rem;
    border-radius: 10px;
    overflow-x: auto;
    margin-bottom: 2rem;
    background: var(--code-fixed-bg) !important;
    border: 1px solid var(--border);
}

code[class*="language-"],
pre[class*="language-"] {
    background: transparent !important;
    color: var(--code-fixed-text) !important;
    font-family: var(--code-font) !important;
    font-size: 0.9em;
    line-height: 1.5;
    text-shadow: none !important; /* Fix do halo branco[cite: 1] */
}

pre::-webkit-scrollbar {
    height: 8px;
}
pre::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 10px;
}

/* ==========================================================================
   7. NAVIGATION, CARDS & FOOTER
   ========================================================================== */
header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 40px 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.site-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text) !important;
}

.nav-links a {
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 20px;
}

.article-card {
    padding: 32px 0;
    border-bottom: 1px solid var(--border);
}

.article-card h2 {
    margin: 0 0 8px;
    border: none;
}

footer {
    margin-top: 80px;
    padding: 40px 0;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}
