/* =============================================
 *   OPTIMIZED CSS FILE - LIGHT & DARK MODE
 *   ============================================= */

/* 1. VARIABLES & RESET */
:root {
    /* --- LIGHT MODE (Default) --- */
    --primary-blue: #3498db;
    --primary-dark: #2980b9;

    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --text-light-grey: #bdc3c7;

    --bg-body: #f4f5f7;           /* Main Background */
    --bg-site: #ffffff;           /* Page/Card Background */
    --bg-blue: #ebf5fb;

    --header-bg: #ffffff;
    --footer-bg: #222222;

    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --border-color: #eaeaea;
    --white: #ffffff;

    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    /* --- DARK MODE --- */
    --primary-blue: #3498db;
    --primary-dark: #2587ba;

    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --text-light-grey: #6b6b6b;

    --bg-body: #18191a;
    --bg-site: #202124;
    --bg-blue: #35363a;

    --header-bg: #2c2e31;
    --footer-bg: #121212;

    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --border-color: #36393f;
}

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

html, body {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

code {
    background: #f4f4f4;
    border-left: 4px solid var(--primary-blue);
    color: #666;
    border-radius: 8px;
    page-break-inside: avoid;
    font-family: monospace;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 1.6em;
    max-width: 100%;
    overflow: auto;
    padding: 1em 1.5em;
    display: block;
    word-wrap: break-word;
}

[data-theme="dark"] code {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
}

/* 2. HEADER & NAVIGATION */
.main-header {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    letter-spacing: -0.5px;
    color: var(--text-main);
    z-index: 1001;
}

.blue-text {
    color: var(--primary-blue);
}

.desktop-nav {
    margin-left: auto; /* Schiebt Nav und Button nach rechts */
}

.desktop-nav a {
    margin-left: 20px;
    font-size: 15px;
    color: var(--text-muted);
}

.desktop-nav a.active, .desktop-nav a:hover {
    color: var(--primary-blue);
}

/* Theme Switcher - Fixiert unten rechts wie im Original */
.theme-switcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--bg-site);
    color: var(--text-muted);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.theme-switcher:hover {
    color: var(--primary-blue);
    background-color: var(--bg-blue);
    transform: rotate(180deg);
}

.icon.sun-icon, .icon.moon-icon {
    display: block;
    width: 24px;
    height: 24px;
}

