/* Markdown writing controls shared by manuscript, thesis, proposal and grounding editors. */
.md-editor-tools { display:flex; flex-wrap:wrap; align-items:center; gap:.35rem; padding:.55rem .75rem; border-bottom:1px solid var(--line); background:var(--panel-alt); }
.md-editor-tools .md-tool-group { display:flex; flex-wrap:wrap; gap:.25rem; }
.md-editor-tools button { border:1px solid var(--line); background:var(--panel-bg); color:var(--ink); border-radius:5px; padding:.35rem .55rem; font:inherit; font-size:.78rem; cursor:pointer; }
.md-editor-tools button:hover,.md-editor-tools button:focus-visible { border-color:var(--accent); outline:2px solid transparent; box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 20%,transparent); }
.md-editor-tools button[aria-pressed="true"] { background:var(--accent); color:white; border-color:var(--accent); }
.md-editor-help { margin-left:auto; color:var(--muted); font-size:.72rem; }
.md-preview { display:none; box-sizing:border-box; min-height:440px; padding:1.25rem clamp(1rem,3vw,2rem); overflow-wrap:anywhere; background:var(--panel-bg); color:var(--ink); font-family:'Source Serif 4',var(--serif); font-size:1rem; line-height:1.75; }
.md-editor-wrapper.md-preview-active > textarea { display:none; }
.md-editor-wrapper.md-preview-active > .md-preview { display:block; }
.md-preview h1,.md-preview h2,.md-preview h3,.md-preview h4 { line-height:1.25; margin:1.25em 0 .45em; color:var(--ink); }
.md-preview h1 { font-size:1.65rem; }.md-preview h2 { font-size:1.4rem; }.md-preview h3 { font-size:1.18rem; }.md-preview h4 { font-size:1.05rem; }
.md-preview p { margin:.45em 0 .9em; }
.md-preview ul,.md-preview ol { padding-left:1.6rem; margin:.4rem 0 1rem; }
.md-preview .md-table-wrap { overflow-x:auto; max-width:100%; margin:1rem 0; }
.md-preview table { border-collapse:collapse; width:max-content; min-width:100%; margin:0; font:inherit; font-size:.92em; overflow-wrap:normal; word-break:normal; }
.md-preview caption { caption-side:top; text-align:left; font-weight:700; padding:.2rem 0 .45rem; }
.md-preview th,.md-preview td { border:1px solid var(--line); padding:.5rem .65rem; text-align:left; vertical-align:top; min-width:6.5rem; overflow-wrap:break-word; }
.md-preview .md-align-center { text-align:center; }
.md-preview .md-align-right { text-align:right; }
.md-preview hr { border:0; border-top:1px solid var(--line); margin:1.2rem 0; }
.md-preview li > ul, .md-preview li > ol { margin:.25rem 0 .25rem; }
.md-preview th { background:var(--panel-alt); font-weight:700; }
.md-preview blockquote { border-left:3px solid var(--accent); margin:1rem 0; padding:.2rem 1rem; color:var(--muted); }
/* Code blocks (ASCII diagrams, pipelines). base.css gives every <pre> LIGHT text for a dark box, so
   when this preview swaps in a light background the text colour must be set too, or the block is
   unreadable. Diagrams also must not wrap: wrapping breaks the box alignment, so they scroll. */
.md-preview pre { white-space:pre; overflow-wrap:normal; word-break:normal; overflow-x:auto; max-width:100%; box-sizing:border-box; padding:.8rem 1rem; margin:1rem 0; border:1px solid var(--line); border-radius:6px; background:var(--panel-alt); color:var(--ink); font-family:ui-monospace,'SFMono-Regular',Consolas,'Liberation Mono',Menlo,monospace; font-size:.82em; line-height:1.35; font-variant-ligatures:none; tab-size:4; }
.md-preview code { font-family:ui-monospace,'SFMono-Regular',Consolas,'Liberation Mono',Menlo,monospace; font-size:.9em; background:var(--panel-alt); color:var(--ink); border-radius:3px; padding:.08em .25em; }
.md-preview pre code { background:none; border-radius:0; padding:0; font-size:inherit; color:inherit; white-space:inherit; }
.md-preview .md-equation { overflow-x:auto; padding:.7rem .5rem; margin:1rem 0; text-align:center; border:1px solid var(--line); border-radius:6px; background:var(--panel-alt); }
.md-preview .md-empty { color:var(--muted); font-style:italic; }
.md-preview img { max-width:100%; }
@media(max-width:650px) { .md-editor-help { width:100%; margin-left:0; }.md-preview { min-height:320px; } }
