/* ==========================================================================
   POST-SINGLE.CSS - Styles für einzelne Blogbeiträge
   - Artikel-Header
   - Inhalt / Typografie
   - Code-Blöcke
   - Bilder
   - Zurück-Button
   ========================================================================== */

/* --------------------------------------------------------------------------
   Artikel-Header
   -------------------------------------------------------------------------- */
.article-header {
    padding: 8rem 2rem 4rem;
    text-align: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--light);
}

.article-header .container {
    max-width: 800px;
}

.article-header h1 {
    font-size: var(--font-2xl);
    margin-bottom: 1.5rem;
    line-height: 1.3;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Meta-Bereich im Header */
.article-header .meta {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    opacity: 0.85;
    font-size: var(--font-base);
    margin-bottom: 1.5rem;
}

.article-header .meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Tags im Header */
.article-header .tags {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.article-header .tag {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.4rem 1.1rem;
    border-radius: var(--radius-xl);
    font-size: var(--font-sm);
    transition: all var(--transition-fast);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.article-header .tag:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   Artikel-Inhalt
   -------------------------------------------------------------------------- */
.article-content {
    background: var(--bg-dark);
    color: var(--light);
    padding: 4rem 2rem;
}

.article-content .container {
    max-width: 800px;
    background: rgba(255, 255, 255, 0.05);
    padding: 3rem;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
}

/* Typografie */
.article-content p {
    margin-bottom: 1.5rem;
    font-size: var(--font-md);
    line-height: 1.85;
}

.article-content h2 {
    font-size: var(--font-xl);
    margin: 3rem 0 1.5rem;
    color: var(--accent);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(0, 168, 232, 0.3);
}

.article-content h2:first-child {
    margin-top: 0;
}

.article-content h3 {
    font-size: var(--font-lg);
    margin: 2rem 0 1rem;
    color: var(--light);
}

.article-content h4 {
    font-size: 1.1rem;
    margin: 1.5rem 0 0.75rem;
    color: var(--accent);
    opacity: 0.9;
}

/* Links */
.article-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition-fast);
}

.article-content a:hover {
    border-bottom-color: var(--accent);
    text-decoration: none;
}

/* Listen */
.article-content ul,
.article-content ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.article-content li {
    margin-bottom: 0.8rem;
    line-height: 1.7;
}

.article-content li::marker {
    color: var(--accent);
}

/* Bilder */
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin: 2rem 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.article-content figure {
    margin: 2rem 0;
}

.article-content figcaption {
    text-align: center;
    font-size: var(--font-sm);
    opacity: 0.7;
    margin-top: 0.75rem;
    font-style: italic;
}

/* Zitate */
.article-content blockquote {
    border-left: 4px solid var(--accent);
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    background: rgba(0, 168, 232, 0.1);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.article-content blockquote p {
    margin-bottom: 0;
}

/* Horizontale Linie */
.article-content hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    margin: 3rem 0;
}

/* Tabellen */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: var(--font-sm);
}

.article-content th,
.article-content td {
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
}

.article-content th {
    background: rgba(0, 168, 232, 0.2);
    color: var(--accent);
    font-weight: 600;
}

.article-content tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

/* --------------------------------------------------------------------------
   Code-Blöcke (mit Mobile-Scrolling)
   -------------------------------------------------------------------------- */

/* Hugo Highlight Wrapper - KRITISCH für Mobile-Scrolling */
.article-content .highlight {
    position: relative;
    margin: 1.5rem 0;
    max-width: 100%;
    overflow: hidden;
}

.article-content pre {
    background: rgba(0, 0, 0, 0.4);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* Horizontales Scrolling */
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    /* Smooth Scrolling auf iOS */
    -webkit-overflow-scrolling: touch;
    /* Scrollbar-Styling */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Webkit Scrollbar (Chrome, Safari, Edge) */
.article-content pre::-webkit-scrollbar {
    height: 8px;
}

.article-content pre::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.article-content pre::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.article-content pre::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.article-content code {
    font-family: 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.9rem;
}

/* Code im Pre-Block */
.article-content pre code {
    color: #abb2bf;
    background: none;
    padding: 0;
    display: block;
    width: max-content;
    min-width: 100%;
}

/* Inline-Code */
.article-content p code,
.article-content li code {
    background: rgba(0, 0, 0, 0.35);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: #e06c75;
    word-break: break-word;
}

/* --------------------------------------------------------------------------
   Artikel-Footer / Zurück-Button
   -------------------------------------------------------------------------- */
.article-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.article-footer .back-to-blog {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    padding: 0.8rem 1.5rem;
    background: rgba(0, 168, 232, 0.1);
    border: 2px solid var(--accent);
    border-radius: var(--radius-full);
    transition: all var(--transition-normal);
}

.article-footer .back-to-blog:hover {
    background: var(--accent);
    color: white;
    transform: translateX(-5px);
}

.article-footer .back-to-blog::before {
    content: '\2190';
    transition: transform var(--transition-fast);
}

.article-footer .back-to-blog:hover::before {
    transform: translateX(-4px);
}

/* Autor-Info (optional für später) */
.author-box {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    margin-top: 2rem;
}

.author-box img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
}

.author-box .author-info h4 {
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.author-box .author-info p {
    margin: 0;
    font-size: var(--font-sm);
    opacity: 0.8;
}

/* --------------------------------------------------------------------------
   Verwandte Artikel (optional für später)
   -------------------------------------------------------------------------- */
.related-posts {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.related-posts h3 {
    margin-bottom: 1.5rem;
    color: var(--light);
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.related-post-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.related-post-card:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.08);
}

.related-post-card h4 {
    color: var(--accent);
    margin-bottom: 0.5rem;
    font-size: var(--font-base);
}

.related-post-card h4 a {
    color: inherit;
}

.related-post-card .date {
    font-size: var(--font-xs);
    opacity: 0.7;
}

/* --------------------------------------------------------------------------
   Responsive Design
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .article-header {
        padding: 6rem 1.5rem 3rem;
    }

    .article-header h1 {
        font-size: var(--font-xl);
    }

    .article-header .meta {
        flex-direction: column;
        gap: 0.75rem;
    }

    .article-content {
        padding: 2rem 1rem;
    }

    .article-content .container {
        padding: 1.5rem;
    }

    .article-content p,
    .article-content li {
        font-size: var(--font-base);
    }

    .article-content h2 {
        font-size: var(--font-lg);
    }

    /* Code-Blöcke auf Mobile - Highlight Wrapper */
    .article-content .highlight {
        margin-left: -1.5rem;
        margin-right: -1.5rem;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .article-content pre {
        padding: 1rem;
        font-size: 0.8rem;
        border-radius: 0;
        /* Scrollbar immer sichtbar auf Mobile */
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .article-content pre code {
        font-size: 0.75rem;
        display: block;
        width: max-content;
        min-width: 100%;
        white-space: pre;
    }

    .author-box {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .article-header h1 {
        font-size: 1.5rem;
    }

    .article-content .container {
        padding: 1.25rem;
    }

    .article-header .tags {
        gap: 0.4rem;
    }

    .article-header .tag {
        font-size: 0.8rem;
        padding: 0.3rem 0.8rem;
    }
}