/* 3. HERO SECTION (Fixiertes Layout) */
.hero-feature {
    display: flex;
    gap: 30px;
    margin-top: 40px;
    background-color: var(--bg-site);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.hero-image {
    flex: 1.5;
    min-width: 0;
}

.hero-image img {
    width: 100%;
    height: auto;
    max-width: 600px;
    border-radius: 8px;
    display: block;
}

.hero-content {
    flex: 1.5;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.story-tag {
    background: var(--bg-blue);
    color: var(--primary-blue);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
    width: fit-content;
    margin-bottom: 15px;
}

.hero-content h1 {
    font-size: 32px;
    color: #1e272e;
    margin-bottom: 15px;
    line-height: 1.2;
}

[data-theme="dark"] .hero-content h1 {
    color: #ffffff;
}

.hero-content h1:hover {
    color: var(--primary-blue);
}

.hero-content p {
    margin-bottom: 20px;
    font-size: 16px;
}

.meta {
    font-size: 14px;
    color: var(--text-light-grey);
    margin-bottom: 30px;
}

.btn-main {
    background-color: var(--primary-blue);
    color: var(--white);
    padding: 14px 32px;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    width: fit-content;
    transition: var(--transition);
}

.btn-main:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

/* 4. LAYOUT & GRID */
.main-layout-grid {
    display: flex;
    gap: 30px;
    margin-top: 50px;
}

.content-column {
    flex: 2.5;
}

.sidebar {
    flex: 1;
}

.section-title {
    font-size: 28px;
    color: #1e272e;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

@media (min-width: 769px) {
    .sidebar {
        position: sticky;
        top: 100px;
        align-self: start;
    }
}

/* 5. CARDS & POSTS (Fixierte Hover-Farbe) */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.post-card {
    background-color: var(--bg-site);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.post-card img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    display: block;
}

.tags-wrapper {
    margin-top: 20px;
    padding-left: 10px;
}

.primary-tag {
    background-color: var(--primary-blue);
    color: var(--white);
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 13px;
    display: inline-block;
    margin-bottom: 10px;
}

.sub-tag {
    background-color: var(--bg-blue);
    color: var(--text-muted);
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    margin-right: 6px;
}

.more-tags {
    background-color: #f0f2f5;
    color: #5e6c7d;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.post-card h3 {
    font-size: 19px;
    line-height: 1.4;
    color: #1e272e;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding: 0 15px;
}

/* Fix: Hover bleibt immer Blau */
.post-card h3:hover {
    color: var(--primary-blue) !important;
}

[data-theme="dark"] .post-card h3 {
    color: #ffffff;
}

.post-card p {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding: 0 15px;
}

[data-theme="dark"] .post-card p,
[data-theme="dark"] .meta,
[data-theme="dark"] .post-meta,
[data-theme="dark"] .article-body p {
    color: var(--text-muted);
}

.post-meta {
    font-size: 13px;
    color: var(--text-light-grey);
    margin-top: auto;
    padding: 0 15px 15px 15px;
}

/* 6. SIDEBAR COMPONENTS */
.info-section {
    background-color: transparent;
    padding: 0;
    margin-bottom: 30px;
}

.latest-updates-section h3, .side-block h3 {
    font-size: 16px;
    color: #1e272e;
    margin-bottom: 18px;
    padding-left: 12px;
    border-left: 4px solid var(--primary-blue);
    text-transform: uppercase;
    font-weight: 600;
}

[data-theme="dark"] .latest-updates-section h3,
[data-theme="dark"] .side-block h3 {
    color: #ffffff;
}

.side-block {
    background-color: var(--bg-site);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.category-link:hover {
    color: var(--primary-blue);
}

.category-link:last-child {
    border-bottom: none;
}

.count {
    background-color: #eef4f9;
    color: var(--primary-blue);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

[data-theme="dark"] .count {
    background-color: var(--bg-blue);
    color: #fff;
}

.avatar-wrapper {
    text-align: center;
    margin-bottom: 20px;
}

.avatar-wrapper img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.about-content {
    font-size: 14px;
}

.about-content p {
    margin-bottom: 12px;
}

/* 7. FOOTER */
.main-footer {
    background-color: var(--footer-bg);
    color: white;
    padding: 40px 0;
    margin-top: 80px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    padding-bottom: 25px;
    margin-bottom: 20px;
}

.footer-left h4 {
    color: white;
    margin-bottom: 10px;
    font-size: 18px;
}

.footer-left p {
    color: #bdc3c7;
    font-size: 14px;
}

.footer-right h5 {
    color: white;
    margin-bottom: 15px;
    font-size: 16px;
}

.footer-right ul {
    list-style: none;
}

.footer-right li {
    margin-bottom: 8px;
}

.footer-right a {
    color: #bdc3c7;
}

.footer-right a:hover {
    color: white;
}

.copyright {
    text-align: center;
    padding-top: 20px;
    font-size: 13px;
    color: #666;
    border-top: 1px solid #333;
}

/* 8. ARTICLE VIEW */
.article-frame {
    background-color: var(--bg-site);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 40px;
    margin-bottom: 40px;
}

.post-main-image {
    margin-bottom: 30px;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.post-main-image img {
    width: 100%;
    height: auto;
    display: block;
}

.article-body {
    font-size: 18px;
    line-height: 1.75;
    color: var(--text-main);
}

[data-theme="dark"] .article-body {
    color: var(--text-muted);
}

.article-body h2 {
    margin-top: 40px;
    margin-bottom: 20px;
    font-size: 24px;
    color: var(--text-main);
}

[data-theme="dark"] .article-body h2 {
    color: #ffffff;
}

.article-body p {
    margin-bottom: 25px;
}

.article-body p img {
    margin-right: 5px;
    width: 200px;
}

@media (max-width: 768px) {
    .article-body p img {
        width: 250px;
        margin-bottom: 5px;
    }
}

.article-body ul li {
    margin-left: 30px;
}

.article-title {
    font-size: 36px;
}

.post-meta {
    margin-bottom: 20px;
    display: block;
}

.meta-label {
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    font-weight: 600;
    display: block;
}

.article-meta-details {
    color: #95a5a6;
    font-size: 14px;
    margin-bottom: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}

[data-theme="dark"] .article-meta-details {
    color: #aaa;
    border-top-color: #36393f;
}

.tags-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.post-tag-pill {
    background-color: var(--bg-blue);
    color: var(--primary-blue);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.article-body blockquote {
    border-left: 4px solid var(--primary-blue);
    background: transparent;
    padding: 30px;
    font-style: italic;
    margin: 40px 0;
    border-radius: 8px;
    color: var(--text-main);
}

[data-theme="dark"] .article-body blockquote {
    color: #ccc;
    background-color: rgba(255,255,255, 0.03);
}

/* 9. PAGINATION */
.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-site);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    transition: var(--transition);
    border: 1px solid transparent;
}

.page-numbers:hover:not(.current):not(.dots) {
    background: var(--bg-blue);
    color: var(--primary-blue);
    border-color: var(--primary-blue);
    transform: translateY(-2px);
}

.page-numbers.current {
    background-color: var(--primary-blue);
    color: var(--white);
    border-radius: 8px;
    font-weight: 600;
    width: fit-content;
}

.page-numbers.prev, .page-numbers.next {
    border: 1px solid #eee;
}

[data-theme="dark"] .page-numbers.prev,
[data-theme="dark"] .page-numbers.next {
    border-color: var(--border-color);
    color: #dcdcdc;
}

/* 10. LIGHTBOX (Fixed Version) */
#lightbox-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-site);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow-y: auto;
}

#lightbox-container:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.hidden {
    display: none !important;
}

.lightbox-content-wrap {
    position: relative;
    width: 100%;
    max-width: 90vw;
    height: 100%;
    margin: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.lightbox-image-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 2;
}

#lightbox-img {
    max-width: 100%;
    height: auto;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.lightbox-close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    font-size: 36px;
    color: var(--text-main) !important;
    cursor: pointer;
    z-index: 100;
    line-height: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.lightbox-close-btn:hover {
    background-color: var(--primary-blue);
}

.lightbox-nav-arrows {
    position: absolute;
    top: 50%;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    pointer-events: auto;
    z-index: 10;
}

.lightbox-prev-btn,
.lightbox-next-btn {
    background-color: rgba(0, 0, 0, 0.5);
    color: white !important;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.lightbox-prev-btn:hover,
.lightbox-next-btn:hover {
    background-color: var(--primary-blue);
}

.lightbox-prev-btn.disabled,
.lightbox-next-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed !important;
}

.lightbox-caption {
    text-align: center;
    margin-top: 15px;
    font-size: 16px;
    color: var(--text-muted);
    padding: 0 20px;
}

/* Theme Adjustments for Lightbox */
[data-theme="dark"] #lightbox-container {
    background-color: var(--bg-body);
}

[data-theme="light"] #lightbox-container {
    background-color: rgba(255, 255, 255, 0.98);
}

/* 11. EXTERNAL LINKS */
a:not([href*="ruckhofer.info"]):not([href^="#"]):not([href^="/"]){
    color: var(--primary-blue);
}
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;
}

