/* === Design Tokens === */
:root {
    --teal:        #00d4aa;
    --teal-2:      #00b4d8;
    --grad:        linear-gradient(135deg, #00d4aa, #d800b6);

    --bg:          #31145a;
    --bg-card:     #161b22;
    --bg-code:     #0d1117;
    --bg-header:   rgba(49, 20, 90, 0.88);

    --text-1:      #e6edf3;
    --text-2:      #8b949e;
    --border:      rgba(48, 54, 61, 0.8);
    --border-card: rgba(48, 54, 61, 0.5);

    --font-sans:    'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Montserrat', system-ui, sans-serif;
    --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

    /* Ghost Admin Custom Fonts */
    --gh-font-body:    var(--font-sans);
    --gh-font-heading: var(--font-heading);

    --radius:    10px;
    --radius-sm: 6px;
    --ease:      200ms ease;

    --w-content: 800px;
    --w-wide:    1200px;
}

[data-theme="light"] {
    --bg:          #f8fafc;
    --bg-card:     #ffffff;
    --bg-code:     #f1f5f9;
    --bg-header:   rgba(248, 250, 252, 0.88);
    --text-1:      #1a2332;
    --text-2:      #64748b;
    --border:      rgba(226, 232, 240, 0.8);
    --border-card: rgba(226, 232, 240, 0.5);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text-1);
    font-size: 1.0625rem;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    transition: background var(--ease), color var(--ease);
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal); text-decoration: none; transition: color var(--ease); }
a:hover { color: var(--teal-2); }

:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

::selection { background: rgba(0, 212, 170, 0.25); color: var(--text-1); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-code); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--teal); }

/* === Layout === */
.container {
    max-width: var(--w-wide);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.site-main { min-height: 60vh; }

/* === Header === */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: background var(--ease);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 64px;
}

.site-logo-link {
    flex-shrink: 0;
    color: var(--text-1);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
}

.site-logo-img { height: 36px; width: auto; }

.logo-bracket { color: var(--teal); }

.site-nav { flex: 1; display: flex; align-items: center; }

.site-nav .nav {
    display: flex;
    gap: 0.125rem;
    list-style: none;
    flex-wrap: wrap;
}

.site-nav .nav a {
    display: block;
    padding: 0.375rem 0.75rem;
    color: var(--text-2);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: color var(--ease), background var(--ease);
}

.site-nav .nav a:hover,
.site-nav .nav .nav-current a {
    color: var(--teal);
    background: rgba(0, 212, 170, 0.08);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.theme-toggle,
.mobile-menu-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    cursor: pointer;
    padding: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--ease), border-color var(--ease), background var(--ease);
}

.theme-toggle:hover,
.mobile-menu-toggle:hover {
    color: var(--teal);
    border-color: var(--teal);
    background: rgba(0, 212, 170, 0.08);
}

.icon-moon,
.icon-close { display: none; }

[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

.mobile-menu-toggle { display: none; }

/* Mobiles Menü offen */
.mobile-nav-open .icon-menu { display: none; }
.mobile-nav-open .icon-close { display: block; }

/* === Hero === */
.site-hero {
    padding: 5rem 0;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.site-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 1rem;
}

.grad-text {
    background: var(--grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.site-description {
    font-size: 1.125rem;
    color: var(--text-2);
    max-width: 580px;
    margin: 0 auto;
    line-height: 1.6;
}

/* === Post Feed Grid === */
.post-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 3rem 0;
}

/* === Post Card === */
.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--ease), border-color var(--ease), box-shadow var(--ease);
    position: relative;
}

.post-card:hover {
    transform: translateY(-4px);
    border-color: var(--teal);
    box-shadow: 0 8px 32px rgba(0, 212, 170, 0.1);
}

.post-card-image-link {
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.post-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 400ms ease;
}

.post-card:hover .post-card-image { transform: scale(1.04); }

.post-card-content {
    padding: 1.25rem 1.5rem 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.post-card-tags { display: flex; flex-wrap: wrap; gap: 0.375rem; }

.post-card-tag {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--teal);
    background: rgba(0, 212, 170, 0.08);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid rgba(0, 212, 170, 0.2);
    position: relative;
    z-index: 1;
}

.post-card-tag:hover { background: rgba(0, 212, 170, 0.15); color: var(--teal); }

.post-card-title {
    font-family: var(--font-heading);
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-1);
}

.post-card-title a { color: inherit; }
.post-card-title a::after { content: ''; position: absolute; inset: 0; }
.post-card:hover .post-card-title a { color: var(--teal); }

