/* Circuit dock (viewer/dock.js). Desktop: one control bar at the bottom of the stage (transport + the dock's controls) with
   the diagram as a see-through overlay growing upward from it; the caption, the progress marks and the body figure sit
   above the whole dock (--dock-h, set by dock.js). Moved to the side panel: below the text, opaque, bar on top.
   Phones: a full-bleed strip between the 3D view and the bottom sheet, edge to edge with a hairline, no card.
   Capture (?capture=1): the whole diagram on an opaque panel below the 3D area, no bar. Scoped to html.lesson-ui. */
html:not(.lesson-ui) .lz-dock, html:not(.lesson-ui) .lz-drop, html:not(.lesson-ui) .lz-ghost { display: none !important; }
html.lesson-ui #lzSciFc { display: none !important; }          /* the single #fc now lives in the dock */

.lz { --dock-h: 0px; --dock-alpha: 76%; }                       /* --dock-alpha: opacity of the overlay's background */
.lz-dock { box-sizing: border-box; display: flex; flex-direction: column; overflow: hidden; }
.lz > .lz-dock.on-stage { position: absolute; left: var(--gap); right: calc(2 * var(--gap) + var(--lz-panel-w)); bottom: var(--gap); z-index: 2;
  background: color-mix(in srgb, var(--panel) var(--dock-alpha), transparent); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.lz.folded > .lz-dock.on-stage { right: var(--gap); }
.lz > .lz-dock.on-stage.off { right: auto; background: var(--ov-bg); }
.lz.lz-docked .lz-bottom { bottom: calc(2 * var(--gap) + var(--dock-h)); }
html.lesson-ui .lz.lz-docked > .lz-fig { bottom: calc(2 * var(--gap) + var(--dock-h)); }
/* the centre figure of a step without the 3D model (lesson.css, .lz-fig.stage) ends above caption and transport, as without the dock */
@media (min-width: 768px) {
  html.lesson-ui .lz.lz-docked > .lz-fig.stage { bottom: calc(2 * var(--gap) + var(--dock-h) + var(--lz-bot-h, 150px) + 12px); }
  html.lz-capture.lesson-ui .lz > .lz-fig.stage { bottom: var(--gap); }                       /* capture: no caption, no transport */
  html.lz-capture.lesson-ui .lz.lz-docked > .lz-fig.stage { bottom: calc(2 * var(--gap) + var(--dock-h)); }
}
/* the bottom inset of the 3D framing: the bar plus a share of the diagram (dock.js sets the height); never seen */
.lz > .lz-dock-inset { position: absolute; left: 0; right: 0; bottom: var(--gap); visibility: hidden; pointer-events: none; }

/* the bar: grip and switch | transport | hint, size, move, minimise */
.lz-dock-bar { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 5px 8px; min-height: 40px; box-sizing: border-box;
  background: color-mix(in srgb, var(--panel) 94%, transparent); border-top: 1px solid var(--ov-line); }
.lz-dock-l, .lz-dock-r { display: flex; align-items: center; gap: 2px; min-width: 0; }
.lz-dock-r { justify-content: flex-end; }
.lz-dock-c { display: flex; justify-content: center; }
.lz-dock-c:empty { display: none; }
.lz-dock:not(.with-trans) .lz-dock-bar { display: flex; }
.lz-dock:not(.with-trans) .lz-dock-r { margin-left: auto; }
.lz-dock-b { font: 600 12.5px var(--body); color: var(--fg); background: none; border: 1px solid transparent; border-radius: 6px; min-height: 32px;
  padding: 0 9px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.lz-dock-b:hover { background: color-mix(in srgb, var(--fg) 8%, transparent); }
.lz-dock-b .dic { font-size: 13px; color: var(--muted); }
.lz-dock-r .lz-dock-b { font-weight: 500; }
#lzDockMin { border-color: var(--ov-line); }
.lz-dock-grip { cursor: grab; padding: 0 6px; font-size: 16px; color: var(--muted); touch-action: none; }
.lz-dragging, .lz-dragging * { cursor: grabbing !important; }
.lz-dock-sw { width: 26px; height: 15px; border-radius: 8px; background: color-mix(in srgb, var(--fg) 28%, transparent); position: relative; flex: none; transition: background .2s; }
.lz-dock-sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--panel); transition: transform .2s; }
.lz-dock-tg[aria-pressed="true"] .lz-dock-sw { background: var(--accent); }
.lz-dock-tg[aria-pressed="true"] .lz-dock-sw::after { transform: translateX(11px); }
.lz-dock-hint { font: 500 11px var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 6px; min-width: 0; }
.lz-dock.off .lz-dock-c, .lz-dock.off .lz-dock-r { display: none; }
.lz-dock.off .lz-dock-bar { border-top: 0; background: none; }
/* the lesson's transport inside the bar: flat, a little smaller */
.lz-dock-bar .lz-trans { background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; padding: 0; gap: 8px; border-radius: 0; }
.lz-dock-bar .lz-trans .lz-btn { min-height: 34px; min-width: 76px; }
.lz-dock-bar .lz-trans .lz-btn.lz-cc { min-width: 44px; }
.lz-dock-bar .lz-play { width: 40px; height: 40px; font-size: 15px; }
.lz-dock.narrow .lz-dock-hint { display: none; }
.lz-dock.narrow.with-trans :is(#lzDockSz, #lzDockMv) .dlb, .lz-dock.in-panel :is(#lzDockSz, #lzDockMv) .dlb { display: none; }
.lz-dock.narrow .lz-dock-bar .lz-trans .lz-btn:not(.lz-cc) { min-width: 0; padding: 0 12px; }

/* the diagram: the engine's #fc is the scroller; the svg gets its pixel size from dock.js */
.lz-dock-body { flex: none; padding: 4px 6px 4px; box-sizing: border-box; }
.lz-dock.min .lz-dock-body, .lz-dock.off .lz-dock-body { display: none; }
.lz-dock .fc { height: 100%; overflow: auto; scrollbar-width: thin; overscroll-behavior: contain; }
.lz-dock .fc svg { display: block; margin: 0 auto; max-width: none; flex: none; }
/* see-through overlay: boxes stay opaque, dimmed parts are dimmed by colour (not by opacity, which would let the model through) */
html:not(.lz-capture) .lz-dock.on-stage .fc .node { opacity: 1; }
html:not(.lz-capture) .lz-dock.on-stage .fc .node:not(.step) rect { stroke-opacity: .55; }
html:not(.lz-capture) .lz-dock.on-stage .fc .node:not(.step) text { fill-opacity: .62; }
html:not(.lz-capture) .lz-dock.on-stage .fc .edge:not(.step) { opacity: .45; }
html:not(.lz-capture) .lz-dock.on-stage .fc .mid text, html:not(.lz-capture) .lz-dock.on-stage .fc text.side,
html:not(.lz-capture) .lz-dock.on-stage .fc .edge text, html:not(.lz-capture) .lz-dock.on-stage .fc .legend text {
  paint-order: stroke; stroke: var(--panel); stroke-width: 3px; stroke-linejoin: round; }

/* moved to the side panel: below the text, opaque, the bar on top as the header of the diagram */
.lz-panel > .lz-dock.in-panel { position: relative; flex: none; flex-direction: column-reverse; border: 0; border-top: 1px solid var(--ov-line); border-radius: 0;
  box-shadow: none; background: var(--panel); -webkit-backdrop-filter: none; backdrop-filter: none; }
.lz-dock.in-panel .lz-dock-bar { border-top: 0; border-bottom: 1px solid var(--ov-line); background: none; padding-inline: 10px; }
.lz-dock.in-panel .lz-dock-hint { display: none; }

/* drag and drop */
.lz > .lz-drop { position: absolute; z-index: 20; display: flex; align-items: center; justify-content: center; pointer-events: none; box-sizing: border-box;
  border: 2px dashed var(--accent); border-radius: var(--ov-radius); background: color-mix(in srgb, var(--accent) 10%, transparent);
  font: 600 14px var(--body); color: var(--accent); }
.lz > .lz-drop span { background: var(--panel); padding: 6px 12px; border-radius: 8px; box-shadow: var(--ov-shadow); }
.lz > .lz-drop.over { border-style: solid; background: color-mix(in srgb, var(--accent) 22%, transparent); }
.lz > #lzDropPanel { top: calc(var(--gap) + 50px); right: var(--gap); bottom: var(--gap); width: var(--lz-panel-w); }
.lz > #lzDropStage { left: var(--gap); right: calc(2 * var(--gap) + var(--lz-panel-w)); bottom: var(--gap); height: 45%; }
.lz > .lz-ghost { position: fixed; left: 0; top: 0; z-index: 30; pointer-events: none; font: 600 12.5px var(--body); color: var(--panel);
  background: var(--accent); border-radius: 999px; padding: 5px 12px; box-shadow: var(--ov-shadow); }
.lz > .lz-drop[hidden], .lz > .lz-ghost[hidden], .lz-dock [hidden] { display: none !important; }

/* capture mode (?capture=1, PDF screenshots): only the 3D view, the body figure and the dock */
html.lz-capture .lz-top, html.lz-capture .lz-panel, html.lz-capture .lz-unfold, html.lz-capture .lz-menu,
html.lz-capture .lz-bottom, html.lz-capture .lz-dock-bar { display: none !important; }
html.lz-capture .lz > .lz-dock.on-stage { left: var(--gap); right: var(--gap); bottom: var(--gap); background: var(--panel); -webkit-backdrop-filter: none; backdrop-filter: none; }
html.lz-capture .lz-dock .fc { overflow: hidden; }
html.lz-capture .lz-dock-body { padding: 6px 6px 6px; }

/* phones: a full-bleed strip between the 3D view and the bottom sheet (no card, no side margins), bar on top; folded by default */
@media (max-width: 767px) {
  .lz > .lz-dock.on-stage, .lz.folded > .lz-dock.on-stage, .lz > .lz-dock.on-stage.off { left: 0; right: 0; bottom: calc(var(--lz-bar) + var(--lz-sheet));
    flex-direction: column-reverse; border-radius: 0; border-inline: 0; border-bottom: 0; box-shadow: none; background: var(--panel);
    -webkit-backdrop-filter: none; backdrop-filter: none; }
  .lz-dock-bar { display: flex; padding: 2px 8px; min-height: 34px; border-top: 0; background: none; }
  .lz-dock-r { margin-left: auto; }
  .lz-dock.compact .lz-dock-bar, .lz-dock.tall .lz-dock-bar { border-bottom: 1px solid var(--ov-line); }
  .lz-dock-body { padding: 0 0 4px; }
  .lz.lz-docked .lz-bottom { bottom: 0; }                     /* the bar stays at the screen edge */
  .lz.lz-docked .lz-cap { bottom: calc(var(--lz-bar) + var(--lz-sheet) + var(--dock-h) + 8px); }
  .lz.lz-docked .lz-unfold { bottom: calc(var(--lz-bar) + var(--dock-h) + 8px); }
  html.lesson-ui .lz.lz-docked > .lz-fig { bottom: auto; }    /* the figure stays top left under the title */
  html.lz-capture .lz > .lz-dock.on-stage { left: 0; right: 0; bottom: 0; }
}
/* switched off on desktop: only the small switch remains at the bottom left; the transport keeps its own place */
@media (min-width: 768px) { html:not(.lz-capture) .lz.lz-docked:has(> .lz-dock.off) .lz-bottom { bottom: var(--gap); } }
