/* -----------------------------------------------------------------------------
   Rendered markdown content.

   Everything here is scoped to `.markdown-body`, the wrapper every page puts
   around output from MarkdownProcessor - the markdown viewer, and the About
   section of a course or module. It lives apart from markdown-viewer.css because
   that file also restyles global `.btn` and `.badge`, which no page outside the
   viewer can afford to load.

   Add the class and this stylesheet together: the class alone is unstyled, and
   the stylesheet alone matches nothing.
----------------------------------------------------------------------------- */

/* Callout Types in Content */
.markdown-body .callout-objectives {
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.markdown-body .callout-objectives h3 {
    margin-top: 0;
    color: rgba(88, 151, 251, 1);
}

.markdown-body .callout-questions {
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.markdown-body .callout-questions h3 {
    margin-top: 0;
    color: rgba(30, 163, 183, 1);
}

/* Every callout in this pane sits on a light tint, because the pane itself is
   always #fff. Body text must therefore be dark. Variants defined for a dark
   card elsewhere (.callout-keypoints in courses.css is #fff on #1a1a1a) would
   otherwise carry their light `color` in here and disappear against the tint.
   Headings keep their own accent colours: those rules come after this one. */
.markdown-body .callout,
.markdown-body .callout p,
.markdown-body .callout li,
.markdown-body .callout td,
.markdown-body .callout summary {
    color: #1a1a1a;
}

.markdown-body .callout-keypoints {
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.markdown-body .callout-keypoints h3 {
    margin-top: 0;
    color: rgba(30, 163, 183, 1);
}

.markdown-body .callout-challenge {
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.markdown-body .callout-challenge h3 {
    margin-top: 0;
    color: #8e6f3e;
}

.markdown-body .callout-solution {
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.markdown-body .callout-solution h3 {
    margin-top: 0;
    color: #28a745;
}

.markdown-body .callout-instructor {
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.markdown-body .callout-instructor h3 {
    margin-top: 0;
    color: #0066cc;
}

.markdown-body .callout-info {
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.markdown-body .callout-info h3 {
    margin-top: 0;
    color: #856404;
}

.markdown-body .callout-spoiler {
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 4px;
    cursor: pointer;
}

.markdown-body .callout-spoiler summary {
    font-weight: 600;
    color: #6f42c1;
}

.markdown-body .callout-spoiler summary h3 {
    margin: 0;
    display: inline;
    color: #6f42c1;
}

/* A heading inside a callout is that callout's label, not a document section.
   The .markdown-body h1-h6 rules give every heading a tint, a left rule and
   padding, which drew a second box around the label inside the callout's own
   background. Strip that chrome back off here. */
.markdown-body .callout > h3,
.markdown-body .callout > summary h3 {
    border-radius: 0;
    padding: 0;
    margin: 0;
}

.markdown-body .callout > h3 {
    margin-bottom: 0.75rem;
}

/* Marker and label on one row, for every collapsible type. The previous arrow
   was attached to `.callout-spoiler summary h3`, so a solution block fell back
   to the native marker with its block-level heading dropping to a second row. */
.markdown-body .callout > summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    cursor: pointer;
}

.markdown-body .callout > summary::-webkit-details-marker {
    display: none;
}

.markdown-body .callout > summary::before {
    content: '\25B6';
    flex: none;
    font-size: 0.75em;
    transition: transform 0.2s ease;
}

.markdown-body .callout[open] > summary::before {
    transform: rotate(90deg);
}

/* Retire the older arrow so the two do not both render. */
.markdown-body .callout > summary h3::before {
    content: none;
}

/* .callout-body is what the renderer emits for any collapsible block;
   .spoiler-content is the older name, kept so existing content still styles. */
.markdown-body .callout-body,
.markdown-body .spoiler-content {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e0d5f5;
}

/* Screenshots inside a collapsed block are often full-resolution captures. */
.markdown-body .callout img {
    max-width: 100%;
    height: auto;
}

.markdown-body .markdown-video,
.markdown-body .markdown-audio {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 1.25rem 0;
    border-radius: 4px;
}

.markdown-body .markdown-video {
    aspect-ratio: 16 / 9;
    background: #000;
}

.markdown-body .callout-discussion {
    margin: 1.5rem 0;
}

.markdown-body .callout-discussion h3 {
    color: #c75200;
    margin-top: 0;
}

.markdown-body {
    background: #fff;
    padding: 0 0 2rem 0;
    line-height: 1.7;
    font-size: 1rem;
    color: #333;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.3;
    scroll-margin-top: var(--anchor-offset);
}

/* h1 — primary teal */
.markdown-body h1 {
    font-size: 1.9rem;
    color: #0e7a8c;
}

/* h2 — slate blue */
.markdown-body h2 {
    font-size: 1.5rem;
    color: #1a4f8a;
}

/* h3 — warm gold (matches site accent) */
.markdown-body h3 {
    font-size: 1.25rem;
    color: #7a5a26;
}

/* h4 — forest green */
.markdown-body h4 {
    font-size: 1.1rem;
    color: #1e6636;
}

/* h5 — muted purple */
.markdown-body h5 {
    font-size: 1rem;
    color: #5a3a9a;
}

/* h6 — neutral slate */
.markdown-body h6 {
    font-size: 0.9rem;
    color: #444;
}

.markdown-body p {
    margin-bottom: 1rem;
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

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

.markdown-body code {
    background: #f5f5f5;
    color: #d63384;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.markdown-body pre {
    background: #01172f;
    color: white;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.markdown-body pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: 1.0em;
}

/* Padding on every side, not just the left: a source line or pull quote was
   otherwise pressed against the rule and against the text above and below it. */
.markdown-body blockquote {
    padding: 0.875rem 1.25rem;
    margin: 1.5rem 0;
    color: #444;
    font-style: italic;
}

/* The quote's own padding sets the spacing, so drop the leading and trailing
   margins the browser gives the paragraphs inside it. */
.markdown-body blockquote > :first-child {
    margin-top: 0;
}

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

.markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.5rem 0;
    background: #fff;
}

.markdown-body table th {
    background: #f5f5f5;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border: 1px solid #ddd;
    color: #1a1a1a;
}

.markdown-body table td {
    padding: 0.75rem;
    border: 1px solid #ddd;
}

.markdown-body table tr:nth-child(even) {
    background: #f9f9f9;
}

/* Inline Callouts in Content */
.markdown-body .callout {
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 6px;
}

.markdown-body .callout h3 {
    margin-top: 0;
    font-size: 1rem;
}
/* -----------------------------------------------------------------------------
   Flat callouts.

   Callout types used to be told apart by a coloured left bar, one per type. With
   six heading tints running down the same page that came to fourteen accent
   colours competing for attention. A block now reads as a block from its surface
   and its heading; the heading keeps the type's colour, which is enough to tell
   a challenge from a solution without ruling the page into stripes.
----------------------------------------------------------------------------- */
.markdown-body .callout {
    background: #f6f6f7;
    border: 1px solid #e6e6e8;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
}

.markdown-body .callout > h3,
.markdown-body .callout > summary h3 {
    font-size: 1.05rem;
}

/* Nested blocks (a solution inside a challenge) sit on white so the nesting
   reads, rather than tint stacking on tint. */
.markdown-body .callout .callout {
    background: #fff;
}

/* Types Carpentries lessons use that had no colour of their own: they fell back
   to the shared surface with an unstyled heading, reading as ordinary text. */
.markdown-body .callout-warning {
    margin: 1.5rem 0;
}

.markdown-body .callout-warning h3 {
    color: #b02a37;
    margin-top: 0;
}

.markdown-body .callout-caution {
    margin: 1.5rem 0;
}

.markdown-body .callout-caution h3 {
    color: #c75200;
    margin-top: 0;
}

.markdown-body .callout-prereq {
    margin: 1.5rem 0;
}

.markdown-body .callout-prereq h3 {
    color: #6f42c1;
    margin-top: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .markdown-body {
        font-size: 0.95rem;
    }

    .markdown-body h1 {
        font-size: 1.75rem;
    }

    .markdown-body h2 {
        font-size: 1.35rem;
    }

    .markdown-body h3 {
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    .markdown-body {
        padding: 1rem 0;
        font-size: 0.9rem;
    }

    .markdown-body h1 {
        font-size: 1.5rem;
    }

    .markdown-body h2 {
        font-size: 1.25rem;
    }

    .markdown-body h3 {
        font-size: 1rem;
    }
}
