/* ================= CSS Variablen (Light & Dark Mode) ================= */
:root {
    --bg-color: #f8fafc;
    --text-color: #334155;
    --heading-color: #0f172a;
    --card-bg: #ffffff;
    --primary-color: #3498db;
    --primary-hover: #0369a1;
    --border-color: #e2e8f0;
    --hero-bg: #3498db;
    --bg-blue: #ebf5fb;
    --hero-text: #ffffff;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --footer-bg: #222222;
    --footer-text-color: #f8fafc;
    --white: #fff;
}

html.dark-mode {
    --bg-color: #18191a;
    --text-color: #cbd5e1;
    --heading-color: #f1f5f9;
    --card-bg: #202124;
    --primary-color: #38bdf8;
    --primary-hover: #7dd3fc;
    --border-color: #334155;
    --hero-bg: #0f172a;
    --hero-text: #f1f5f9;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* ================= Reset & Basis ================= */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background-color: var(--bg-color); color: var(--text-color); line-height: 1.6; transition: background-color 0.3s, color 0.3s; }
a { color: var(--primary-color); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-hover); }
h1, h2, h3, h4 { color: var(--heading-color); margin-bottom: 1rem; line-height: 1.2; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ================= Header ================= */
.site-header { background-color: var(--card-bg); border-bottom: 1px solid var(--border-color); padding: 15px 0; position: sticky; align-self: start; top: 0; z-index: 999; }
.header-flex { display: flex; justify-content: space-between; align-items: center; }
.blue-text { color: var(--primary-color); }
.black-text { color: var(--heading-color); }
.logo { font-size: 24px; font-weight: bold; letter-spacing: -0.5px; z-index: 1001; }

/* ================= Header Navigation ================= */
.main-nav { margin-left: auto; }
.main-nav ul { list-style: none; display: flex; gap: 25px; margin: 0; padding: 0; align-items: center; }
.main-nav a { color: var(--text-color); font-weight: 600; font-size: 1rem; }
.main-nav a:hover { color: var(--primary-color); }

/* ================= Floating Theme Switcher ================= */
.theme-switcher { position: fixed; bottom: 30px; right: 30px; z-index: 9999; background-color: var(--card-bg); border: 1px solid var(--border-color); border-radius: 50%; width: 55px; height: 55px; display: flex; align-items: center; justify-content: center; box-shadow: var(--card-shadow); cursor: pointer; color: var(--text-color); font-size: 1.5rem; transition: background-color 0.3s, box-shadow 0.2s; padding: 0; line-height: 0; }
.theme-switcher:hover { transform: none; box-shadow: var(--card-shadow); }
.theme-switcher .icon { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.theme-switcher svg { color: var(--text-color); display: block; }

/* ================= Hero Kachel ================= */
.hero-tile-section { grid-column: 1 / -1; margin-bottom: 0; }
.hero-tile { background-color: var(--card-bg); border-radius: 12px; overflow: hidden; box-shadow: var(--card-shadow); border: 1px solid var(--border-color); display: flex; flex-direction: column; transition: transform 0.2s; }
.hero-tile:hover, .blog-card:hover { transform: translateY(-5px); }
.hero-image-link { flex: 0 0 58%; display: block; min-height: 300px; }
.hero-image { width: 100%; height: 100%; min-height: 300px; background-size: cover; background-position: center; }
.hero-content { flex: 0 0 42%; padding: 40px; display: flex; flex-direction: column; justify-content: center; min-width: 0; overflow-wrap: break-word; hyphens: auto; }
.hero-content h1 { font-size: 1.8rem; margin: 15px 0; line-height: 1.2; }
.hero-content h1 a { color: var(--primary-color); }
.hero-content h1 a:hover { color: var(--primary-hover); }
.hero-content p, .card-content p { font-size: 1.1rem; margin-bottom: 25px; color: var(--text-color); }
.hero-footer { margin-top: auto; }

/* ================= Main Layout ================= */
.content { display: contents; }
.main-layout { display: grid; grid-template-columns: 3fr 1fr; gap: 40px; margin-top: 40px; margin-bottom: 60px; grid-auto-flow: dense; }
.blog-grid, .single-page, .pagination { grid-column: 1 / 2; }
.sidebar { grid-column: 2 / 3; grid-row: span 2; position: sticky; top: 110px; align-self: start; }

/* ================= Blog Grid ================= */
.blog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.blog-card { background: var(--card-bg); border-radius: 8px; overflow: hidden; box-shadow: var(--card-shadow); display: flex; flex-direction: column; border: 1px solid var(--border-color); transition: transform 0.2s; }
.card-image { height: 180px; background-size: cover; background-position: center; }
.fallback-image { background-color: var(--primary-color); opacity: 0.1; }
.card-content { padding: 20px; display: flex; flex-direction: column; flex-grow: 1; }
.card-content h2 { font-size: 1.2rem; margin-bottom: 10px; }
.category-badge, .category-count { display: inline-block; font-size: 0.75rem; text-transform: uppercase; background: var(--primary-color); color: #fff; padding: 2px 8px; border-radius: 4px; }
.category-badge { margin-bottom: 10px; align-self: flex-start; }
.description { font-size: 0.9rem; flex-grow: 1; margin-bottom: 15px; }
.card-footer { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; border-top: 1px solid var(--border-color); padding-top: 15px; }
.read-more { font-weight: 600; }

/* ================= Sidebar & Kategorien ================= */
.widget { background: var(--card-bg); padding: 25px; border-radius: 8px; box-shadow: var(--card-shadow); margin-bottom: 30px; border: 1px solid var(--border-color); }
.widget h3 { font-size: 1.1rem; border-bottom: 2px solid var(--primary-color); padding-bottom: 10px; margin-bottom: 15px; }
.about-content { text-align: center; }
.about-content img { width: 100px; height: 100px; border-radius: 50%; margin-bottom: 15px; }
.about-content p { font-size: 0.9rem; text-align: left; }
.search-widget form { display: flex; }
.search-widget input { flex-grow: 1; padding: 10px; border: 1px solid var(--border-color); border-radius: 4px 0 0 4px; background: var(--bg-color); color: var(--text-color); }
.search-widget button { padding: 10px 15px; background: var(--primary-color); color: #fff; border: none; border-radius: 0 4px 4px 0; cursor: pointer; }
.categories ul { list-style: none; }
.categories li { border-bottom: 1px solid var(--border-color); }
.categories li:last-child { border-bottom: none; }
.categories a { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; color: var(--text-color); transition: all 0.2s; }
.categories a:hover { color: var(--primary-color); padding-left: 5px; }

/* ================= Single Page ================= */
.single-page { background: var(--card-bg); padding: 40px; border-radius: 8px; box-shadow: var(--card-shadow); border: 1px solid var(--border-color); min-width: 0; }
.page-header { text-align: left; margin-bottom: 30px; }
.page-header h1 { font-size: 2.2rem; }
.page-header .meta { color: #64748b; text-transform: uppercase; font-size: 12px; letter-spacing: 1px; font-weight: 600; display: block; }
.page-cover-image { width: 100%; object-fit: cover; border-radius: 8px; margin-bottom: 30px; }
.page-body img { max-width: 100%; height: auto; border-radius: 4px; }
.page-body p { margin-bottom: 1.5rem; }
.page-body ul li { margin-left: 30px; }
.page-body blockquote { border-left: 4px solid var(--primary-color); background: transparent; padding: 30px; font-style: italic; margin: 40px 0; border-radius: 8px; color: var(--text-color); }
html.dark-mode .page-body blockquote { color: #ccc; background-color: rgba(255, 255, 255, 0.03); }
hr { border: none; height: 1px; color: #eaeaea; background-color: #eaeaea; }

/* ================= Pagination & Footer ================= */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 40px 0; padding: 20px 0; }
.page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; padding: 0 14px; border-radius: 8px; background: var(--bg-color); color: var(--text-color); font-weight: 600; font-size: 0.9rem; box-shadow: 0 2px 5px rgba(0,0,0,0.03); transition: all 0.2s; border: 1px solid var(--primary-color); }
.page-numbers:hover:not(.current):not(.dots) { background: var(--bg-blue); color: var(--primary-color); border-color: var(--primary-color); transform: translateY(-2px); }
html.dark-mode .page-numbers:hover:not(.current):not(.dots) { background: var(--card-bg); color: var(--primary-color); border-color: var(--primary-color); transform: translateY(-2px); }
.page-numbers.current { background-color: var(--primary-color); color: var(--white); border-radius: 8px; font-weight: 600; width: fit-content; }
.page-numbers.prev, .page-numbers.next { border: 1px solid var(--primary-color); }
.site-footer { color: var(--footer-text-color); background: var(--footer-bg); border-top: 1px solid var(--border-color); padding: 20px 0; text-align: center; font-size: 0.9rem; margin-top: 40px; }

/* ================= Code View ================= */
code { display: block !important; max-width: 100% !important; overflow-x: auto !important; white-space: pre !important; word-break: normal !important; background: #f4f4f4; border-left: 4px solid var(--primary-color); color: #666; border-radius: 8px; page-break-inside: avoid; font-family: monospace; font-size: 15px; line-height: 1.6; margin-bottom: 1.6em; padding: 1em 1.5em; }
html.dark-mode code { background: rgba(255, 255, 255, 0.03) !important; color: #d4d4d4 !important; border-left: 4px solid var(--primary-color); }

/* ================= External Links ================= */
a:not([href*="ruckhofer.info"]):not([href^="#"]):not([href^="/"]) { color: var(--primary-color); }
a:not([href*="ruckhofer.info"]):not([href^="#"]):not([href^="/"]):not(.no-icon)::after { content: '\2197'; display: inline-block; margin-left: 5px; font-size: 0.9em; }
a:hover:not([href*="ruckhofer.info"]):not([href^="#"]):not([href^="/"]):not(.no-icon) { text-decoration: underline; }

/* ================= Media Queries ================= */
@media (min-width: 768px) {
    .hero-tile { flex-direction: row; align-items: stretch; }
}

@media (max-width: 1100px) { 
    .blog-grid { grid-template-columns: repeat(2, 1fr); } 
}

@media (max-width: 900px) { 
    .main-layout { grid-template-columns: 1fr; } 
    .hero-tile-section, .blog-grid, .single-page, .pagination, .sidebar { grid-column: 1 / -1; grid-row: auto; }
    .sidebar { position: static; }
}

@media (max-width: 768px) {
    .header-flex { flex-direction: column; gap: 15px; }
    .main-nav { margin-left: 0; }
    .main-nav ul { flex-wrap: wrap; justify-content: center; }
    .single-page { 
        padding: 20px;
    }
    .page-header h1 { 
        font-size: 1.6rem;
        word-wrap: break-word;
        hyphens: auto;
    }
    .page-body blockquote {
        padding: 15px;
        margin: 20px 0;
    }
}

@media (max-width: 600px) { 
    .blog-grid { grid-template-columns: 1fr; } 
}

/* ================= Font Faces ================= */
@font-face { font-display: swap; font-family: 'Inter'; font-style: normal; font-weight: 300; src: url('../css/inter-v20-latin-300.woff2') format('woff2'); }
@font-face { font-display: swap; font-family: 'Inter'; font-style: normal; font-weight: 400; src: url('../css/inter-v20-latin-regular.woff2') format('woff2'); }
@font-face { font-display: swap; font-family: 'Inter'; font-style: normal; font-weight: 600; src: url('../css/inter-v20-latin-600.woff2') format('woff2'); }
@font-face { font-display: swap; font-family: 'Inter'; font-style: normal; font-weight: 700; src: url('../css/inter-v20-latin-700.woff2') format('woff2'); }
