/* Lyra markdown.css: styles for markdown.js output inside chat bubbles.
   Uses the board's design tokens when present, with standalone fallbacks. */

/* Typographic scale inside bubbles (Wave 2): headings step clearly away from the 15 px body so a
   long reply can be scanned; h1 carries a hairline rule, h4 is a quiet muted lead-in. Headings
   are rendered one level down (h3 to h6) so the page outline stays intact. */
.md-p { margin: 0 0 .6em; }
.md-p:last-child, .md-list:last-child, .md-quote:last-child, .md-code-wrap:last-child,
.md-table-wrap:last-child, .md-math-block:last-child, .md-callout:last-child, .md-q:last-child { margin-bottom: 0; }

.md-h { line-height: 1.25; color: var(--text, inherit); text-wrap: balance; }
.md-h1 { font-size: 1.36em; font-weight: 740; letter-spacing: -.015em; margin: 1em 0 .45em; padding-bottom: .28em;
  border-bottom: 1px solid var(--line, #e2e5ea); }
.md-h2 { font-size: 1.18em; font-weight: 700; letter-spacing: -.008em; margin: .9em 0 .35em; }
.md-h3 { font-size: 1.04em; font-weight: 660; margin: .75em 0 .28em; }
.md-h4 { font-size: .92em; font-weight: 650; margin: .7em 0 .2em; color: var(--muted, #5d6577); letter-spacing: .01em; }
.md-h:first-child { margin-top: 0; }

.md-list { margin: 0 0 .6em; padding-left: 1.4em; }
.md-list .md-list { margin: .2em 0 .1em; }
.md-list li { margin: .25em 0; padding-left: .1em; }
.md-list li::marker { color: color-mix(in srgb, var(--muted, #5d6577) 80%, var(--text, #1f2328)); }
ol.md-list > li::marker { font-weight: 600; font-variant-numeric: tabular-nums; }
.md-task { list-style: none; margin-left: -1.2em; display: flex; gap: .45em; align-items: baseline; }
.md-task-box {
  flex: none; width: .9em; height: .9em; border-radius: 3px; transform: translateY(.1em);
  border: 1.5px solid var(--muted, #6b7385); box-sizing: border-box;
}
.md-task-box { position: relative; }
.md-task.is-done .md-task-box { background: var(--ok, #1f8a4c); border-color: var(--ok, #1f8a4c); }
.md-task.is-done .md-task-box::after { content: ""; position: absolute; left: 28%; top: 10%; width: 30%; height: 55%;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.md-task.is-done > .md-li-body { color: var(--muted, #6b7385); }

.md-quote {
  margin: 0 0 .5em; padding: .1em 0 .1em .75em;
  border-left: 3px solid var(--line-strong, var(--line, #d5dae2)); color: var(--muted, #5d6577);
}

.md-hr { border: 0; border-top: 1px solid var(--line, #e2e5ea); margin: .7em 0; }

.md-link { color: var(--link, var(--accent, #2d5bd2)); text-decoration: underline;
  text-underline-offset: .15em; text-decoration-thickness: 1px; overflow-wrap: anywhere; }
.md-link:hover { text-decoration-thickness: 2px; }
.md-link:focus-visible { outline: 2px solid var(--focus, var(--accent, #2d5bd2)); outline-offset: 2px;
  border-radius: 2px; }

.md-code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .86em;
  background: var(--code, #eef1f5); padding: .08em .36em; border-radius: 5px; overflow-wrap: anywhere;
  border: 1px solid color-mix(in srgb, var(--line, #e2e5ea) 80%, transparent); box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.md-h .md-code { font-size: .84em; }

.md-code-wrap { margin: 0 0 .5em; border: 1px solid var(--line, #e2e5ea); border-radius: 8px;
  overflow: hidden; background: var(--code, #eef1f5); }
.md-code-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .2rem .25rem .2rem .6rem; border-bottom: 1px solid var(--line, #e2e5ea);
  font-size: .75rem; color: var(--muted, #5d6577); }
.md-code-lang { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.md-code-copy {
  font: inherit; font-size: .75rem; border: 0; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--accent, #2d5bd2); padding: .25rem .55rem; min-height: 28px;
}
.md-code-copy:hover { background: var(--hover, rgba(45, 91, 210, .08)); }
.md-code-copy:focus-visible { outline: 2px solid var(--focus, var(--accent, #2d5bd2)); outline-offset: 1px; }
@media (pointer: coarse), (max-width: 959px) { .md-code-copy { min-height: 44px; min-width: 44px; } }
.md-pre { margin: 0; padding: .6rem .7rem; overflow-x: auto; white-space: pre; tab-size: 2;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .84em; line-height: 1.5; }

.md-table-wrap { margin: 0 0 .5em; max-width: 100%; overflow-x: auto; border-radius: 8px;
  border: 1px solid var(--line, #e2e5ea); overscroll-behavior-x: contain; }
.md-table-wrap:focus-visible { outline: 2px solid var(--focus, var(--accent, #2d5bd2)); outline-offset: 2px; }
.md-table { border-collapse: collapse; font-size: .9em; min-width: 100%;
  font-variant-numeric: tabular-nums; }
.md-table th, .md-table td { padding: .4rem .65rem; border-bottom: 1px solid var(--line, #e2e5ea);
  text-align: left; vertical-align: top; }
.md-table th { font-weight: 650; font-size: .94em; background: var(--table-head, rgba(127, 140, 160, .08)); white-space: nowrap;
  border-bottom-color: var(--line-strong, #cdd1d6); }
.md-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--table-head, rgba(127, 140, 160, .08)) 45%, transparent); }
.md-table tbody tr:hover td { background: var(--hover, rgba(45, 91, 210, .05)); }
.md-table tr:last-child td { border-bottom: 0; }
.md-table .ta-c { text-align: center; }
.md-table .ta-r { text-align: right; }

.md-math-block { margin: .3em 0 .6em; overflow-x: auto; overflow-y: hidden; max-width: 100%; }
.md-math-inline .katex { font-size: 1.05em; }
.md-math-fallback { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .88em;
  color: var(--muted, #5d6577); }

/* Semantic highlight tokens: ==red:BLOCKED== etc. Text colour plus a faint wash keeps
   contrast at or above 4.5:1 in both themes; meaning never rests on colour alone because
   the words themselves carry it. light-dark() follows the page's color-scheme, so the board's
   own theme switch wins over the OS setting. */
.md-color { border-radius: 4px; padding: 0 .2em; font-weight: 600; box-decoration-break: clone;
  -webkit-box-decoration-break: clone; }
.md-color-red { color: light-dark(#a8231b, #ff9a8f); background: light-dark(rgba(214, 48, 39, .1), rgba(255, 110, 96, .14)); }
.md-color-orange { color: light-dark(#a23d05, #ffb37a); background: light-dark(rgba(234, 108, 21, .11), rgba(255, 140, 60, .14)); }
.md-color-amber { color: light-dark(#7f5100, #f5c85c); background: light-dark(rgba(214, 150, 0, .15), rgba(240, 180, 40, .14)); }
.md-color-green { color: light-dark(#186f3d, #74d8a0); background: light-dark(rgba(31, 138, 76, .11), rgba(76, 195, 138, .14)); }
.md-color-blue { color: light-dark(#1d4ab8, #9db8ff); background: light-dark(rgba(45, 91, 210, .1), rgba(123, 156, 255, .15)); }
.md-color-purple { color: light-dark(#6b2fb0, #c9a5ff); background: light-dark(rgba(124, 58, 237, .1), rgba(170, 120, 255, .15)); }
.md-color-gray { color: light-dark(#4a5263, #b5bdcc); background: light-dark(rgba(100, 112, 133, .12), rgba(160, 170, 190, .13)); }

.md-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* GitHub-style callouts: a 3 px accent bar, a compact label with its icon, and a faint wash.
   Each kind sets --co (bar and label) and --co-wash; light-dark() follows the board theme. */
.md-callout { --co: light-dark(#155ec4, #8ab4f8); --co-wash: light-dark(rgba(21, 94, 196, .055), rgba(138, 180, 248, .08));
  margin: 0 0 .6em; padding: .42em .8em .5em .78em; border-left: 3px solid var(--co); border-radius: 0 8px 8px 0;
  background: var(--co-wash); }
.md-callout-tip { --co: light-dark(#147231, #81c995); --co-wash: light-dark(rgba(20, 114, 49, .055), rgba(129, 201, 149, .08)); }
.md-callout-important { --co: light-dark(#8430ce, #c58af9); --co-wash: light-dark(rgba(132, 48, 206, .055), rgba(197, 138, 249, .08)); }
.md-callout-warning { --co: light-dark(#9a5500, #fdd663); --co-wash: light-dark(rgba(214, 120, 0, .07), rgba(253, 214, 99, .08)); }
.md-callout-caution { --co: light-dark(#c5221f, #f28b82); --co-wash: light-dark(rgba(197, 34, 31, .055), rgba(242, 139, 130, .08)); }
.md-callout-title { display: flex; align-items: center; gap: .38em; margin: 0 0 .18em; color: var(--co); font-weight: 650;
  font-size: .86em; line-height: 1.4; }
.md-callout-title svg { flex: none; }
.md-callout > .md-p:last-child, .md-callout > .md-list:last-child { margin-bottom: 0; }

/* @mentions of group members: quiet, the accent marks who the message is routed to. */
/* Stage 4F: "#123" message references render as understated jump chips (only in live bubbles). */
.md-msg-ref { position: relative; display: inline-flex; align-items: center; gap: .14em; vertical-align: baseline;
  min-height: 0; margin: 0 .04em; padding: 0 .28em 0 .26em; font: inherit; font-size: .9em; font-weight: 600; line-height: 1.3;
  font-variant-numeric: tabular-nums; color: var(--link, var(--accent, #155ec4)); cursor: pointer;
  background: var(--info-wash, rgba(21, 94, 196, .08)); border: 1px solid color-mix(in srgb, var(--accent, #155ec4) 20%, transparent);
  border-radius: 6px; }
.md-msg-ref:hover { background: color-mix(in srgb, var(--accent, #155ec4) 14%, transparent);
  border-color: color-mix(in srgb, var(--accent, #155ec4) 42%, transparent); }
.md-msg-ref:focus-visible { outline: 2px solid var(--focus, var(--accent, #155ec4)); outline-offset: 1px; }
.md-msg-ref-arrow { flex: none; opacity: .7; }
@media (pointer: coarse) { .md-msg-ref::after { content: ""; position: absolute; inset: -10px -5px; } }   /* a larger touch target */

.md-mention { color: var(--accent, #155ec4); font-weight: 600; background: var(--info-wash, rgba(21, 94, 196, .08));
  border-radius: 4px; padding: 0 .14em; white-space: nowrap; }

/* Question card (```lyra-questions): numbered rows, pill choices, one understated primary action. */
.md-q { margin: .25em 0 .6em; border: 1px solid var(--line, #e2e5ea); border-radius: 10px; overflow: hidden;
  background: color-mix(in srgb, var(--bg, #f6f7f9) 40%, var(--card, #fff)); }
.md-q-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6em; padding: .5em .8em .45em;
  border-bottom: 1px solid var(--line, #e2e5ea); }
.md-q-title { min-width: 0; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.md-q-meta { flex: none; font-size: .76em; color: var(--muted, #5d6577); font-variant-numeric: tabular-nums; }
.md-q-state { flex: none; font-size: .72em; font-weight: 650; line-height: 1.6; padding: 0 .55em; border-radius: 999px;
  color: var(--ok, #147231); border: 1px solid color-mix(in srgb, var(--ok, #147231) 40%, transparent); }
.md-q-list { list-style: none; margin: 0; padding: 0; }
.md-q-row { display: grid; grid-template-columns: 1.55em minmax(0, 1fr); gap: .65em; padding: .6em .8em .65em;
  border-bottom: 1px solid var(--line, #e2e5ea); }
.md-q-row:last-child { border-bottom: 0; }
.md-q-num { width: 1.55em; height: 1.55em; margin-top: .02em; border-radius: 50%; display: grid; place-items: center;
  font-size: .74em; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--muted, #5d6577);
  background: var(--code, #eef1f5); transition: background-color .12s ease-out, color .12s ease-out; }
.md-q-row.is-invalid .md-q-num { color: light-dark(#fff, #202124); background: var(--bad, #c5221f); }
.md-q-main { min-width: 0; display: grid; gap: .42em; }
.md-q-label { font-weight: 560; line-height: 1.38; overflow-wrap: anywhere; }
.md-q-req { font-size: .7em; font-weight: 600; color: var(--muted, #5d6577); border: 1px solid var(--line-strong, #cdd1d6);
  border-radius: 999px; padding: 0 .45em; vertical-align: .12em; white-space: nowrap; }
.md-q-opts { display: flex; flex-wrap: wrap; gap: .35em; min-width: 0; }
.md-q-opt { font: inherit; font-size: .86em; font-weight: 500; line-height: 1.3; min-height: 32px; padding: .22em .8em;
  border-radius: 999px; border: 1px solid var(--line-strong, #cdd1d6); background: var(--card, #fff); color: var(--text, #1f2328);
  cursor: pointer; max-width: 100%; overflow-wrap: anywhere; text-align: left;
  transition: background-color .12s ease-out, border-color .12s ease-out, color .12s ease-out; }
.md-q-opt:hover { border-color: color-mix(in srgb, var(--accent, #155ec4) 50%, var(--line-strong, #cdd1d6)); }
.md-q-opt[aria-checked="true"] { border-color: var(--accent, #155ec4); color: var(--accent, #155ec4); font-weight: 600;
  background: var(--info-wash, rgba(21, 94, 196, .08)); }
.md-q-opt[role="checkbox"][aria-checked="true"]::before { content: ""; display: inline-block; width: .32em; height: .62em;
  margin: 0 .5em .12em .05em; border: solid currentColor; border-width: 0 .14em .14em 0; transform: rotate(45deg); }
.md-q-opt.is-other { border-style: dashed; }
.md-q-opt.is-other[aria-checked="true"] { border-style: solid; }
.md-q-opt:focus-visible, .md-q-submit:focus-visible { outline: 2px solid var(--focus, #155ec4); outline-offset: 2px; }
.md-q-input { font: inherit; font-size: .92em; width: 100%; min-height: 34px; padding: .3em .6em; border-radius: 8px;
  border: 1px solid var(--line-strong, #cdd1d6); background: var(--card, #fff); color: var(--text, #1f2328); }
.md-q-input:focus { outline: none; border-color: var(--accent, #155ec4);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #155ec4) 22%, transparent); }
.md-q-row.is-invalid .md-q-input, .md-q-row.is-invalid .md-q-opt:not([aria-checked="true"]) {
  border-color: color-mix(in srgb, var(--bad, #c5221f) 70%, var(--line-strong, #cdd1d6)); }
.md-q-foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .5em .8em; padding: .5em .8em;
  border-top: 1px solid var(--line, #e2e5ea); }
.md-q-error { margin: 0 auto 0 0; min-width: 0; color: var(--bad, #c5221f); font-size: .8em; }
.md-q-error:empty { display: none; }
.md-q-submit { font: inherit; font-size: .86em; font-weight: 600; min-height: 34px; padding: .3em 1.05em; border-radius: 999px;
  border: 1px solid transparent; background: var(--accent, #155ec4); color: var(--accent-text, #fff); cursor: pointer; }
.md-q-submit:hover:not(:disabled) { filter: brightness(1.07); }
.md-q-submit:disabled { opacity: .55; cursor: default; }
.md-q-answer { font-size: .94em; overflow-wrap: anywhere; }
.md-q-answer.is-empty { color: var(--muted, #5d6577); }
.md-q-opts.is-static { gap: .3em; }
.md-q-chip { font-size: .8em; color: var(--muted, #5d6577); border: 1px solid var(--line, #e2e5ea); border-radius: 999px;
  padding: .02em .6em; overflow-wrap: anywhere; }
.md-q.is-answered .md-q-label, .md-q.is-submitted .md-q-label { color: var(--muted, #5d6577); font-weight: 500; }
@media (pointer: coarse), (max-width: 959px) {
  .md-q-opt, .md-q-submit, .md-q-input { min-height: 44px; }
  .md-q-input { font-size: 16px; }
}
