/* ==========================================================================
   maexbert.de – Markdown Content Styling
   Rendered markdown body inside blog/project detail pages
   ========================================================================== */

.markdown-body {
    color: var(--text-primary);
    font-size: var(--font-size-base);
    line-height: 1.8;
    word-wrap: break-word;
}

/* Headings */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.3;
    margin-top: 2rem;
    margin-bottom: 1rem;
    scroll-margin-top: 80px;
}

.markdown-body h1 { font-size: var(--font-size-3xl); }
.markdown-body h2 {
    font-size: var(--font-size-2xl);
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border-color);
}
.markdown-body h3 { font-size: var(--font-size-xl); }
.markdown-body h4 { font-size: var(--font-size-lg); }

/* Paragraphs */
.markdown-body p {
    margin-bottom: 1.25rem;
}

/* Links */
.markdown-body a {
    color: var(--accent-primary);
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 212, 255, 0.3);
    transition: all var(--transition-fast);
}

.markdown-body a:hover {
    color: var(--text-link-hover);
    border-bottom-color: var(--text-link-hover);
}

/* Lists */
.markdown-body ul,
.markdown-body ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.markdown-body li {
    margin-bottom: 0.4rem;
}

.markdown-body li > ul,
.markdown-body li > ol {
    margin-top: 0.4rem;
    margin-bottom: 0;
}

/* Blockquotes */
.markdown-body blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 3px solid var(--accent-primary);
    background: rgba(0, 212, 255, 0.04);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
}

.markdown-body blockquote p:last-child {
    margin-bottom: 0;
}

/* Inline Code */
.markdown-body code {
    padding: 0.15rem 0.4rem;
    background: rgba(0, 212, 255, 0.08);
    color: var(--accent-primary);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85em;
}

/* Code Blocks */
.markdown-body pre {
    margin: 1.5rem 0;
    padding: 0;
    background: #0d1117;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.markdown-body pre code {
    display: block;
    padding: 1.25rem;
    background: transparent;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    line-height: 1.6;
    overflow-x: auto;
}

/* Pygments code blocks have .highlight wrapper */
.markdown-body .highlight {
    margin: 1.5rem 0;
    background: #0d1117;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.markdown-body .highlight pre {
    margin: 0;
    padding: 1.25rem;
    border: none;
    background: transparent;
}

.markdown-body .highlight pre code {
    padding: 0;
}

/* Tables */
.markdown-body table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: collapse;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.markdown-body th {
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: 600;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
}

.markdown-body td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.markdown-body tr:last-child td {
    border-bottom: none;
}

.markdown-body tr:hover td {
    background: rgba(0, 212, 255, 0.02);
}

/* Horizontal Rule */
.markdown-body hr {
    margin: 2rem 0;
    border: none;
    height: 1px;
    background: var(--border-color);
}

/* Images */
.markdown-body img {
    max-width: 100%;
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin: 1rem 0;
    cursor: zoom-in;
    transition: border-color var(--transition-fast);
}

.markdown-body img:hover {
    border-color: var(--border-hover);
}

/* Videos */
.markdown-body video {
    max-width: 100%;
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin: 1rem 0;
    display: block;
    background: #000;
}

.markdown-body video:hover {
    border-color: var(--border-hover);
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    border: none;
    cursor: default;
}

.lightbox-close {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 2001;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    line-height: 1;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Definition Lists */
.markdown-body dt {
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 1rem;
}

.markdown-body dd {
    margin-left: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* Footnotes */
.markdown-body .footnote {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* TOC Permalink */
.markdown-body .toc-link {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 0.4rem;
    opacity: 0;
    transition: opacity var(--transition-fast);
    font-size: 0.8em;
}

.markdown-body h1:hover .toc-link,
.markdown-body h2:hover .toc-link,
.markdown-body h3:hover .toc-link,
.markdown-body h4:hover .toc-link {
    opacity: 1;
}

/* Task Lists */
.markdown-body .task-list {
    list-style: none;
    padding-left: 0;
    margin: 1rem 0;
}

.markdown-body .task-list-item {
    position: relative;
    padding-left: 2.4rem;
    margin-bottom: 0.65rem;
    line-height: 1.7;
    transition: color 0.3s ease;
}

.markdown-body .task-list-item:has(input:checked) {
    color: var(--text-muted);
    text-decoration: line-through;
    text-decoration-color: rgba(0, 212, 255, 0.4);
    text-decoration-thickness: 1.5px;
}

.markdown-body .task-list-control {
    position: absolute;
    left: 0;
    top: 0.2rem;
    cursor: default;
    display: flex;
    align-items: center;
}

/* Hide native checkbox completely */
.markdown-body .task-list-control input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

/* Custom checkbox indicator – unchecked */
.markdown-body .task-list-indicator {
    display: block;
    width: 1.35rem;
    height: 1.35rem;
    border: 2px solid var(--text-muted);
    border-radius: 5px;
    background: var(--bg-input);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-shrink: 0;
}

/* Unchecked hover glow */
.markdown-body .task-list-item:hover .task-list-indicator {
    border-color: var(--accent-primary);
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.25);
}

/* Checked state – gradient fill with glow */
.markdown-body .task-list-control input[type="checkbox"]:checked + .task-list-indicator {
    box-shadow:
        0 0 12px rgba(0, 212, 255, 0.4),
        0 0 4px rgba(124, 58, 237, 0.3),
        inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

/* Checkmark – SVG for crisp rendering */
.markdown-body .task-list-control input[type="checkbox"]:checked + .task-list-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.75rem;
    height: 0.75rem;
    transform: translate(-50%, -50%);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='4 12 10 18 20 6'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.markdown-body input[type="checkbox"] {
    margin-right: 0.4rem;
    accent-color: var(--accent-primary);
}

/* Strong / Bold */
.markdown-body strong {
    color: var(--text-primary);
    font-weight: 700;
}

/* Emphasis */
.markdown-body em {
    font-style: italic;
    color: var(--text-secondary);
}
