/* Interactive figures of the note on constrained convex optimisation: the build-up of the
   feasible set from half-planes (konvex.html) and the balance of forces at a corner
   (gleichgewicht.html). Same look as the Zentralpfad demo; controls sit below the drawing. */
:root { color-scheme: light; --paper: #faf9f6; --ink: #252525; --muted: #65635d; --line: #d8d5cc; --blue: #173fbe; --orange: #b95a28;
  --green: #426f6b; --area: #e5eeeb; --target: #8a5979; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.5 "Courier New", Courier, monospace; }
body { padding: 6px 0; }
#experiment { display: flow-root; max-width: 820px; margin: auto; }
.experiment-heading { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 5px 20px; padding: 12px 0; border-block: 1px solid var(--line); font-size: 11px; letter-spacing: .07em; }
#live-state { color: var(--blue); }
svg.plot { display: block; width: 100%; height: auto; user-select: none; touch-action: manipulation; }
svg.plot text { font: 15px "Courier New", Courier, monospace; fill: var(--muted); }
.grid line { stroke: #e6e3db; stroke-width: .75; }
.grid .zero { stroke: #c7c3b8; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 17px; padding: 4px 0 14px; font-size: 12px; color: var(--muted); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 15px; height: 0; border-top: 2px solid; flex-shrink: 0; }
.key.box { width: 12px; height: 12px; border: 1px solid var(--green); background: var(--area); }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.controls .spacer { flex: 1; }
.hint { font-size: 12px; color: var(--muted); margin: 0; }
button { font: inherit; font-size: 12px; border: 1px solid #bebbb3; padding: 8px 10px; border-radius: 2px; background: var(--paper); color: var(--ink); cursor: pointer; min-height: 36px; }
button:hover { background: #eeece5; border-color: #868177; }
button:focus-visible, input:focus-visible, .handle:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
button.primary { border-color: var(--blue); color: var(--blue); min-width: 150px; }
button.primary[aria-pressed=true] { color: var(--paper); background: var(--blue); }
.steps { display: inline-flex; border: 1px solid #bebbb3; border-radius: 2px; }
.steps button { border: 0; border-right: 1px solid #d8d5cc; border-radius: 0; min-width: 40px; }
.steps button:last-child { border-right: 0; }
.steps button[aria-current=step] { background: var(--ink); color: var(--paper); }
.status { min-height: 3em; margin: 0; padding: 10px 0 4px; font-size: 13px; }
.status strong { color: var(--green); }
.status .warn { color: var(--orange); font-weight: bold; }
.sliders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 28px; padding: 12px 0 4px; border-top: 1px solid var(--line); }
.range-label { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.range-label output { color: var(--green); font-weight: bold; font-variant-numeric: tabular-nums; }
input[type=range] { display: block; width: 100%; margin: 0; height: 30px; accent-color: var(--green); cursor: pointer; }
sub { font-size: .8em; line-height: 0; }
/* figure 2: the values c_i(x) with their state */
.readout { display: flex; flex-wrap: wrap; gap: 8px 10px; padding: 10px 0 14px; border-top: 1px solid var(--line); font-size: 13px; }
.chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 9px; border: 1px solid var(--line); background: #fffdf4; font-variant-numeric: tabular-nums; }
.chip b { min-width: 5ch; text-align: right; }
.chip i { font-style: normal; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.chip.aktiv { border-color: var(--orange); box-shadow: 2px 2px 0 var(--orange); }
.chip.aktiv i { color: var(--orange); font-weight: bold; }
.chip.verletzt { border-style: dashed; }
.chip.verletzt i { color: var(--target); font-weight: bold; }
/* segmented switch (figure 3) */
.switch { display: inline-flex; border: 1px solid #bebbb3; border-radius: 2px; }
.switch button { border: 0; border-right: 1px solid #d8d5cc; border-radius: 0; min-width: 96px; }
.switch button:last-child { border-right: 0; }
.switch button[aria-pressed=true] { background: var(--ink); color: var(--paper); }
/* The name of the current set grows from ℝ² to 𝒳 = ℋ₁ ∩ … ∩ ℋ₄; a fixed width keeps the legend from reflowing. */
#set-label { display: inline-block; min-width: 23ch; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.handle { cursor: grab; outline: none; touch-action: none; }
.handle:active { cursor: grabbing; }
.handle .hit-area { fill: transparent; }
.handle:focus .hit-area, .handle:hover .hit-area { fill: rgba(138, 89, 121, .12); }
/* Embedded in the 790px text column the drawing is about 790px wide; below that the labels grow. */
@media (max-width: 600px) {
  svg.plot text { font-size: 23px; }
  .sliders { grid-template-columns: 1fr; }
  .readout { font-size: 12px; gap: 6px; }
  .chip { padding: 3px 7px; gap: 4px; }
  .chip i { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
