/*
 * Styles for HTML rendered by sanitise_question_markdown() in
 * template_filters.py. That sanitiser strips inline <style> blocks
 * (XSS hardening for stored question content, #998), so the rules
 * below must live in a real CSS file loaded by the page templates
 * that inject question_html via innerHTML.
 *
 * Rules are kept in sync with the inline <style> block in
 * markdown_filter() so questions rendered through either path look
 * identical. Selectors are scoped under .markdown-content where
 * possible to avoid leaking into the rest of the page.
 */

.markdown-content {
    line-height: 1.7;
}
.markdown-content h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
}
.markdown-content h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
}
.markdown-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}
.markdown-content p {
    margin-bottom: 1.25rem;
}
.markdown-content ul,
.markdown-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1.25rem;
}
.markdown-content ul {
    list-style-type: disc;
}
.markdown-content ol {
    list-style-type: decimal;
}
.markdown-content li {
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
}
.markdown-content a {
    color: rgb(37 99 235);
    text-decoration: underline;
}
.markdown-content a:hover {
    color: rgb(59 130 246);
}
.markdown-content table {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 1.5rem 0;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 0.92rem;
    line-height: 1.45;
}
.markdown-content th {
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(209, 213, 219, 0.9);
    white-space: nowrap;
}
.markdown-content td {
    padding: 0.75rem 1rem;
    border: 1px solid rgba(209, 213, 219, 0.9);
    vertical-align: top;
}
.markdown-content code {
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}
.markdown-content pre {
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}
.markdown-content pre code {
    padding: 0;
    border-radius: 0;
}
.markdown-content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid rgba(229, 231, 235, 0.2);
    font-style: italic;
}
.markdown-content img {
    max-width: 100%;
    height: auto;
    margin: 1.5rem 0;
    border-radius: 0.5rem;
}
.markdown-content hr {
    margin: 2rem 0;
    border: 0;
    border-top: 1px solid rgba(229, 231, 235, 0.2);
}
.markdown-content strong {
    font-weight: 600;
}

/*
 * Case-study (collapsible <details>) blocks. Selectors are not
 * scoped under .markdown-content because the class names are
 * unique enough to be safe at document scope, matching the
 * behaviour of the inline <style> block in markdown_filter().
 */
.case-study-block {
    margin: 1.5rem 0;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background: #f9fafb;
    overflow: hidden;
}
.case-study-block summary {
    cursor: pointer;
    padding: 0.75rem 1rem;
    font-weight: 600;
    background: #f3f4f6;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
}
.case-study-block summary::-webkit-details-marker {
    display: none;
}
.case-study-block summary::before {
    content: "\25B6";
    font-size: 0.7em;
    transition: transform 0.2s;
}
.case-study-block[open] summary::before {
    transform: rotate(90deg);
}
.case-study-content {
    padding: 1rem 1.25rem;
    max-height: 400px;
    overflow-y: auto;
}
.case-study-content > *:first-child {
    margin-top: 0;
}
