/* ============================================================================
   Engine layout — the static rules for the concentric column packer.
   These are NEVER mutated; per-instance geometry (layer left/width/top, float
   width/height/side, fonts, direction) is set inline by src/engine/daf.ts, so
   multiple dafim coexist without clobbering each other.
   ========================================================================== */

.daf-root {
  position: relative;
  box-sizing: content-box;
}
.daf-root *,
.daf-root *::before,
.daf-root *::after {
  box-sizing: border-box;
}

/* Each column is an absolute overlay; layers overlap in inline space but their
   text regions are carved apart by the float spacers. Layers stack, so the topmost
   layer's full-width box would swallow hovers (and clicks/selection) meant for the
   layers beneath it. Therefore the layer <div>, the float <div>, and the (full-width)
   .daf-text <div> stay pointer-transparent, and ONLY the inline word/note/verse SPANS
   capture — every word is wrapped in a span (see model/content.ts), so the main text is
   selectable AND a hover falls through empty layer area to the element under the cursor. */
.daf-layer {
  position: absolute;
  pointer-events: none;
}

/* The empty spacer that the column's text flows around: narrow beside the
   interior at the top, then the text reclaims full width below it. */
.daf-float {
  pointer-events: none;
}

.daf-text {
  pointer-events: none;
  /* All columns are justified — the classic daf block. (Side commentary is laid out as plain
     POSITIONED strips + embrace heads, not float-flanked, so justify is safe there; the gemara
     and the reclaim flow around floats but with bounded heights.) */
  text-align: justify;
  /* A column line may NEVER exceed its width — otherwise it bleeds sideways into a
     neighbouring column (e.g. a long run of citation superscripts with no spaces between
     them). `anywhere` lets such an over-wide run wrap as a last resort; normal text, which
     already fits, is unaffected. This is the renderer's hard horizontal-containment rule. */
  overflow-wrap: anywhere;
}
.daf-text span {
  pointer-events: auto;
}
.daf-text > :first-child {
  margin-top: 0;
}

/* The gemara (center) IS justified (the classic daf block), but reads as flat flowing text —
   its last line starts at the edge, not centered. */
.daf-text.is-center {
  text-align: justify;
  text-align-last: start;
}

/* A rebalance ISLAND: a too-short flank floated into the gemara's bottom corner so the main text
   wraps around it. Justified like any commentary, last line at the start — PINNED here so it never
   inherits the gemara's lone-line `text-align-last` (alignLoneLines sets that inline on the center,
   and text-align-last inherits). */
.daf-island {
  text-align: justify;
  text-align-last: start;
}

/* The catchword (שומר הדף): the next page's first word, set alone at the foot of a column. Absolutely
   positioned in the engine mount (shrink-to-fit, so it adds no height; placed by view.ts once the
   layout has settled) and indented a few letters in from the column's left edge. It is chrome, not
   body text — it never captures pointer events and never joins a text selection. */
.daf-catch {
  position: absolute;
  padding-left: 2.5ch; /* ~3 letters in from the column's left edge */
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}
