/*
 * csec-why — the causes pull threads into one knot (chapter 3).
 *   thread     unsewn: a faint guide; .sewn: ink; .on: the chapter colour,
 *              sewn from the cause to the knot, its stitches following
 *   node       the cause's label; .on is bold, .sewn is ink, others muted
 *   loop       the arc from the knot back to "prior C-section"
 */
.csw { position: relative; height: 100%; color: var(--ink); }
.csw:not(.in-scrolly) { height: clamp(540px, 62vw, 680px); }
.csw-svg { position: absolute; inset: 0; overflow: visible; }

.csw-group { font-family: var(--font-mono); font-size: 12px; letter-spacing: .02em; fill: var(--muted); }

.csw-name { font-family: var(--font-display); font-size: 19px; font-weight: 450; fill: rgba(var(--ink-rgb), .62); transition: fill .4s ease; }
.csw-sub { font-family: var(--font-mono); font-size: 11.5px; fill: var(--label-ink); transition: fill .4s ease; }
.csw-dot { fill: var(--bg); stroke: rgba(var(--ink-rgb), .35); stroke-width: 1.5; transition: fill .4s ease, stroke .4s ease; }
.csw-node.sewn .csw-name { fill: rgba(var(--ink-rgb), .82); }
.csw-node.sewn .csw-dot { stroke: rgba(var(--ink-rgb), .7); }
.csw-node.on .csw-name { fill: var(--ink); font-weight: 600; }
.csw-node.on .csw-sub { fill: var(--muted); }
.csw-node.on .csw-dot { fill: var(--cat-emph); stroke: var(--cat-emph); }

.csw-guide { fill: none; stroke: rgba(var(--ink-rgb), .14); stroke-width: 1; stroke-dasharray: 2 5; }
.csw-line {
  fill: none;
  stroke: rgba(var(--ink-rgb), .55);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset .9s cubic-bezier(.5, 0, .2, 1), stroke .4s ease;
}
.csw-tk { stroke: rgba(var(--ink-rgb), .45); stroke-width: 1.2; stroke-linecap: round; opacity: 0; transition: opacity .2s ease, stroke .4s ease; }
.csw-thread.sewn .csw-line, .csw-thread.on .csw-line { stroke-dashoffset: 0; }
.csw-thread.sewn .csw-tk, .csw-thread.on .csw-tk { opacity: 1; transition-delay: calc(var(--t) * .85s); }
.csw-thread.on .csw-line { stroke: var(--cat-emph); stroke-width: 2.6; }
.csw-thread.on .csw-tk { stroke: color-mix(in srgb, var(--cat-emph) 62%, var(--ink)); stroke-width: 1.5; }

/* the knot */
.csw-ring { fill: none; stroke: rgba(var(--ink-rgb), .16); stroke-width: 1; stroke-dasharray: 2 4; }
.csw-core { fill: color-mix(in srgb, var(--cat-emph) 14%, var(--bg)); stroke: var(--cat-emph); stroke-width: 1.6; transition: fill .5s ease; }
.csw-knum { font-family: var(--font-display); font-size: var(--knum, 56px); font-weight: 400; letter-spacing: -.03em; fill: var(--cat-emph); }
.csw-ksub { font-family: var(--font-mono); font-size: 11.5px; fill: var(--muted); }
.csw-klbl { font-family: var(--font-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; fill: var(--cat-emph); }
.csw.knot-loop .csw-knum { font-size: calc(var(--knum, 56px) * .52); }

.csw.knot-loop .csw-core { fill: color-mix(in srgb, var(--cat-emph) 24%, var(--bg)); }

/* the loop */
.csw-loop {
  fill: none;
  stroke: var(--cat-emph);
  stroke-width: 2;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.1s cubic-bezier(.5, 0, .2, 1);
}
.csw-loop.on { stroke-dashoffset: 0; }
.csw-loopmark { opacity: 0; transition: opacity .3s ease; }
.csw-loopmark.on { opacity: 1; transition-delay: .9s; }
.csw-arrow { fill: none; stroke: var(--cat-emph); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.csw-looptext { font-family: var(--font-mono); font-size: 11.5px; fill: var(--cat-emph); paint-order: stroke; stroke: var(--bg); stroke-width: 5px; }

.csw.snap .csw-line, .csw.snap .csw-tk, .csw.snap .csw-loop, .csw.snap .csw-loopmark { transition: none !important; }

@media (width < 900px) {
  .csw.in-scrolly { height: 62%; }
  .csw-name { font-size: 15px; }
  .csw-klbl { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .csw-line, .csw-tk, .csw-loop, .csw-loopmark, .csw-name, .csw-dot, .csw-core { transition: none !important; }
}

/* ---- quotes in the step cards ---------------------------------------------- */
.sc-card .sc-quote {
  margin: 0 0 14px;
  padding-left: 14px;
  border-left: 2px solid var(--cat-emph);
}
.sc-card .sc-quote p {
  font-style: italic;
  font-size: clamp(18px, 1.55vw, 21px);
  line-height: 1.4;
  margin: 0;
}
.sc-card .sc-quote footer {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .03em;
  color: var(--muted);
}
.sc-card .sc-quote + p { font-size: clamp(16px, 1.3vw, 18px); color: rgba(var(--ink-rgb), .8); }
@media (width < 900px) {
  .sc-card .sc-quote p { font-size: 16.5px; }
  .sc-card .sc-quote + p { font-size: 15px; }
}