.post-card-excerpt {
    font-size: 0.9rem;
    color: var(--text-2);
    line-height: 1.65;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-2);
    margin-top: auto;
    padding-top: 0.375rem;
}

.post-card-meta-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-2);
    flex-shrink: 0;
}

/* === Single Post === */
.post-full {
    max-width: var(--w-content);
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
}

.post-full-header { margin-bottom: 2rem; }

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

.post-full-tag {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--teal);
}

.post-full-tag:hover { color: var(--teal-2); }

.post-full-title {
    font-family: var(--font-heading);
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
    color: var(--text-1);
}

.post-full-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-2);
}

.post-full-meta a { color: var(--text-2); }
.post-full-meta a:hover { color: var(--teal); }

.post-full-meta-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-2);
    flex-shrink: 0;
}

.post-full-image {
    margin-bottom: 2.5rem;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.post-full-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* === Artikel-Inhalt (Ghost Content) === */
.gh-content {
    font-size: 1.0625rem;
    line-height: 1.8;
    color: var(--text-1);
}

.gh-content > * + * { margin-top: 1.5rem; }

.gh-content h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.375rem, 3vw, 1.625rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.3;
    color: var(--text-1);
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
}

.gh-content h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-top: 2rem;
    margin-bottom: 0.625rem;
}

.gh-content h4 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
}

.gh-content a {
    color: var(--teal);
    text-decoration: underline;
    text-decoration-color: rgba(0, 212, 170, 0.4);
    text-underline-offset: 3px;
    transition: text-decoration-color var(--ease);
}

.gh-content a:hover { text-decoration-color: var(--teal); }

.gh-content ul,
.gh-content ol {
    padding-left: 1.5rem;
}

.gh-content li + li { margin-top: 0.375rem; }

.gh-content blockquote {
    border-left: 3px solid var(--teal);
    background: rgba(0, 212, 170, 0.04);
    padding: 1rem 1.5rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-2);
    font-style: italic;
}

.gh-content pre {
    background: var(--bg-code);
    border-left: 3px solid var(--teal);
    border-radius: var(--radius-sm);
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.875em;
    line-height: 1.65;
    position: relative;
}

.gh-content code { font-family: var(--font-mono); font-size: 0.875em; }

.gh-content :not(pre) > code {
    background: var(--bg-card);
    color: var(--teal);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    border: 1px solid var(--border-card);
}

.gh-content img {
    border-radius: var(--radius-sm);
    max-width: 100%;
}

.gh-content figure { text-align: center; }

.gh-content figcaption {
    font-size: 0.8rem;
    color: var(--text-2);
    margin-top: 0.5rem;
}

.gh-content hr {
    border: none;
    border-top: 1px solid var(--border);
}

.gh-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    overflow-x: auto;
    display: block;
}

.gh-content th,
.gh-content td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    text-align: left;
}

.gh-content th {
    background: var(--bg-card);
    font-weight: 600;
    color: var(--teal);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Kod-Copy-Button */
.code-copy-btn {
    position: absolute;
    top: 0.625rem;
    right: 0.625rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    transition: color var(--ease), border-color var(--ease);
    opacity: 0;
    transition: opacity var(--ease), color var(--ease), border-color var(--ease);
}

.gh-content pre:hover .code-copy-btn { opacity: 1; }

.code-copy-btn:hover {
    color: var(--teal);
    border-color: var(--teal);
}

/* === Autoren-Box === */
.post-full-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.author-card {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.author-profile-image {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--teal);
}

.author-profile-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--grad);
    color: #0d1117;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.author-info { min-width: 0; }

.author-name {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.author-name a { color: var(--text-1); }
.author-name a:hover { color: var(--teal); }

.author-bio { font-size: 0.9rem; color: var(--text-2); line-height: 1.6; }

/* === Archive Header (Tag / Author) === */
.archive-header {
    text-align: center;
    padding: 4rem 0;
    border-bottom: 1px solid var(--border);
}

.archive-cover {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1.25rem;
    border: 2px solid var(--teal);
}

.author-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1.25rem;
    border: 2px solid var(--teal);
}

.author-avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--grad);
    color: #0d1117;
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}

.archive-title {
    font-family: var(--font-heading);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
    color: var(--text-1);
}

.archive-description {
    color: var(--text-2);
    font-size: 1rem;
    max-width: 500px;
    margin: 0 auto 0.5rem;
    line-height: 1.6;
}

.archive-count {
    font-size: 0.875rem;
    color: var(--text-2);
    margin-top: 0.5rem;
}

