/* markdown.css — shared typography for rendered markdown content.
   Applied via the .markdown-body class to any container whose innerHTML
   comes from marked.parse(). Currently used by Product Docs; can be added
   to Privacy/Security's content containers the same way (just add the
   class alongside their existing one).

   Reads theme colors from the CSS custom properties defined in sidebar.css
   (--accent-color, --text-primary, --surface-secondary, etc.) so it follows
   whichever theme (light/rose/dracula/dark/midnight) is currently active. */

.markdown-body {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.75;
    /* No max-width/centering here — the overlay body (e.g. .plib-overlay-body)
       already provides horizontal padding site-wide (see styles.css /
       products-library.css conventions). Adding a second width cap on top
       of that padding just doubles the empty space on both sides. */
}

/* ── Page title (H1) ───────────────────────────────────────────
   Reads like a real website's hero title: large, bold, accent-colored,
   with a soft underline rule to separate it from the body. */

.markdown-body h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--accent-color);
    text-align: center;
    margin: 0 0 6px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--border-color);
}

/* First H1 in the doc doubles as the page hero — no top margin needed */
.markdown-body > h1:first-child {
    margin-top: 0;
}

/* A tagline/subtitle paragraph directly after the H1 reads like a
   website's hero subhead: larger, muted, breathing room below.
   (text-align lives in its own rule further down, after the generic
   .markdown-body p rule, so it wins on equal specificity.) */
.markdown-body h1 + p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin: 16px 0 28px;
}

/* ── Section headings (H2) ─────────────────────────────────────
   Left accent bar + primary text color, like a docs-site section
   header — distinct from H1 so the hierarchy reads at a glance. */

.markdown-body h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 2.2em 0 0.8em;
    padding-left: 14px;
    border-left: 4px solid var(--accent-color);
    line-height: 1.4;
}

.markdown-body h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 1.8em 0 0.6em;
}

.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 1.4em 0 0.5em;
}

/* ── Body copy ──────────────────────────────────────────────────
   Justified text reads more like an edited web page / print document
   than left-ragged markdown output. Long words won't overflow thanks
   to hyphens; feature/spec lists stay left-aligned (justify looks odd
   on short list items). */

.markdown-body p {
    margin: 0 0 1.1em;
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
}

/* Must come after the generic p rule above to win on equal specificity */
.markdown-body h1 + p {
    text-align: center;
}

.markdown-body ul,
.markdown-body ol {
    margin: 0 0 1.1em;
    padding-left: 1.5em;
    text-align: left;
}

.markdown-body li {
    margin: 0.4em 0;
}

.markdown-body li > p {
    text-align: left; /* list item text stays left-aligned even if it wraps into a <p> */
}

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

/* ── Links ──────────────────────────────────────────────────────*/

.markdown-body a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--accent-color) 40%, transparent);
    transition: border-color 0.15s, color 0.15s;
}

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

/* ── Images ─────────────────────────────────────────────────────
   Card-like presentation — rounded corners + soft shadow so a hero
   screenshot actually looks like part of a real website, not a
   floating raw <img>. */

.markdown-body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.4em 0;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 24px var(--shadow-color);
}

/* ── Inline code + code blocks ─────────────────────────────────*/

.markdown-body code {
    background: var(--surface-tertiary);
    color: var(--text-primary);
    padding: 0.15em 0.45em;
    border-radius: 5px;
    font-size: 0.88em;
    font-family: 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
}

.markdown-body pre {
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    padding: 16px 18px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 0 0 1.2em;
}

.markdown-body pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
    font-size: 0.85em;
}

/* ── Tables ─────────────────────────────────────────────────────
   Real docs-site table styling — header row uses the accent-tinted
   surface, alternating-free but with clear border separation. */

.markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 0 0 1.4em;
    font-size: 0.9em;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.markdown-body th,
.markdown-body td {
    border: 1px solid var(--border-color);
    padding: 9px 14px;
    text-align: left;
}

.markdown-body th {
    background: var(--surface-secondary);
    color: var(--text-primary);
    font-weight: 700;
}

.markdown-body tr:nth-child(even) td {
    background: color-mix(in srgb, var(--surface-secondary) 45%, transparent);
}

/* ── Blockquotes ────────────────────────────────────────────────
   Pull-quote treatment: accent left bar, tinted background, so a
   quoted callout reads distinctly from body copy. */

.markdown-body blockquote {
    margin: 0 0 1.2em;
    padding: 12px 18px;
    border-left: 4px solid var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 8%, var(--surface-secondary));
    border-radius: 0 8px 8px 0;
    color: var(--text-primary);
    font-style: italic;
}

.markdown-body blockquote p {
    margin: 0;
    text-align: left; /* quotes read better left-aligned, not justified */
}

/* ── Horizontal rule ────────────────────────────────────────────*/

.markdown-body hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2.4em 0;
}

/* ── Responsive ─────────────────────────────────────────────────*/

@media (max-width: 640px) {
    .markdown-body {
        font-size: 14px;
    }

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

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

    /* Justified text needs a decent column width to look good;
       on narrow screens ragged-left reads cleaner. */
    .markdown-body p {
        text-align: left;
        hyphens: none;
    }
}
