/*
 * Page content: the type scale, links, code, tables, callouts and images.
 *
 * The type scale starts from 16px body text, with headings scaled up from it.
 * It is a starting point to review, not a settled design. The app's own
 * scale (9 to 16px, 32px page title) is built for dense data screens; its
 * small sizes are reused here only for labels and captions (13px and 11px).
 *
 * Only Inter 400 and 500 are loaded, so 500 is the heaviest weight in use.
 */

.md-typeset {
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-primary);
}

/* 32px Regular, as the app's page title: size is doing the work, not weight. */
.md-typeset h1 {
  margin: 0 0 24px;
  font-size: 32px;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.md-typeset h2 {
  margin: 48px 0 16px;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.005em;
}

.md-typeset h3 {
  margin: 32px 0 12px;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.35;
}

.md-typeset h4 {
  margin: 24px 0 8px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
}

/* Label size (the app's 13px Medium), not shouting capitals. */
.md-typeset h5,
.md-typeset h6 {
  margin: 24px 0 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text-secondary);
}

.md-typeset strong,
.md-typeset b {
  font-weight: 500;
}

/* The pilcrow beside each heading. */
.md-typeset .headerlink {
  color: var(--text-muted);
}

.md-typeset .headerlink:hover,
.md-typeset .headerlink:focus {
  color: var(--accent);
}

/* Links ------------------------------------------------------------------ */

.md-typeset a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.md-typeset a:hover,
.md-typeset a:focus {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.md-typeset .headerlink,
.md-typeset .bs-button {
  text-decoration: none;
}

/* Code -------------------------------------------------------------------- */

.md-typeset code,
.md-typeset kbd,
.md-typeset pre {
  font-size: 0.875em;
}

.md-typeset code {
  border-radius: 3px;
}

/* The block already has the smaller size; without this its code shrinks twice. */
.md-typeset pre > code {
  font-size: 1em;
}

.md-typeset pre > code {
  border: 1px solid var(--border);
  border-radius: 4px;
  line-height: 1.55;
}

.md-typeset .md-clipboard {
  color: var(--text-muted);
}

.md-typeset .md-clipboard:hover,
.md-typeset .md-clipboard:focus {
  color: var(--accent);
}

/* Tables: headers at label size, rows ruled with hairlines like the app's. */

.md-typeset table:not([class]) {
  font-size: 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: none;
}

.md-typeset table:not([class]) th {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border-bottom: 1px solid var(--border);
}

.md-typeset table:not([class]) td {
  border-top: 1px solid var(--divider);
}

.md-typeset table:not([class]) tbody tr:hover {
  background: var(--sidebar-active-bg);
  box-shadow: none;
}

/* Quotes and rules --------------------------------------------------------- */

.md-typeset blockquote {
  color: var(--text-secondary);
  border-left: 3px solid var(--divider);
}

.md-typeset hr {
  border-bottom: 1px solid var(--divider);
}

.md-typeset figcaption,
.md-typeset .caption {
  font-size: 13px;
  font-style: italic;
  color: var(--text-muted);
}

/*
 * Callouts (admonitions and collapsible details). Each kind takes the app's
 * pill colours for the matching state: information, done, running, failed.
 * The [class] and :is() raise these above Material's per-kind rules.
 */

.md-typeset .admonition[class],
.md-typeset details[class] {
  --callout-text: var(--info-text);
  --callout-fill: var(--info-bg);
  --callout-edge: var(--accent);

  font-size: 15px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--callout-edge);
  border-radius: 4px;
  box-shadow: none;
}

.md-typeset :is(.admonition, details):is(.tip, .hint, .success, .check, .done) {
  --callout-text: var(--status-done-text);
  --callout-fill: var(--status-done-bg);
  --callout-edge: var(--success);
}

.md-typeset :is(.admonition, details):is(.warning, .caution, .attention) {
  --callout-text: var(--status-running-text);
  --callout-fill: var(--status-running-bg);
  --callout-edge: var(--working);
}

.md-typeset :is(.admonition, details):is(.danger, .error, .failure, .fail, .missing, .bug) {
  --callout-text: var(--status-failed-text);
  --callout-fill: var(--status-failed-bg);
  --callout-edge: var(--danger);
}

.md-typeset :is(.admonition, details)[class] > :is(.admonition-title, summary) {
  font-weight: 500;
  color: var(--callout-text);
  background: var(--callout-fill);
}

.md-typeset :is(.admonition, details)[class] > :is(.admonition-title, summary)::before,
.md-typeset details[class] > summary::after {
  background-color: var(--callout-text);
}

/*
 * Light and dark images (CONTENT.md): a page includes both name.light.png and
 * name.dark.png, and only the one for the current mode is shown.
 */
:root:not([data-theme='dark']) .md-typeset img[src*='.dark.'],
:root[data-theme='dark'] .md-typeset img[src*='.light.'] {
  display: none;
}
