/* stretchserve — page and stretchtext styles */

:root {
  --fg: #1a1a1a;
  --bg: #fcfcf9;
  --accent: #0b5cad;
  --new: #8a5b00;
  --muted: #6b6b6b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 6rem;
}

h1, h2, h3 { line-height: 1.25; margin-top: 2em; }
h1 { margin-top: 0.5em; }

code, pre { font: 0.875em/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
pre.codehilite, pre { padding: 0.8em 1em; overflow-x: auto; background: #f3f3ef; border-radius: 6px; }
code { background: #f3f3ef; padding: 0.1em 0.3em; border-radius: 4px; }
pre code { background: none; padding: 0; }

blockquote { margin: 1em 0; padding: 0.1em 1em; border-left: 3px solid #d8d8d0; color: #444; }
table { border-collapse: collapse; }
th, td { border: 1px solid #ddd; padding: 0.35em 0.7em; }
img { max-width: 100%; }

nav a { color: var(--muted); text-decoration: none; font-size: 0.85rem; }
nav a:hover { color: var(--accent); }

/* --- stretchtext --- */

.stx-short.is-link {
  border-bottom: 1px dotted var(--accent);
  cursor: pointer;
}
.stx-short.is-link:hover { background: rgba(11, 92, 173, 0.08); }

.stx-long { display: none; }
.stx.open > .stx-short { display: none; }
.stx.open > .stx-long { display: inline; }

/* block-level growth: the long form is one or more blocks */
.stx-block { display: block; margin: 0.5em 0; }
.stx-block > .stx-short { display: inline; }
.stx-block > .stx-long { display: none; }
.stx-block.open > .stx-short { display: none; }
.stx-block.open > .stx-long { display: block; }

/* new words, marked the way Dream Machines appears to set them */
.stx-long mark.stx-new {
  background: none;
  color: inherit;
  font-weight: 600;
}

.stx-close {
  all: unset;
  cursor: pointer;
  color: var(--muted);
  padding: 0 0.15em;
  font-weight: 700;
}
.stx-close:hover { color: var(--accent); }

/* pinned open: the reader clicked, so it stays grown after hover-away */
.stx.pinned > .stx-long { background: rgba(11, 92, 173, 0.05); box-shadow: 0 0 0 4px rgba(11, 92, 173, 0.05); border-radius: 3px; }
.stx.pinned .stx-close { color: var(--accent); }

/* hover preview: floats above the pointer, inert to it, never reflows the page */
.stx-tip {
  position: fixed;
  z-index: 1000;
  max-width: min(42rem, calc(100vw - 1rem));
  padding: 0.55em 0.85em;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid #d8d8d0;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  font-size: 0.95em;
  line-height: 1.55;
  pointer-events: none;
}
/* « belongs to the in-place copy; the preview is read-only */
.stx-tip .stx-close { display: none; }
/* nested stretches inside the preview are display-only */
.stx-tip .stx-short { cursor: default; }

/* --- warnings (authoring feedback) --- */

.stx-warnings {
  border: 1px solid #e0c26a;
  background: #fdf6e3;
  border-radius: 6px;
  padding: 0.6em 1em;
  font-size: 0.85rem;
  margin-bottom: 1.5em;
}
.stx-warnings ul { margin: 0.3em 0 0; padding-left: 1.2em; }

/* --- mermaid / graphviz --- */

.mermaid, .graph-svg { max-width: 100%; overflow-x: auto; }
.graph-svg svg { max-width: 100%; height: auto; }

