/* A small, self-contained illustrated machine inside the plain HTML article. */
#moulding-cutaway { margin: 36px 0; }
.moulding-demo { border: 1px solid #888; padding: 14px; max-width: 1060px; }
.moulding-demo [hidden] { display: none !important; }
.moulding-demo button, .moulding-demo select { font: inherit; color: #111; background: #f7f7f7; border: 1px solid #888; border-radius: 0; padding: 5px 8px; }
.moulding-demo button { cursor: pointer; }
.moulding-demo button:hover { background: #eee; }
.moulding-demo button[aria-pressed="true"] { background: #222; color: white; }
.moulding-demo button:focus-visible, .moulding-demo input:focus-visible, .moulding-demo select:focus-visible { outline: 2px solid #0000ee; outline-offset: 3px; }
.moulding-controls, .moulding-view-controls, .moulding-stages, .moulding-parts { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.moulding-controls [data-play] { min-width: 78px; }
.moulding-controls label { margin-left: 6px; }
.moulding-scrubber { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; align-items: center; margin: 14px 0; }
.moulding-scrubber input { width: 100%; margin: 4px 0; accent-color: #333; min-width: 0; }
.moulding-scrubber output { grid-column: 2; font-size: .9em; color: #444; }
.moulding-stages { gap: 5px; }
.moulding-stages button { font-size: .92em; padding: 5px 7px; }
.moulding-view-controls { border-top: 1px solid #ccc; padding-top: 12px; }
.moulding-view-controls label { white-space: nowrap; }
.moulding-view-controls input { accent-color: #333; }
.moulding-stage-readout { min-height: 102px; max-width: 88ch; }
.moulding-stage-readout p { margin-top: 5px; margin-bottom: 8px; }
.moulding-drawing { width: 100%; overflow: hidden; border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; background: white; }
.moulding-drawing svg { display: block; width: 100%; height: auto; aspect-ratio: 1100 / 555; }
.moulding-demo[data-view="barrel"] svg { aspect-ratio: 550 / 360; }
.moulding-demo[data-view="mould"] svg { aspect-ratio: 380 / 510; }
.machine-channel { fill: none; stroke: #fff; stroke-width: 6; }
.machine-hot-flow { fill: none; stroke: #e96622; stroke-width: 5; stroke-dasharray: 1; }
.machine-water path { fill: none; stroke: #1274a4; stroke-width: 3; }
.machine-water path[data-water-path] { stroke-dasharray: 6 5; }
.machine-covers, .machine-detail-labels { display: none; }
.moulding-demo[data-cutaway="false"] .machine-cutaway { visibility: hidden; }
.moulding-demo[data-cutaway="false"] .machine-covers { display: block; }
.moulding-demo[data-water="false"] .machine-water, .moulding-demo[data-labels="false"] .machine-labels, .moulding-demo[data-labels="false"] .machine-detail-labels { display: none; }
.moulding-demo[data-view="mould"][data-labels="true"][data-cutaway="true"] .machine-detail-labels { display: block; }
.moulding-demo[data-view="mould"] .machine-labels { font-size: 14px; }
.moulding-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: .92em; margin-top: 12px; }
.moulding-legend span { display: inline-flex; align-items: center; gap: 6px; }
.moulding-legend i { display: inline-block; width: 12px; height: 12px; border: 1px solid #666; }
.legend-pellet { background: #b8a685; border-radius: 50%; }
.legend-melt { background: #e96622; }
.legend-solid { background: #267a83; }
.legend-water { background: white; border: 2px dashed #1274a4 !important; box-sizing: border-box; }
.moulding-status { padding: 7px 0; border-bottom: 1px solid #ccc; font-size: .95em; }
.moulding-parts button { font-size: .92em; }
.moulding-demo [data-part-copy] { max-width: 88ch; margin-bottom: 0; min-height: 3em; }
@media (max-width: 600px) {
 .moulding-demo { padding: 10px; }
 .moulding-controls, .moulding-view-controls { gap: 8px 6px; }
 .moulding-controls label { margin-left: 0; }
 .moulding-scrubber { grid-template-columns: 1fr; gap: 3px; }
 .moulding-scrubber output { grid-column: 1; }
 .moulding-stage-readout { min-height: 172px; }
 .moulding-demo button { min-height: 40px; }
 .moulding-view-controls [role="group"] { display: flex; flex-wrap: wrap; gap: 5px; }
 .moulding-legend { gap: 6px 12px; }
}
@media print {
 .moulding-controls, .moulding-scrubber, .moulding-stages, .moulding-view-controls, .moulding-parts { display: none; }
 .moulding-demo { break-inside: avoid; }
}

.moulding-demo[data-view="mould"] .machine-barrel-label, .moulding-demo[data-view="mould"] .machine-clamp-label, .moulding-demo[data-view="barrel"] .machine-mould-label, .moulding-demo[data-view="barrel"] .machine-clamp-label { display: none; }
.moulding-demo[data-view="barrel"] .machine-labels { font-size: 18px; }

.moulding-transport { position: sticky; top: 0; z-index: 2; background: white; padding-top: 6px; border-bottom: 1px solid #ccc; margin-bottom: 12px; }
.moulding-demo[data-view="mould"] svg { width: min(100%, 477px); margin: 0 auto; overflow: hidden; }
.moulding-demo[data-view="barrel"] svg { width: min(100%, 850px); margin: 0 auto; overflow: hidden; }
