/**
 * AI Report — Markdown Override Styles
 * Adjustments for Markdig-generated HTML within .ai-report
 * Fixes spacing, custom container rendering, and table alignment
 * when the AI response is Markdown converted to HTML server-side.
 */

/* ─────────────────────────────────────────────
   Custom Containers (Markdig wraps content in <p>)
   Remove extra margins inside semantic boxes
   ───────────────────────────────────────────── */

.ai-report .poetic-opening > p:first-child,
.ai-report .executive-summary > p:first-child,
.ai-report .direct-answer > p:first-child,
.ai-report .closing > p:first-child,
.ai-report .success-box > p:first-child,
.ai-report .warning-box > p:first-child,
.ai-report .danger-box > p:first-child,
.ai-report .info-box > p:first-child,
.ai-report .period-card > p:first-child {
    margin-top: 0;
}

.ai-report .poetic-opening > p:last-child,
.ai-report .executive-summary > p:last-child,
.ai-report .direct-answer > p:last-child,
.ai-report .closing > p:last-child,
.ai-report .success-box > p:last-child,
.ai-report .warning-box > p:last-child,
.ai-report .danger-box > p:last-child,
.ai-report .info-box > p:last-child,
.ai-report .period-card > p:last-child {
    margin-bottom: 0;
}

/* ─────────────────────────────────────────────
   Markdig Pipe Tables
   Ensure Markdig-generated tables get full styling
   ───────────────────────────────────────────── */

.ai-report table thead th {
    text-align: left;
}

.ai-report table td,
.ai-report table th {
    vertical-align: top;
}

/* ─────────────────────────────────────────────
   Closing Block — Signature & Blessing
   ───────────────────────────────────────────── */

.ai-report .closing .quote {
    font-family: var(--font-serif);
    font-style: italic;
    text-align: center;
    color: var(--muted-foreground);
}

.ai-report .closing .blessing,
.ai-report .closing .mantra {
    text-align: center;
    color: var(--primary);
    font-weight: 500;
}

/* ─────────────────────────────────────────────
   Markdig headings inside custom containers
   ───────────────────────────────────────────── */

.ai-report .success-box > h3:first-child,
.ai-report .warning-box > h3:first-child,
.ai-report .danger-box > h3:first-child,
.ai-report .info-box > h3:first-child,
.ai-report .period-card > h3:first-child {
    margin-top: 0;
}

/* ─────────────────────────────────────────────
   Ensure blockquote styling applies to
   Markdig-generated blockquotes
   ───────────────────────────────────────────── */

.ai-report blockquote > p:first-child { margin-top: 0; }
.ai-report blockquote > p:last-child { margin-bottom: 0; }

/* ─────────────────────────────────────────────
   Hide h3 diamond bullet inside semantic containers
   ───────────────────────────────────────────── */

.ai-report .poetic-opening h3::before,
.ai-report .executive-summary h3::before,
.ai-report .direct-answer h3::before,
.ai-report .closing h3::before {
    display: none;
}

/* ─────────────────────────────────────────────
   Closing Block — Markdig em/strong styling
   *"quote"* → <em>, **blessing** → <strong>
   ───────────────────────────────────────────── */

.ai-report .closing em {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1rem;
    color: var(--foreground);
    display: block;
    margin-bottom: 0.75rem;
}

.ai-report .closing strong {
    font-family: var(--font-serif);
    font-size: 1.125rem;
    color: var(--primary);
    display: block;
    margin-top: 0.75rem;
}