/* === Pagination === */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 0 3rem;
    flex-wrap: wrap;
}

.pagination a,
.pagination .page-number {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-2);
    transition: color var(--ease), border-color var(--ease), background var(--ease);
}

.pagination a:hover {
    color: var(--teal);
    border-color: var(--teal);
    background: rgba(0, 212, 170, 0.08);
}

/* === Footer === */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 2rem 0;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    text-align: center;
}

.footer-copyright {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-2);
}

.footer-copyright a { color: var(--text-2); }
.footer-copyright a:hover { color: var(--teal); }

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(0.85); }
}

.footer-tagline {
    font-size: 0.8rem;
    color: var(--text-2);
    opacity: 0.7;
}

.footer-powered {
    font-size: 0.75rem;
    color: var(--text-2);
    opacity: 0.5;
}

.footer-powered a { color: inherit; }
.footer-powered a:hover { color: var(--teal); opacity: 1; }

/* === Error Page === */
.error-page {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
}

.error-inner { max-width: 480px; }

.error-code {
    font-family: var(--font-heading);
    font-size: clamp(5rem, 15vw, 8rem);
    font-weight: 700;
    line-height: 1;
    background: var(--grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.error-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.error-description {
    color: var(--text-2);
    margin-bottom: 2rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--grad);
    color: #0d1117;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    transition: opacity var(--ease), transform var(--ease);
}

.btn-primary:hover {
    opacity: 0.88;
    transform: translateY(-2px);
    color: #0d1117;
}

/* === Scroll-to-Top === */
.scroll-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--ease), color var(--ease), border-color var(--ease), transform var(--ease);
    z-index: 50;
}

.scroll-top.visible { opacity: 1; pointer-events: auto; }

.scroll-top:hover {
    color: var(--teal);
    border-color: var(--teal);
    transform: translateY(-2px);
}

/* === Responsive === */
@media (max-width: 900px) {
    .post-feed { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .site-nav { display: none; }
    .site-nav.mobile-open { display: block; }

    .mobile-menu-toggle { display: flex; }

    /* Mobiles Dropdown-Menü */
    .site-header.mobile-nav-open .site-nav {
        display: block;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-header);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border);
        padding: 0.75rem 1.5rem 1rem;
    }

    .site-header.mobile-nav-open .site-nav .nav {
        flex-direction: column;
        gap: 0.125rem;
    }

    .post-feed { grid-template-columns: 1fr; }

    .post-full { padding: 2rem 1rem 3rem; }

    .author-card { flex-direction: column; }

    .pagination { gap: 0.625rem; }
}

/* === Koenig Editor Cards === */

/* Breite Bilder (wide) – größer als der Textblock */
.kg-width-wide {
    margin-left: calc(50% - 50vw + 2rem);
    margin-right: calc(50% - 50vw + 2rem);
    width: calc(100vw - 4rem);
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

/* Vollbreite Bilder */
.kg-width-full {
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    width: 100vw;
    max-width: 100vw;
}

.kg-image-card { margin: 1.5rem 0; }
.kg-image-card img { border-radius: var(--radius-sm); }

.kg-gallery-card { margin: 1.5rem 0; }
.kg-gallery-container { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.kg-gallery-row { display: flex; gap: 0.5rem; width: 100%; }
.kg-gallery-image { flex: 1; min-width: 0; }
.kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); }

.kg-bookmark-card {
    margin: 1.5rem 0;
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    transition: border-color var(--ease);
}

.kg-bookmark-card:hover { border-color: var(--teal); }

.kg-bookmark-container {
    display: flex;
    text-decoration: none;
    color: inherit;
}

.kg-bookmark-content { padding: 1.25rem; flex: 1; min-width: 0; }
.kg-bookmark-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.25rem; color: var(--text-1); }
.kg-bookmark-description { font-size: 0.85rem; color: var(--text-2); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kg-bookmark-metadata { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.75rem; font-size: 0.75rem; color: var(--text-2); }
.kg-bookmark-icon { width: 16px; height: 16px; }
.kg-bookmark-thumbnail { flex-shrink: 0; width: 160px; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

.kg-callout-card {
    margin: 1.5rem 0;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-left: 3px solid var(--teal);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
}

.kg-callout-emoji { font-size: 1.25rem; flex-shrink: 0; }
.kg-callout-text { font-size: 0.95rem; line-height: 1.65; }

.kg-video-card { margin: 1.5rem 0; }
.kg-video-card video { border-radius: var(--radius-sm); width: 100%; }

.kg-audio-card {
    margin: 1.5rem 0;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
}
