/* ========================================
   CSS Variables for Light/Dark Theme
   ======================================== */

:root {
    /* Light theme (default) */
    --bg-color: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-color: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --accent-color: #2d8659;
    --accent-hover: #236b47;
    --link-color: #2d8659;
    --link-hover: #236b47;
    --shadow: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    /* Dark theme */
    --bg-color: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-color: #e0e0e0;
    --text-secondary: #a0a0a0;
    --border-color: #404040;
    --accent-color: #3fb878;
    --accent-hover: #4dd68d;
    --link-color: #3fb878;
    --link-hover: #4dd68d;
    --shadow: rgba(0, 0, 0, 0.3);
}

/* ========================================
   Base Styles
   ======================================== */

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

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition:
        background-color 0.3s ease,
        color 0.3s ease;
}

/* ========================================
   Container & Layout
   ======================================== */

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

/* ========================================
   Header
   ======================================== */

header {
    background-color: var(--bg-secondary);
    border-bottom: 2px solid var(--accent-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.site-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.site-title a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-title a:hover {
    color: var(--accent-color);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ========================================
   Theme Toggle
   ======================================== */

.theme-toggle {
    background: transparent;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    font-size: 1.25rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    border-color: var(--accent-color);
    transform: scale(1.05);
}

.theme-icon {
    display: block;
    line-height: 1;
}

/* ========================================
   Language Switcher
   ======================================== */

.language-switcher {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.lang-link {
    color: var(--link-color);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.lang-link:hover {
    background-color: var(--bg-secondary);
    color: var(--link-hover);
}

.lang-current {
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
}

/* ========================================
   Navigation
   ======================================== */

nav {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

nav a:hover {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

/* ========================================
   Translation Notice
   ======================================== */

.translation-notice {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.translation-notice a {
    color: var(--link-color);
    font-weight: 600;
    text-decoration: none;
}

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

/* ========================================
   Main Content
   ======================================== */

main {
    min-height: calc(100vh - 250px);
}

main.container {
    padding: 2rem 20px 3rem;
}

/* ========================================
   Typography
   ======================================== */

h1 {
    font-size: 2.25rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    line-height: 1.2;
}

h2 {
    font-size: 1.75rem;
    margin: 1.5rem 0 0.75rem;
    color: var(--text-color);
}

h3 {
    font-size: 1.35rem;
    margin: 1.25rem 0 0.5rem;
    color: var(--text-color);
}

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

a {
    color: var(--link-color);
    transition: color 0.2s ease;
}

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

/* ========================================
   Page Content
   ======================================== */

.page {
    max-width: 800px;
}

.page-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

/* ========================================
   Blog Index
   ======================================== */

.blog-index h1 {
    margin-bottom: 0.5rem;
}

.blog-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.rss-link {
    margin-bottom: 2rem;
}

.feed-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--accent-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.95rem;
    transition: background-color 0.2s ease;
}

.feed-link:hover {
    background-color: var(--accent-hover);
}

.blog-posts {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.blog-post-preview {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 2rem;
}

.blog-post-preview:last-child {
    border-bottom: none;
}

.blog-post-preview h2 {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
}

.blog-post-preview h2 a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.blog-post-preview h2 a:hover {
    color: var(--accent-color);
}

.post-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.post-meta time,
.post-meta .author {
    display: flex;
    align-items: center;
}

.post-summary {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.read-more {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.read-more:hover {
    color: var(--link-hover);
}

/* ========================================
   Blog Post
   ======================================== */

.blog-post {
    max-width: 800px;
}

.post-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.post-header h1 {
    margin-bottom: 0.75rem;
}

.post-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.tag {
    background-color: var(--bg-secondary);
    color: var(--text-color);
    padding: 0.25rem 0.75rem;
    border-radius: 16px;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
}

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

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.post-content img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px var(--shadow);
}

/* Bildgrößen-Klassen */
.post-content img.img-small {
    max-width: 400px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.post-content img.img-medium {
    max-width: 600px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.post-content img.img-large {
    max-width: 100%;
}

/* Bilder nebeneinander (side-by-side) */
.post-content img.img-side-by-side {
    display: inline-block;
    max-width: 48%;
    margin: 1.5rem 1% 1.5rem 0;
    vertical-align: top;
}

@media (max-width: 768px) {
    .post-content img.img-side-by-side {
        display: block;
        max-width: 400px;
        margin: 1.5rem auto;
    }
}

/* Lightbox für Vollbildansicht */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    cursor: zoom-out;
}

.lightbox.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 4px;
    cursor: default;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
}

.lightbox-close:hover {
    color: var(--accent-color);
}

.post-content code {
    background-color: var(--bg-secondary);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    font-size: 0.9em;
}

.post-content pre {
    background-color: var(--bg-secondary);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid var(--border-color);
}

.post-content pre code {
    background-color: transparent;
    padding: 0;
}

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

.post-content ul,
.post-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

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

.post-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.back-link {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.back-link:hover {
    color: var(--link-hover);
}

/* ========================================
   Pagination
   ======================================== */

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination a {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.pagination a:hover {
    border-color: var(--accent-color);
    color: var(--link-hover);
    background-color: var(--bg-secondary);
}

.page-info {
    color: var(--text-secondary);
}

/* ========================================
   Footer
   ======================================== */

footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
    transition: background-color 0.3s ease;
}

footer p {
    color: var(--text-secondary);
    margin: 0;
}

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

footer a:hover {
    color: var(--accent-color);
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .site-title {
        font-size: 1.5rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    nav {
        gap: 1rem;
    }

    .post-content,
    .page-content {
        font-size: 1rem;
    }

    .pagination {
        justify-content: center;
    }

    .pagination .page-info {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .header-controls {
        flex-direction: row;
        gap: 0.75rem;
    }

    .theme-toggle {
        padding: 0.4rem 0.6rem;
    }

    main.container {
        padding: 1.5rem 15px 2rem;
    }
}
