/*
 * dyad-flow — mother's condition → what happens → newborn outcome (ch. 4).
 * Lines run from ink (mother) to var(--cat-emph) (newborn). Line style is
 * evidence: solid holds, dashed a lead, dotted not clear / not seen.
 */
.df { display: flex; flex-direction: column; height: 100%; color: var(--ink); }
.df:not(.in-scrolly) { height: auto; }
.df-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0 0 6px; padding: 0; list-style: none; }
.df-legend li { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11.5px; color: rgba(var(--ink-rgb), .7); }
.df-legend svg { width: 28px; height: 6px; overflow: visible; }
.df-legend line { stroke: var(--ink); stroke-width: 2px; }
.df-legend .directional line { stroke-dasharray: 6 4; }
.df-legend .unresolved line { stroke-dasharray: 1.5 4; stroke-linecap: round; }

.df-flow { position: relative; flex: 1 1 auto; min-height: 0; }
.df:not(.in-scrolly) .df-flow { height: 440px; flex: none; }
.df-flow svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.df-col { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; fill: var(--muted); }
.df-col.baby { fill: var(--cat-emph); }
.df-lbl { font-family: var(--font-mono); font-size: 12px; fill: rgba(var(--ink-rgb), .82); transition: opacity .35s, fill .35s; }
.df-lbl.route { font-size: 11px; fill: rgba(var(--ink-rgb), .6); }
.df-lbl.baby { fill: var(--cat-emph); }
.df-node.m, .df-node.r { fill: var(--ink); }
.df-node.o { fill: var(--cat-emph); transform-box: fill-box; transform-origin: center; }
.df-hit { fill: transparent; }
.df-m { cursor: pointer; outline: none; }
.df-m:hover .df-lbl, .df-m:focus-visible .df-lbl { fill: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.df-base, .df-hl { fill: none; stroke-width: 1.4px; stroke-linecap: round; }
.df-base { stroke: rgba(var(--ink-rgb), .22); transition: opacity .35s; }
.df-hl { stroke-width: 2.4px; opacity: 0; }
.df-row.on .df-hl { opacity: 1; }
.df-row.directional :is(.df-base, .df-hl) { stroke-dasharray: 6 5; }
.df-row:is(.unresolved, .unlinked) :is(.df-base, .df-hl) { stroke-dasharray: 1.5 5; }
.df-row:is(.unresolved, .unlinked) .df-hl { stroke-width: 2.2px; }

/* a selection: the rest of the graph recedes */
.df[data-state="sel"] .df-row:not(.on) .df-base { opacity: .35; }
.df[data-state="sel"] :is(.df-m, .df-route, .df-o):not(.on) :is(.df-lbl, .df-node) { opacity: .3; }
.df[data-state="sel"] :is(.df-m, .df-route).on .df-lbl { fill: var(--ink); font-weight: 600; }
.df[data-state="sel"] .df-o.on .df-lbl { font-weight: 600; }
.df-o.hit .df-node { animation: df-hit .6s var(--rv-ease); }
@keyframes df-hit { 40% { transform: scale(1.8); } }

.df-pulse { fill: var(--cat-emph); stroke: var(--bg); stroke-width: 1.5px; transition: opacity .4s; }
.df-pulse.done { opacity: 0; }

/* the readout: one line per selected pair */
.df-read { flex: none; display: grid; gap: 6px; min-height: 92px; margin: 10px 0 0; padding: 12px 0 0; list-style: none; border-top: 1px solid var(--hairline); }
.df-r {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 4ch minmax(13ch, auto); align-items: baseline; gap: 4px 14px;
  font-family: var(--font-mono); font-size: 12px;
}
.df-r-pair { min-width: 0; line-height: 1.4; }
.df-r-m { color: var(--ink); }
.df-r-arrow { margin: 0 6px; color: var(--muted); }
.df-r-o { color: var(--cat-emph); font-weight: 500; }
.df-r-fig { color: var(--muted); white-space: nowrap; }
.df-r-fig strong { color: var(--ink); font-weight: 500; }
.df-r-x { font-weight: 600; color: var(--cat-emph); font-variant-numeric: tabular-nums; min-width: 4ch; text-align: right; }
.df-r-s { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); line-height: 1.4; }
.df-r.holds .df-r-s { color: var(--ink); font-weight: 500; }
.df-r:is(.unresolved, .unlinked) :is(.df-r-x, .df-r-o) { opacity: .6; }

/* a phone: one chain per selection instead of three columns */
.df-chain { display: none; }
@container (width < 640px) {
  .df-flow { display: none; }
  .df-chain { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none; padding: 8px 0 0; }
  .df-c-box { margin: 0; padding: 8px 12px; max-width: 100%; text-align: center; font-family: var(--font-mono); font-size: 12px; line-height: 1.45; border-radius: var(--radius-s); border: 1px solid var(--hairline); }
  .df-c-box.m { color: var(--ink); font-weight: 500; }
  .df-c-box.r { color: var(--muted); border-style: dashed; }
  .df-c-box.o { color: var(--cat-emph); font-weight: 500; border-color: color-mix(in srgb, var(--cat-emph) 50%, transparent); }
  .df-c-arrow { width: 2px; height: 18px; background: linear-gradient(var(--ink), var(--cat-emph)); animation: df-down .5s var(--rv-ease) both; }
  .df-c-arrow + .df-c-box + .df-c-arrow { animation-delay: .25s; }
  .df-chain-hint { margin: 0; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
  .df-legend { gap: 4px 14px; }
  .df-legend li { font-size: 10.5px; }
  .df-r { grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; font-size: 11.5px; }
  .df-r-fig { display: none; }
  .df-r-s { grid-column: 1 / -1; font-size: 9.5px; }
  .df-read { min-height: 0; gap: 7px; }
  .df-c-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 4px 0 6px; padding: 0; list-style: none; }
  .df-c-list li { padding: 5px 10px; font-family: var(--font-mono); font-size: 11px; color: rgba(var(--ink-rgb), .7); border: 1px dashed var(--hairline); border-radius: 96px; }
}
@keyframes df-down { from { transform: scaleY(0); transform-origin: top; } }
@media (prefers-reduced-motion: reduce) {
  .df-base, .df-lbl, .df-pulse { transition: none; }
  .df-o.hit .df-node, .df-c-arrow { animation: none; }
}
