/* Author: Xu Chen, University of Washington. Pop-out figure panels for the Control in Practice pages (light and dark). */
.popfig-host { position: relative; }
.popfig-host img[data-popfig] { cursor: zoom-in; }
.popfig-host a[href] img[data-popfig] { cursor: pointer; }
.popfig-btn {
  position: absolute; top: 6px; right: 6px; z-index: 2; display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; margin: 0; padding: 0; border: 0; border-radius: 6px; cursor: pointer;
  color: #fff; background: rgba(20, 22, 28, .62); opacity: 0; transition: opacity .15s;
}
.popfig-host:hover .popfig-btn, .popfig-btn:focus-visible { opacity: 1; }
.popfig-btn:hover { background: rgba(20, 22, 28, .82); }
.popfig-btn:focus-visible { outline: 2px solid rgb(var(--color-primary-500, 16 185 129)); outline-offset: 2px; }
@media (hover: none) { .popfig-btn { opacity: .7; } }

.popfig-panel {
  --pf-bg: #ffffff; --pf-fg: #1f2330; --pf-bar: #eef0f4;
  position: fixed; z-index: 1050; display: flex; flex-direction: column; box-sizing: border-box;
  background: var(--pf-bg); color: var(--pf-fg); border: 1px solid #8a8f9c; border-radius: 8px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, .28); overflow: hidden; outline: none;
}
.dark .popfig-panel {
  --pf-bg: #1f2128; --pf-fg: #e6e6ea; --pf-bar: #2a2d36;
  box-shadow: 0 10px 32px rgba(0, 0, 0, .6);
}
.popfig-panel:focus-visible { box-shadow: 0 0 0 2px rgb(var(--color-primary-500, 16 185 129)), 0 10px 32px rgba(0, 0, 0, .28); }
.popfig-bar {
  flex: 0 0 34px; display: flex; align-items: center; gap: 2px; height: 34px; padding: 0 4px 0 10px;
  background: var(--pf-bar); border-bottom: 1px solid #8a8f9c; cursor: move; touch-action: none;
  user-select: none; -webkit-user-select: none; font: 13px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.popfig-title { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.popfig-title p { display: inline; margin: 0; }
.popfig-b {
  flex: 0 0 auto; width: 30px; height: 28px; margin: 0; padding: 0; border: 0; border-radius: 5px; cursor: pointer;
  background: transparent; color: inherit; font: 18px/28px system-ui, sans-serif; text-align: center;
}
.popfig-b:hover, .popfig-b:focus-visible { background: rgba(127, 127, 127, .22); }
.popfig-b:focus-visible { outline: 2px solid rgb(var(--color-primary-500, 16 185 129)); outline-offset: -2px; }
.popfig-img {
  display: block; flex: 1 1 auto; width: 100%; min-height: 0; margin: 0; object-fit: contain;
  user-select: none; -webkit-user-drag: none; pointer-events: none;
}
.popfig-grip {
  position: absolute; right: 0; bottom: 0; width: 22px; height: 22px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 52%, #8a8f9c 52%, #8a8f9c 60%, transparent 60%,
    transparent 70%, #8a8f9c 70%, #8a8f9c 78%, transparent 78%);
}
.popfig-moving { opacity: .92; }
@media print { .popfig-panel, .popfig-btn { display: none !important; } }
