/* pretext-flow.css: generalized styles for routed-prose flow elements.
   Designed to work alongside pretext-flow.js.
   Copy into your artifact and adjust custom properties to match your design. */

/* --- container --- */
.pt-flow {
  position: relative;
  margin-bottom: 1.5rem;
}

/* renderer is hidden until JS adds pt-flow-ready */
.pt-flow-renderer {
  position: relative;
  display: none;
}

.pt-flow.pt-flow-ready .pt-flow-renderer {
  display: block;
}

/* source is visible by default so plain prose shows without JS.
   Once ready, visually hide it (screen readers still read it). */
.pt-flow.pt-flow-ready .pt-flow-source {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- positioned line spans --- */
.pt-line {
  position: absolute;
  left: 0;
  top: 0;
  white-space: pre;
  /* match the font used in pretext-flow.js BODY_FONT */
  font: 17px/1.7 system-ui, -apple-system, sans-serif;
  letter-spacing: 0;
}

/* list item indentation */
.pt-line.list-line {
  padding-left: 1.1rem;
}

/* bullet for the first line of each list item */
.pt-line.list-start::before {
  content: "";
  position: absolute;
  left: 0.1rem;
  top: 0.82em;
  width: 0.25rem;
  height: 0.25rem;
  border-radius: 50%;
  background: currentColor;
}

/* --- obstacle node --- */
.pt-flow-obstacle {
  position: absolute;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  border: 1px dashed currentColor;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  line-height: 1.45;
  text-align: center;
  text-transform: uppercase;
  padding: 0.8rem;
  pointer-events: none;
}

/* connector lines above and below the obstacle */
.pt-flow-obstacle::before,
.pt-flow-obstacle::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 1px;
  height: 1.5rem;
  background: currentColor;
}

.pt-flow-obstacle::before { top: -1.5rem; }
.pt-flow-obstacle::after { bottom: -1.5rem; }

.pt-flow-obstacle-label {
  display: block;
}

/* --- obstacle note (smaller subtext) --- */
.pt-flow-note {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  line-height: 1.4;
  opacity: 0.7;
  text-transform: none;
}

/* --- mobile / narrow fallback (<760px) ---
   The renderer is hidden and the plain source prose is shown.
   This keeps the page readable without JS layout on small screens. */
@media (max-width: 760px) {
  .pt-flow.pt-flow-ready .pt-flow-renderer {
    display: none;
  }

  .pt-flow.pt-flow-ready .pt-flow-source {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }
}

/* --- print: always show source prose --- */
@media print {
  .pt-flow .pt-flow-renderer {
    display: none !important;
  }

  .pt-flow .pt-flow-source {
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
  }
}
