/* =============================================================
   Matrix Theme — Hauptstylesheet
   Architektur: CSS Custom Properties + feste data-theme="matrix"
   Keine externen CSS-Frameworks, alles selbst geschrieben
   ============================================================= */

/* ---- CSS Custom Properties (Farbpalette) ---- */
:root {
    --bg:           #000000;
    --content-bg:   rgba(0, 0, 0, 0.82);
    --nav-bg:       rgba(0, 0, 0, 0.90);
    --text:         #c0c0c0;
    --text-bright:  #e0e0e0;
    --headline:     #00ff41;
    --link:         #00ff41;
    --link-hover:   #33ff77;
    --code-bg:      #0a0a0a;
    --code-text:    #00ff41;
    --border:       #1a3a1a;
    --border-hover: #00ff41;
    --accent:       #00ff41;
    --muted:        #555555;
    --font-mono:    'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    --font-body:    'Inter', system-ui, -apple-system, sans-serif;
    --max-width:    760px;
}

/* ---- Reset & Box Model ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ---- Basis-Layout ---- */
html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.75;
    min-height: 100vh;
}

/* ---- Canvas: liegt fix hinter allem anderen ---- */
/*
    z-index: 1 → unter dem Content
    pointer-events: none → Klicks gehen durch den Canvas hindurch
    position: fixed → bleibt beim Scrollen an Ort und Stelle
*/
#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    display: block;
}

/* ---- Navigation ---- */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100; /* Weit über dem Canvas (z-index: 1) */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 2rem;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.nav-logo {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    color: var(--headline);
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: color 0.2s;
}
.nav-logo:hover { color: var(--link-hover); }

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--link);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    letter-spacing: 0.03em;
    transition: color 0.2s;
}
.nav-links a:hover { color: var(--link-hover); }

/* ---- Content-Wrapper: der "Kasten" über dem Canvas ---- */
/*
    z-index: 10 → über dem Canvas (z-index: 1)
    backdrop-filter → leichter Blur-Effekt hinter dem Content
    Der schwarze RGBA-Hintergrund macht den Text trotz Animation lesbar
*/
.content-wrapper {
    position: relative;
    z-index: 10;
    max-width: var(--max-width);
    margin: 5.5rem auto 4rem;
    padding: 2rem 2.5rem;
    background: var(--content-bg);
    border: 1px solid var(--border);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* ---- Typografie ---- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-mono);
    color: var(--headline);
    line-height: 1.3;
    margin: 2rem 0 0.75rem;
}

h1 { font-size: 1.875rem; }
h2 {
    font-size: 1.375rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.4rem;
}
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

p {
    margin-bottom: 1.25rem;
    color: var(--text);
}

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

/* ---- Page / Post Titles ---- */
.page-title,
.post-title {
    font-size: 1.75rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
}

/* ---- Post-Meta (Datum, Tags) ---- */
.post-meta {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.post-date { color: var(--muted); }

.post-tag {
    color: var(--accent);
    font-size: 0.75rem;
}
.post-tag:hover { color: var(--link-hover); }

/* ---- Post-Karten (Index / Tag-Seiten) ---- */
.post-card {
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: border-color 0.25s;
}
.post-card:hover { border-color: var(--border-hover); }
.post-card h2 {
    border: none;
    margin-top: 0.25rem;
    font-size: 1.2rem;
}
.post-card h2 a { color: var(--headline); }
.post-card h2 a:hover { color: var(--link-hover); }

.post-excerpt {
    color: var(--text);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.read-more {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* ---- Post-Content (der eigentliche Artikel-Inhalt) ---- */
.post-content,
.page-content {
    margin-top: 1.5rem;
}

.post-content img,
.page-content img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    display: block;
    margin: 1.5rem auto;
}

.post-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--muted);
    font-style: italic;
}

.post-content ul,
.post-content ol {
    margin: 1rem 0 1.25rem 1.5rem;
}

.post-content li { margin-bottom: 0.3rem; }

.post-feature-image {
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

/* ---- Code ---- */
code {
    background: var(--code-bg);
    color: var(--code-text);
    font-family: var(--font-mono);
    font-size: 0.875em;
    padding: 0.1em 0.4em;
    border: 1px solid var(--border);
}

pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    padding: 1.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-size: 0.875rem;
}

pre code {
    padding: 0;
    border: none;
    background: transparent;
}

/* ---- Post-Footer (Zurück-Link) ---- */
.post-footer,
.post-full footer {
    margin-top: 2.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.btn-back {
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--muted);
}

.btn-prev,
.btn-next {
    font-family: var(--font-mono);
}

/* ---- Error-Seite ---- */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.error-content { text-align: center; }

.error-code {
    font-size: 2.5rem;
    color: #ff4141;
    margin-bottom: 1rem;
}

.error-message {
    color: var(--muted);
    margin-bottom: 2rem;
}

/* ---- Tag-Header ---- */
.tag-header { margin-bottom: 2rem; }
.tag-description {
    color: var(--muted);
    margin-top: 0.5rem;
    font-size: 0.95rem;
}

/* ---- Footer ---- */
.site-footer {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 1.5rem 2rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: var(--nav-bg);
}

.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--link-hover); }

/* ---- Responsive: Mobile ---- */
@media (max-width: 640px) {
    .content-wrapper {
        margin-top: 4.5rem;
        margin-left: 0.5rem;
        margin-right: 0.5rem;
        padding: 1.25rem 1rem;
    }

    .nav-bar { padding: 0.75rem 1rem; }
    .nav-links { gap: 1rem; }
    .nav-links a { font-size: 0.8rem; }

    h1, .page-title, .post-title { font-size: 1.375rem; }
    h2 { font-size: 1.125rem; }
}

/* ---- Barrierefreiheit: prefers-reduced-motion ---- */
/*
    Wenn der Nutzer "Animationen reduzieren" aktiviert hat:
    Canvas ausblenden statt Animation anhalten — sauberer visueller Effekt.
    Die JS-Animation prüft dies zusätzlich und startet gar nicht erst.
*/
@media (prefers-reduced-motion: reduce) {
    #matrix-canvas { display: none; }
}
