/* Prose - shared Markdown body for article pages (knowledge base,
   news, quick start). One comfortable reading column: ~65 characters,
   16-20px, relaxed line-height, calm one-directional paragraph rhythm. */

/* Article column: the page stays wide, the reading block is centered
   rather than pinned to the left edge. The font-size here only makes
   `ch` resolve in the prose's font context, so the 65ch measure is the
   same one the body text uses; children set their own sizes. Adding the
   container padding keeps the text content at exactly one measure. */
.article {
    max-width: calc(var(--text-measure) + var(--space-8));
    margin-inline: auto;
    font-size: clamp(var(--font-size-lg), var(--font-size-base) + 0.35vw, var(--font-size-xl));
}

/* The article title stays the largest heading on the page, above the
   prose h1-h3 that live inside the body. */
.article .section-title {
    font-size: clamp(var(--font-size-2xl), 1.4rem + 2vw, var(--font-size-4xl));
}

/* Article chrome: the metadata line under the page title. */
.article-meta {
    margin-block: 0 var(--space-4);
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.prose {
    /* Comfortable measure lives on the column, not the page. */
    max-width: var(--text-measure);
    /* Live size that still respects the user's root font size. */
    font-size: clamp(var(--font-size-lg), var(--font-size-base) + 0.35vw, var(--font-size-xl));
    line-height: var(--line-height-relaxed);
    color: var(--text-secondary);
    font-optical-sizing: auto;
    overflow-wrap: break-word;
}

/* Rhythm: bottom margins only, so heading spacing cannot stack with
   paragraph spacing. */
.prose > :first-child {
    margin-block-start: 0;
}

.prose > :last-child {
    margin-block-end: 0;
}

.prose p {
    margin-block: 0 var(--space-4);
    text-wrap: pretty;
}

/* Headings sit close to the text they introduce and further from the
   block above them. */
.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
    margin-block: var(--space-8) var(--space-3);
    color: var(--text-primary);
    line-height: var(--line-height-snug);
    text-wrap: balance;
    overflow-wrap: break-word;
}

/* Sizes are relative to the prose size, so a subheading is never
   smaller than the body text at any viewport. */
.prose h1 {
    font-size: 1.4em;
}

.prose h2 {
    font-size: 1.25em;
}

.prose h3 {
    font-size: 1.1em;
}

.prose h4 {
    font-size: 1.05em;
}

.prose h5,
.prose h6 {
    font-size: 1em;
}

.prose h4,
.prose h5,
.prose h6 {
    font-family: var(--font-sans);
    font-weight: 700;
}

.prose strong {
    font-weight: inherit;
    color: var(--accent);
}

/* Links keep the underline affordance, not just color. */
.prose a {
    color: var(--text-secondary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

.prose a:hover {
    color: var(--accent-dark);
}

.prose ul,
.prose ol {
    margin-block: 0 var(--space-4);
    padding-inline-start: var(--space-6);
}

.prose li + li {
    margin-block-start: var(--space-2);
}

.prose li > ul,
.prose li > ol {
    margin-block: var(--space-2) 0;
}

.prose li::marker {
    color: var(--accent-dark);
}

.prose img {
    display: block;
    max-width: 100%;
    height: auto;
    margin-block: var(--space-6);
    border: var(--border-width-thin) solid var(--border);
}

/* Code is monospace and one step smaller than prose, so it never
   competes with the text column. */
.prose code {
    padding: 0.1em 0.35em;
    font-family: var(--font-mono);
    font-size: 0.9em;
    color: var(--accent);
    background: var(--bg-alt);
    border: var(--border-width-thin) solid var(--border);
}

.prose pre {
    margin-block: var(--space-6);
    padding: var(--space-4) var(--space-5);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
    background: var(--bg-alt);
    border-top: var(--border-width-accent) solid var(--border);
    overflow-x: auto;
    tab-size: 2;
}

.prose pre code {
    display: block;
    padding: 0;
    font-size: inherit;
    color: var(--accent);
    background: none;
    border: none;
}

/* Pull quotes get a shorter measure and a top edge accent, never a
   left-side bar. */
.prose blockquote {
    max-width: 55ch;
    margin-block: var(--space-6);
    padding-block: var(--space-4) 0;
    border-top: var(--border-width) solid var(--border);
    color: var(--text-primary);
    font-style: italic;
}

.prose blockquote p {
    margin-block-end: var(--space-3);
}

.prose hr {
    margin-block: var(--space-10);
    border: none;
    border-top: var(--border-width) solid var(--border-light);
}

.prose table {
    max-width: 100%;
    margin-block: var(--space-6);
    border-collapse: collapse;
    font-size: var(--font-size-base);
}

.prose th,
.prose td {
    padding: var(--space-2) var(--space-4);
    border: var(--border-width-thin) solid var(--border);
    text-align: start;
}

.prose th {
    color: var(--text-primary);
    font-weight: 700;
}