/* 12. 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');
}

/* 13. RESPONSIVE DESIGN */
@media (max-width: 992px) {
    .hero-feature {
        flex-direction: column;
        padding: 20px;
        margin-top: 30px;
    }

    .hero-image img {
        max-width: 100%;
        max-height: 400px;
        width: auto;
        margin-bottom: 20px;
        object-fit: cover;
    }

    .hero-content h1 {
        font-size: 24px;
        word-wrap: break-word;
    }

    .story-tag {
        font-size: 0.7rem;
        padding: 4px 12px;
    }

    .btn-main {
        padding: 12px 24px;
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .main-header .container {
        flex-direction: column;
        gap: 15px;
    }

    .desktop-nav {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }

    .desktop-nav a {
        margin-left: 0;
        margin-bottom: 8px;
    }

    .logo {
        font-size: 20px;
    }

    .main-layout-grid {
        flex-direction: column;
    }

    .content-column, .sidebar {
        width: 100%;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .post-card img {
        height: 200px;
    }

    .hero-content h1 {
        font-size: 22px;
    }

    .article-title {
        font-size: 24px;
        line-height: 1.3;
    }

    #lightbox-container {
        overflow-y: scroll;
        background-color: var(--bg-body);
    }

    .lightbox-nav-arrows {
        top: auto;
        bottom: 100px;
        left: 20px;
        right: 20px;
        width: auto;
        display: flex;
    }
}