/* figure.css — the 3D figure's overlay: view controls, colour key and arc labels. Shared by the
   THA Stability modules and the Spinopelvic Motion module (partials/figure-tools.njk, motion-arc.mjs). */
.oa-fig-stage { position: relative; }
.oa-fig-stage canvas { display: block; }

/* Controls: a strip across the top of the canvas. */
.oa-fig-tools { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; pointer-events: none; }
.oa-fig-group { display: flex; overflow: hidden; background: rgba(12, 27, 39, .78); border: 1px solid #355268; border-radius: 8px; pointer-events: auto; }
.oa-fig-group button { min-width: 32px; min-height: 32px; padding: 4px 10px; color: #dce9f2; background: transparent; border: 0; border-left: 1px solid #284257; border-radius: 0; font: 700 11px/1.2 var(--sans); cursor: pointer; }
.oa-fig-group button:first-child { border-left: 0; }
.oa-fig-group button:hover { color: #fff; background: #1e394a; }
.oa-fig-group button[data-zoom] { padding: 4px 8px; font-size: 15px; line-height: 1; }
.oa-fig-group button[aria-pressed="true"] { color: #0c1b27; background: #9fd8f0; }
.oa-fig-group [data-toggle-bone][aria-pressed="false"], .oa-fig-group [data-toggle-cone][aria-pressed="false"], .oa-fig-group [data-toggle-labels][aria-pressed="false"] { text-decoration: line-through; }
.oa-fig-group button:focus-visible { outline: 2px solid #9fd8f0; outline-offset: -2px; }
.oa-fig-group button[hidden], .oa-fig-group[hidden] { display: none; }
@media (pointer: coarse) { .oa-fig-group button { min-width: 40px; min-height: 40px; } }
/* On phones the strip leaves the canvas and sits under it, so it never hides the arc. */
@media (max-width: 599px) {
  /* One row that scrolls sideways, not two that wrap: on a phone every row taken here is model lost. */
  .oa-fig-tools { position: static; flex-wrap: nowrap; justify-content: flex-start; gap: 6px; padding: 6px 8px; overflow-x: auto; scrollbar-width: none; background: #10222f; border-top: 1px solid #263d50; }
  .oa-fig-tools::-webkit-scrollbar { display: none; }
  /* While the row overflows, scroll-strip.mjs makes it a focusable scroll region. */
  .oa-fig-tools[tabindex]:focus-visible { outline: 2px solid #9fd8f0; outline-offset: -2px; }
  .oa-fig-group { flex: none; }
  .oa-fig-group button { padding: 4px 9px; }
}

/* Colour key: a strip under the canvas, so it never covers the model; it folds on phones. */
.oa-fig-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 7px 10px; color: #dce9f2; background: #10222f; border-top: 1px solid #263d50; font: 600 11px/1.3 var(--sans); }
.oa-fig-legend summary { display: list-item; padding: 2px 0; color: #aec4d4; cursor: pointer; }
.oa-fig-legend[open] summary { display: none; }
.oa-fig-legend ul { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; list-style: none; }
.oa-fig-legend li { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.oa-fig-legend i { flex: none; display: inline-block; width: 16px; height: 4px; border-radius: 2px; }
.oa-fig-legend .k-wedge { height: 12px; background: rgba(92, 219, 143, .35); border: 1px solid #5cdb8f; border-radius: 0 12px 0 0; }
.oa-fig-legend .k-bone { background: #ffbd40; }
.oa-fig-legend .k-rim { background: #ff5c4d; }
.oa-fig-legend .k-ring { height: 6px; background: linear-gradient(90deg, #5cdb8f 0 60%, #ff5c4d 60%); box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); }
.oa-fig-legend .k-cup { background: #ff66c4; }
.oa-fig-legend .k-neck { background: #83f3e7; }
.oa-fig-legend .k-dot { width: 10px; height: 10px; border-radius: 50%; }
.oa-fig-legend .k-contact { background: #ff5c4d; }
.oa-fig-legend .k-second { background: #ffbd40; }
.oa-fig-legend .k-handle { background: #5a9eff; }
/* One knob per movement, each in its own colour (knob-cues.mjs): the key names them in a row of its own. */
.oa-fig-legend li.k-knobs { flex-wrap: wrap; gap: 4px 10px; white-space: normal; }
.oa-fig-legend .k-knobs span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.oa-fig-legend .k-knob-thigh { background: #5a9eff; }
.oa-fig-legend .k-knob-abduct { background: #b8ed4d; }
.oa-fig-legend .k-knob-rotate { background: #c794ff; }
.oa-fig-legend .k-knob-cup { background: #ff66c4; }
.oa-fig-legend .k-knob-incline { background: #ff8c33; }
.oa-fig-legend .k-knob-neck { background: #82f2e8; }

/* Arc labels: activities outside their ticks, stop angles inside the wedge. Coloured as the key. */
.oa-arc-label, .oa-tha-labels span[data-kind="arc"][data-side] { position: absolute; padding: 1px 6px; color: #8ff0b6; background: rgba(12, 27, 39, .78); border: 0; border-radius: 9px; font: 700 11px/1.4 var(--sans); white-space: nowrap; transform: translate(-50%, -50%); }
.oa-arc-label[data-tone="bone"], .oa-tha-labels span[data-kind="arc"][data-side][data-tone="bone"] { color: #ffd27a; }
.oa-arc-label[data-tone="implant"], .oa-tha-labels span[data-kind="arc"][data-side][data-tone="implant"] { color: #ff8a80; }
.oa-arc-label[hidden] { display: none; }
canvas.is-dragging-thigh { cursor: grabbing; }

/* Direct handles (module.js): hover cursor and the live readout beside the pointer while dragging. */
.oa-fig-stage canvas.is-over-handle { cursor: move; }
.oa-fig-drag-badge { position: absolute; z-index: 2; padding: 3px 8px; color: #0c1b27; background: #b8dbff; border-radius: 6px; font: 700 11px/1.3 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.oa-fig-drag-badge[hidden] { display: none; }
/* Direction arrows round a hovered or dragged knob, each labelled with what that way does. */
.oa-knob-cue { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.oa-knob-cue line { stroke-width: 3.5; stroke-linecap: round; }
.oa-knob-cue .halo { fill: rgba(12, 27, 39, .85); stroke: rgba(12, 27, 39, .85); stroke-width: 4; stroke-linejoin: round; }
.oa-knob-cue line.halo { stroke-width: 7.5; }
.oa-knob-cue text { font: 700 12px/1 var(--sans); paint-order: stroke; stroke: rgba(12, 27, 39, .92); stroke-width: 4px; stroke-linejoin: round; }

/* Quiet figure (pages with direct handles, the Spinopelvic Motion module included): with a mouse, the toolbar shows while the pointer is over the
   figure or a control in it has focus; touch screens always show it. */
@media (hover: hover) and (min-width: 600px) {
  .oa-fig-stage.is-quiet .oa-fig-tools .oa-fig-group:not(.oa-fig-pinned) { opacity: 0; transition: opacity .18s ease; }
  .oa-fig-stage.is-quiet:hover .oa-fig-tools .oa-fig-group, .oa-fig-stage.is-quiet:focus-within .oa-fig-tools .oa-fig-group { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .oa-fig-stage.is-quiet .oa-fig-tools .oa-fig-group { transition: none; } }
.oa-fig-legend li[hidden] { display: none; }
/* The Controls toggle stays visible on a quiet figure: it is the way to the sliders. */
.oa-fig-pinned button[aria-expanded="true"] { color: #0c1b27; background: #9fd8f0; }
