/* Dark-tech prose theme for rendered markdown. */
.markdown-preview {
    color: hsl(var(--foreground) / 0.92);
    line-height: 1.75;
    font-size: 0.975rem;
    white-space: normal;
    word-wrap: break-word;
    overflow-x: auto;
}

.markdown-preview > *:first-child {
    margin-top: 0;
}

.markdown-preview p {
    margin: 0 0 1rem;
}

.markdown-preview a {
    color: hsl(var(--primary));
    text-decoration: none;
    border-bottom: 1px solid hsl(var(--primary) / 0.3);
    transition: border-color 0.15s, color 0.15s;
}
.markdown-preview a:hover {
    color: hsl(var(--primary));
    border-bottom-color: hsl(var(--primary));
    text-shadow: 0 0 10px hsl(var(--primary) / 0.5);
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4,
.markdown-preview h5,
.markdown-preview h6 {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-weight: 600;
    color: hsl(var(--foreground));
    line-height: 1.3;
    margin: 2rem 0 0.85rem;
    scroll-margin-top: 5rem;
}
.markdown-preview h1 {
    font-size: 1.9rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid hsl(var(--border));
}
.markdown-preview h1::before,
.markdown-preview h2::before {
    content: "# ";
    color: hsl(var(--primary) / 0.6);
}
.markdown-preview h2 {
    font-size: 1.5rem;
}
.markdown-preview h3 {
    font-size: 1.25rem;
    color: hsl(var(--foreground) / 0.9);
}
.markdown-preview h4 {
    font-size: 1.05rem;
}
.markdown-preview h5,
.markdown-preview h6 {
    font-size: 0.95rem;
    color: hsl(var(--muted-foreground));
}

.markdown-preview ul,
.markdown-preview ol {
    padding-left: 1.5rem;
    margin: 0 0 1rem;
}
.markdown-preview ul {
    list-style-type: disc;
}
.markdown-preview ol {
    list-style-type: decimal;
}
.markdown-preview li {
    margin-bottom: 0.4rem;
}
.markdown-preview li::marker {
    color: hsl(var(--primary) / 0.7);
}

.markdown-preview blockquote {
    margin: 0 0 1rem;
    padding: 0.5rem 1rem;
    border-left: 3px solid hsl(var(--secondary));
    background: hsl(var(--secondary) / 0.08);
    color: hsl(var(--foreground) / 0.8);
    border-radius: 0 6px 6px 0;
}

.markdown-preview hr {
    border: none;
    border-top: 1px solid hsl(var(--border));
    margin: 2rem 0;
}

.markdown-preview img {
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid hsl(var(--border));
}

/* Inline code */
.markdown-preview :not(pre) > code {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 0.85em;
    background-color: hsl(var(--muted));
    color: hsl(var(--primary));
    padding: 0.15em 0.4em;
    border-radius: 4px;
    border: 1px solid hsl(var(--border));
}

/* Fenced code blocks (react-syntax-highlighter wraps in <pre>) */
.markdown-preview pre {
    background-color: hsl(222 40% 4%) !important;
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    padding: 1rem !important;
    overflow-x: auto;
    margin: 0 0 1rem;
    box-shadow: inset 0 0 40px -20px hsl(var(--primary) / 0.25);
}
.markdown-preview pre code {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 0.85rem;
    background: transparent;
    border: none;
    padding: 0;
}

/* Tables */
.markdown-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1rem;
    font-size: 0.9rem;
}
.markdown-preview th,
.markdown-preview td {
    border: 1px solid hsl(var(--border));
    padding: 0.6rem 0.8rem;
    text-align: left;
}
.markdown-preview th {
    background-color: hsl(var(--muted));
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: hsl(var(--muted-foreground));
}
.markdown-preview tr:hover td {
    background: hsl(var(--accent) / 0.5);
}

/* KaTeX on dark */
.katex-display {
    margin: 1.25em 0;
    text-align: center;
    overflow-x: auto;
    overflow-y: hidden;
}
.katex {
    font-size: 1.1rem;
    color: hsl(var(--foreground));
}
