/* Label diagram: an SVG with numbered markers. The markers are 44 px buttons in a column on each side of
   the picture; leader lines join them to the spot. The widget places them by arithmetic in pixels (a 44 px
   badge), so the number inside a badge is capped at its size for a 16 px root font, as the text inside the
   picture is. The part names are in rem and grow with the text size. The widget measures them in the side
   columns: while they all fit they stay under their numbers (room for them is made from their measured
   height), and when one does not it adds .is-listed and the names move to the numbered list under the
   picture, where they wrap across the full width of the card. */
.label-diagram { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: min(0.8rem, 12.8px); box-shadow: var(--shadow); }
.label-diagram figcaption { font-weight: 700; margin-bottom: 0.5rem; overflow-wrap: anywhere; } /* a long word in a caption breaks inside the card */
.ld-frame { width: 100%; min-width: 0; }
.ld-stage { position: relative; width: 100%; }
.ld-art { position: absolute; }
.ld-art > svg { display: block; width: 100%; height: 100%; }

.ld-leaders { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.ld-leader-halo { stroke: var(--surface); stroke-width: 4.5; stroke-linecap: round; }
.ld-leader { stroke: var(--accent); stroke-width: 1.75; stroke-linecap: round; }
.ld-anchor { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.ld-pin.is-active .ld-leader { stroke: var(--user-line); stroke-width: 3; }
.ld-pin.is-active .ld-anchor { fill: var(--user-line); r: 7; }

.ld-markers { list-style: none; margin: 0; padding: 0; }
.ld-marker { position: absolute; display: flex; flex-direction: column; align-items: center; margin: 0; padding: 0; }
.ld-badge { display: block; width: 44px; height: 44px; padding: 0; margin: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; font: inherit; cursor: pointer; touch-action: manipulation; }
.ld-num { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; margin: 5px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: min(1rem, 16px); font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--surface); }
.ld-badge:hover .ld-num { filter: brightness(1.1); }
.ld-badge:focus-visible { outline: 3px solid var(--text); outline-offset: 0; }
.ld-marker.is-active .ld-num { background: var(--user-line); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--user-line); }
.ld-label { overflow-wrap: normal; /* the widget measures whether a name overflows its column, so it keeps the browser's own word rule, not the page's break-word */ display: block; max-width: 100%; margin-top: 2px; font-size: 0.8rem; font-weight: 600; line-height: 1.2; text-align: center; }
.is-listed .ld-label { display: none; }
.ld-probe { position: absolute; left: 0; top: 0; width: 1rem; height: 1px; visibility: hidden; pointer-events: none; }

.ld-names { display: none; list-style: none; margin: 0.6rem 0 0; padding: 0; }
.is-listed .ld-names { display: grid; gap: 0.35rem; }
.ld-name { display: flex; align-items: baseline; gap: 0.6em; min-width: 0; font-size: 0.9rem; font-weight: 600; line-height: 1.3; }
.ld-name-num { flex: none; box-sizing: border-box; min-width: 1.7em; padding: 0.1em 0.35em; border-radius: 1em; background: var(--accent); color: var(--accent-text); font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; }
.ld-name-text { min-width: 0; overflow-wrap: anywhere; }
.ld-name.is-active .ld-name-num { background: var(--user-line); }

.ld-status { margin: 0; }
.ld-readout { margin: 0.6rem 0 0; min-height: 1.4em; color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
