/* Snap-fit joints — on top of calc.css */
main.sf .tabs { grid-template-columns: repeat(3, 1fr); }
main.sf .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.sf .stage-bar .hist { margin-left: auto; }
.sf-types button { white-space: nowrap; }
#view { display: block; width: 100%; height: auto; user-select: none; touch-action: none; }
#view .hit { fill: transparent; stroke: none; }
#view .handle { cursor: grab; }
#view .handle.ns { cursor: ns-resize; }
#view .handle.ew { cursor: ew-resize; }
#view .handle .knob { fill: var(--surface); stroke: var(--sel); stroke-width: 1.8; }
#view .handle:hover .knob, #view .handle:focus .knob { fill: var(--sel); }
#view .handle:focus { outline: none; }
#view .handle.mate .knob { stroke: var(--steel-750); }

/* parts */
.sf-base { fill: var(--steel-250); stroke: var(--steel-750); stroke-width: 1; }
.sf-part { fill: var(--steel-100); stroke: var(--steel-750); stroke-width: 1.1; stroke-linejoin: round; }
.sf-ghost { fill: none; stroke: var(--steel-500); stroke-width: .8; stroke-dasharray: 4 3; pointer-events: none; }
.sf-mate { fill: var(--steel-300); stroke: var(--steel-750); stroke-width: 1; }
.sf-hatch { fill: none; stroke: var(--steel-400); stroke-width: .6; pointer-events: none; }
.sf-band { stroke: none; pointer-events: none; }
.sf-outline { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; pointer-events: none; }
.sf-cl { fill: none; stroke: var(--steel-500); stroke-width: .7; stroke-dasharray: 8 3 1.5 3; pointer-events: none; }
.sf-na { fill: none; stroke: var(--moment); stroke-width: .8; stroke-dasharray: 4 3; pointer-events: none; }
.sf-dim { fill: none; stroke: var(--steel-500); stroke-width: .8; }
.sf-dimthin { fill: none; stroke: var(--steel-400); stroke-width: .7; stroke-dasharray: 3 3; }
.sf-load line { stroke: var(--load); stroke-width: 1.8; }
.sf-load path { fill: var(--load); stroke: none; }
.sf-react line { stroke: var(--text-2); stroke-width: 1.8; }
.sf-react path { fill: var(--text-2); stroke: none; }
.sf-move line { stroke: var(--blue-4); stroke-width: 1.8; }
.sf-move path { fill: var(--blue-4); stroke: none; }
.sf-inset rect.fr { fill: var(--surface); stroke: var(--x-e1e1dc, #e1e1dc); }
.sf-small { font-size: 11px; fill: var(--text-3); }
.sf-cap { font-size: 11px; fill: var(--text-3); font-weight: 500; }
.sf-peak { fill: var(--surface); stroke: var(--ink); stroke-width: 1.2; }
.sf-twist { fill: none; stroke: var(--moment); stroke-width: 1; }

/* pills */
#view .pill rect { fill: var(--surface); stroke: var(--steel-300); }
#view .pill text { font-size: 11.5px; font-weight: 500; fill: var(--text-2); font-variant-numeric: tabular-nums; }
#view .pill.force rect { stroke: color-mix(in srgb, var(--load) 45%, transparent); } #view .pill.force text { fill: var(--load-ink); font-weight: 600; }
#view .pill.strain rect { stroke: color-mix(in srgb, var(--ink) 35%, transparent); } #view .pill.strain text { fill: var(--text); font-weight: 600; }
#view .pill.editable { cursor: text; }
#view .pill.editable:hover rect, #view .pill.editable:focus rect { stroke: var(--sel); stroke-width: 1.4; }
#view .pill.editable:focus { outline: none; }
#view .lg text { font-size: 10.5px; fill: var(--text-2); font-variant-numeric: tabular-nums; }
#view .lg rect.sw { stroke: rgba(0, 0, 0, .08); stroke-width: .6; }

/* editor in the drawing */
.stage { position: relative; }
.sf-edit { position: absolute; transform: translate(-50%, -50%); z-index: 5; display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1.5px solid var(--sel); border-radius: 9px; padding: 2px 8px 2px 4px; box-shadow: 0 6px 18px rgba(20, 24, 30, .14); }
.sf-edit input { width: 82px; border: 0; outline: none; font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px; }
.sf-edit span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

/* live strip */
.sf-live { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; min-height: 38px; align-items: center; }
.sf-live b { font-weight: 500; color: var(--text-3); margin-right: 5px; }
.sf-live i { font-style: normal; color: var(--text-3); }
.sf-live .sf-err { color: var(--bad-ink, #b42318); }

/* panel */
.sf-seg { margin-bottom: 6px; }
.sf-lab { font-size: 12px; color: var(--text-3); margin: 8px 0 4px; }
#panel input.bad { color: var(--bad); }
#panel .num:has(input.bad) input { border-color: var(--bad); }
#panel .small-note a { color: inherit; }
#panel .f.sel.wide { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
#panel .f.sel.wide select { width: 100%; max-width: none; }
.f > label span { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.3; }
.sf-mt { width: 100%; border-collapse: collapse; font-size: 12px; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.sf-mt td { padding: 3px 0; border-bottom: 1px solid var(--line); color: var(--text-2); vertical-align: top; }
.sf-mt td:first-child { color: var(--text-3); padding-right: 10px; }
.sf-mt td:last-child { text-align: right; }
#panel.fade-b { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); }
#panel.fade-t { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28px); mask-image: linear-gradient(to bottom, transparent, #000 28px); }
#panel.fade-t.fade-b { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, transparent, #000 28px, #000 calc(100% - 32px), transparent); }

/* summary and margins */
.sf-say { margin-top: 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; max-width: 36ch; }
.sf-tag { display: inline-flex; align-items: center; font-size: 10.5px; color: var(--text-3); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; margin-left: 4px; white-space: nowrap; line-height: 1.5; }
#checks td.note { white-space: normal; min-width: 200px; line-height: 1.4; }
#checks .ms { white-space: nowrap; }

/* charts */
.sf-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
#fChart, #yChart { touch-action: none; user-select: none; }
#fChart .cdrag, #yChart .cdrag { cursor: ew-resize; }
main.sf .ch-pill rect { fill: var(--sel); }
main.sf .ch-pill text { fill: var(--on-accent); font-weight: 600; }

@media (max-width: 1100px) { .sf-two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .sf-types { display: flex; flex-wrap: wrap; }
  .sf-types button { flex: 1 1 auto; }
  #checks thead { display: none; }
  #checks, #checks tbody { display: block; width: 100%; }
  #checks tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
  #checks td { display: block; border: 0; padding: 0; text-align: left; white-space: normal; }
  #checks td.chk { grid-column: 1; grid-row: 1; }
  #checks td:nth-child(5) { grid-column: 2; grid-row: 1; align-self: center; }
  #checks td:nth-child(2) { grid-column: 1; grid-row: 2; font-size: 12.5px; }
  #checks td:nth-child(3) { grid-column: 2; grid-row: 2; font-size: 12.5px; text-align: right; }
  #checks td:nth-child(2)::before { content: "actual "; color: var(--text-3); }
  #checks td:nth-child(3)::before { content: "allowed "; color: var(--text-3); }
  #checks td:nth-child(4) { grid-column: 1 / -1; grid-row: 3; font-size: 12px; color: var(--text-3); min-width: 0; }
}
@media print { .sf-edit { display: none !important; } }

/* the strain bands in dark: the light scale's pale upper bands would glow, so dark gets its own ramp, from the
   part's own steel through deep amber to red, each band heavier than the one below (the arm and the legend share it) */
@media screen and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --sf-b2: #4a3d22; --sf-b3: #6b5126; --sf-b4: #95582f; --sf-b5: #b4463d; } }
@media screen { :root[data-theme="dark"] { --sf-b2: #4a3d22; --sf-b3: #6b5126; --sf-b4: #95582f; --sf-b5: #b4463d; } }

/* theme-auto:start · generated by scripts/theme/hexmap.py: dark values (the rule of scripts/theme/colour.py) for
   colours that are not tokens, written as var(--x-rrggbb, #rrggbb): light is the fallback, unchanged */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --x-6e7177: #85827f; --x-8f979f: #61676d; --x-b42318: #ee8273; --x-dce6ee: #2b3237; --x-e1e1dc: #35332f;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-6e7177: #85827f; --x-8f979f: #61676d; --x-b42318: #ee8273; --x-dce6ee: #2b3237; --x-e1e1dc: #35332f;
  }
}
/* theme-auto:end */
